>this is from an example in the new LWP and Perl book (page 11, ex 1-2) >it doesn't work for me. > >################################## ># ex 1-2, p11; >use strict; >use LWP; > >my $url = "http://use.perl.org/"; >my $browser = LWP::UserAgent->new(); >my $response = $browser->get($url); >print $response->header("Server"), "\n"; > > >H:\perl>perl -w up.pl >Can't locate object method "get" via package "LWP::UserAgent" (perhaps >you forgot to load "LWP::UserAgent"?) > at up.pl line 8. > >H:\perl> > >H:\perl>perl -MLWP -le "print(LWP->VERSION)" >5.51
I guess your book is old. Do a perldoc LWP::UserAgent. There is no "get" method. Try this: use strict; use LWP::UserAgent; my $url = "http://use.perl.org/"; my $browser = LWP::UserAgent->new(); my $request = HTTP::Request->new('GET', $url); my $response = $browser->request($request); print $response->header("Server"), "\n"; Jing Wee _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs