On Thu, 9 Jan 2003, Jim Martinez wrote: > Is there some way to improve this cycle : edit code -> refresh browser -> > possibly look at the error log -> edit code -> ...
No one seems to have mentioned WWW::Mechanize (or if they have I've missed it.) It's a simple module that allows you to interact with LWP like it's a web browser (i.e. click on that link, enter these values into the form, etc) abstracting away the actual parsing of the HTML. Links: http://www.perladvent.org/2002/16th/ http://search.cpan.org/author/PETDANCE/WWW-Mechanize/lib/WWW/Mechanize.pm It's quite easy to integrate this with a test suite. You can start doing things like: #!/usr/bin/perl # turn on the safety features use strict; use warnings; # declare three tests use Test::More tests => 3; # create a new web browser use WWW::Mechanize; my $browser = WWW::Mechanize->new(); # see if we can get the front page of search.cpan.org $browser->get("http://search.cpan.org/"); ok($browser->{res}->is_success, "search.cpan.org"); # see if we can get a search page back $browser->form(1); $browser->field("query","Acme::Buffy"); $browser->click(); ok($browser->{res}->is_success, "module listing back"); # something that will fail $browser->get("http://2shortplanks.com/nosuchurl"); ok($browser->{res}->is_success, "no such url"); This prints out: 1..3 ok 1 - search.cpan.org ok 2 - module listing back not ok 3 - no such url # Failed test (test.pl at line 26) # Looks like you failed 1 tests of 3. Hope that helps. Mark. -- #!/usr/bin/perl -T use strict; use warnings; print q{Mark Fowler, [EMAIL PROTECTED], http://twoshortplanks.com/};