First Mech script: entering a form value (another simple thing no doubt)
Hi all, I managed to get the problem with my script not connecting to the page last night, turned out my web host wouldn't allow it. Got that sorted. Filling in the form should be really simple but I'm getting the following error when trying to set the acOriginAirport field, I thought it might be to do with the javascript on the page but I'm entering a value that the form accepts. The form is being found on the page as I can dump out $agent-forms(); Any ideas anyone? Status: 500 Content-type: text/html Software error: Can't call method value on an undefined value at /usr/local/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 1407. This is my script: #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use WWW::Mechanize; use HTML::TokeParser; use Data::Dumper; print Content-type: text/html\n\n; print setting up mechbr /; my $agent = WWW::Mechanize-new(); $agent-agent_alias('Windows Mozilla'); print mech setup; $agent-get('http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279'); print setting up airports br /; $agent-field(acOriginAirport, Glasgow GLA); Cheers in advance, G :)
Re: First Mech script: entering a form value (another simple thing no doubt)
On Mar 14, 2013, at 8:27 AM, G M wrote: Hi all, I managed to get the problem with my script not connecting to the page last night, turned out my web host wouldn't allow it. Got that sorted. Filling in the form should be really simple but I'm getting the following error when trying to set the acOriginAirport field, I thought it might be to do with the javascript on the page but I'm entering a value that the form accepts. The form is being found on the page as I can dump out $agent-forms(); Any ideas anyone? Status: 500 Content-type: text/html Software error: Can't call method value on an undefined value at /usr/local/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 1407. This is my script: #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use WWW::Mechanize; use HTML::TokeParser; use Data::Dumper; print Content-type: text/html\n\n; print setting up mechbr /; my $agent = WWW::Mechanize-new(); $agent-agent_alias('Windows Mozilla'); print mech setup; $agent-get('http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279'); print setting up airports br /; $agent-field(acOriginAirport, Glasgow GLA); I have not used WWW::Mechanize, but from reading the documentation, it would seem you must call $agent-form_number($number) with a form number before making any calls to field(). Line 1407 of Mechanize.pm is part of the field method: sub field { my ($self, $name, $value, $number) = @_; $number ||= 1; my $form = $self-current_form(); if ($number 1) { $form-find_input($name, undef, $number)-value($value); } else { if ( ref($value) eq 'ARRAY' ) { $form-param($name, $value); } else { $form-value($name = $value); # line 1407 } } } The current_form() method is returning null because you have not specified (with a call to form_number()) which form you are using. Hence the error message you are seeing. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: First Mech script: entering a form value (another simple thing no doubt)
Hi, Thanks for replying. As far as I understand it will return undef if no form is found. The form is there so it should do something I would've though, I tried adding in that line anyway using 1 to signify the first (and only) form on the page, still get the same error though :( Cheers, G :) Subject: Re: First Mech script: entering a form value (another simple thing no doubt) From: jimsgib...@gmail.com Date: Thu, 14 Mar 2013 09:27:27 -0700 To: beginners@perl.org On Mar 14, 2013, at 8:27 AM, G M wrote: Hi all, I managed to get the problem with my script not connecting to the page last night, turned out my web host wouldn't allow it. Got that sorted. Filling in the form should be really simple but I'm getting the following error when trying to set the acOriginAirport field, I thought it might be to do with the javascript on the page but I'm entering a value that the form accepts. The form is being found on the page as I can dump out $agent-forms(); Any ideas anyone? Status: 500 Content-type: text/html Software error: Can't call method value on an undefined value at /usr/local/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 1407. This is my script: #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use WWW::Mechanize; use HTML::TokeParser; use Data::Dumper; print Content-type: text/html\n\n; print setting up mechbr /; my $agent = WWW::Mechanize-new(); $agent-agent_alias('Windows Mozilla'); print mech setup; $agent-get('http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279'); print setting up airports br /; $agent-field(acOriginAirport, Glasgow GLA); I have not used WWW::Mechanize, but from reading the documentation, it would seem you must call $agent-form_number($number) with a form number before making any calls to field(). Line 1407 of Mechanize.pm is part of the field method: sub field { my ($self, $name, $value, $number) = @_; $number ||= 1; my $form = $self-current_form(); if ($number 1) { $form-find_input($name, undef, $number)-value($value); } else { if ( ref($value) eq 'ARRAY' ) { $form-param($name, $value); } else { $form-value($name = $value); # line 1407 } } } The current_form() method is returning null because you have not specified (with a call to form_number()) which form you are using. Hence the error message you are seeing. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: First Mech script: entering a form value (another simple thing no doubt)
On Thu, 14 Mar 2013 16:42:52 + G M iamnotregiste...@hotmail.com wrote: Hi, Thanks for replying. As far as I understand it will return undef if no form is found. The form is there so it should do something I would've though, I tried adding in that line anyway using 1 to signify the first (and only) form on the page, still get the same error though :( There are no forms on the page. DB6 $mech = WWW::Mechanize-new; DB7 $mech-get( 'http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279'); DB8 x $mech-forms; empty array See also: [davidp@supernova:~]$ wget -q -O- http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279 | grep -i 'form' [davidp@supernova:~]$ WWW::Mechanize wants to be able to find a form to actually submit. You may be able to just fake the request yourself - at a quick glance, it looks like it submits to http://www.easyjet.com/EN/Booking.mvc, so take the field names from the source of the URL you gave before, and POST them at that URL, and see what happens. Failing that, you'll have to use the form in your browser while using an addon like Firebug or something, or capturing HTTP traffic off the wire, and see what happens, and make your script do the same. -- David Precious (bigpresh) dav...@preshweb.co.uk http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: First Mech script: entering a form value (another simple thing no doubt)
Hi, Thanks for that, yeah I can see there are no form tags on that page, I'll give your suggestion a go. Thank you very much! G :) Date: Thu, 14 Mar 2013 16:56:37 + From: dav...@preshweb.co.uk To: beginners@perl.org Subject: Re: First Mech script: entering a form value (another simple thing no doubt) On Thu, 14 Mar 2013 16:42:52 + G M iamnotregiste...@hotmail.com wrote: Hi, Thanks for replying. As far as I understand it will return undef if no form is found. The form is there so it should do something I would've though, I tried adding in that line anyway using 1 to signify the first (and only) form on the page, still get the same error though :( There are no forms on the page. DB6 $mech = WWW::Mechanize-new; DB7 $mech-get( 'http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279'); DB8 x $mech-forms; empty array See also: [davidp@supernova:~]$ wget -q -O- http://www.easyjet.com/en/searchpod.mvc/showborderless?aclwidth=279 | grep -i 'form' [davidp@supernova:~]$ WWW::Mechanize wants to be able to find a form to actually submit. You may be able to just fake the request yourself - at a quick glance, it looks like it submits to http://www.easyjet.com/EN/Booking.mvc, so take the field names from the source of the URL you gave before, and POST them at that URL, and see what happens. Failing that, you'll have to use the form in your browser while using an addon like Firebug or something, or capturing HTTP traffic off the wire, and see what happens, and make your script do the same. -- David Precious (bigpresh) dav...@preshweb.co.uk http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Mozilla::CA installation
Hi All, I'm trying to install LWP::Protocol::https on my system. I had already successfully installed LWP. I am running Perl v5.14.2 on Cygwin. I noted that the installation of some of the dependencies for LWP::Protocol::https had failed so I decided to look into this and try to install these individually. See below the messages when I try to install Mozilla::CA under the cpan program. I can see the file CA.pm: Heim@Heim-PC ~/.cpan $ find . | egrep CA.pm *./build/Mozilla-CA-20130114-7cyvJm/lib/Mozilla/CA.pm* There seems to be a problem with the paths in @INC (see below) but why should a standard install process fail? LWP was the first CPAN package that I tried to install and I didn't have any problems with this. Any help appreciated. Thanks in advance, Edward - cpan[2] install Mozilla::CA Running install for module '' Running make for A/AB/ABH/Mozilla-CA-20130114.tar.gz Has already been unwrapped into directory /home/Heim/.cpan/build/Mozilla-CA-20130114-7cyvJm Has already been made Running make test PERL_DL_NONLAZY=1 /usr/bin/perl.exe -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/locate-file.t ..*Can't locate Mozilla/CA.pm in @INC (@INC contains: /home/Heim/.cpan/build/Mozilla-CA-20130114-7cyvJm/blib/lib /home/Heim/.cpan/build/Mozilla-CA-20130114-7cyvJm/blib/arch /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int /usr/lib/perl5/site_perl/5.14 /usr/lib/perl5/vendor_perl/5.14/i686-cygwin-threads-64int /usr/lib/perl5/vendor_perl/5.14 /usr/lib/perl5/5.14/i686-cygwin-threads-64int /usr/lib/perl5/5.14 /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5*/site_perl/5.8 .) at t/locate-file.t line 7. BEGIN failed--compilation aborted at t/locate-file.t line 7. t/locate-file.t .. Dubious, test returned 2 (wstat 512, 0x200) No subtests run Test Summary Report --- t/locate-file.t (Wstat: 512 Tests: 0 Failed: 0) Non-zero exit status: 2 Parse errors: No plan found in TAP output Files=1, Tests=0, 1 wallclock secs ( 0.05 usr 0.02 sys + 0.04 cusr 0.03 csys = 0.14 CPU) Result: FAIL Failed 1/1 test programs. 0/0 subtests failed. Makefile:776: recipe for target `test_dynamic' failed make: *** [test_dynamic] Error 2 ABH/Mozilla-CA-20130114.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports ABH/Mozilla-CA-20130114.tar.gz Running make install make test had returned bad status, won't install without force Already tried without success Failed during this command: ABH/Mozilla-CA-20130114.tar.gz : make_test NO cpan[3]
daemon framework
Hi Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: daemon framework
On Mar 14, 2013, at 7:18 PM, Ken Peng wrote: Hi Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. See 'perldoc -q daemon', which mentions Proc::Daemon (I have not used it). -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: daemon framework
于 2013-3-15 10:19, Jim Gibson 写道: Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. See 'perldoc -q daemon', which mentions Proc::Daemon (I have not used it). Thank you. I also currently happen to check this module on CPAN. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: daemon framework
于 2013-3-15 10:19, Jim Gibson 写道: On Mar 14, 2013, at 7:18 PM, Ken Peng wrote: Hi Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. See 'perldoc -q daemon', which mentions Proc::Daemon (I have not used it). But I found both Proc::Daemon and Daemon::Generic don't support logging. Net::Server has logging. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/