- set $VERSION using eval per modperlstyle
- new() now will strip off multiple leading dashes before calling build_subs
NOTE: we should probably have it remove any \W to make perl happy
- required_fields() now croaks with a list of missing fields
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,
foreach(keys %data) {
my $key = lc($_);
my $value = $data{$_};
- $key =~ s/^\-//;
+ $key =~ s/^\-+//;
$self->build_subs($key);
$self->$key($value);
}
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 {