Debian Codegraph @

t/embedded-WWW-Mechanize-FormFiller-Value-Fixed.t

raw symbols SCIP
1 #!/opt/perl58/bin/perl -w
2
3 use Test::Morescip-perl cpan WWW-Mechanize-FormFiller 0.13 Test/More/ 'no_plan';
4
5 package Catchscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/;
6
7 sub TIEHANDLEscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/TIEHANDLE(). {
8 my($class, $var) = @_scip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/`@_`.;
9 return blessscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/bless(). { var => $var }, $class;
10 }
11
12 sub PRINTscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/PRINT(). {
13 my($self) = shiftscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/shift().;
14 ${'main::'.$self->{var}} .= joinscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/join(). '', @_scip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/`@_`.;
15 }
16
17 sub OPENscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/OPEN(). {} # XXX Hackery in case the user redirects
18 sub CLOSEscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/CLOSE(). {} # XXX STDERR/STDOUT. This is not the behavior we want.
19
20 sub READscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/READ(). {}
21 sub READLINEscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/READLINE(). {}
22 sub GETCscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/GETC(). {}
23 sub BINMODEscip-perl cpan WWW-Mechanize-FormFiller 0.13 Catch/BINMODE(). {}
24
25 my $Original_File = 'lib/WWW/Mechanize/FormFiller/Value/Fixed.pm';
26
27 package mainscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/;
28
29 # pre-5.8.0's warns aren't caught by a tied STDERR.
30 $SIGscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`%SIG`.{__WARN__} = sub { $main::_STDERR_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDERR_. .= joinscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/join(). '', @_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`@_`.; };
31 tie *STDOUT, 'Catch', '_STDOUT_' or diescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/die(). $!scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$!`.;
32 tie *STDERR, 'Catch', '_STDERR_' or diescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/die(). $!scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$!`.;
33
34 SKIP: {
35 # A header testing whether we find all prerequisites :
36 # Check for module WWW::Mechanize::FormFiller
37 eval { requirescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/require(). WWW::Mechanize::FormFiller };
38 skipscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/skip(). "Need module WWW::Mechanize::FormFiller to run this test", 1
39 if $@scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$@`.;
40
41 # Check for module WWW::Mechanize::FormFiller::Value::Fixed
42 eval { requirescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/require(). WWW::Mechanize::FormFiller::Value::Fixed };
43 skipscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/skip(). "Need module WWW::Mechanize::FormFiller::Value::Fixed to run this test", 1
44 if $@scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$@`.;
45
46
47 # The original POD test
48 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDOUT_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDOUT_.;
49 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDERR_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDERR_.;
50 eval q{
51 my $example = sub {
52 local $^W = 0;
53
54 #line 28 lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
55
56 use WWW::Mechanize::FormFiller;
57 use WWW::Mechanize::FormFiller::Value::Fixed;
58
59 my $f = WWW::Mechanize::FormFiller->new();
60
61 # Create a fixed value for the HTML field "login"
62 my $fixed = WWW::Mechanize::FormFiller::Value::Fixed->new( login => "Corion" );
63 $f->add_value( login => $fixed );
64
65 # Alternatively take the following shorthand, which adds the
66 # field to the list as well :
67 my $password = $f->add_filler( password => Fixed => "secret" );
68
69
70
71
72 ;
73
74 }
75 };
76 isscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/is().($@scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$@`., '', "example from line 28");
77
78 };
79 SKIP: {
80 # A header testing whether we find all prerequisites :
81 # Check for module HTML::Form
82 eval { requirescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/require(). HTML::Form };
83 skipscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/skip(). "Need module HTML::Form to run this test", 1
84 if $@scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$@`.;
85
86 # Check for module WWW::Mechanize::FormFiller
87 eval { requirescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/require(). WWW::Mechanize::FormFiller };
88 skipscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/skip(). "Need module WWW::Mechanize::FormFiller to run this test", 1
89 if $@scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$@`.;
90
91 # Check for module WWW::Mechanize::FormFiller::Value::Fixed
92 eval { requirescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/require(). WWW::Mechanize::FormFiller::Value::Fixed };
93 skipscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/skip(). "Need module WWW::Mechanize::FormFiller::Value::Fixed to run this test", 1
94 if $@scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/`$@`.;
95
96
97 # The original POD test
98 {
99 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDOUT_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDOUT_.;
100 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDERR_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDERR_.;
101 #line 28 lib/WWW/Mechanize/FormFiller/Value/Fixed.pm
102
103 use WWW::Mechanize::FormFillerscip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/;
104 use WWW::Mechanize::FormFiller::Value::Fixedscip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/Value/Fixed/;
105
106 my $f = WWW::Mechanize::FormFiller->newscip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/new().();
107
108 # Create a fixed value for the HTML field "login"
109 my $fixed = WWW::Mechanize::FormFiller::Value::Fixed->newscip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/Value/Fixed/new().( login => "Corion" );
110 $f->add_valuescip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/add_value().( login => $fixed );
111
112 # Alternatively take the following shorthand, which adds the
113 # field to the list as well :
114 my $password = $f->add_fillerscip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/add_filler().( password => Fixed => "secret" );
115
116
117
118
119 requirescip-perl cpan WWW-Mechanize-FormFiller 0.13 main/require(). HTML::Form;
120 my $form = HTML::Form->parsescip-perl cpan WWW-Mechanize-FormFiller 0.13 HTML/Form/parse().('<html><body><form method=get action=/>
121 <input type=text name=login value=foo />
122 <input type=text name=password value=bar />
123 </form></body></html>','http://www.example.com/');
124 $f->fill_formscip-perl cpan WWW-Mechanize-FormFiller 0.13 WWW/Mechanize/FormFiller/fill_form().($form);
125 isscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/is().( $form->valuescip-perl cpan WWW-Mechanize-FormFiller 0.13 HTML/Form/value().('login'), "Corion", "Login gets set");
126 isscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/is().( $form->valuescip-perl cpan WWW-Mechanize-FormFiller 0.13 HTML/Form/value().('password'), "secret", "Password gets set");
127
128 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDOUT_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDOUT_.;
129 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDERR_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDERR_.;
130 }
131
132 };
133 SKIP: {
134 # A header testing whether we find all prerequisites :
135
136 # The original POD test
137 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDOUT_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDOUT_.;
138 undefscip-perl cpan WWW-Mechanize-FormFiller 0.13 main/undef(). $main::_STDERR_scip-perl cpan WWW-Mechanize-FormFiller 0.13 main/$_STDERR_.;
139
140 };