#! /usr/bin/perl use LWP; use HTTP::Request; use HTTP::Response; use HTML::Form; $con=new LWP::UserAgent; $con->agent('n3u7digit'); $request=new HTTP::Request(GET=>"http://www.<site>.org"); $reply=$con->request($request); @forms=HTML::Form->parse($reply); for $formh(@forms){@keys=keys %$formh; for $name(@keys){ print "\t---$name\n"; } }
....the second version ..
for $formh(@forms){@keys=values %$formh; for $name(@keys){ process($name); print "--$name--\n"; } + sub process{$return=shift;return $return;}
the output: CASE 1
CASE 2---enctype ---action ---method ---attr ---inputs ---enctype ---action ---method ---attr ---inputs
So the utility of a closure seems evident, but why?--application/x-www-form-urlencoded-- --http:/<site>.org/-- --GET-- --HASH(0x84d3d4c)-- --ARRAY(0x85190e4)-- --application/x-www-form-urlencoded-- --http://<site>.org/en/video?destination=node%xxxxxx-- --POST--- --HASH(0x852232c)-- --ARRAY(0x852ac40)--
#! /usr/bin/perl use LWP; use HTTP::Request; use HTTP::Response; use HTML::Form; $con=new LWP::UserAgent; $con->agent('n3u7digit'); $request=new HTTP::Request(GET=>"http://www.<site>.org"); $reply=$con->request($request); @forms=HTML::Form->parse($reply); for $formh(@forms){@keys=values %$formh; for $name(@keys){ process($name); print "--$name--\n"; } sub process{ $return=shift; return $return; }
In reply to HTML::Form Phenomena by dReKurCe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |