Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl and the internet.

Status
Not open for further replies.

programingnoob

Technical User
Dec 31, 2002
71
CA
Hi,
Is it possible for perl to:
1. Go on the internet and grab files, (ex: html pages).
2. Use forms in html. (boxes, buttons ....)
3. Run automaticly, (ex: automaticlly run a command every hour.)

If this is possible, what are the command for them? Is there any FAQs for this, and is there any good comprehensive sites that talk about this?

Also, in perl, is it only possible to respond to a program on the command line? Is it possible to make it as another format?

Thanks
 
Yes to all of your questions. Have a look at the LWP and LWP::Simple perl modules ( and maybe the Perl and LWP book:


It is possibe to respond to perl programs on the command line, but I have never written one of these myself so I couldn't comment on how to do it. As for running programs automatically, you can do this by running perl programs via cron, or by running a perl process as a daemon and getting it to sleep/wake up occaisionally and do stuff.

Will will@hellacool.co.uk
 

The documentation was helpful, but was very hard to understand. Bye the way, what is the command to make perl do stuff according to the time, and is there a command that makes PERL get random numbers?

Thanks
 
After using the script that was shown in the documentation,

#script
# Create a user agent object
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");

# Create a request
my $req = HTTP::Request->new(POST => ' $req->content_type('application/x- $req->content('match=
# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}
#end of script

There were serveral problems that I don't know how to solve. First, the results are unsteady, sometimes it works, sometimes it doesnt. What should I do to fix it?

Thanks..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top