This is an automated email from the git hooks/post-receive script. abe pushed a commit to annotated tag 0.50 in repository libcgi-test-perl.
commit 9ce2c65a3d432026f13442a64687ce331c66f325 Author: Alexander Tokarev <toka...@cpan.org> Date: Mon May 28 18:51:53 2012 -0700 Removed dependencies on obsolete modules --- Changes | 12 ++++ Makefile.PL | 5 +- README | 4 +- lib/CGI/Test.pm | 95 ++++++++++++++-------------- lib/CGI/Test/Form.pm | 15 ++--- lib/CGI/Test/Form/Group.pm | 6 +- lib/CGI/Test/Form/Widget.pm | 21 +++--- lib/CGI/Test/Form/Widget/Box.pm | 15 ++--- lib/CGI/Test/Form/Widget/Box/Check.pm | 7 +- lib/CGI/Test/Form/Widget/Box/Radio.pm | 16 ++--- lib/CGI/Test/Form/Widget/Button.pm | 12 ++-- lib/CGI/Test/Form/Widget/Button/Image.pm | 5 +- lib/CGI/Test/Form/Widget/Button/Plain.pm | 5 +- lib/CGI/Test/Form/Widget/Button/Reset.pm | 6 +- lib/CGI/Test/Form/Widget/Button/Submit.pm | 5 +- lib/CGI/Test/Form/Widget/Hidden.pm | 6 +- lib/CGI/Test/Form/Widget/Input.pm | 5 +- lib/CGI/Test/Form/Widget/Input/File.pm | 5 +- lib/CGI/Test/Form/Widget/Input/Password.pm | 6 +- lib/CGI/Test/Form/Widget/Input/Text_Area.pm | 6 +- lib/CGI/Test/Form/Widget/Input/Text_Field.pm | 8 +-- lib/CGI/Test/Form/Widget/Menu.pm | 20 +++--- lib/CGI/Test/Form/Widget/Menu/List.pm | 6 +- lib/CGI/Test/Form/Widget/Menu/Popup.pm | 9 ++- lib/CGI/Test/Input.pm | 7 +- lib/CGI/Test/Input/Multipart.pm | 5 +- lib/CGI/Test/Input/URL.pm | 5 +- lib/CGI/Test/Page.pm | 6 +- lib/CGI/Test/Page/Error.pm | 2 - lib/CGI/Test/Page/HTML.pm | 2 - lib/CGI/Test/Page/Other.pm | 2 - lib/CGI/Test/Page/Real.pm | 30 ++++----- lib/CGI/Test/Page/Text.pm | 2 - t/browse.pl | 6 +- 34 files changed, 172 insertions(+), 195 deletions(-) diff --git a/Changes b/Changes index 8166221..ae261d8 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,15 @@ +Mon May 28 18:37:24 PSD 2012 Alexander Tokarev <toka...@cpan.org> + + Version 0.3 + + Completely removed all traces of dependency on Log::Agent and + Getargs::Long. Both are long obsolete, hardly maintained + anymore and at least one of these (Log::Agent) is failing its + tests. + + Changed bugtracker attribute in Makefile.PL to point to + Git tracker. + Sun Mar 25 15:49:33 PSD 2012 Alexander Tokarev <toka...@cpan.org> Version 0.2.4 diff --git a/Makefile.PL b/Makefile.PL index 69eba40..9b2f1e6 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,6 +2,7 @@ # $Id$ # # Copyright (c) 2001, Raphael Manfredi +# Copyright (c) 2011, 2012 Alexander Tokarev # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. @@ -41,8 +42,6 @@ WriteMakefile( PREREQ_PM => { 'CGI' => '0', 'Digest::MD5' => '0', - 'Getargs::Long' => '0.103', - 'Log::Agent' => '0.207', 'URI' => '1.10', ($] >= 5.008 # HTTP::Status is now in ? ('HTTP::Message' => '0', ) # HTTP::Message bundle which @@ -60,7 +59,7 @@ WriteMakefile( META_MERGE => { resources => { - bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=CGI-Test', + bugtracker => 'http://github.com/nohuhu/CGI-Test/issues', repository => 'http://github.com/nohuhu/CGI-Test', }, }, diff --git a/README b/README index 8a272ef..520241c 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ - CGI::Test 0.2.4 + CGI::Test 0.3 Copyright (c) 2001, Raphael Manfredi Current maintainer: Alexander Tokarev <toka...@cpan.org> @@ -14,7 +14,7 @@ Artistic License for more details. ------------------------------------------------------------------------ - *** This is alpha software -- use at your own risks *** + *** This is beta software -- use at your own risk *** Name DSLI Description Info ----------- ---- -------------------------------------------- ----- diff --git a/lib/CGI/Test.pm b/lib/CGI/Test.pm index 1d58dcc..e8a570e 100644 --- a/lib/CGI/Test.pm +++ b/lib/CGI/Test.pm @@ -1,19 +1,19 @@ -package CGI::Test; -use strict; -use warnings; ################################################################ -# $Id: Test.pm 412 2011-09-26 13:15:02Z noh...@nohuhu.org $ -# $Name: cgi-test_0-104_t1 $ +# $Id$ ################################################################# # Copyright (c) 2001, Raphael Manfredi +# Copyright (c) 2011-2012, Alexander Tokarev # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. # +package CGI::Test; +use strict; +use warnings; +no warnings 'uninitialized'; + use Carp; -use Getargs::Long; -use Log::Agent; use HTTP::Status; use URI; use File::Temp qw(mkstemp); @@ -23,7 +23,7 @@ use File::Basename; require Exporter; use vars qw($VERSION @ISA @EXPORT); -$VERSION = '0.2.4'; +$VERSION = '0.3'; @ISA = qw(Exporter); @EXPORT = qw(ok); @@ -44,14 +44,13 @@ $VERSION = '0.2.4'; sub new { my $this = bless {}, shift; - my ($ubase, $dir, $doc, $tmp, $env) = - xgetargs(@_, - -base_url => 's', - -cgi_dir => 's', - -doc_dir => [ 's', "/var/www" ], - -tmp_dir => [ 's', $ENV{TMPDIR} || "/tmp" ], - -cgi_env => [ 'HASH' ], - ); + my %params = @_; + + my $ubase = $params{-base_url}; + my $dir = $params{-cgi_dir}; + my $doc = $params{-doc_dir} || "/var/www"; + my $tmp = $params{-tmp_dir} || $ENV{TMPDIR} || "/tmp"; + my $env = $params{-cgi_env}; my $uri = URI->new($ubase); croak "-base_url $ubase is not within the http scheme" @@ -291,7 +290,7 @@ sub _cgi_request substr($upath, 0, length $base_path) = ''; - logdbg 'info', "uri $uri -> script+path $upath"; +# logdbg 'info', "uri $uri -> script+path $upath"; # # We have script + path_info in the $upath variable. To determine where @@ -322,7 +321,7 @@ sub _cgi_request my $script_name = $base_path . join("/", @script); # Virtual my $path = "/" . join("/", @components); # Virtual - logdbg 'info', "script=$script, path=$path"; +# logdbg 'info', "script=$script, path=$path"; return $error->new(RC_NOT_FOUND, $this) unless -f $script; return $error->new(RC_UNAUTHORIZED, $this) unless -x $script; @@ -338,7 +337,7 @@ sub _cgi_request { unless (pipe(PREAD, PWRITE)) { - logerr "can't open pipe: $!"; + warn "can't open pipe: $!"; return $error->new(RC_INTERNAL_SERVER_ERROR, $this); } @@ -362,7 +361,7 @@ sub _cgi_request # my $pid = fork; - logdie "can't fork: $!" unless defined $pid; + die "can't fork: $!" unless defined $pid; # # Child will run the CGI program with no input if it's a GET and @@ -382,7 +381,7 @@ sub _cgi_request -path_info => $path, @post, # Additional params for POST ); - logconfess "not reachable!"; + confess "not reachable!"; } # @@ -394,16 +393,16 @@ sub _cgi_request { # Send POST input data close PREAD; syswrite PWRITE, $input->data, $input->length; - close PWRITE or logwarn "failure while closing pipe: $!"; + close PWRITE or warn "failure while closing pipe: $!"; } my $child = waitpid $pid, 0; if ($pid != $child) { - logerr "waitpid returned with pid=$child, but expected pid=$pid"; - kill 'TERM', $pid or logwarn "can't SIGTERM pid $pid: $!"; - unlink $fname or logwarn "can't unlink $fname: $!"; + warn "waitpid returned with pid=$child, but expected pid=$pid"; + kill 'TERM', $pid or warn "can't SIGTERM pid $pid: $!"; + unlink $fname or warn "can't unlink $fname: $!"; return $error->new(RC_NO_CONTENT, $this); } @@ -414,8 +413,8 @@ sub _cgi_request my $header = $this->_parse_header($fname); unless (scalar keys %$header) { - logerr "script $script_name generated no valid headers"; - unlink $fname or logwarn "can't unlink $fname: $!"; + warn "script $script_name generated no valid headers"; + unlink $fname or warn "can't unlink $fname: $!"; return $error->new(RC_INTERNAL_SERVER_ERROR, $this); } @@ -436,7 +435,7 @@ sub _cgi_request $objtype = "CGI::Test::Page::$objtype"; eval "require $objtype"; - logdie "can't load module $objtype: $@" if chop $@; + die "can't load module $objtype: $@" if chop $@; my $page = $objtype->new( -server => $this, @@ -446,7 +445,7 @@ sub _cgi_request -uri => $u, ); - unlink $fname or logwarn "can't unlink $fname: $!"; + unlink $fname or warn "can't unlink $fname: $!"; return $page; } @@ -469,17 +468,17 @@ sub _cgi_request sub _run_cgi { my $this = shift; - my ($script, $name, $user, $in, $out, $u, $path, $input) = - cxgetargs(@_, - -script_file => 's', - -script_name => 's', - -user => [ undef ], - -in => [ undef ], - -out => undef, - -uri => 'URI', - -path_info => 's', - -input => [ 'CGI::Test::Input' ], - ); + + my %params = @_; + + my $script = $params{-script_file}; + my $name = $params{-script_name}; + my $user = $params{-user}; + my $in = $params{-in}; + my $out = $params{-out}; + my $u = $params{-uri}; + my $path = $params{-path_info}; + my $input = $params{-input}; # # Connect file descriptors. @@ -487,14 +486,14 @@ sub _run_cgi if (defined $in) { - open(STDIN, '<&=' . fileno($in)) || logdie "can't redirect STDIN: $!"; + open(STDIN, '<&=' . fileno($in)) || die "can't redirect STDIN: $!"; } else { my $devnull = File::Spec->devnull; - open(STDIN, $devnull) || logdie "can't open $devnull: $!"; + open(STDIN, $devnull) || die "can't open $devnull: $!"; } - open(STDOUT, '>&=' . fileno($out)) || logdie "can't redirect STDOUT: $!"; + open(STDOUT, '>&=' . fileno($out)) || die "can't redirect STDOUT: $!"; # # Setup default CGI environment. @@ -582,10 +581,10 @@ sub _run_cgi my $directory = dirname($script); my $basename = basename($script); - chdir $directory or logdie "can't cd to $directory: $!"; + chdir $directory or die "can't cd to $directory: $!"; {exec "./$basename"} - logdie "could not exec $script: $!"; + die "could not exec $script: $!"; return; } @@ -605,7 +604,7 @@ sub _parse_header my ($file) = @_; my %header; local *FILE; - open(FILE, $file) || logerr "can't open $file: $!"; + open(FILE, $file) || warn "can't open $file: $!"; local $_; my $field; @@ -623,14 +622,14 @@ sub _parse_header $field =~ s/(\w+)/\u\L$1/g; # Normalize spelling if (exists $header{$field}) { - logwarn "duplicate $field header in $file"; + warn "duplicate $field header in $file"; $header{$field} .= " "; } $header{$field} .= $value; } else { - logwarn "mangled header in $file"; + warn "mangled header in $file"; %header = (); # Discard what we read sofar last; } diff --git a/lib/CGI/Test/Form.pm b/lib/CGI/Test/Form.pm index 75b8984..06ea4ef 100644 --- a/lib/CGI/Test/Form.pm +++ b/lib/CGI/Test/Form.pm @@ -17,7 +17,6 @@ use strict; # use Carp; -use Log::Agent; # # We may not create an instance of all those classes, but the cost of @@ -475,7 +474,7 @@ sub submit if ($method eq "GET") { - logconfess "GET requests only allowed URL encoding, not %s", + confess "GET requests only allowed URL encoding, not %s", $input->mime_type unless $input->mime_type eq "application/x-www-form-urlencoded"; @@ -488,7 +487,7 @@ sub submit } else { - logconfess "unsupported method $method for FORM action"; + confess "unsupported method $method for FORM action"; } return $result; @@ -594,12 +593,12 @@ sub _xtract } elsif ($tag eq "isindex") { - logwarn "ISINDEX is deprecated, ignoring %s", $node->starttag; + warn "ISINDEX is deprecated, ignoring %s", $node->starttag; next; } else { - logconfess "reached tag '$tag': invalid tree look_down()?"; + confess "reached tag '$tag': invalid tree look_down()?"; } # @@ -614,14 +613,14 @@ sub _xtract my $type = $node->attr("type"); unless (defined $type) { - logerr "missing TYPE indication in %s: %s", uc($tag), + warn "missing TYPE indication in %s: %s", uc($tag), $node->starttag; next; } my $info = $hlookup->{lc($type)}; unless (defined $info) { - logerr "unknown TYPE '%s' in %s: %s", $type, uc($tag), + warn "unknown TYPE '%s' in %s: %s", $type, uc($tag), $node->starttag; next; } @@ -828,7 +827,7 @@ sub _output } else { - logwarn "unknown FORM encoding type $enctype, using default" + warn "unknown FORM encoding type $enctype, using default" if $enctype ne "application/x-www-form-urlencoded"; require CGI::Test::Input::URL; $input = CGI::Test::Input::URL->new(); diff --git a/lib/CGI/Test/Form/Group.pm b/lib/CGI/Test/Form/Group.pm index f4338e3..8e122b6 100644 --- a/lib/CGI/Test/Form/Group.pm +++ b/lib/CGI/Test/Form/Group.pm @@ -14,8 +14,6 @@ use strict; # and which buttons belong to some named group. # -use Log::Agent; - # # ->new # @@ -124,7 +122,7 @@ sub _validate_radios # invalid operation. We're resettting the attribute directly. # - logwarn + warn "found %d checked %ss for '%s', keeping first (tag \"%s\")", $checked, $first->gui_type, $gname, ($first->value || ""); @@ -136,7 +134,7 @@ sub _validate_radios elsif ($checked == 0) { my $first = $this->{$gname}->[ 0 ]; - logwarn "no checked %ss for '%s', checking first (tag \"%s\")", + warn "no checked %ss for '%s', checking first (tag \"%s\")", $first->gui_type, $gname, ($first->value || ""); $first->{is_checked} = 1; # Direct access } diff --git a/lib/CGI/Test/Form/Widget.pm b/lib/CGI/Test/Form/Widget.pm index 96a9013..a2b82f9 100644 --- a/lib/CGI/Test/Form/Widget.pm +++ b/lib/CGI/Test/Form/Widget.pm @@ -11,14 +11,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a CGI form widget (button, text field, etc...). # It belongs to one form, identified by its `form' attribute , a ref # to a CGI::Test::Form object. # -use Log::Agent; - ############################################################ # # ->new @@ -35,7 +35,7 @@ sub new # Can't create a CGI::Test::Form::Widget object, only heirs. # - logconfess "%s is a deferred class", __PACKAGE__ + confess "%s is a deferred class", __PACKAGE__ if ref $this eq __PACKAGE__; $this->_common_init($form); @@ -81,7 +81,7 @@ sub _init { my $this = shift; my ($node) = @_; - logconfess "deferred"; + confess "deferred"; } ############################################################ @@ -195,7 +195,7 @@ sub is_file sub gui_type { - logconfess "deferred"; + confess "deferred"; } ############################################################ @@ -213,7 +213,7 @@ sub is_mutable if ($this->is_disabled) { - logcarp 'cannot change value of disabled %s "%s"', $this->gui_type, + carp 'cannot change value of disabled %s "%s"', $this->gui_type, $this->name if $warn; return 0; @@ -221,7 +221,7 @@ sub is_mutable if ($this->is_read_only) { - logcarp 'cannot change value of read-only %s "%s"', $this->gui_type, + carp 'cannot change value of read-only %s "%s"', $this->gui_type, $this->name if $warn; return 0; @@ -334,7 +334,7 @@ sub is_submitable ############################################################ sub _is_successful { - logconfess "deferred"; + confess "deferred"; } ############################################################ @@ -480,7 +480,7 @@ be marked as disabled in HTML via a suitable attribute. Test whether widget can change value. Returns I<false> when the widget C<is_read_only> or C<is_disabled>. -When the optional I<warn_flag> is true, C<logcarp> is called +When the optional I<warn_flag> is true, C<carp> is called to emit a warning from the perspective of the caller. =item C<is_read_only> @@ -574,8 +574,7 @@ CGI::Test::Form::Widget::Box(3), CGI::Test::Form::Widget::Button(3), CGI::Test::Form::Widget::Input(3), CGI::Test::Form::Widget::Hidden(3), -CGI::Test::Form::Widget::Menu(3), -Log::Agent(3). +CGI::Test::Form::Widget::Menu(3). =cut diff --git a/lib/CGI/Test/Form/Widget/Box.pm b/lib/CGI/Test/Form/Widget/Box.pm index 340c600..2d38375 100644 --- a/lib/CGI/Test/Form/Widget/Box.pm +++ b/lib/CGI/Test/Form/Widget/Box.pm @@ -10,15 +10,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM box, either a radio button or a checkbox. # -use CGI::Test::Form::Widget; use base qw(CGI::Test::Form::Widget); -use Log::Agent; - ############################################################ # # %attr @@ -212,7 +211,7 @@ sub is_box ############################################################ sub is_radio { - logconfess "deferred"; + confess "deferred"; } ############################################################ sub is_standalone @@ -274,12 +273,12 @@ sub _mark_by_tag if (@boxes == 0) { - logcarp "no %s within the group '%s' bears the tag \"$tag\"", + carp "no %s within the group '%s' bears the tag \"$tag\"", $this->gui_type(), $this->name(); } else { - logcarp "found %d %ss within the group '%s' bearing the tag \"$tag\"", + carp "found %d %ss within the group '%s' bearing the tag \"$tag\"", scalar(@boxes), $this->gui_type(), $this->name() if @boxes > 1; @@ -345,7 +344,7 @@ This may be called on any box, and it will locate the box whose value attribute is I<tag> within the C<group_list>, and then check it. If the specified I<tag> is not found, the caller will get a warning -via C<logcarp>. +via C<carp>. =item C<uncheck> @@ -361,7 +360,7 @@ It is not possible to do this on a radio button, as explained in C<uncheck> above. If the specified I<tag> is not found, the caller will get a warning -via C<logcarp>. +via C<carp>. =back diff --git a/lib/CGI/Test/Form/Widget/Box/Check.pm b/lib/CGI/Test/Form/Widget/Box/Check.pm index 9fbcf6c..050ff8f 100644 --- a/lib/CGI/Test/Form/Widget/Box/Check.pm +++ b/lib/CGI/Test/Form/Widget/Box/Check.pm @@ -15,11 +15,8 @@ use strict; # This class models a FORM checkbox button. # -use CGI::Test::Form::Widget::Box; use base qw(CGI::Test::Form::Widget::Box); -use Log::Agent; - # # Attribute access # @@ -49,11 +46,9 @@ CGI::Test::Form::Widget::Box::Check - A checkbox widget # Inherits from CGI::Test::Form::Widget::Box # $form is a CGI::Test::Form - use Log::Agent; # logdie below - my ($agree, $ads) = $form->checkbox_by_name(qw(i_agree ads)); - logdie "expected a standalone checkbox" unless $agree->is_standalone; + die "expected a standalone checkbox" unless $agree->is_standalone; $agree->check; $ads->uncheck_tagged("spam OK"); diff --git a/lib/CGI/Test/Form/Widget/Box/Radio.pm b/lib/CGI/Test/Form/Widget/Box/Radio.pm index d8940d2..dc5d8ea 100644 --- a/lib/CGI/Test/Form/Widget/Box/Radio.pm +++ b/lib/CGI/Test/Form/Widget/Box/Radio.pm @@ -11,15 +11,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM radio button. # -use CGI::Test::Form::Widget::Box; use base qw(CGI::Test::Form::Widget::Box); -use Log::Agent; - # # ->set_is_checked -- redefined # @@ -53,12 +52,12 @@ sub set_is_checked sub uncheck { - logcarp "ignoring uncheck on radio button"; + carp "ignoring uncheck on radio button"; } sub uncheck_tagged { - logcarp "ignoring uncheck_tagged on radio button"; + carp "ignoring uncheck_tagged on radio button"; } # @@ -104,13 +103,13 @@ will by users. All other radio buttons of the same group are automatically unchecked. If no radio button is checked initially, C<CGI::Test> arbitrarily chooses -the first one listed and warns you via C<logwarn>. +the first one listed and warns you via C<warn>. The interface is the same as the one described in L<CGI::Test::Form::Widget::Box>. Any attempt to C<uncheck> a radio button will be ignored, and a warning -emitted via C<logcarp>, to help you identify the caller. +emitted via C<carp>, to help you identify the caller. =head1 AUTHORS @@ -122,8 +121,7 @@ Current maintainer is Alexander Tokarev F<E<lt>toka...@cpan.orge<gt>>. =head1 SEE ALSO -CGI::Test::Form::Widget::Box(3), CGI::Test::Form::Widget::Box::Check(3), -Log::Agent(3). +CGI::Test::Form::Widget::Box(3), CGI::Test::Form::Widget::Box::Check(3). =cut diff --git a/lib/CGI/Test/Form/Widget/Button.pm b/lib/CGI/Test/Form/Widget/Button.pm index bab817a..530786e 100644 --- a/lib/CGI/Test/Form/Widget/Button.pm +++ b/lib/CGI/Test/Form/Widget/Button.pm @@ -10,15 +10,15 @@ use strict; # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. # + +use Carp; + # # This class models a FORM button. # -require CGI::Test::Form::Widget; use base qw(CGI::Test::Form::Widget); -use Log::Agent; - ############################################################ # # ->new @@ -35,7 +35,7 @@ sub new # Can't create a CGI::Test::Form::Widget::Button object, only heirs. # - logconfess "%s is a deferred class", __PACKAGE__ + confess "%s is a deferred class", __PACKAGE__ if ref $this eq __PACKAGE__; $this->_common_init($form); @@ -158,7 +158,7 @@ sub press # Routine is redefined in heirs when processing required. # - logwarn 'ignoring button press: name="%s", value="%s"', $this->name(), + warn 'ignoring button press: name="%s", value="%s"', $this->name(), $this->value(); return undef; @@ -285,7 +285,7 @@ request is issued as appropriate and the reply is made available through a C<CGI::Test::Page> object. Otherwise, the button pressing is ignored, a warning is issued from the -perspective of the caller, via C<logcarp>, and C<undef> is returned. +perspective of the caller, via C<carp>, and C<undef> is returned. =back diff --git a/lib/CGI/Test/Form/Widget/Button/Image.pm b/lib/CGI/Test/Form/Widget/Button/Image.pm index 3ef21c9..031e4bd 100644 --- a/lib/CGI/Test/Form/Widget/Button/Image.pm +++ b/lib/CGI/Test/Form/Widget/Button/Image.pm @@ -11,16 +11,15 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM image button. # It's really a submit button in disguise as far as processing goes. # -use CGI::Test::Form::Widget::Button::Submit; use base qw(CGI::Test::Form::Widget::Button::Submit); -use Log::Agent; - # # Attribute access # diff --git a/lib/CGI/Test/Form/Widget/Button/Plain.pm b/lib/CGI/Test/Form/Widget/Button/Plain.pm index 2e98836..2d57aaf 100644 --- a/lib/CGI/Test/Form/Widget/Button/Plain.pm +++ b/lib/CGI/Test/Form/Widget/Button/Plain.pm @@ -11,15 +11,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM plain <BUTTON>. # -require CGI::Test::Form::Widget::Button; use base qw(CGI::Test::Form::Widget::Button); -use Log::Agent; - # # Attribute access # diff --git a/lib/CGI/Test/Form/Widget/Button/Reset.pm b/lib/CGI/Test/Form/Widget/Button/Reset.pm index 65c6fc6..5e5928b 100644 --- a/lib/CGI/Test/Form/Widget/Button/Reset.pm +++ b/lib/CGI/Test/Form/Widget/Button/Reset.pm @@ -10,15 +10,15 @@ use strict; # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. # + +use Carp; + # # This class models a FORM reset button. # -require CGI::Test::Form::Widget::Button; use base qw(CGI::Test::Form::Widget::Button); -use Log::Agent; - # # Attribute access # diff --git a/lib/CGI/Test/Form/Widget/Button/Submit.pm b/lib/CGI/Test/Form/Widget/Button/Submit.pm index f8d40f4..4d58e6b 100644 --- a/lib/CGI/Test/Form/Widget/Button/Submit.pm +++ b/lib/CGI/Test/Form/Widget/Button/Submit.pm @@ -11,15 +11,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM submit button. # -use CGI::Test::Form::Widget::Button; use base qw(CGI::Test::Form::Widget::Button); -use Log::Agent; - # # Attribute access # diff --git a/lib/CGI/Test/Form/Widget/Hidden.pm b/lib/CGI/Test/Form/Widget/Hidden.pm index 6afa587..6486e39 100644 --- a/lib/CGI/Test/Form/Widget/Hidden.pm +++ b/lib/CGI/Test/Form/Widget/Hidden.pm @@ -9,16 +9,16 @@ use strict; # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. +# + +use Carp; # # This class models a FORM hidden field. # -require CGI::Test::Form::Widget; use base qw(CGI::Test::Form::Widget); -use Log::Agent; - # # %attr # diff --git a/lib/CGI/Test/Form/Widget/Input.pm b/lib/CGI/Test/Form/Widget/Input.pm index 2454de2..23043a6 100644 --- a/lib/CGI/Test/Form/Widget/Input.pm +++ b/lib/CGI/Test/Form/Widget/Input.pm @@ -11,16 +11,15 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM input field. # It factorizes the interface of our heirs: Text_Area and Text_Field # -use CGI::Test::Form::Widget; use base qw(CGI::Test::Form::Widget); -use Log::Agent; - # # ->_is_successful -- defined # diff --git a/lib/CGI/Test/Form/Widget/Input/File.pm b/lib/CGI/Test/Form/Widget/Input/File.pm index 80cbaf8..8dba7e6 100644 --- a/lib/CGI/Test/Form/Widget/Input/File.pm +++ b/lib/CGI/Test/Form/Widget/Input/File.pm @@ -11,6 +11,8 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM file input for uploading. # @@ -19,11 +21,8 @@ use strict; # the browser to select a file. # -use CGI::Test::Form::Widget::Input::Text_Field; use base qw(CGI::Test::Form::Widget::Input::Text_Field); -use Log::Agent; - # # Attribute access # diff --git a/lib/CGI/Test/Form/Widget/Input/Password.pm b/lib/CGI/Test/Form/Widget/Input/Password.pm index 63b5269..2ab735b 100644 --- a/lib/CGI/Test/Form/Widget/Input/Password.pm +++ b/lib/CGI/Test/Form/Widget/Input/Password.pm @@ -9,6 +9,9 @@ use strict; # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. +# + +use Carp; # # This class models a FORM password input field. @@ -17,11 +20,8 @@ use strict; # and a password field is whether characters are shown as typed or not. # -use CGI::Test::Form::Widget::Input::Text_Field; use base qw(CGI::Test::Form::Widget::Input::Text_Field); -use Log::Agent; - # # Attribute access # diff --git a/lib/CGI/Test/Form/Widget/Input/Text_Area.pm b/lib/CGI/Test/Form/Widget/Input/Text_Area.pm index 9106dbf..b0c75c0 100644 --- a/lib/CGI/Test/Form/Widget/Input/Text_Area.pm +++ b/lib/CGI/Test/Form/Widget/Input/Text_Area.pm @@ -9,16 +9,16 @@ use strict; # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. +# + +use Carp; # # This class models a FORM textarea input field. # -use CGI::Test::Form::Widget::Input; use base qw(CGI::Test::Form::Widget::Input); -use Log::Agent; - # # %attr # diff --git a/lib/CGI/Test/Form/Widget/Input/Text_Field.pm b/lib/CGI/Test/Form/Widget/Input/Text_Field.pm index 18d45ea..bc17551 100644 --- a/lib/CGI/Test/Form/Widget/Input/Text_Field.pm +++ b/lib/CGI/Test/Form/Widget/Input/Text_Field.pm @@ -10,15 +10,15 @@ use strict; # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. # + +use Carp; + # # This class models a FORM text field. # -use CGI::Test::Form::Widget::Input; use base qw(CGI::Test::Form::Widget::Input); -use Log::Agent; - # # %attr # @@ -96,7 +96,7 @@ sub set_value if (defined $maxlen && length($value) > $maxlen) { - logcarp "truncating text to %d byte%s for %s '%s'", $maxlen, + carp "truncating text to %d byte%s for %s '%s'", $maxlen, $maxlen == 1 ? "" : "s", $this->gui_type, $this->name; substr($value, $maxlen) = ''; } diff --git a/lib/CGI/Test/Form/Widget/Menu.pm b/lib/CGI/Test/Form/Widget/Menu.pm index af3c373..095baec 100644 --- a/lib/CGI/Test/Form/Widget/Menu.pm +++ b/lib/CGI/Test/Form/Widget/Menu.pm @@ -11,16 +11,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM menu (either a popup or a scrollable list). # -use Carp; - -use CGI::Test::Form::Widget; use base qw(CGI::Test::Form::Widget); -use Log::Agent; use Storable qw(dclone); ############################################################ @@ -60,7 +58,7 @@ sub _parse_options next if $opt->tag() eq "optgroup"; unless ($opt->tag() eq "option") { - logwarn "ignoring non-option tag '%s' within SELECT", + warn "ignoring non-option tag '%s' within SELECT", uc($opt->tag()); next; } @@ -77,7 +75,7 @@ sub _parse_options unless (defined $value) { - logwarn "ignoring OPTION tag with no value: %s", $opt->starttag(); + warn "ignoring OPTION tag with no value: %s", $opt->starttag(); next; } @@ -88,7 +86,7 @@ sub _parse_options # since they bear the same value... Tough choice... Let's warn! # - logwarn "duplicate value '%s' in OPTION for SELECT NAME=\"%s\"", + warn "duplicate value '%s' in OPTION for SELECT NAME=\"%s\"", $value, $this->name if $seen{$value}++; @@ -113,7 +111,7 @@ sub _parse_options my $first = $values->[ 0 ]; $selected->{$first}++; $count++; - logwarn "implicitely selecting OPTION '%s' for SELECT NAME=\"%s\"", + warn "implicitely selecting OPTION '%s' for SELECT NAME=\"%s\"", $first, $this->name(); } @@ -250,7 +248,7 @@ sub is_menu ############################################################ sub is_popup { - logconfess "deferred"; + confess "deferred"; } ############################################################ @@ -267,7 +265,7 @@ sub is_selected unless ($this->known_values->{$value}) { - logcarp "unknown value \"%s\" in $this", $value; + carp "unknown value \"%s\" in $this", $value; return 0; } @@ -288,7 +286,7 @@ sub set_selected unless ($this->known_values->{$value}) { - logcarp "unknown value \"%s\" in $this", $value; + carp "unknown value \"%s\" in $this", $value; return; } diff --git a/lib/CGI/Test/Form/Widget/Menu/List.pm b/lib/CGI/Test/Form/Widget/Menu/List.pm index 92e04de..2b6b178 100644 --- a/lib/CGI/Test/Form/Widget/Menu/List.pm +++ b/lib/CGI/Test/Form/Widget/Menu/List.pm @@ -9,16 +9,16 @@ use strict; # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. +# + +use Carp; # # This class models a FORM scrollable list. # -use CGI::Test::Form::Widget::Menu; use base qw(CGI::Test::Form::Widget::Menu); -use Log::Agent; - # # %attr # diff --git a/lib/CGI/Test/Form/Widget/Menu/Popup.pm b/lib/CGI/Test/Form/Widget/Menu/Popup.pm index 7d41ef6..c6a5e8d 100644 --- a/lib/CGI/Test/Form/Widget/Menu/Popup.pm +++ b/lib/CGI/Test/Form/Widget/Menu/Popup.pm @@ -11,15 +11,14 @@ use strict; # as specified in the README file that comes with the distribution. # +use Carp; + # # This class models a FORM popup menu. # -use CGI::Test::Form::Widget::Menu; use base qw(CGI::Test::Form::Widget::Menu); -use Log::Agent; - # # %attr # @@ -58,7 +57,7 @@ sub set_selected unless ($state) { - logcarp "cannot unselect value \"%s\" from popup $this", $value; + carp "cannot unselect value \"%s\" from popup $this", $value; return; } @@ -104,7 +103,7 @@ and for which there is at least one item selected, i.e. where exactly one item is chosen. If no item was explicitely selected, C<CGI::Test> arbitrarily chooses the -first item in the popup (if not empty) and warns you via C<logwarn>. +first item in the popup (if not empty) and warns you via C<warn>. =head1 INTERFACE diff --git a/lib/CGI/Test/Input.pm b/lib/CGI/Test/Input.pm index f546b9a..7e75f20 100644 --- a/lib/CGI/Test/Input.pm +++ b/lib/CGI/Test/Input.pm @@ -17,7 +17,6 @@ use strict; # use Carp; -use Log::Agent; ############################################################ # @@ -28,7 +27,7 @@ use Log::Agent; ############################################################ sub new { - logconfess "deferred"; + confess "deferred"; } ############################################################ @@ -209,12 +208,12 @@ sub add_file_now ############################################################ sub mime_type { - logconfess "deferred"; + confess "deferred"; } ############################################################ sub _build_data { - logconfess "deferred"; + confess "deferred"; } # diff --git a/lib/CGI/Test/Input/Multipart.pm b/lib/CGI/Test/Input/Multipart.pm index f89f495..3edc605 100644 --- a/lib/CGI/Test/Input/Multipart.pm +++ b/lib/CGI/Test/Input/Multipart.pm @@ -15,10 +15,9 @@ use strict; # POST input data to be encoded with "multipart/form-data". # -use CGI::Test::Input; -use base qw(CGI::Test::Input); +use Carp; -use Log::Agent; +use base qw(CGI::Test::Input); # # ->new diff --git a/lib/CGI/Test/Input/URL.pm b/lib/CGI/Test/Input/URL.pm index 251847b..6f03c1c 100644 --- a/lib/CGI/Test/Input/URL.pm +++ b/lib/CGI/Test/Input/URL.pm @@ -14,10 +14,9 @@ use strict; # POST input data to be encoded with "application/x-www-form-urlencoded". # -require CGI::Test::Input; -use base qw(CGI::Test::Input); +use Carp; -use Log::Agent; +use base qw(CGI::Test::Input); # # ->new diff --git a/lib/CGI/Test/Page.pm b/lib/CGI/Test/Page.pm index dc4d708..7ec7730 100644 --- a/lib/CGI/Test/Page.pm +++ b/lib/CGI/Test/Page.pm @@ -16,8 +16,8 @@ use strict; # The page can be an error, or a real page, each with its own class hierarchy. # -use Getargs::Long; -use Log::Agent; +use Carp; + ###################################################################### # # ->new @@ -27,7 +27,7 @@ use Log::Agent; ###################################################################### sub new { - logconfess "deferred"; + confess "deferred"; } # diff --git a/lib/CGI/Test/Page/Error.pm b/lib/CGI/Test/Page/Error.pm index 523307e..ee0d127 100644 --- a/lib/CGI/Test/Page/Error.pm +++ b/lib/CGI/Test/Page/Error.pm @@ -14,8 +14,6 @@ use strict; # A reply to an HTTP request resulted in an error. # -use Getargs::Long; - require CGI::Test::Page; use base qw(CGI::Test::Page); diff --git a/lib/CGI/Test/Page/HTML.pm b/lib/CGI/Test/Page/HTML.pm index d5ab82b..0b7b778 100644 --- a/lib/CGI/Test/Page/HTML.pm +++ b/lib/CGI/Test/Page/HTML.pm @@ -10,8 +10,6 @@ use strict; # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. -use Getargs::Long; - require CGI::Test::Page::Real; use base qw(CGI::Test::Page::Real); diff --git a/lib/CGI/Test/Page/Other.pm b/lib/CGI/Test/Page/Other.pm index ddc3f94..8e1c09a 100644 --- a/lib/CGI/Test/Page/Other.pm +++ b/lib/CGI/Test/Page/Other.pm @@ -11,8 +11,6 @@ use strict; # as specified in the README file that comes with the distribution. # -use Getargs::Long; - require CGI::Test::Page::Real; use base qw(CGI::Test::Page::Real); diff --git a/lib/CGI/Test/Page/Real.pm b/lib/CGI/Test/Page/Real.pm index 7e1da1b..c8239e7 100644 --- a/lib/CGI/Test/Page/Real.pm +++ b/lib/CGI/Test/Page/Real.pm @@ -16,10 +16,8 @@ use strict; # depending on the Content-Type. # -use Getargs::Long; -use Log::Agent; +use Carp; -require CGI::Test::Page; use base qw(CGI::Test::Page); # @@ -29,7 +27,7 @@ use base qw(CGI::Test::Page); # sub new { - logconfess "deferred"; + confess "deferred"; } # @@ -62,19 +60,17 @@ sub raw_content_ref sub _init { my $this = shift; - my ($server, $file, $ctype, $user, $uri) = cxgetargs( - @_, {-strict => 0, -extra => 0}, - -server => 'CGI::Test', # XXX may be extended one day - -file => 's', - -content_type => 's', - -user => undef, - -uri => 'URI', - ); - $this->{server} = $server; - $this->{content_type} = $ctype; - $this->{user} = $user; - $this->{uri} = $uri; + + my %params = @_; + + my $file = $params{-file}; + $this->{server} = $params{-server}; + $this->{content_type} = $params{-content_type}; + $this->{user} = $params{-user}; + $this->{uri} = $params{-uri}; + $this->_read_raw_content($file); + return; } @@ -92,7 +88,7 @@ sub _read_raw_content my ($file) = @_; local *FILE; - open(FILE, $file) || logdie "can't open $file: $!"; + open(FILE, $file) || die "can't open $file: $!"; my $size = -s FILE; $this->{raw_content} = ' ' x -s (FILE); # Pre-extend buffer diff --git a/lib/CGI/Test/Page/Text.pm b/lib/CGI/Test/Page/Text.pm index d2d1cf9..b16bc7f 100644 --- a/lib/CGI/Test/Page/Text.pm +++ b/lib/CGI/Test/Page/Text.pm @@ -11,8 +11,6 @@ use strict; # as specified in the README file that comes with the distribution. # -use Getargs::Long; - use CGI::Test::Page::Real; use base qw(CGI::Test::Page::Real); diff --git a/t/browse.pl b/t/browse.pl index 8e8603d..039c3c2 100644 --- a/t/browse.pl +++ b/t/browse.pl @@ -41,7 +41,6 @@ # use CGI::Test; -use Getargs::Long; use Config; @@ -55,7 +54,10 @@ use Config; $ENV{PATH} = $Config{bin} . ':' . $ENV{PATH}; sub browse { - my ($method, $enctype) = getargs(@_, [qw(method enctype)]); + my %params = @_; + + my $method = $params{method}; + my $enctype = $params{enctype}; print "1..27\n"; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-test-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits