Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I was daydreaming [perl.org] along these lines myself after YAPC. Having a SOAP interface to Thomas [loc.gov] would be pretty cool--and popular I imagine.
    • I wrote to Senator Fitzgerald a while ago, and he invited me to visit him in Washington when I get back (I think he does this for everyone though). Maybe I can bring this up when I talk to him about S1980. :)
      • Cool :-) In the meantime writing a Mech agent, or something that fits into the WWW::Search framework for accessing Thomas may not be too difficult. SOAP would be a whole lot cleaner, and versatile. But...
        #!/usr/bin/perl

        use strict;
        use warnings;
        use WWW::Mechanize;

        my $bill = shift;
        if ( !$bill ) { print "usage: bill S1980\n"; exit(1); }

        my $th = WWW::Mechanize->new();
        $th->get( 'http://thomas.loc.gov' );

        $th->field( docidc108 => $bill );
        $th->submit();

        $th->follow_link( text => "GPO's PDF" )
            or ( print "No such bill $bill\n" and exit(1) );

        $th->follow_link( text => 'Continue' );

        open( PDF, ">$bill.pdf" );
        print PDF $th->content();
        close( PDF );
        is a nice quick hack...Perl, ahhh!