r559 - in general: . libwww-mechanize-formfiller-perl libwww-mechanize-formfiller-perl/branches libwww-mechanize-formfiller-perl/branches/upstream libwww-mechanize-formfiller-perl/branches/upstream/current libwww-mechanize-formfiller-perl/branches/upstream/current/lib libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random libwww-mechanize-formfiller-perl/branches/upstream/current/t

Tobias Grimm pkg-vdr-dvb-changes@lists.alioth.debian.org
Sun, 22 May 2005 09:13:57 +0000


Author: tiber-guest
Date: 2005-05-22 09:13:55 +0000 (Sun, 22 May 2005)
New Revision: 559

Added:
   general/libwww-mechanize-formfiller-perl/
   general/libwww-mechanize-formfiller-perl/branches/
   general/libwww-mechanize-formfiller-perl/branches/upstream/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/Changes
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/MANIFEST
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/Makefile.PL
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/README
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Callback.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Default.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Keep.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/00-FF-Value.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/01-FF-Value-Fixed.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/02-FF-Value-Default.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/03-FF-Value-Callback.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/04-FF-api.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/05-Form-1.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/06-Form-Image-Button.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/07-FF-Value-Random.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/99-pod.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Callback.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Default.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Interactive.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Keep.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Chars.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Date.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Word.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value.t
   general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller.t
   general/libwww-mechanize-formfiller-perl/tags/
Log:
[svn-inject] Installing original source of libwww-mechanize-formfiller-perl

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/Changes
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/Changes	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/Changes	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,28 @@
+Revision history for Perl extension WWW::Mechanize::FormFiller.
+
+0.05
+  - Documentation fixed for Chars.pm (Thanks to Mark Stosberg)
+  - Now it is possible to also use regular expressions instead
+    of names to specify the fields.
+  - Added documentation and inline test for the above feature
+
+0.04  20030517
+  - Fixed Makefile.PL for Perl 5.8.0
+  - Fixed inline tests
+  - Fixed inline examples so they actually show in the Pod
+  - Added more inline tests to test the synopses
+  - New prerequisite: Data::Random - to fill out forms with
+    better random data
+  - Added custom random date generation
+  - Added 'use strict' to all FormFiller::Value::* modules (only cosmetic)
+  - Added WWW::Mechanize::FormFiller::fillout, the dwim routine to
+    fill out forms, suggested by Mark Stosberg. Thanks !
+
+0.02  20030217
+  - More tests
+  - Inline tests
+  - first release on CPAN in preparation of WWW::Mechanize::Shell
+
+0.01  Thu Nov  7 23:04:33 2002
+  - original version; created by h2xs 1.21 with options
+    -X WWW::Mechanize::FormFiller


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/Changes
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/MANIFEST
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/MANIFEST	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/MANIFEST	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,35 @@
+Changes
+MANIFEST			This list of files
+Makefile.PL
+README
+lib/WWW/Mechanize/FormFiller.pm
+lib/WWW/Mechanize/FormFiller/Value.pm
+lib/WWW/Mechanize/FormFiller/Value/Callback.pm
+lib/WWW/Mechanize/FormFiller/Value/Default.pm
+lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
+lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
+lib/WWW/Mechanize/FormFiller/Value/Keep.pm
+lib/WWW/Mechanize/FormFiller/Value/Random.pm
+lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm
+lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm
+lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm
+t/00-FF-Value.t
+t/01-FF-Value-Fixed.t
+t/02-FF-Value-Default.t
+t/03-FF-Value-Callback.t
+t/04-FF-api.t
+t/05-Form-1.t
+t/06-Form-Image-Button.t
+t/07-FF-Value-Random.t
+t/99-pod.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Callback.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Default.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Interactive.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Keep.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Random.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Random-Word.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Random-Chars.t
+t/embedded-WWW-Mechanize-FormFiller-Value-Random-Date.t
+t/embedded-WWW-Mechanize-FormFiller-Value.t
+t/embedded-WWW-Mechanize-FormFiller.t


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/MANIFEST
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/Makefile.PL
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/Makefile.PL	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/Makefile.PL	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,65 @@
+use ExtUtils::MakeMaker;
+
+use lib 'lib';
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'    => 'WWW::Mechanize::FormFiller',
+    'VERSION_FROM'  => 'lib/WWW/Mechanize/FormFiller.pm', # finds $VERSION
+    'PREREQ_PM'    => { 'HTML::Form' => undef,
+    										'Test::More' => undef,
+    										'Data::Random' => 0.05,
+    									}, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM => 'lib/WWW/Mechanize/FormFiller.pm', # retrieve abstract from module
+       AUTHOR     => 'Max Maischein <corion@cpan.org>') : ()),
+);
+
+use vars qw($have_test_inline);
+BEGIN {
+  eval { require Test::Inline;
+         $have_test_inline = $Test::Inline::VERSION ge '0.15_001'; };
+  undef $@;
+  if ($have_test_inline) {
+    print "Good - you have a patched Test::Inline\n";
+  } else {
+    print "Test::Inline 0.15_001 is nice for testing the examples, but not necessary\n"
+  };
+};
+
+# Autocreate the synopsis test from the pod of every module
+# (if we have Test::Inline)
+{
+    package MY;
+    use strict;
+    sub top_targets {
+
+        my($self) = @_;
+        my $out = "POD2TEST_EXE = pod2test\n";
+
+        $out .= $self->SUPER::top_targets(@_);
+        return $out unless $main::have_test_inline;
+
+        $out =~ s/^(pure_all\b.*)/$1 testifypods/m;
+
+        $out .= "\n\ntestifypods : \n";
+
+        foreach my $pod (keys %{$self->{MAN1PODS}},
+                         keys %{$self->{MAN3PODS}})
+        {
+            (my $test = $pod) =~ s/\.(pm|pod)$//;
+            $test =~ s|/|-|g;
+            $test =~ s/^lib\W//;
+            $test =~ s/\W/-/;
+            $test = "embedded-$test.t";
+            $out .= "\t$self->{NOECHO}\$(POD2TEST_EXE) ".
+                    "$pod t/$test\n";
+        }
+
+        return $out;
+    }
+}
+
+# To make Test::Prereq happy
+1;


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/Makefile.PL
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/README
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/README	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/README	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,30 @@
+WWW/Mechanize/FormFiller version 0.01
+=====================================
+
+WWW::Mechanize::FormFiller and its submodules are useful to automate
+web forms. The FormFiller object is filled with a set of rules how to
+fill out HTML form field and then let loose on a HTML form. It fills
+in the fields according to the preset rules.
+
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  Test::More for the tests
+  HTML::Form for the filling of HTML forms
+
+COPYRIGHT AND LICENCE
+
+These modules may be used under the same terms as Perl itself
+
+Copyright (C) 2002,2003 Max Maischein, corion@cpan.org


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/README
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Callback.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Callback.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Callback.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,112 @@
+package WWW::Mechanize::FormFiller::Value::Callback;
+use base 'WWW::Mechanize::FormFiller::Value';
+use strict;
+
+use vars qw( $VERSION );
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,$coderef) = @_;
+  my $self = $class->SUPER::new($name);
+  
+  $self->{callback} = $coderef;
+
+  $self;
+};
+
+sub value {
+  my ($self,$input) = @_;
+  no strict 'refs';
+  $self->{callback}->($self,$input);
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Callback - Call Perl code to fill out a HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Callback;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a default value for the HTML field "login"
+  # This will put the current login name into the login field
+
+  sub find_login {
+    getlogin || getpwuid($<) || "Kilroy";
+  };
+
+  my $login = WWW::Mechanize::FormFiller::Value::Callback->new( login => \&find_login );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "If there is no password, put a nice number there
+  my $password = $f->add_filler( password => Callback => sub { int rand(90) + 10 } );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  my $login_str = getlogin || getpwuid($<) || "Kilroy";
+  is( $form->value('login'), $login_str, "Login gets set");
+  cmp_ok( $form->value('password'), '<', 100, "Password gets set");
+  cmp_ok( $form->value('password'), '>', 9, "Password gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a value returned by Perl code into a HTML field.
+
+=over 4
+
+=item new NAME, CODE
+
+Creates a new value which will correspond to the HTML field C<NAME>. The C<CODE>
+is a code reference that will return the value to be written into the HTML field.
+The code reference will be called with two parameters, the object and the
+HTML::Form::Input object.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Random>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Callback.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Default.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Default.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Default.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,109 @@
+package WWW::Mechanize::FormFiller::Value::Default;
+use base 'WWW::Mechanize::FormFiller::Value';
+use strict;
+
+use vars qw( $VERSION );
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,$value) = @_;
+  my $self = $class->SUPER::new($name);
+  $self->{value} = $value;
+
+  $self;
+};
+
+sub value {
+  my ($self,$input) = @_;
+  defined $input->value && $input->value ne "" ? $input->value : $self->{value};
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Default - Fill a fixed value into an empty HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Default;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a default value for the HTML field "login"
+  # This will put "Corion" into the login field unless
+  # there already is some other text.
+  my $login = WWW::Mechanize::FormFiller::Value::Default->new( login => "Corion" );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "If there is no password, put 'secret' there"
+  my $password = $f->add_filler( password => Default => "secret" );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "Corion", "Login gets set");
+  is( $form->value('password'), "secret", "Password gets set");
+  $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=Test />
+  <input type=text name=password value=geheim />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "Test", "Login gets not overwritten");
+  is( $form->value('password'), "geheim", "Password gets not overwritten");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a fixed value into a HTML field.
+
+=over 4
+
+=item new NAME, VALUE
+
+Creates a new value which will correspond to the HTML field C<NAME>. The C<VALUE>
+is the value to be written into the HTML field.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Random>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Default.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Fixed.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Fixed.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,94 @@
+package WWW::Mechanize::FormFiller::Value::Fixed;
+use base 'WWW::Mechanize::FormFiller::Value';
+use strict;
+
+use vars qw( $VERSION );
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,$value) = @_;
+  my $self = $class->SUPER::new($name);
+  $self->{value} = $value;
+
+  $self;
+};
+
+sub value { $_[0]->{value} };
+
+1;
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Fixed - Fill a fixed value into an HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Fixed;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a fixed value for the HTML field "login"
+  my $fixed = WWW::Mechanize::FormFiller::Value::Fixed->new( login => "Corion" );
+  $f->add_value( login => $fixed );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+  my $password = $f->add_filler( password => Fixed => "secret" );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=foo />
+  <input type=text name=password value=bar />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "Corion", "Login gets set");
+  is( $form->value('password'), "secret", "Password gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a fixed value into a HTML field.
+
+=over 4
+
+=item new NAME, VALUE
+
+Creates a new value which will correspond to the HTML field C<NAME>. The C<VALUE>
+is the value to be written into the HTML field.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Random>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Interactive.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Interactive.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,108 @@
+package WWW::Mechanize::FormFiller::Value::Interactive;
+use base 'WWW::Mechanize::FormFiller::Value::Callback';
+use strict;
+
+use vars qw( $VERSION );
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name) = @_;
+  my $self = $class->SUPER::new($name, \&ask_value);
+
+  $self;
+};
+
+sub ask_value {
+  my ($self,$input) = @_;
+  print $input->name,"> ","[",$input->value,"]";
+  my $result = <>;
+  chomp $result;
+  $result = $input->value if $result eq "";
+  $result;
+};
+
+1;
+
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Interactive - Ask the user to fill out a HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Interactive;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Ask the user for the "login"
+  my $login = WWW::Mechanize::FormFiller::Value::Interactive->new( 'login' );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "Ask the user for the password"
+  my $password = $f->add_filler( password => 'Interactive' );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  BEGIN { no warnings 'redefine'; *WWW::Mechanize::FormFiller::Value::Interactive::ask_value = sub {'fixed'}};
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=foo />
+  <input type=text name=password value=bar />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "fixed", "Login gets set");
+  is( $form->value('password'), "fixed", "Password gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a value read from STDIN into a HTML field.
+
+=over 4
+
+=item new NAME
+
+Creates a new value which will correspond to the HTML field C<NAME>.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field. The value will be read from
+STDIN. The name of the HTML field to be read and the current value will
+be printed to STDOUT. An empty string will use the given default. There
+currently is no way to enter an empty string if there is a different
+default string.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Random>,L<WWW::Mechanize::FormFiller::Value::Fixed>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Keep.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Keep.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Keep.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,97 @@
+package WWW::Mechanize::FormFiller::Value::Keep;
+use base 'WWW::Mechanize::FormFiller::Value';
+use strict;
+
+use vars qw( $VERSION );
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,$value) = @_;
+  my $self = $class->SUPER::new($name);
+  $self->{value} = $value;
+
+  $self;
+};
+
+sub value { $_[1]->value };
+
+1;
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Keep - Leave an HTML field alone
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Keep;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Leave the login field untouched
+  my $login = WWW::Mechanize::FormFiller::Value::Keep->new( 'login' );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+  my $sessionid = $f->add_filler( session => 'Keep' );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=foo />
+  <input type=hidden name=sessionid value=bar />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "foo", "Login gets set");
+  is( $form->value('sessionid'), "bar", "Password gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to keep a value in an HTML field.
+
+=over 4
+
+=item new NAME
+
+Creates a new value which will correspond to the HTML field C<NAME>.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns whatever C<FIELD->value()> returns.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,
+L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value>,
+L<WWW::Mechanize::FormFiller::Value::Fixed>,
+L<WWW::Mechanize::FormFiller::Value::Default>,
+L<WWW::Mechanize::FormFiller::Value::Random>,
+L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Keep.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,105 @@
+package WWW::Mechanize::FormFiller::Value::Random::Chars;
+use base 'WWW::Mechanize::FormFiller::Value';
+use strict;
+
+use vars qw( $VERSION );
+use Data::Random qw(rand_chars);
+$VERSION = '0.05';
+
+sub new {
+  my ($class,$name,@args) = @_;
+  my $self = $class->SUPER::new($name);
+  @args = (set => 'alpha', min => 5, max => 8) unless scalar @args;
+  $self->{args} = [ @args ];
+  $self;
+};
+
+sub value {
+  my ($self,$input) = @_;
+  join "", (rand_chars( @{$self->{args}} ));
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Random::Chars - Fill characters into an HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Chars;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+
+  my $login = WWW::Mechanize::FormFiller::Value::Random::Chars->new(
+                       login => set => 'alpha', min => 3, max => 8 );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => 'Random::Chars' );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('login'), qr/^([a-zA-Z]+)$/, "Login gets set");
+  like( $form->value('password'), qr/^([a-zA-Z]+)$/, "Password gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a randomly chosen value into a HTML field.
+
+=over 4
+
+=item new NAME, LIST
+
+Creates a new value which will correspond to the HTML field C<NAME>. The C<LIST>
+is the list of arguments passed to Data::Random::rand_chars. If the list is
+empty, C<< set => 'alpha', min => 5, max => 8 >> is assumed.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<Data::Random>,
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Fixed>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,140 @@
+package WWW::Mechanize::FormFiller::Value::Random::Date;
+use base 'WWW::Mechanize::FormFiller::Value';
+use Carp qw(croak);
+
+use vars qw( $VERSION );
+use POSIX;
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,%args) = @_;
+  my $self = $class->SUPER::new($name);
+  %args = (string => '%Y%m%d') unless scalar (keys %args);
+  $args{min} ||= undef;
+  $args{max} ||= undef;
+
+  $self->{args} = \%args;
+
+  $self;
+};
+
+sub value {
+  my ($self,$input) = @_;
+  my $min = $self->{args}->{min};
+  my $max = $self->{args}->{max};
+
+  for ($min, $max) {
+    $_ = strftime $self->{args}->{string}, gmtime()
+      if $_ eq "now";
+  };
+  croak "Minimum timestamp is greater or equal maximum timestamp"
+    if defined $max and defined $min and $max le $min;
+
+  my $result;
+  RANDOM: {
+    my $timestamp = rand(0x7FFFFFFF);
+    #warn $self->{args}->{string};
+    #warn gmtime($timestamp);
+    $result = strftime $self->{args}->{string}, gmtime($timestamp);
+    redo RANDOM if defined $min and $result lt $min;
+    redo RANDOM if defined $max and $result ge $max;
+  };
+  $result;
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Random::Date - Fill a timestamp into an HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Date;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "born"
+
+  my $born = WWW::Mechanize::FormFiller::Value::Random::Date->new(
+    born => string => '%Y%m%d', min => '20000101', max => '20373112' );
+  $f->add_value( born => $born );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $last_here = $f->add_filler( last_here => Random::Date => string => '%H%M%S', min => '000000', max => 'now');
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=born />
+  <input type=text name=last_here />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('born'), qr/^(\d{8})$/, "born gets set");
+  like( $form->value('last_here'), qr/^(\d{6})$/, "last_here gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a randomly chosen value into a HTML field.
+
+=over 4
+
+=item new NAME, %ARGS
+
+Creates a new value which will correspond to the HTML field C<NAME>. The allowed
+%ARGS are
+
+  string => POSIX strftime string
+  min    => minimum time stamp (inclusive)
+  max    => maximum time stamp (exclusive)
+
+The C<min> and C<max> time stamps must be in the same format as the C<string> supplies.
+
+B<WARNING>
+
+The algorithm to implement C<min> and C<max> barriers is very simplicistic - it
+tries as many random values as necessary to meet the two criteria. This means that
+your script may enter an infinite loop if the criteria can never be attained or
+are too little apart.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<Data::Random>,
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Fixed>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,109 @@
+package WWW::Mechanize::FormFiller::Value::Random::Word;
+use base 'WWW::Mechanize::FormFiller::Value';
+
+use vars qw( $VERSION );
+use Data::Random qw(rand_words);
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,@args) = @_;
+  my $self = $class->SUPER::new($name);
+  @args = (size => 1) unless scalar @args;
+  $self->{args} = [ @args ];
+  $self;
+};
+
+sub value {
+  my ($self,$input) = @_;
+  return join " ", @{rand_words( @{$self->{args}} )};
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Random::Word - Fill a word into an HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Word;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+  my $login = WWW::Mechanize::FormFiller::Value::Random::Word->new( login => size => 1 );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => Random::Word => size => 1 );
+
+  # Spew some bogus text into the comments field
+  my $comments = $f->add_filler( comments => Random::Word => size => 10 );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  <input type=text name=comments />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('login'), qr/^(\w+)$/, "Login gets set");
+  like( $form->value('password'), qr/^(\w+)$/, "Password gets set");
+  my @words = split(" ", $form->value('comments'));
+  is( scalar @words, 10, "Comments get set")
+    or diag "Words found : ",$form->value('comments');
+
+=head1 DESCRIPTION
+
+This class provides a way to write a randomly chosen value into a HTML field.
+
+=over 4
+
+=item new NAME, LIST
+
+Creates a new value which will correspond to the HTML field C<NAME>. The C<LIST>
+is the list of arguments passed to Data::Random::rand_words. If the list is
+empty, C<< size => 1 >> is assumed.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<Data::Random>,
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Fixed>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,111 @@
+package WWW::Mechanize::FormFiller::Value::Random;
+use strict;
+use base 'WWW::Mechanize::FormFiller::Value';
+use Data::Random qw(rand_enum);
+
+use vars qw( $VERSION );
+$VERSION = '0.04';
+
+sub new {
+  my ($class,$name,@values) = @_;
+  my $self = $class->SUPER::new($name);
+  $self->{values} = [ @values ];
+
+  $self;
+};
+
+sub value {
+  my ($self,$input) = @_;
+  my @values;
+  @values = @{$self->{values}}
+    if ($self->{values});
+
+  # Pick a choice among the allowed values for this input
+  # unless we got some prespecified values
+  @values = $input->possible_values unless scalar @values;
+  rand_enum( set => \@values, size => 1 );
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value::Random - Randomly fill out a HTML form field
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+
+  my $login = WWW::Mechanize::FormFiller::Value::Random->new( login => "root","administrator","corion" );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => Random => "foo","bar","baz" );
+
+=for example end
+
+=for example_testing
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('login'), qr/^(root|administrator|corion)$/, "Login gets set");
+  like( $form->value('password'), qr/^(foo|bar|baz)$/, "Password gets set");
+
+=head1 DESCRIPTION
+
+This class provides a way to write a randomly chosen value into a HTML field.
+
+=over 4
+
+=item new NAME, LIST
+
+Creates a new value which will correspond to the HTML field C<NAME>. The C<LIST>
+is a list of items one of which will be returned for each call to C<value()>.
+There is no persistence of these values. For items that can only take a finite
+set of elements, a random element out of that list is taken by default.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Value>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Fixed>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value/Random.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,79 @@
+package WWW::Mechanize::FormFiller::Value;
+
+use vars qw( $VERSION @ISA );
+$VERSION = '0.04';
+@ISA = ();
+
+sub new {
+  my ($class,$name) = @_;
+  my $self = {
+    name => $name,
+  };
+
+  bless $self,$class;
+
+  $self;
+};
+
+# You're supposed to override this
+sub value { undef };
+
+# You can't set the name, but retrieve it
+sub name { my $result = $_[0]->{name}; $_[0]->{name} = $_[1] if scalar @_ == 2; $result };
+
+1;
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller::Value - Base class for HTML form values
+
+=head1 SYNOPSIS
+
+=begin example
+
+  # This class is not used directly
+
+=end example
+
+=head1 DESCRIPTION
+
+This class is the base class for different values - it defines the
+interface implemented by the subclasses.
+
+=over 4
+
+=item new NAME
+
+Creates a new value which will correspond to the HTML field C<NAME>.
+
+=item name [NEWNAME]
+
+Gets and sets the name of the HTML field this value corresponds to.
+
+=item value FIELD
+
+Returns the value to put into the HTML field.
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller>,L<WWW::Mechanize::FormFiller::Value::Fixed>,
+L<WWW::Mechanize::FormFiller::Value::Default>,L<WWW::Mechanize::FormFiller::Value::Random>,L<WWW::Mechanize::FormFiller::Value::Interactive>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller/Value.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller.pm
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller.pm	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller.pm	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,461 @@
+package WWW::Mechanize::FormFiller;
+use strict;
+use Carp;
+
+use vars qw( $VERSION @ISA );
+
+$VERSION = '0.05';
+@ISA = ();
+
+sub load_value_class {
+  my ($class) = @_;
+  if ($class) {
+    no strict 'refs';
+
+    my $full_class = "WWW::Mechanize::FormFiller::Value::$class";
+
+    unless (defined eval '${' . $full_class . '::VERSION}') {
+      eval "use $full_class";
+      Carp::confess $@ if $@;
+    };
+  } else {
+    Carp::croak "No class name given to load" unless $class;
+  };
+};
+
+sub new {
+  my ($class,%args) = @_;
+  my $self = {
+    values => {},
+    default => undef
+  };
+  bless $self, $class;
+
+  if (exists $args{default}) {
+    my ($class,@args) = @{$args{default}};
+    load_value_class($class);
+    no strict 'refs';
+    $self->{default} = "WWW::Mechanize::FormFiller::Value::$class"->new(undef, @args);
+  };
+
+  if (exists $args{values}) {
+    if (ref $args{values} eq 'ARRAY') {
+      for my $value (@{$args{values}}) {
+        if (ref $value eq 'ARRAY') {
+          my ($name,$class,@args) = @$value;
+          if ($class) {
+            $self->add_filler( $name, $class, @args );
+          } else {
+            Carp::croak "Each element of the values array must have at least 2 elements (name and class)" unless defined $class;
+            Carp::croak "Each element of the values array must have a class name" unless $class;
+          };
+        } else {
+          Carp::croak "Each element of the values array must be an array reference";
+        };
+      }
+    } else {
+      Carp::croak "values parameter must be an array reference";
+    };
+  };
+  return $self;
+};
+
+sub add_filler {
+  my ($self,$name,$class,@args) = @_;
+  load_value_class($class);
+
+  if ($class) {
+    no strict 'refs';
+    $self->add_value( $name, "WWW::Mechanize::FormFiller::Value::$class"->new($name, @args));
+  } else {
+    Carp::croak "A value must have at least a class name and a field name (which may be undef though)" ;
+  };
+};
+
+sub add_value {
+  my ($self, $name, $value) = @_;
+  if (ref $name and UNIVERSAL::isa($name,'Regexp')) {
+    $self->{values}->{byre}->{$name} = $value;
+  } else {
+    $self->{values}->{byname}->{$name} = $value;
+  };
+  $value;
+};
+
+sub default {
+  my ($self,$newdefault) = @_;
+  my $result = $self->{default};
+  $self->{default} = $newdefault if (@_ > 1);
+  $result;
+};
+
+sub find_filler {
+  my ($self,$input) = @_;
+  croak "No input given" unless defined $input;
+  my $value;
+  if (exists $self->{values}->{byname}->{$input->name()}) {
+    $value = $self->{values}->{byname}->{$input->name};
+  } elsif (grep { $input->name =~ /$_/ } keys %{$self->{values}->{byre}}) {
+    my $match = (grep { $input->name =~ /$_/ } keys %{$self->{values}->{byre}})[0];
+    $value = $self->{values}->{byre}->{$match};
+  } elsif ($input->type eq "image") {
+    # Image inputs are really buttons, and if they have no (user) specified value,
+    # we don't ask about them.
+  } elsif ($self->default) {
+    $value = $self->default();
+  };
+  $value;
+};
+
+sub fill_form {
+  my ($self,$form) = @_;
+  #for (keys %{$self->{values}}) {
+  #  warn $_, " ", ref $_;
+  #};
+  for my $input ($form->inputs) {
+    my $value = $self->find_filler($input);
+    # We leave all values alone whenever we don't know what to do with them
+    if (defined $value) {
+      # Hmm - who cares about whether a value was hidden/readonly ??
+      no warnings;
+      local $^W = undef;
+      my $v = $value->value($input);
+      undef $v if ($input->type() eq "checkbox" and $v eq "");
+      $input->value( $v );
+    };
+  };
+};
+
+sub fillout {
+  my $self_class = shift;
+  my $self = ref $self_class ? $self_class : $self_class->new();
+  my $form;
+
+  while (@_) {
+    if (ref $_[0] and eval { UNIVERSAL::isa($_[0],'HTML::Form') }) {
+      croak "Two HTML::Form objects passed into fillout()" if ($form);
+      $form = shift;
+    } else {
+      my $field = shift;
+      if (ref $_[0] eq 'ARRAY') {
+        my $args = shift;
+        $self->add_filler($field,@$args);
+      } else {
+        my $value = shift;
+        $self->add_filler($field,'Fixed',$value);
+      };
+    };
+  };
+  $self->fill_form($form) if $form;
+  $self;
+};
+
+1;
+__END__
+
+=head1 NAME
+
+WWW::Mechanize::FormFiller - framework to automate HTML forms
+
+=head1 SYNOPSIS
+
+=begin example
+
+  use WWW::Mechanize::FormFiller;
+  use HTML::Form;
+
+  # Create a form filler that fills out google for my homepage
+
+  my $html = "<html><body><form name='f' action='http://www.google.com/search'>
+      <input type='text' name='q' value='' />
+      <input type='submit' name=btnG value='Google Search' />
+      <input type='hidden' name='secretValue' value='0xDEADBEEF' />
+    </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new(
+      values => [
+                 [q => Fixed => "Corion Homepage"],
+  							]);
+  my $form = HTML::Form->parse($html,"http://www.google.com/intl/en/");
+  $f->fill_form($form);
+
+  my $request = $form->click("btnG");
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+
+  print $request->as_string;
+
+=end example
+
+=for example_testing
+  $_STDOUT_ =~ s/[\x0a\x0d]+$//;
+  is($_STDOUT_,"GET http://www.google.com/search?q=Corion+Homepage&btnG=Google+Search&secretValue=0xDEADBEEF",'Got the expected HTTP query string');
+  
+Form fields can be specified by name or by a regular expression. A
+field specified by name takes precedence over a matching regular
+expression.
+
+=for example
+  use WWW::Mechanize::FormFiller;
+  use HTML::Form;
+
+=begin example
+
+  my $html = "<html><body><form name='f' action='http://www.example.com/'>
+      <input type='text' name='date_birth_spouse' value='' />
+      <input type='text' name='date_birth' value='' />
+      <input type='text' name='date_birth_kid_1' value='' />
+      <input type='text' name='date_birth_kid_2' value='' />
+      <input type='submit' name='fool'>
+    </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new(
+      values => [
+                 [date_birth => Fixed => "01.01.1970"],
+                 
+                 # We are less discriminate with the other dates
+                 [qr/date_birth/ => 'Random::Date' => string => '%d.%m.%Y'],
+  							]);
+  my $form = HTML::Form->parse($html,"http://www.example.com");
+  $f->fill_form($form);
+
+  my $request = $form->click("fool");
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+
+  print $request->as_string;
+
+=end example
+
+=for example_testing
+  $_STDOUT_ =~ s/[\x0a\x0d]+$//;
+  like($_STDOUT_,qr"^GET\shttp://www\.example\.com/
+  	\?date_birth_spouse=\d\d.\d\d.\d\d\d\d
+  	\&date_birth=01.01.1970
+  	\&date_birth_kid_1=\d\d.\d\d.\d\d\d\d
+  	\&date_birth_kid_2=\d\d.\d\d.\d\d\d\d$"x,'Got the expected HTTP query string');
+
+You are not limited to fixed form values - callbacks and interactive
+editing are also already provided :
+
+=for example
+  no warnings 'once';
+  require HTML::Form;
+  require WWW::Mechanize::FormFiller::Value::Interactive;
+  local *WWW::Mechanize::FormFiller::Value::Interactive::ask_value = sub { "s3[r3t" }; #<-- not a good password
+
+=for example begin
+
+  # Create a form filler that asks us for the password
+
+  # Normally, the HTML would come from a LWP::UserAgent request
+  my $html = "<html><body><form name='f' action='/login.asp'>
+    <input type='text' name='login'>
+    <input type='password' name='password' >
+    <input type='submit' name=Login value='Log in'>
+    <input type='hidden' name='session' value='0xDEADBEEF' />
+  </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new();
+  my $form = HTML::Form->parse($html,"http://www.fbi.gov/super/secret/");
+
+  $f->add_filler( password => Interactive => []);
+  $f->fill_form($form);
+
+  my $request = $form->click("Login");
+
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+  print $request->as_string;
+
+=for example end
+
+=for example_testing
+  isa_ok($f,"WWW::Mechanize::FormFiller");
+  $_STDOUT_ =~ s/[\x0a\x0d]+$//;
+  like($_STDOUT_,qr"^GET http://www.fbi.gov/login.asp\?login=&(password=.*?&)?Login=Log\+in&session=0xDEADBEEF",'Got the expected HTTP query string');
+
+=head1 DESCRIPTION
+
+The module is intended as a simple way to fill out HTML forms from a
+set of predetermined values. You set up the form filler with value elements,
+retrieve the HTML form, and let the form filler loose on that form.
+
+There are value classes provided for many tasks - fixed values, values
+to be queried interactively from the user, values taken randomly from
+a list of values and values specified through a callback to some Perl code.
+
+=over 4
+
+=item new %ARGS
+
+Creates a new instance. The C<%ARGS> hash has two possible keys :
+C<default>, whose value should be an array reference consisting of the
+name of a C<WWW::Mechanize::FormFiller::Value> subclass and the optional
+constructor values.
+C<values> must be an array reference, which contains array
+and C<Files>, which takes an array reference to the filenames to
+watch.
+
+Example :
+
+=begin example
+
+  # This filler fills all unspecified fields
+  # with the string "<purposedly left blank>"
+  my $f = WWW::Mechanize::FormFiller->new(
+    default => [ Fixed => "<purposedly left blank>" ]);
+
+  # This filler automatically fills in a username
+  # and asks for a password
+  my $f = WWW::Mechanize::FormFiller->new(
+                       values => [[ login => Fixed => "corion" ],
+                                  [ password => Interactive => []],
+                                 ]);
+
+  # This filler only fills in a username
+  # if it is the empty string, and still asks for the password :
+  my $f = WWW::Mechanize::FormFiller->new(
+                       values => [[ login => Default => "corion" ],
+                                  [ password => Interactive => [],
+                                 ]]);
+
+=end example
+
+=item add_filler NAME, CLASS, @ARGS
+
+Adds a new value to the list of filled fields. C<NAME> is the name
+of the form field, C<CLASS> is the name of the class in the
+C<WWW::Mechanize::FormFiller::Value> namespace - it must live
+below there ! C<@ARGS> is an optional array reference to the parameters
+that the subclass constructor takes.
+
+=item add_value NAME, VALUE
+
+Adds a new WWW::Mechanize::FormFiller::Value subclass to the list
+of filled fields. C<NAME> is the name of the form field, C<VALUE>
+is an object that responds to the interface of C<WWW::Mechanize::FormFiller::Value>.
+
+=item fill_form FORM
+
+Sets the field values in FORM to the values returned by the
+C<WWW::Mechanize::FormFiller::Value> elements. FORM should be
+of type HTML::Forms or respond to the same interface.
+
+=item fillout @ARGS
+
+This is a very dwimmy routine that allows you to intuitively
+set up values and fill out a form, if needed. It works as both
+a constructor and a method. The parameters are decoded according
+to the following examples :
+
+=for example begin
+
+  $filler = WWW::Mechanize::FormFiller->new();
+  $filler->fillout(
+    # For the the simple case, assumed 'Fixed' class,
+    name => 'Mark',
+
+    # With an array reference, create and fill with the right kind of object.
+    widget_id => [ 'Random', (1..5) ],
+  );
+
+=for example end
+
+=for example_testing
+  isa_ok($filler,"WWW::Mechanize::FormFiller");
+
+=for example
+  $form = HTML::Form->parse('<html><body><form>
+    <input name="name" type="text" />
+    <input name="motto" type="text" />
+  </form></body></html>','http://www.example.com/');
+
+=for example begin
+
+  $filler = WWW::Mechanize::FormFiller->new();
+  $filler->fillout(
+    # If the first parameter isa HTML::Form, it is
+    # filled out directly
+    $form,
+    name => 'Mark',
+    motto => [ 'Random::Word', size => 5 ],
+  );
+
+=for example end
+
+=for example_testing
+  isa_ok($filler,"WWW::Mechanize::FormFiller");
+  is($form->value('name'),'Mark','Name is set');
+  like($form->value('motto'),qr/^\w+( \w+){3} \w+$/,'Motto is set');
+
+=for example
+  $form2 = HTML::Form->parse('<html><body><form>
+    <input name="name" type="text" />
+    <input name="motto" type="text" />','http://www.example.com/');
+
+=for example begin
+
+  # This works as a direct constructor as well
+  WWW::Mechanize::FormFiller->fillout(
+    $form2,
+    name => 'Mark',
+    motto => [ 'Random::Word', size => 5 ],
+  );
+
+=for example end
+
+=for example_testing
+  isa_ok($filler,"WWW::Mechanize::FormFiller");
+  is($form2->value('name'),'Mark','Name is set');
+  like($form2->value('motto'),qr/^\w+( \w+){3} \w+$/,'Motto is set');
+
+=back
+
+=head2 Value subclasses
+
+The following WWW::Mechanize::FormFiller::Value subclasses are currently distributed :
+
+=over 4
+
+=item L<WWW::Mechanize::FormFiller::Value::Callback>
+
+=item L<WWW::Mechanize::FormFiller::Value::Default>
+
+=item L<WWW::Mechanize::FormFiller::Value::Fixed>
+
+=item L<WWW::Mechanize::FormFiller::Value::Interactive>
+
+=item L<WWW::Mechanize::FormFiller::Value::Keep>
+
+=item L<WWW::Mechanize::FormFiller::Value::Random>
+
+=item L<WWW::Mechanize::FormFiller::Value::Random::Word>
+
+=item L<WWW::Mechanize::FormFiller::Value::Random::Chars>
+
+=item L<WWW::Mechanize::FormFiller::Value::Random::Date>
+
+=back
+
+=head2 EXPORT
+
+None by default.
+
+=head2 COPYRIGHT AND LICENSE
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+Copyright (C) 2002,2003 Max Maischein
+
+=head1 AUTHOR
+
+Max Maischein, E<lt>corion@cpan.orgE<gt>
+
+Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !
+
+Bug reports are best done via RT at https://rt.cpan.org
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>,L<WWW::Mechanize::Shell>,L<WWW::Mechanize::FormFiller::Value>


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/lib/WWW/Mechanize/FormFiller.pm
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/00-FF-Value.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/00-FF-Value.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/00-FF-Value.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,18 @@
+use strict;
+use Test::More tests => 5;
+
+use_ok("WWW::Mechanize::FormFiller::Value");
+
+# Check the API :
+my $v = WWW::Mechanize::FormFiller::Value->new("foo");
+
+# Now check our published API :
+my $meth;
+for $meth (qw(name value)) {
+  can_ok($v,$meth);
+};
+
+# name is a read-only property :
+is( $v->name, "foo", "The name was set correctly" );
+$v->name("bar");
+is( $v->name, "bar", "The name can be changed" );


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/00-FF-Value.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/01-FF-Value-Fixed.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/01-FF-Value-Fixed.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/01-FF-Value-Fixed.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,18 @@
+use strict;
+
+my @values;
+BEGIN {
+  @values = ("foo",1,"",0,undef);
+};
+
+use Test::More tests => 1 + scalar @values * 3;
+
+use_ok("WWW::Mechanize::FormFiller::Value::Fixed");
+
+for my $value (@values) {
+  my $v = WWW::Mechanize::FormFiller::Value::Fixed->new("foo",$value);
+  isa_ok($v,"WWW::Mechanize::FormFiller::Value::Fixed");
+  can_ok($v,"value");
+  my $pvalue = $value ||"";
+  is($v->value(undef),$value,"Fixed returns the correct value for $pvalue");
+};
\ No newline at end of file


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/01-FF-Value-Fixed.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/02-FF-Value-Default.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/02-FF-Value-Default.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/02-FF-Value-Default.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,50 @@
+use strict;
+
+my @values;
+BEGIN {
+  @values = (
+    ["foo","","foo"],
+    [1,"",1],
+    ["","",""],
+    [0,"",0],
+    [undef,"",undef],
+
+    ["foo","foo","foo"],
+    [1,"foo","foo"],
+    ["","foo","foo"],
+    [0,"foo","foo"],
+    [undef,"foo","foo"],
+
+    ["foo",1,1],
+    [1,1,1],
+    ["",1,1],
+    [0,1,1],
+    [undef,1,1],
+
+    ["foo",0,0],
+    [1,0,0],
+    ["",0,0],
+    [0,0,0],
+    [undef,0,0],
+  );
+};
+
+use Test::More tests => 1 + scalar @values * 3;
+
+use_ok("WWW::Mechanize::FormFiller::Value::Default");
+SKIP: {
+  eval { require Test::MockObject };
+  skip "Need Test::MockObject to do tests on values", scalar @values *3 if $@;
+
+  for my $row (@values) {
+    my ($value,$form_value,$expected) = @$row;
+
+    my $input = Test::MockObject->new()->set_always('value',$form_value);
+
+    my $v = WWW::Mechanize::FormFiller::Value::Default->new("foo",$value);
+    isa_ok($v,"WWW::Mechanize::FormFiller::Value::Default");
+    can_ok($v,"value");
+    my $pvalue = $value || "";
+    is($v->value($input),$expected,"Fixed returns the correct value for ('$pvalue'/'$form_value')");
+  };
+};
\ No newline at end of file


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/02-FF-Value-Default.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/03-FF-Value-Callback.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/03-FF-Value-Callback.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/03-FF-Value-Callback.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,42 @@
+use strict;
+
+my @values;
+BEGIN {
+  @values = ("foo","bar","","baz",1,0);
+};
+
+use Test::More tests => 1 + scalar @values * 7;
+
+use_ok("WWW::Mechanize::FormFiller::Value::Callback");
+
+SKIP: {
+  eval { require Test::MockObject };
+  skip "Need Test::MockObject to do tests on values", scalar @values *7 if $@;
+
+  my $called;
+  my $value;
+  my $return_value;
+
+  sub callback {
+    my ($ff_value,$form_value) = @_;
+    isa_ok($ff_value,"WWW::Mechanize::FormFiller::Value::Callback");
+    $called = 1;
+    can_ok($form_value, "value");
+    is($form_value->value,$value,"Value passed correctly to callback ($value)");
+    $return_value;
+  };
+
+  my $val;
+  for $val (@values) {
+    $value = $val;
+    undef $called;
+    $return_value = $value;
+
+    my $input = Test::MockObject->new()->set_always('value',$value);
+    my $v = WWW::Mechanize::FormFiller::Value::Callback->new("foo",\&callback);
+    isa_ok($v,"WWW::Mechanize::FormFiller::Value::Callback");
+    can_ok($v,"value");
+    is($v->value($input),$return_value,"Callback returns the correct value for ('$value')");
+    is($called,1,"Callback was called for ($value)");
+  };
+};
\ No newline at end of file


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/03-FF-Value-Callback.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/04-FF-api.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/04-FF-api.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/04-FF-api.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,128 @@
+use strict;
+use Test::More tests => 33;
+
+use_ok("WWW::Mechanize::FormFiller");
+
+my $f = WWW::Mechanize::FormFiller->new();
+isa_ok($f,"WWW::Mechanize::FormFiller");
+
+# Now check our published API :
+my $meth;
+for $meth (qw(add_filler add_value fill_form fillout )) {
+  can_ok($f,$meth);
+};
+
+$f = WWW::Mechanize::FormFiller->new( default => [ Fixed => "foo" ]);
+isa_ok($f,"WWW::Mechanize::FormFiller");
+isa_ok($f->{default},"WWW::Mechanize::FormFiller::Value::Fixed","Default value");
+
+$f = WWW::Mechanize::FormFiller->new( default => [Default => "foo"],
+                                      values => [[ foo => Fixed => "foo"],
+                                                 [ bar => Default => "bar"],
+                                                 [ baz => Random => "1","2","3" ],
+                                                ]);
+isa_ok($f,"WWW::Mechanize::FormFiller");
+isa_ok($f->{default},"WWW::Mechanize::FormFiller::Value::Default","Default value");
+is(scalar keys %{$f->{values}->{byname}}, 3, "Correct number of values gets stored");
+
+$f = WWW::Mechanize::FormFiller->new(values => [[ login => Fixed => "root" ]]);
+my $v = WWW::Mechanize::FormFiller::Value::Fixed->new(undef,"secret");
+$f->add_value(password => $v);
+$f->add_value(password_confirm => $v);
+isa_ok($f,"WWW::Mechanize::FormFiller");
+is($f->{default},undef,"Passing in no default results in no default being set");
+is(scalar keys %{$f->{values}->{byname}}, 3, "Correct number of values gets stored");
+is($f->{values}->{byname}->{password}, $f->{values}->{byname}->{password_confirm}, "Duplicate values get stored only once");
+
+my $croaked;
+{
+  local *Carp::croak = sub {$croaked .= $_[0]};
+  $f = WWW::Mechanize::FormFiller->new(values => "don't know");
+  isnt($croaked,undef,"We croaked on invalid parameters");
+  like($croaked,qr"values parameter must be an array reference","Passing no array reference as values raises an error");
+  undef $croaked;
+};
+
+{
+  local *Carp::croak = sub {$croaked .= $_[0]};
+  $f = WWW::Mechanize::FormFiller->new(values => ["don't know"]);
+  isnt($croaked,undef,"We croaked on invalid parameters");
+  like($croaked,qr"Each element of the values array must be an array reference","Passing no array reference as element of values raises an error");
+  undef $croaked;
+};
+
+{
+  local *Carp::croak = sub {$croaked .= $_[0]};
+  $f = WWW::Mechanize::FormFiller->new(values => [["don't know"]]);
+  isnt($croaked,undef,"We croaked on invalid parameters");
+  like($croaked,qr"Each element of the values array must have at least 2 elements \(name and class\)","Passing too few array elements raises an error");
+  undef $croaked;
+};
+
+{
+  local *Carp::croak = sub {$croaked .= $_[0]};
+  $f = WWW::Mechanize::FormFiller->new(values => [[undef,""]]);
+  isnt($croaked,undef,"We croaked on invalid parameters");
+  like($croaked,qr"Each element of the values array must have a class name","Passing an empty classname raises an error");
+  undef $croaked;
+};
+
+{
+  local *Carp::croak = sub {$croaked .= $_[0]};
+  $f = WWW::Mechanize::FormFiller->new();
+  $f->add_filler( foo => "" => "bar" );
+  isnt($croaked,undef,"add_filler croaks on invalid parameters");
+  like($croaked,qr"A value must have at least a class name and a field name \(which may be undef though\)","Passing an empty classname to add_filler raises an error");
+  undef $croaked;
+};
+
+SKIP: {
+  eval { require HTML::Form; };
+  skip "Need HTML::Form to test fillout()", 2
+    if $@;
+  my $form = HTML::Form->parse('<form></form>','http://www.example.com');
+  {
+    local *Carp::croak = sub { die @_};
+    eval { $f = WWW::Mechanize::FormFiller->fillout($form,$form); };
+    $croaked = $@;
+    isnt($croaked,undef,"fillout croaks on double form");
+    like($croaked,qr"Two HTML::Form objects passed into fillout\(\)","Passing two forms to fillout raises an error");
+    undef $croaked;
+  };
+};
+
+SKIP: {
+  eval { require HTML::Form; };
+  skip "Need HTML::Form to test fillout()", 2
+    if $@;
+  my $form = HTML::Form->parse('<form>
+  <input name=name value=none />
+  </form>','http://www.example.com');
+  $f = WWW::Mechanize::FormFiller->fillout($form, name => 'Mark' );
+  isa_ok($f,'WWW::Mechanize::FormFiller');
+  is($form->value('name'),'Mark','fillout has a default of Fixed');
+};
+
+SKIP: {
+  eval { require HTML::Form; };
+  skip "Need HTML::Form to test fillout()", 2
+    if $@;
+  my $form = HTML::Form->parse('<form>
+  <input name=name value=none />
+  </form>','http://www.example.com');
+  $f = WWW::Mechanize::FormFiller->fillout($form, name => [ Random => 'Mark' ]);
+  isa_ok($f,'WWW::Mechanize::FormFiller');
+  is($form->value('name'),'Mark','Other classes work as well');
+};
+
+SKIP: {
+  eval { require HTML::Form; };
+  skip "Need HTML::Form to test fillout()", 2
+    if $@;
+  my $form = HTML::Form->parse('<form>
+  <input name=name value=none />
+  </form>','http://www.example.com');
+  $f = WWW::Mechanize::FormFiller->fillout(name => [ Random => 'Mark' ], $form);
+  isa_ok($f,'WWW::Mechanize::FormFiller');
+  is($form->value('name'),'Mark','The place of $form is irrelevant');
+};
\ No newline at end of file


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/04-FF-api.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/05-Form-1.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/05-Form-1.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/05-Form-1.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,113 @@
+use strict;
+
+my @tests;
+BEGIN{
+@tests = (
+  # Class, name,args, html index, expected value
+  ['Fixed',"text_input_1",["bar"],0,"bar"],
+  ['Fixed',"text_input_2",["bar"],1,"bar"],
+  ['Fixed',"radio",["0"],2,"0"],
+  ['Fixed',"radio",["1"],2,"1"],
+  ['Fixed',"radio",["2"],2,"2"],
+  ['Fixed',"radio",["3"],2,"3"],
+  ['Fixed',"checkbox_1",[""],3,undef],
+  ['Fixed',"checkbox_1",["on"],3,"on"],
+  ['Fixed',"checkbox_2",[""],4,undef],
+  ['Fixed',"checkbox_2",["on"],4,"on"],
+  ['Default',"text_input_1",["bar"],0,"bar"],
+  ['Default',"text_input_2",["bar"],1,"xxx"],
+  ['Default',"radio",["0"],2,"1"],
+  ['Default',"radio",["1"],2,"1"],
+  ['Default',"radio",["2"],2,"1"],
+  ['Default',"radio",["3"],2,"1"],
+  ['Default',"checkbox_1",[""],3,"on"],
+  ['Default',"checkbox_1",["on"],3,"on"],
+  ['Default',"checkbox_2",[""],4,undef], # ??? This is a bit weird, but that's OK at the moment
+  ['Default',"checkbox_2",["on"],4,"on"],
+
+  # REs
+  ['Fixed',qr/text_input/,["bar"],0,"bar"],
+  ['Fixed',qr/text_input/,["bar"],1,"bar"],
+);
+};
+
+use Test::More tests => 1 + scalar @tests * 3;
+BEGIN {
+  use_ok("WWW::Mechanize::FormFiller");
+};
+SKIP: {
+  eval { require HTML::Form };
+  skip "Need HTML::Form to run the more extensive tests", scalar @tests * 3 if $@;
+
+  # Load the different HTML sets
+  my @forms = split /---/, do {
+    local $/ = undef;
+    <DATA>;
+  };
+
+  for my $row (@tests) {
+    my ($class,$name,$args,$index,$expected) = @$row;
+
+    my $f = WWW::Mechanize::FormFiller->new();
+    isa_ok($f,"WWW::Mechanize::FormFiller");
+    my $form = HTML::Form->parse($forms[$index],"http://www.nowhere.org");
+
+    my $filler = $f->add_filler($name,$class,@$args);
+    isa_ok($filler, "WWW::Mechanize::FormFiller::Value::$class");
+    $f->fill_form($form);
+    my @filled_inputs;
+    if (ref $name and UNIVERSAL::isa( $name,'Regexp')) {
+	    @filled_inputs = grep { $_->name =~ $name } $form->inputs;
+    } else {
+      @filled_inputs = $form->find_input($name);
+    };
+    for my $input (@filled_inputs) {
+      is($input->value,$expected,"Modified the expected field for page $index/$name ($class:".join(":",@$args).")");
+    };
+  };
+};
+
+__DATA__
+<html><head><title>Text box</title></head>
+<body>
+<form>
+  <input type="text" name="text_input_1" value="">
+  <input type="text" name="secondary" value="">
+</form>
+</body>
+</html>
+---
+<html><head><title>Text box (prefilled)</title></head>
+<body>
+<form>
+  <input type="text" name="text_input_2" value="xxx">
+</form>
+</body>
+</html>
+---
+<html><head><title>Radio box</title></head>
+<body>
+<form>
+  <input type=radio name=radio value="0">
+  <input type=radio name=radio value="1" checked>
+  <input type=radio name=radio value="2" >
+  <input type=radio name=radio value="3" >
+</form>
+</body>
+</html>
+---
+<html><head><title>Readonly checkbox</title></head>
+<body>
+<form>
+  <input type=checkbox name=checkbox_1 checked=1>
+</form>
+</body>
+</html>
+---
+<html><head><title>Readonly checkbox</title></head>
+<body>
+<form>
+  <input type=checkbox name=checkbox_2>
+</form>
+</body>
+</html>
\ No newline at end of file


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/05-Form-1.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/06-Form-Image-Button.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/06-Form-Image-Button.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/06-Form-Image-Button.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,51 @@
+use strict;
+
+use Test::More tests => 7;
+
+use_ok("WWW::Mechanize::FormFiller");
+
+SKIP: {
+  eval { require HTML::Form };
+  skip "Need HTML::Form to run the form image value test", 6 if $@;
+  eval { require Test::MockObject };
+  skip "Need Test::MockObject to run the form image value test", 6 if $@;
+
+  {
+    my $f = WWW::Mechanize::FormFiller->new();
+    isa_ok($f,"WWW::Mechanize::FormFiller");
+
+    my $value = $f->add_value("image1", Test::MockObject->new()->set_always('value','Returned Value'));
+    my $form = HTML::Form->parse(<<HTML,"http://www.nowhere.org");
+    <html><body><form>
+      <input type='image' name='image1' value='Original Value'/>
+    </form></body></html>
+HTML
+
+    $f->fill_form($form);
+    my ($method,$args) = $value->next_call;
+    is($method,"value","Image inputs get called if they are specified");
+    my $filled_input = $form->find_input("image1");
+    is($filled_input->value, 'Returned Value', "Returned image values get set")
+  };
+
+  {
+    my $value = Test::MockObject->new()->set_always('value','Returned Value');
+    $value->fake_module('WWW::Mechanize::FormFiller::Value::Test');
+    $value->fake_new('WWW::Mechanize::FormFiller::Value::Test');
+
+    my $f = WWW::Mechanize::FormFiller->new( default => [ 'Test' ] );
+    isa_ok($f,"WWW::Mechanize::FormFiller");
+
+    my $form = HTML::Form->parse(<<HTML,"http://www.nowhere.org");
+    <html><body><form>
+      <input type='image' name='image1' value='Original Value'/>
+    </form></body></html>
+HTML
+
+    $f->fill_form($form);
+    my ($method,$args) = $value->next_call;
+    is($method,undef,"Image inputs don't get called if they are not explicitly specified");
+    my $filled_input = $form->find_input("image1");
+    is($filled_input->value, 'Original Value', "Returned image values stay what they are set to")
+  };
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/06-Form-Image-Button.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/07-FF-Value-Random.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/07-FF-Value-Random.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/07-FF-Value-Random.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,27 @@
+use strict;
+
+
+use Test::More tests => 1 + 3 + 3;
+
+use_ok("WWW::Mechanize::FormFiller::Value::Random");
+
+SKIP: {
+  eval { require Test::MockObject };
+  skip "Need Test::MockObject to do tests on values", 3+3
+    if $@;
+
+  my @values = ("foo","bar","baz");
+  my $value;
+  
+  my $input = Test::MockObject->new()->set_always('value',$value);
+  my $v = WWW::Mechanize::FormFiller::Value::Random->new("foo","bar");
+  isa_ok($v,"WWW::Mechanize::FormFiller::Value::Random");
+  can_ok($v,"value");
+  is($v->value($input),"bar","Single argument list returns single argument");
+
+  $input = Test::MockObject->new()->set_always('value',$value);
+  $v = WWW::Mechanize::FormFiller::Value::Random->new("foo",@values);
+  isa_ok($v,"WWW::Mechanize::FormFiller::Value::Random");
+  can_ok($v,"value");
+  like($v->value($input),"/" . join("|",@values)."/","Multiple arguments return one of the list");
+};
\ No newline at end of file


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/07-FF-Value-Random.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/99-pod.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/99-pod.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/99-pod.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,36 @@
+use Test::More;
+
+# Check our Pod
+# The test was provided by Andy Lester,
+# who stole it from Brian D. Foy
+# Thanks to both !
+
+use File::Spec;
+use File::Find;
+use strict;
+
+eval {
+  require Test::Pod;
+  Test::Pod->import;
+};
+
+my @files;
+
+if ($@) {
+  plan skip_all => "Test::Pod required for testing POD";
+}
+elsif ($Test::Pod::VERSION < 0.95) {
+  plan skip_all => "Test::Pod 0.95 required for testing POD";
+}
+else {
+  my $blib = File::Spec->catfile(qw(blib lib));
+  find(\&wanted, $blib);
+  plan tests => scalar @files;
+  foreach my $file (@files) {
+    pod_file_ok($file);
+  }
+}
+
+sub wanted {
+  push @files, $File::Find::name if /\.p(l|m|od)$/;
+}


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/99-pod.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Callback.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Callback.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Callback.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,158 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Callback.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Callback
+  eval { require WWW::Mechanize::FormFiller::Value::Callback };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Callback to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 34 lib/WWW/Mechanize/FormFiller/Value/Callback.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Callback;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a default value for the HTML field "login"
+  # This will put the current login name into the login field
+
+  sub find_login {
+    getlogin || getpwuid($<) || "Kilroy";
+  };
+
+  my $login = WWW::Mechanize::FormFiller::Value::Callback->new( login => \&find_login );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "If there is no password, put a nice number there
+  my $password = $f->add_filler( password => Callback => sub { int rand(90) + 10 } );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 34");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Callback
+  eval { require WWW::Mechanize::FormFiller::Value::Callback };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Callback to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 34 lib/WWW/Mechanize/FormFiller/Value/Callback.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Callback;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a default value for the HTML field "login"
+  # This will put the current login name into the login field
+
+  sub find_login {
+    getlogin || getpwuid($<) || "Kilroy";
+  };
+
+  my $login = WWW::Mechanize::FormFiller::Value::Callback->new( login => \&find_login );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "If there is no password, put a nice number there
+  my $password = $f->add_filler( password => Callback => sub { int rand(90) + 10 } );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  my $login_str = getlogin || getpwuid($<) || "Kilroy";
+  is( $form->value('login'), $login_str, "Login gets set");
+  cmp_ok( $form->value('password'), '<', 100, "Password gets set");
+  cmp_ok( $form->value('password'), '>', 9, "Password gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Callback.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Default.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Default.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Default.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,155 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Default.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Default
+  eval { require WWW::Mechanize::FormFiller::Value::Default };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Default to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 32 lib/WWW/Mechanize/FormFiller/Value/Default.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Default;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a default value for the HTML field "login"
+  # This will put "Corion" into the login field unless
+  # there already is some other text.
+  my $login = WWW::Mechanize::FormFiller::Value::Default->new( login => "Corion" );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "If there is no password, put 'secret' there"
+  my $password = $f->add_filler( password => Default => "secret" );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 32");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Default
+  eval { require WWW::Mechanize::FormFiller::Value::Default };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Default to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 32 lib/WWW/Mechanize/FormFiller/Value/Default.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Default;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a default value for the HTML field "login"
+  # This will put "Corion" into the login field unless
+  # there already is some other text.
+  my $login = WWW::Mechanize::FormFiller::Value::Default->new( login => "Corion" );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "If there is no password, put 'secret' there"
+  my $password = $f->add_filler( password => Default => "secret" );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "Corion", "Login gets set");
+  is( $form->value('password'), "secret", "Password gets set");
+  $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=Test />
+  <input type=text name=password value=geheim />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "Test", "Login gets not overwritten");
+  is( $form->value('password'), "geheim", "Password gets not overwritten");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Default.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,140 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Fixed.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Fixed
+  eval { require WWW::Mechanize::FormFiller::Value::Fixed };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Fixed to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 28 lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Fixed;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a fixed value for the HTML field "login"
+  my $fixed = WWW::Mechanize::FormFiller::Value::Fixed->new( login => "Corion" );
+  $f->add_value( login => $fixed );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+  my $password = $f->add_filler( password => Fixed => "secret" );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 28");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Fixed
+  eval { require WWW::Mechanize::FormFiller::Value::Fixed };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Fixed to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 28 lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Fixed;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a fixed value for the HTML field "login"
+  my $fixed = WWW::Mechanize::FormFiller::Value::Fixed->new( login => "Corion" );
+  $f->add_value( login => $fixed );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+  my $password = $f->add_filler( password => Fixed => "secret" );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=foo />
+  <input type=text name=password value=bar />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "Corion", "Login gets set");
+  is( $form->value('password'), "secret", "Password gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Interactive.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Interactive.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Interactive.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,145 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Interactive.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Interactive
+  eval { require WWW::Mechanize::FormFiller::Value::Interactive };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Interactive to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 36 lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Interactive;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Ask the user for the "login"
+  my $login = WWW::Mechanize::FormFiller::Value::Interactive->new( 'login' );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "Ask the user for the password"
+  my $password = $f->add_filler( password => 'Interactive' );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 36");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Interactive
+  eval { require WWW::Mechanize::FormFiller::Value::Interactive };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Interactive to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 36 lib/WWW/Mechanize/FormFiller/Value/Interactive.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Interactive;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Ask the user for the "login"
+  my $login = WWW::Mechanize::FormFiller::Value::Interactive->new( 'login' );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # "Ask the user for the password"
+  my $password = $f->add_filler( password => 'Interactive' );
+
+
+
+
+  require HTML::Form;
+  BEGIN { no warnings 'redefine'; *WWW::Mechanize::FormFiller::Value::Interactive::ask_value = sub {'fixed'}};
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=foo />
+  <input type=text name=password value=bar />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "fixed", "Login gets set");
+  is( $form->value('password'), "fixed", "Password gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Interactive.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Keep.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Keep.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Keep.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,140 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Keep.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Keep
+  eval { require WWW::Mechanize::FormFiller::Value::Keep };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Keep to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 28 lib/WWW/Mechanize/FormFiller/Value/Keep.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Keep;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Leave the login field untouched
+  my $login = WWW::Mechanize::FormFiller::Value::Keep->new( 'login' );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+  my $sessionid = $f->add_filler( session => 'Keep' );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 28");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Keep
+  eval { require WWW::Mechanize::FormFiller::Value::Keep };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Keep to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 28 lib/WWW/Mechanize/FormFiller/Value/Keep.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Keep;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Leave the login field untouched
+  my $login = WWW::Mechanize::FormFiller::Value::Keep->new( 'login' );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+  my $sessionid = $f->add_filler( session => 'Keep' );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login value=foo />
+  <input type=hidden name=sessionid value=bar />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  is( $form->value('login'), "foo", "Login gets set");
+  is( $form->value('sessionid'), "bar", "Password gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Keep.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Chars.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Chars.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Chars.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,148 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Random\Chars.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random::Chars
+  eval { require WWW::Mechanize::FormFiller::Value::Random::Chars };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random::Chars to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 33 lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Chars;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+
+  my $login = WWW::Mechanize::FormFiller::Value::Random::Chars->new(
+                       login => set => 'alpha', min => 3, max => 8 );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => 'Random::Chars' );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 33");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random::Chars
+  eval { require WWW::Mechanize::FormFiller::Value::Random::Chars };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random::Chars to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 33 lib/WWW/Mechanize/FormFiller/Value/Random/Chars.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Chars;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+
+  my $login = WWW::Mechanize::FormFiller::Value::Random::Chars->new(
+                       login => set => 'alpha', min => 3, max => 8 );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => 'Random::Chars' );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('login'), qr/^([a-zA-Z]+)$/, "Login gets set");
+  like( $form->value('password'), qr/^([a-zA-Z]+)$/, "Password gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Chars.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Date.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Date.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Date.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,148 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Random\Date.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random::Date
+  eval { require WWW::Mechanize::FormFiller::Value::Random::Date };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random::Date to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 56 lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Date;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "born"
+
+  my $born = WWW::Mechanize::FormFiller::Value::Random::Date->new(
+    born => string => '%Y%m%d', min => '20000101', max => '20373112' );
+  $f->add_value( born => $born );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $last_here = $f->add_filler( last_here => Random::Date => string => '%H%M%S', min => '000000', max => 'now');
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 56");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random::Date
+  eval { require WWW::Mechanize::FormFiller::Value::Random::Date };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random::Date to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 56 lib/WWW/Mechanize/FormFiller/Value/Random/Date.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Date;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "born"
+
+  my $born = WWW::Mechanize::FormFiller::Value::Random::Date->new(
+    born => string => '%Y%m%d', min => '20000101', max => '20373112' );
+  $f->add_value( born => $born );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $last_here = $f->add_filler( last_here => Random::Date => string => '%H%M%S', min => '000000', max => 'now');
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=born />
+  <input type=text name=last_here />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('born'), qr/^(\d{8})$/, "born gets set");
+  like( $form->value('last_here'), qr/^(\d{6})$/, "last_here gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Date.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Word.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Word.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Word.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,154 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Random\Word.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random::Word
+  eval { require WWW::Mechanize::FormFiller::Value::Random::Word };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random::Word to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 32 lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Word;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+  my $login = WWW::Mechanize::FormFiller::Value::Random::Word->new( login => size => 1 );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => Random::Word => size => 1 );
+
+  # Spew some bogus text into the comments field
+  my $comments = $f->add_filler( comments => Random::Word => size => 10 );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 32");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random::Word
+  eval { require WWW::Mechanize::FormFiller::Value::Random::Word };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random::Word to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 32 lib/WWW/Mechanize/FormFiller/Value/Random/Word.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random::Word;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+  my $login = WWW::Mechanize::FormFiller::Value::Random::Word->new( login => size => 1 );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => Random::Word => size => 1 );
+
+  # Spew some bogus text into the comments field
+  my $comments = $f->add_filler( comments => Random::Word => size => 10 );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  <input type=text name=comments />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('login'), qr/^(\w+)$/, "Login gets set");
+  like( $form->value('password'), qr/^(\w+)$/, "Password gets set");
+  my @words = split(" ", $form->value('comments'));
+  is( scalar @words, 10, "Comments get set")
+    or diag "Words found : ",$form->value('comments');
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random-Word.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,146 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value\Random.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random
+  eval { require WWW::Mechanize::FormFiller::Value::Random };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 40 lib/WWW/Mechanize/FormFiller/Value/Random.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+
+  my $login = WWW::Mechanize::FormFiller::Value::Random->new( login => "root","administrator","corion" );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => Random => "foo","bar","baz" );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 40");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Random
+  eval { require WWW::Mechanize::FormFiller::Value::Random };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Random to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 40 lib/WWW/Mechanize/FormFiller/Value/Random.pm
+
+  use WWW::Mechanize::FormFiller;
+  use WWW::Mechanize::FormFiller::Value::Random;
+
+  my $f = WWW::Mechanize::FormFiller->new();
+
+  # Create a random value for the HTML field "login"
+
+  my $login = WWW::Mechanize::FormFiller::Value::Random->new( login => "root","administrator","corion" );
+  $f->add_value( login => $login );
+
+  # Alternatively take the following shorthand, which adds the
+  # field to the list as well :
+
+  # If there is no password, put a random one out of the list there
+  my $password = $f->add_filler( password => Random => "foo","bar","baz" );
+
+
+
+
+  require HTML::Form;
+  my $form = HTML::Form->parse('<html><body><form method=get action=/>
+  <input type=text name=login />
+  <input type=text name=password />
+  </form></body></html>','http://www.example.com/');
+  $f->fill_form($form);
+  like( $form->value('login'), qr/^(root|administrator|corion)$/, "Login gets set");
+  like( $form->value('password'), qr/^(foo|bar|baz)$/, "Password gets set");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value-Random.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,62 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller\Value.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 34 lib/WWW/Mechanize/FormFiller/Value.pm
+
+  # This class is not used directly
+
+;
+
+  }
+};
+is($@, '', "example from line 34");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller-Value.t
___________________________________________________________________
Name: svn:executable
   + 

Added: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller.t
===================================================================
--- general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller.t	2005-05-22 09:13:13 UTC (rev 558)
+++ general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller.t	2005-05-22 09:13:55 UTC (rev 559)
@@ -0,0 +1,677 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\WWW\Mechanize\FormFiller.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 163 lib/WWW/Mechanize/FormFiller.pm
+
+  use WWW::Mechanize::FormFiller;
+  use HTML::Form;
+
+  # Create a form filler that fills out google for my homepage
+
+  my $html = "<html><body><form name='f' action='http://www.google.com/search'>
+      <input type='text' name='q' value='' />
+      <input type='submit' name=btnG value='Google Search' />
+      <input type='hidden' name='secretValue' value='0xDEADBEEF' />
+    </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new(
+      values => [
+                 [q => Fixed => "Corion Homepage"],
+  							]);
+  my $form = HTML::Form->parse($html,"http://www.google.com/intl/en/");
+  $f->fill_form($form);
+
+  my $request = $form->click("btnG");
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+
+  print $request->as_string;
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 163");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 163 lib/WWW/Mechanize/FormFiller.pm
+
+  use WWW::Mechanize::FormFiller;
+  use HTML::Form;
+
+  # Create a form filler that fills out google for my homepage
+
+  my $html = "<html><body><form name='f' action='http://www.google.com/search'>
+      <input type='text' name='q' value='' />
+      <input type='submit' name=btnG value='Google Search' />
+      <input type='hidden' name='secretValue' value='0xDEADBEEF' />
+    </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new(
+      values => [
+                 [q => Fixed => "Corion Homepage"],
+  							]);
+  my $form = HTML::Form->parse($html,"http://www.google.com/intl/en/");
+  $f->fill_form($form);
+
+  my $request = $form->click("btnG");
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+
+  print $request->as_string;
+
+
+
+
+  $_STDOUT_ =~ s/[\x0a\x0d]+$//;
+  is($_STDOUT_,"GET http://www.google.com/search?q=Corion+Homepage&btnG=Google+Search&secretValue=0xDEADBEEF",'Got the expected HTTP query string');
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 199 lib/WWW/Mechanize/FormFiller.pm
+  use WWW::Mechanize::FormFiller;
+  use HTML::Form;
+
+
+
+  my $html = "<html><body><form name='f' action='http://www.example.com/'>
+      <input type='text' name='date_birth_spouse' value='' />
+      <input type='text' name='date_birth' value='' />
+      <input type='text' name='date_birth_kid_1' value='' />
+      <input type='text' name='date_birth_kid_2' value='' />
+      <input type='submit' name='fool'>
+    </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new(
+      values => [
+                 [date_birth => Fixed => "01.01.1970"],
+                 
+                 # We are less discriminate with the other dates
+                 [qr/date_birth/ => 'Random::Date' => string => '%d.%m.%Y'],
+  							]);
+  my $form = HTML::Form->parse($html,"http://www.example.com");
+  $f->fill_form($form);
+
+  my $request = $form->click("fool");
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+
+  print $request->as_string;
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 199");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller
+  eval { require WWW::Mechanize::FormFiller };
+  skip "Need module WWW::Mechanize::FormFiller to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 199 lib/WWW/Mechanize/FormFiller.pm
+  use WWW::Mechanize::FormFiller;
+  use HTML::Form;
+
+
+
+  my $html = "<html><body><form name='f' action='http://www.example.com/'>
+      <input type='text' name='date_birth_spouse' value='' />
+      <input type='text' name='date_birth' value='' />
+      <input type='text' name='date_birth_kid_1' value='' />
+      <input type='text' name='date_birth_kid_2' value='' />
+      <input type='submit' name='fool'>
+    </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new(
+      values => [
+                 [date_birth => Fixed => "01.01.1970"],
+                 
+                 # We are less discriminate with the other dates
+                 [qr/date_birth/ => 'Random::Date' => string => '%d.%m.%Y'],
+  							]);
+  my $form = HTML::Form->parse($html,"http://www.example.com");
+  $f->fill_form($form);
+
+  my $request = $form->click("fool");
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+
+  print $request->as_string;
+
+
+
+
+  $_STDOUT_ =~ s/[\x0a\x0d]+$//;
+  like($_STDOUT_,qr"^GET\shttp://www\.example\.com/
+  	\?date_birth_spouse=\d\d.\d\d.\d\d\d\d
+  	\&date_birth=01.01.1970
+  	\&date_birth_kid_1=\d\d.\d\d.\d\d\d\d
+  	\&date_birth_kid_2=\d\d.\d\d.\d\d\d\d$"x,'Got the expected HTTP query string');
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Interactive
+  eval { require WWW::Mechanize::FormFiller::Value::Interactive };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Interactive to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 242 lib/WWW/Mechanize/FormFiller.pm
+  no warnings 'once';
+  require HTML::Form;
+  require WWW::Mechanize::FormFiller::Value::Interactive;
+  local *WWW::Mechanize::FormFiller::Value::Interactive::ask_value = sub { "s3[r3t" }; #<-- not a good password
+
+
+
+  # Create a form filler that asks us for the password
+
+  # Normally, the HTML would come from a LWP::UserAgent request
+  my $html = "<html><body><form name='f' action='/login.asp'>
+    <input type='text' name='login'>
+    <input type='password' name='password' >
+    <input type='submit' name=Login value='Log in'>
+    <input type='hidden' name='session' value='0xDEADBEEF' />
+  </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new();
+  my $form = HTML::Form->parse($html,"http://www.fbi.gov/super/secret/");
+
+  $f->add_filler( password => Interactive => []);
+  $f->fill_form($form);
+
+  my $request = $form->click("Login");
+
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+  print $request->as_string;
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 242");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module HTML::Form
+  eval { require HTML::Form };
+  skip "Need module HTML::Form to run this test", 1
+    if $@;
+
+  # Check for module WWW::Mechanize::FormFiller::Value::Interactive
+  eval { require WWW::Mechanize::FormFiller::Value::Interactive };
+  skip "Need module WWW::Mechanize::FormFiller::Value::Interactive to run this test", 1
+    if $@;
+
+
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 242 lib/WWW/Mechanize/FormFiller.pm
+  no warnings 'once';
+  require HTML::Form;
+  require WWW::Mechanize::FormFiller::Value::Interactive;
+  local *WWW::Mechanize::FormFiller::Value::Interactive::ask_value = sub { "s3[r3t" }; #<-- not a good password
+
+
+
+  # Create a form filler that asks us for the password
+
+  # Normally, the HTML would come from a LWP::UserAgent request
+  my $html = "<html><body><form name='f' action='/login.asp'>
+    <input type='text' name='login'>
+    <input type='password' name='password' >
+    <input type='submit' name=Login value='Log in'>
+    <input type='hidden' name='session' value='0xDEADBEEF' />
+  </form></body></html>";
+
+  my $f = WWW::Mechanize::FormFiller->new();
+  my $form = HTML::Form->parse($html,"http://www.fbi.gov/super/secret/");
+
+  $f->add_filler( password => Interactive => []);
+  $f->fill_form($form);
+
+  my $request = $form->click("Login");
+
+  # Now we have a complete HTTP request, which we can hand off to
+  # LWP::UserAgent or (preferrably) WWW::Mechanize
+  print $request->as_string;
+
+
+
+
+  isa_ok($f,"WWW::Mechanize::FormFiller");
+  $_STDOUT_ =~ s/[\x0a\x0d]+$//;
+  like($_STDOUT_,qr"^GET http://www.fbi.gov/login.asp\?login=&(password=.*?&)?Login=Log\+in&session=0xDEADBEEF",'Got the expected HTTP query string');
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 303 lib/WWW/Mechanize/FormFiller.pm
+
+  # This filler fills all unspecified fields
+  # with the string "<purposedly left blank>"
+  my $f = WWW::Mechanize::FormFiller->new(
+    default => [ Fixed => "<purposedly left blank>" ]);
+
+  # This filler automatically fills in a username
+  # and asks for a password
+  my $f = WWW::Mechanize::FormFiller->new(
+                       values => [[ login => Fixed => "corion" ],
+                                  [ password => Interactive => []],
+                                 ]);
+
+  # This filler only fills in a username
+  # if it is the empty string, and still asks for the password :
+  my $f = WWW::Mechanize::FormFiller->new(
+                       values => [[ login => Default => "corion" ],
+                                  [ password => Interactive => [],
+                                 ]]);
+
+;
+
+  }
+};
+is($@, '', "example from line 303");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 353 lib/WWW/Mechanize/FormFiller.pm
+
+  $filler = WWW::Mechanize::FormFiller->new();
+  $filler->fillout(
+    # For the the simple case, assumed 'Fixed' class,
+    name => 'Mark',
+
+    # With an array reference, create and fill with the right kind of object.
+    widget_id => [ 'Random', (1..5) ],
+  );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 353");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 353 lib/WWW/Mechanize/FormFiller.pm
+
+  $filler = WWW::Mechanize::FormFiller->new();
+  $filler->fillout(
+    # For the the simple case, assumed 'Fixed' class,
+    name => 'Mark',
+
+    # With an array reference, create and fill with the right kind of object.
+    widget_id => [ 'Random', (1..5) ],
+  );
+
+
+
+
+  isa_ok($filler,"WWW::Mechanize::FormFiller");
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 369 lib/WWW/Mechanize/FormFiller.pm
+  $form = HTML::Form->parse('<html><body><form>
+    <input name="name" type="text" />
+    <input name="motto" type="text" />
+  </form></body></html>','http://www.example.com/');
+
+
+
+  $filler = WWW::Mechanize::FormFiller->new();
+  $filler->fillout(
+    # If the first parameter isa HTML::Form, it is
+    # filled out directly
+    $form,
+    name => 'Mark',
+    motto => [ 'Random::Word', size => 5 ],
+  );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 369");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 369 lib/WWW/Mechanize/FormFiller.pm
+  $form = HTML::Form->parse('<html><body><form>
+    <input name="name" type="text" />
+    <input name="motto" type="text" />
+  </form></body></html>','http://www.example.com/');
+
+
+
+  $filler = WWW::Mechanize::FormFiller->new();
+  $filler->fillout(
+    # If the first parameter isa HTML::Form, it is
+    # filled out directly
+    $form,
+    name => 'Mark',
+    motto => [ 'Random::Word', size => 5 ],
+  );
+
+
+
+
+  isa_ok($filler,"WWW::Mechanize::FormFiller");
+  is($form->value('name'),'Mark','Name is set');
+  like($form->value('motto'),qr/^\w+( \w+){3} \w+$/,'Motto is set');
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 393 lib/WWW/Mechanize/FormFiller.pm
+  $form2 = HTML::Form->parse('<html><body><form>
+    <input name="name" type="text" />
+    <input name="motto" type="text" />','http://www.example.com/');
+
+
+
+  # This works as a direct constructor as well
+  WWW::Mechanize::FormFiller->fillout(
+    $form2,
+    name => 'Mark',
+    motto => [ 'Random::Word', size => 5 ],
+  );
+
+
+
+
+;
+
+  }
+};
+is($@, '', "example from line 393");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+    {
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+#line 393 lib/WWW/Mechanize/FormFiller.pm
+  $form2 = HTML::Form->parse('<html><body><form>
+    <input name="name" type="text" />
+    <input name="motto" type="text" />','http://www.example.com/');
+
+
+
+  # This works as a direct constructor as well
+  WWW::Mechanize::FormFiller->fillout(
+    $form2,
+    name => 'Mark',
+    motto => [ 'Random::Word', size => 5 ],
+  );
+
+
+
+
+  isa_ok($filler,"WWW::Mechanize::FormFiller");
+  is($form2->value('name'),'Mark','Name is set');
+  like($form2->value('motto'),qr/^\w+( \w+){3} \w+$/,'Motto is set');
+
+    undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+}
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};


Property changes on: general/libwww-mechanize-formfiller-perl/branches/upstream/current/t/embedded-WWW-Mechanize-FormFiller.t
___________________________________________________________________
Name: svn:executable
   +