8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello everyone,
I've got some problem intalling a perl module.
The installation is well done as you can see below.
gueg@ux31:~$ sudo apt-get install libwww-mechanize-perl
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état...... (4 Replies)
Discussion started by: tot94
4 Replies
2. Shell Programming and Scripting
Hello,
Am very new to perl , please help me here !!
I need help in reading a URL from command line using PERL:: Mechanize and needs all the contents from the URL to get into a file.
below is the script which i have written so far ,
#!/usr/bin/perl
use LWP::UserAgent;
use... (2 Replies)
Discussion started by: scott_cog
2 Replies
3. Shell Programming and Scripting
hi gurus ,
i want the command to get the output in the desired format .
basically to convert columns to rows.
please refer to the attachment. (3 Replies)
Discussion started by: r_t_1601
3 Replies
4. Shell Programming and Scripting
Hello
Today I had a beautiful test to write some commands using Ubuntu, now I want to make sure of my answers to be reassured, if I had a mistake please correct me
List all files details under ubuntu Desktop.
my answer:
cd Desktop |ls -l
Navigate to your Desktop directory and... (7 Replies)
Discussion started by: S4K
7 Replies
5. Programming
We've been running perl scripts using the www::mechanize module on a linux box with no issues, however we just implemented the same scripts on an aix machine, aix 6.1, perl 5.8.8, and I am running into the issue with Content_Encoding: gzip in the returned html. I can't read it in that it is coming... (0 Replies)
Discussion started by: islanderman
0 Replies
6. UNIX for Dummies Questions & Answers
Hi All'
I'm a newbe, and just is started to learn unix.
Where can I find a complete sample scripts? I looking for a sample scripts which log in at another unix host and and execute another script server side.
Any input welcome (5 Replies)
Discussion started by: ioniCoder
5 Replies
7. Shell Programming and Scripting
So, I've just started learning Perl, and I've decided to read up on some modules. I encountered WWW::Mechanize, which interests me, so I decided to try out a couple of basic tutorials. One of them is found here. I tried what seems a very basic case:
#!/usr/bin/perl
use WWW::Mechanize;
$url... (1 Reply)
Discussion started by: treesloth
1 Replies
8. Answers to Frequently Asked Questions
Every now and then our users post complete programs to this site. It is especially important that these contributions don't get lost, so I will collect them here. Some of these programs are intended to demonstrate a programming technique and some are ready to run. As a guideline, the code... (0 Replies)
Discussion started by: Perderabo
0 Replies
WWW::Mechanize::Cookbook(3pm) User Contributed Perl Documentation WWW::Mechanize::Cookbook(3pm)
NAME
WWW::Mechanize::Cookbook - Recipes for using WWW::Mechanize
INTRODUCTION
First, please note that many of these are possible just using LWP::UserAgent. Since "WWW::Mechanize" is a subclass of LWP::UserAgent,
whatever works on "LWP::UserAgent" should work on "WWW::Mechanize". See the lwpcook man page included with the libwww-perl distribution.
BASICS
Launch the WWW::Mechanize browser
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 1 );
The "autocheck => 1" tells Mechanize to die if any IO fails, so you don't have to manually check. It's easier that way. If you want to do
your own error checking, leave it out.
Fetch a page
$mech->get( "http://search.cpan.org" );
print $mech->content;
"$mech->content" contains the raw HTML from the web page. It is not parsed or handled in any way, at least through the "content" method.
Fetch a page into a file
Sometimes you want to dump your results directly into a file. For example, there's no reason to read a JPEG into memory if you're only
going to write it out immediately. This can also help with memory issues on large files.
$mech->get( "http://www.cpan.org/src/stable.tar.gz",
":content_file" => "stable.tar.gz" );
Fetch a password-protected page
Generally, just call "credentials" before fetching the page.
$mech->credentials( 'admin' => 'password' );
$mech->get( 'http://10.11.12.13/password.html' );
print $mech->content();
LINKS
Find all image links
Find all links that point to a JPEG, GIF or PNG.
my @links = $mech->find_all_links(
tag => "a", url_regex => qr/.(jpe?g|gif|png)$/i );
Find all download links
Find all links that have the word "download" in them.
my @links = $mech->find_all_links(
tag => "a", text_regex => qr/download/i );
APPLICATIONS
Check all pages on a web site
Use Abe Timmerman's WWW::CheckSite http://search.cpan.org/dist/WWW-CheckSite/ <http://search.cpan.org/dist/WWW-CheckSite/>
SEE ALSO
WWW::Mechanize
AUTHORS
Copyright 2005-2010 Andy Lester "<andy@petdance.com>"
Later contributions by Peter Scott, Mark Stosberg and others. See Acknowledgements section in WWW::Mechanize for more.
perl v5.14.2 2011-08-05 WWW::Mechanize::Cookbook(3pm)