X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=OnlinePayment.pm;h=d051c742156989b4b7d9c37b0b6eb6b33ac12afc;hb=2627584a8ec11ec8b680bafc314ffa1c1721a491;hp=2a9cee0a9f46ab7fe3697650bc7a436f4eddea22;hpb=777166d3e32e0fc5aeb5eb84731e02852831cba9;p=Business-OnlinePayment.git diff --git a/OnlinePayment.pm b/OnlinePayment.pm index 2a9cee0..d051c74 100644 --- a/OnlinePayment.pm +++ b/OnlinePayment.pm @@ -1,24 +1,14 @@ package Business::OnlinePayment; use strict; -use vars qw($VERSION); # @ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use vars qw($VERSION); use Carp; use Symbol; require 5.005; -#use Data::Dumper; - -#require Exporter; - -#@ISA = (); #qw(Exporter AutoLoader); -#@EXPORT = qw(); -#@EXPORT_OK = qw(); $VERSION = '3.00_04'; -sub VERSION { #Argument "3.00_01" isn't numeric in subroutine entry - local($^W)=0; - UNIVERSAL::VERSION(@_); -} +$VERSION = eval $VERSION; # modperlstyle: convert the string into a number my %fields = ( is_success => undef, @@ -59,7 +49,7 @@ sub new { foreach(keys %data) { my $key = lc($_); my $value = $data{$_}; - $key =~ s/^\-//; + $key =~ s/^\-+//; $self->build_subs($key); $self->$key($value); } @@ -148,10 +138,14 @@ sub content { sub required_fields { my($self,@fields) = @_; + my @missing; my %content = $self->content(); foreach(@fields) { - Carp::croak("missing required field $_") unless exists $content{$_}; + push(@missing, $_) unless exists $content{$_}; } + + Carp::croak("missing required field(s): " . join(", ", @missing) . "\n") + if(@missing); } sub get_fields {