Using perl to automate web surfing
Download
1 / 9

Web Automation - PowerPoint PPT Presentation


  • 451 Views
  • Updated On :

Using Perl to automate web surfing Web Automation Why Automate Surfing? The automatch program #! /usr/bin/perl -w # The 'automatch' program - check a collection of sequences against # the 'mersearchmulti.html' web page. use strict;

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Web Automation' - Leo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript


Slide3 l.jpg

The automatch program

#! /usr/bin/perl -w

# The 'automatch' program - check a collection of sequences against

# the 'mersearchmulti.html' web page.

use strict;

use constant URL => "http://pblinux.itcarlow.ie/mersearchmulti.html";

use WWW::Mechanize;

my $browser = WWW::Mechanize->new;

while ( my $seq = <> )

{

chomp( $seq );

print "Now processing: '$seq'.\n";


Slide4 l.jpg

The automatch program, cont.

$browser->get( URL );

$browser->form( 1 );

$browser->field( "shortsequence", $seq );

$browser->submit;

if ( $browser->success )

{

my $content = $browser->content;

while ( $content =~

m[<tr align="CENTER" /><td>(\w+?)</td><td>yes</td>]g )

{

print "\tAccession code: $1 matched '$seq'.\n";

}

}

else

{

print "Something went wrong: HTTP status code: ",

$browser->status, "\n";

}

}


Slide5 l.jpg

Running the automatch program

$ chmod +x automatch

$ ./automatch sequences.txt


Slide6 l.jpg

Results from automatch ...

Now processing: 'attccgattagggcgta'.

Now processing: 'aattc'.

Accession code: AF213017 matched 'aattc'.

Accession code: J01730 matched 'aattc'.

Accession code: M24940 matched 'aattc'.

Now processing: 'aatgggc'.

Now processing: 'aaattt'.

Accession code: AF213017 matched 'aaattt'.

Accession code: J01730 matched 'aaattt'.

Accession code: M24940 matched 'aaattt'.

Now processing: 'acgatccgcaagtagcaacc'.

Accession code: M15049 matched 'acgatccgcaagtagcaacc'.

Now processing: 'gggcccaaa'.

Now processing: 'atcgatcg'.

Now processing: 'tcatgcacctgatgaacgtgcaaaaccacag'.

Accession code: AF213017 matched 'tcatgcacctgatgaacgtgcaaaaccacag'.

.

.

Now processing: 'ccaaat'.

Accession code: AF213017 matched 'ccaaat'.

Accession code: J01730 matched 'ccaaat'.

Accession code: M24940 matched 'ccaaat'.


Figmersearchsource eps l.jpg

figMERSEARCHSOURCE.eps

Viewing the source of the mersearchmulti.html web page




ad