[interchange] allow for bounces from Autoload routines
Stefan Hornburg
interchange-cvs at icdevgroup.org
Sun Mar 7 07:10:32 UTC 2010
commit 4ccb37a636724c0de01b785955e3a72d2f1d44d5
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Sun Mar 7 08:06:20 2010 +0100
allow for bounces from Autoload routines
added new autoload_inspect SpecialSub to signal skipping of further Autoload processing
lib/Vend/Config.pm | 8 +++++++-
lib/Vend/Dispatch.pm | 18 ++++++++++++++----
2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/lib/Vend/Config.pm b/lib/Vend/Config.pm
index f4a013e..ffda977 100644
--- a/lib/Vend/Config.pm
+++ b/lib/Vend/Config.pm
@@ -3238,7 +3238,13 @@ my @Cleanups;
Autoload => sub {
#::logDebug("Doing Autoload dispatch...");
- Vend::Dispatch::run_macro($Vend::Cfg->{Autoload});
+ my ($subname, $inspect_sub);
+
+ if ($subname = $Vend::Cfg->{SpecialSub}{autoload_inspect}) {
+ $inspect_sub = $Vend::Cfg->{Sub}{$subname} || $Global::GlobalSub->{$subname};
+ }
+
+ Vend::Dispatch::run_macro($Vend::Cfg->{Autoload}, undef, $inspect_sub);
},
CookieLogin => sub {
diff --git a/lib/Vend/Dispatch.pm b/lib/Vend/Dispatch.pm
index cf982a1..d0b7d29 100644
--- a/lib/Vend/Dispatch.pm
+++ b/lib/Vend/Dispatch.pm
@@ -1190,7 +1190,8 @@ sub run_macro {
my $macro = shift
or return;
my $content_ref = shift;
-
+ my $inspect_sub = shift;
+
my @mac;
if(ref $macro eq 'ARRAY') {
@mac = @$macro;
@@ -1203,6 +1204,8 @@ sub run_macro {
}
for my $m (@mac) {
+ my $ret;
+
if ($m =~ /^\w+$/) {
my $sub = $Vend::Cfg->{Sub}{$m} || $Global::GlobalSub->{$m}
or do {
@@ -1217,13 +1220,19 @@ sub run_macro {
}
next;
};
- $sub->($content_ref);
+ $ret = $sub->($content_ref);
}
elsif($m =~ /^\w+-\w+$/) {
- Vend::Interpolate::tag_profile($m);
+ $ret = Vend::Interpolate::tag_profile($m);
}
else {
- interpolate_html($m);
+ $ret = interpolate_html($m);
+ }
+
+ if ($inspect_sub) {
+ unless ($inspect_sub->($m, $ret)) {
+ last;
+ }
}
}
}
@@ -1656,6 +1665,7 @@ EOF
for my $routine (@{$Vend::Cfg->{DispatchRoutines}}) {
$routine->();
+ return if $Vend::Sent;
}
#show_times("end DispatchRoutines") if $Global::ShowTimes;
More information about the interchange-cvs
mailing list