From 534d2788a7f98d0cdbda89cdfd024c85fee816ba Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 25 Feb 2014 00:20:32 -0800 Subject: [PATCH] Rework build_subs(), thanks to Michal Schwern, closes: CPAN#22073 --- Changes | 1 + OnlinePayment.pm | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index f3fc130..a0fc2b7 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ Revision history for Perl extension Business::OnlinePayment. - Document repository moved from CVS to git - Add avs_code and cvv2_response to build_subs, they're standard fields - Document best-practice eval of the submit() method in example + - Rework build_subs(), thanks to Michal Schwern, closes: CPAN#22073 3.02 Fri Aug 19 16:20:04 PDT 2011 - Fix fatal error calling ->info('supported_actions') on a gateway that diff --git a/OnlinePayment.pm b/OnlinePayment.pm index f8417ba..86551c4 100644 --- a/OnlinePayment.pm +++ b/OnlinePayment.pm @@ -6,7 +6,7 @@ use Carp; require 5.005; -$VERSION = '3.03_01'; +$VERSION = '3.03_02'; $VERSION = eval $VERSION; # modperlstyle: convert the string into a number # Remember subclasses we have "wrapped" submit() with _pre_submit() @@ -37,6 +37,8 @@ my @methods = qw( cvv2_response ); +__PACKAGE__->build_subs(@methods); + #fallback sub _info { my $class = shift; @@ -88,7 +90,6 @@ sub new { croak("unknown processor $processor ($@)") if $@; my $self = bless {processor => $processor}, $subclass; - $self->build_subs(@methods); if($self->can("set_defaults")) { $self->set_defaults(%data); @@ -159,7 +160,6 @@ sub _pre_submit { unless ( $@ =~ m/^Can\'t locate/ ); } else { my $risk_tx = bless( { processor => $fraud_detection }, $subclass ); - $risk_tx->build_subs(@methods); if ($risk_tx->can('set_defaults')) { $risk_tx->set_defaults(); } -- 2.11.0