a little more info, i'm using the following version:
v5.8.1-RC3 built for darwin-thread-multi-2level
Chad
On 8/18/05, Chad Armstrong
<chad.armstrong-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> Hello,
> I am having hopefully what is a simple error, but I've been racking
> my brain for a couple of days now. I've newly set up the
> Template::Extract module on my OS X machine at home, installed what I
> thought were all the necessary modules, based on the error messages
> generated from the includes, and tried the example at:
> www.perladvent.org/2003/5th
> -----------------------------------------------
> #!/usr/bin/perl
>
> # turn on perl's safety features
> use strict;
> use warnings;
>
> # create a new template extractor
> use Template::Extract;
> my $extract = Template::Extract->new();
>
> # get the source of the page
> use LWP::Simple qw(get);
> my $document = get "http://www.timeanddate.com/worldclock/"
> or die "Can't get page";
>
> # define the template
> my $template = << '.';
> <a href="city.html?n=[% ... %]">[% city %]
> </a></td><td class=r>[% time %]</td>
> .
>
> # extract the data
> my $data = $extract->extract($template, $document);
>
> # print it out so we can see we've got what we want to
> use Data::Dumper;
> print Dumper $data;
> -------------------------------------------------
>
> When I run this, I get a single line of output and no error:
>
> >>>$VAR1 = undef
>
> when it should print something like:
>
> >>>$VAR1 = {
> 'city' => 'Addis Ababa',
> 'time' => 'Thu 3:18 AM'
> };
>
> Any ideas what could be wrong? I've verified that LWP works and
> returns the html of the target page. This isn't the first test I've
> tried, but seems to be the most concise and potentially least
> error-prone, but I am always getting the same "error".
>
> thanks in advance,
> Chad
>
|