Skip to content

Commit

Permalink
Large-scale code clean-up driven by Perl::Critic. All critic flags
Browse files Browse the repository at this point in the history
down to severity 1 now removed.
  • Loading branch information
rjray committed Mar 13, 2010
1 parent cd38fc5 commit 2664b6b
Show file tree
Hide file tree
Showing 12 changed files with 1,847 additions and 1,230 deletions.
209 changes: 122 additions & 87 deletions lib/Apache/RPC/Server.pm

Large diffs are not rendered by default.

276 changes: 153 additions & 123 deletions lib/Apache/RPC/Status.pm

Large diffs are not rendered by default.

608 changes: 346 additions & 262 deletions lib/RPC/XML.pm

Large diffs are not rendered by default.

270 changes: 172 additions & 98 deletions lib/RPC/XML/Client.pm

Large diffs are not rendered by default.

64 changes: 35 additions & 29 deletions lib/RPC/XML/Function.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# This file copyright (c) 2002-2009 Randy J. Ray, all rights reserved
# This file copyright (c) 2002-2010 Randy J. Ray, all rights reserved
#
# Copying and distribution are permitted under the terms of the Artistic
# License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php) or
Expand Down Expand Up @@ -31,16 +31,14 @@ package RPC::XML::Function;
use 5.006001;
use strict;
use warnings;
use vars qw($VERSION @ISA);
use vars qw($VERSION);
use subs qw(new signature make_sig_table clone is_valid match_signature);
use base qw(RPC::XML::Procedure);

use AutoLoader 'AUTOLOAD';

require RPC::XML::Procedure;

@ISA = qw(RPC::XML::Procedure);
$VERSION = '1.08';
$VERSION = eval $VERSION; ## no critic
$VERSION = '1.09';
$VERSION = eval $VERSION; ## no critic (ProhibitStringyEval)

###############################################################################
#
Expand All @@ -66,8 +64,7 @@ sub new
# the super-class new, but this is sufficient for now.
#

my $class = shift;
my @argz = @_;
my ($class, @argz) = @_;

my $data; # This will be a hashref that eventually gets blessed

Expand All @@ -80,7 +77,7 @@ sub new
{
# 1. A hashref containing all the relevant keys
$data = {};
%$data = %{$argz[0]};
%{$data} = %{$argz[0]};
}
elsif (@argz == 1)
{
Expand All @@ -97,14 +94,22 @@ sub new
if (defined $class)
{
$data = $class->load_XPL_file($argz[0]);
return $data unless ref $data; # load_XPL_path signalled an error
if (! ref $data)
{
# load_XPL_path signalled an error
return $data;
}
}
else
{
# Spoofing the "class" argument to load_XPL_file makes me feel
# even dirtier...
$data = load_XPL_file(\$class, $argz[0]);
return $data unless ref $data; # load_XPL_path signalled an error
if (! ref $data)
{
# load_XPL_path signalled an error
return $data;
}
$class = "RPC::XML::$class";
}
}
Expand All @@ -116,7 +121,7 @@ sub new
$data = {};
while (@argz)
{
($key, $val) = splice(@argz, 0, 2);
($key, $val) = splice @argz, 0, 2;
if ($key eq 'signature')
{
# Noop
Expand All @@ -133,21 +138,24 @@ sub new
}
}

return "${class}::new: Missing required data"
unless ($data->{name} and $data->{code});
bless $data, $class;
if (! ($data->{name} and $data->{code}))
{
return "${class}::new: Missing required data";
}

return bless $data, $class;
}

#
# These two are only implemented here at all, because some of the logic in
# other places call them
#
sub signature { undef; }
sub make_sig_table { $_[0]; }
sub signature { return; }
sub make_sig_table { return shift; }

1;

=pod
__END__
=head1 NAME
Expand Down Expand Up @@ -176,7 +184,7 @@ value. If an object of this class anticipates that the data may be ambiguous
it encapsulates should consider encoding the response with the data-classes
documented in L<RPC::XML> prior to return.
=head1 USAGE
=head1 SUBROUTINES/METHODS
Only those routines different from B<RPC::XML::Procedure> are listed:
Expand Down Expand Up @@ -249,9 +257,9 @@ L<http://github.com/rjray/rpc-xml>
=back
=head1 COPYRIGHT & LICENSE
=head1 LICENSE AND COPYRIGHT
This file and the code within are copyright (c) 2009 by Randy J. Ray.
This file and the code within are copyright (c) 2010 by Randy J. Ray.
Copying and distribution are permitted under the terms of the Artistic
License 2.0 (L<http://www.opensource.org/licenses/artistic-license-2.0.php>) or
Expand All @@ -269,12 +277,10 @@ L<RPC::XML>, L<RPC::XML::Procedure>, L<make_method>
=head1 AUTHOR
Randy J. Ray <rjray@blackperl.com>
Randy J. Ray C<< <rjray@blackperl.com> >>
=cut
__END__
#
# These are the same as RPC::XML::Procedure subs, except that they have no
# references to signatures.
Expand All @@ -297,9 +303,9 @@ sub clone
my $self = shift;
my $new_self = {};
%$new_self = %$self;
%{$new_self} = %{$self};
bless $new_self, ref($self);
return bless $new_self, ref $self;
}
###############################################################################
Expand All @@ -321,7 +327,7 @@ sub is_valid
{
my $self = shift;
return ((ref($self->{code}) eq 'CODE') and $self->{name});
return ((ref $self->{code} eq 'CODE') and $self->{name});
}
###############################################################################
Expand All @@ -340,5 +346,5 @@ sub is_valid
###############################################################################
sub match_signature
{
'scalar';
return 'scalar';
}
20 changes: 7 additions & 13 deletions lib/RPC/XML/Method.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# This file copyright (c) 2001-2009 Randy J. Ray, all rights reserved
# This file copyright (c) 2001-2010 Randy J. Ray, all rights reserved
#
# Copying and distribution are permitted under the terms of the Artistic
# License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php) or
Expand Down Expand Up @@ -28,12 +28,10 @@ use 5.006001;
use strict;
use warnings;
use vars qw($VERSION);
use base qw(RPC::XML::Procedure);

require RPC::XML::Procedure;

@RPC::XML::Method::ISA = qw(RPC::XML::Procedure);
$VERSION = '1.12';
$VERSION = eval $VERSION; ## no critic
$VERSION = '1.13';
$VERSION = eval $VERSION; ## no critic (ProhibitStringyEval)

1;

Expand Down Expand Up @@ -96,9 +94,9 @@ L<http://github.com/rjray/rpc-xml>
=back
=head1 COPYRIGHT & LICENSE
=head1 LICENSE AND COPYRIGHT
This file and the code within are copyright (c) 2009 by Randy J. Ray.
This file and the code within are copyright (c) 2010 by Randy J. Ray.
Copying and distribution are permitted under the terms of the Artistic
License 2.0 (L<http://www.opensource.org/licenses/artistic-license-2.0.php>) or
Expand All @@ -116,8 +114,4 @@ L<RPC::XML::Procedure>
=head1 AUTHOR
Randy J. Ray <rjray@blackperl.com>
=cut
__END__
Randy J. Ray C<< <rjray@blackperl.com> >>
39 changes: 24 additions & 15 deletions lib/RPC/XML/Parser.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# This file copyright (c) 2001-2009 Randy J. Ray, all rights reserved
# This file copyright (c) 2001-2010 Randy J. Ray, all rights reserved
#
# Copying and distribution are permitted under the terms of the Artistic
# License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php) or
Expand Down Expand Up @@ -29,8 +29,8 @@ use warnings;
use vars qw($VERSION);
use subs qw(new parse);

$VERSION = '1.21';
$VERSION = eval $VERSION; ## no critic
$VERSION = '1.22';
$VERSION = eval $VERSION; ## no critic (ProhibitStringyEval)

###############################################################################
#
Expand All @@ -47,7 +47,7 @@ $VERSION = eval $VERSION; ## no critic
###############################################################################
sub new
{
my $class = shift;
my ($class, @args) = @_;

if ($class eq 'RPC::XML::Parser')
{
Expand All @@ -56,11 +56,11 @@ sub new
# RPC::XML::ParserFactory and return a factory-generated instance:
require RPC::XML::ParserFactory;

return RPC::XML::ParserFactory->new(class => 'xmlparser', @_);
return RPC::XML::ParserFactory->new(class => 'xmlparser', @args);
}

die __PACKAGE__ . '::new: This method should have been overridden by ' .
"the $_[0] class";
"the $class class\n";
}

###############################################################################
Expand All @@ -76,10 +76,11 @@ sub new
###############################################################################
sub parse
{
my $class = ref($_[0]) || $_[0];
my $class = shift;
$class = ref($class) || $class;

die __PACKAGE__ . '::parse: This method should have been overridden by ' .
"the $class class";
"the $class class\n";
}

###############################################################################
Expand All @@ -96,10 +97,11 @@ sub parse
###############################################################################
sub parse_more
{
my $class = ref($_[0]) || $_[0];
my $class = shift;
$class = ref($class) || $class;

die __PACKAGE__ . '::parse_more: This method should have been overridden' .
" by the $class class";
" by the $class class\n";
}

###############################################################################
Expand All @@ -116,10 +118,11 @@ sub parse_more
###############################################################################
sub parse_done
{
my $class = ref($_[0]) || $_[0];
my $class = shift;
$class = ref($class) || $class;

die __PACKAGE__ . '::parse_done: This method should have been overridden' .
" by the $class class";
" by the $class class\n";
}

1;
Expand All @@ -143,7 +146,7 @@ B<RPC::XML::ParserFactory> class.
All parser implementations that are intended to be returned by calls to
RPC::XML::ParserFactory::new() should declare this as their parent class.
=head1 METHODS
=head1 SUBROUTINES/METHODS
This class provides empty implementations for the following methods. A parser
implementation must provide definitions for B<both> of these methods. If the
Expand Down Expand Up @@ -258,6 +261,12 @@ parse_done() may also signal an error by throwing an exception.
=back
=head1 DIAGNOSTICS
Unless otherwises specified, routines return the object reference itself upon
a successful operation, and an error string (which is not a blessed reference)
upon error.
=head1 BUGS
Please report any bugs or feature requests to
Expand Down Expand Up @@ -292,9 +301,9 @@ L<http://github.com/rjray/rpc-xml>
=back
=head1 COPYRIGHT & LICENSE
=head1 LICENSE AND COPYRIGHT
This file and the code within are copyright (c) 2009 by Randy J. Ray.
This file and the code within are copyright (c) 2010 by Randy J. Ray.
Copying and distribution are permitted under the terms of the Artistic
License 2.0 (L<http://www.opensource.org/licenses/artistic-license-2.0.php>) or
Expand Down
Loading

0 comments on commit 2664b6b

Please sign in to comment.