[interchange-cvs] interchange - jon modified lib/Vend/Config.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Feb 22 22:34:54 EST 2006
User: jon
Date: 2006-02-23 03:34:53 GMT
Modified: lib/Vend Config.pm
Log:
Allow using an arbitrary subroutine in any package as a GlobalSub,
like this:
GlobalSub my_subname My::Package::some_subname
Also works for a catalog-level Sub, if AllowGlobal is on for the catalog:
Sub my_subname My::Package::some_subname
Revision Changes Path
2.197 +15 -2 interchange/lib/Vend/Config.pm
rev 2.197, prev_rev 2.196
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.196
retrieving revision 2.197
diff -u -u -r2.196 -r2.197
--- Config.pm 16 Feb 2006 14:21:01 -0000 2.196
+++ Config.pm 23 Feb 2006 03:34:53 -0000 2.197
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.196 2006/02/16 14:21:01 jon Exp $
+# $Id: Config.pm,v 2.197 2006/02/23 03:34:53 jon Exp $
#
# Copyright (C) 2002-2006 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
use Vend::Data;
use Vend::Cron;
-$VERSION = substr(q$Revision: 2.196 $, 10);
+$VERSION = substr(q$Revision: 2.197 $, 10);
my %CDname;
my %CPname;
@@ -4943,6 +4943,19 @@
unless (defined $value and $value) {
return $c || {};
}
+
+ # Allow mapping a Perl package and subroutine directly
+ if (
+ $value =~ /\A(\w+)\s+((?:\w+::)+\w+)\z/
+ and (
+ ! $C
+ or $Global::AllowGlobal->{$C->{CatalogName}}
+ )
+ ) {
+ no strict 'refs';
+ $c->{$1} = \&{"$2"};
+ return $c;
+ }
$value =~ s/^(\w+\s+)?\s*sub\s+(\w+\s*)?{/sub {/;
More information about the interchange-cvs
mailing list