[ic] TrackSub is Broke?

Mike Heins mike at perusion.com
Sun May 1 13:23:54 EDT 2005

Quoting Duane Hinkley (duane at downhomewebdesign.com):
> If I changed the Track.pm to use the same method for defining the 
> subroutine to use as the Payment.pm uses to call the payment modules, 
> that seems like a simpler way for future users to plug in a custom 
> tracking module.  Then they would just have to pass the name of the 
> module to use.
> Would that work better?

I would say the way you suggest is developer-oriented and requires
permission to write the Interchange software directory. That is not
normally the way we do things -- something like Vend::Payment is 
a bit different because it *requires* development.

If you were to allow an arbitrary module-oriented subroutine name,
that is a security hole, so you have to constrain it to a package
in some way.

All in all, I would really prefer to just have a mechanism similar to
Autoload where you just specify a subroutine name, because that allows
both catalog routines for those without global permissions and full
access for those with.

So it seems like adding this to Vend::Config makes sense:

sub parse_action_from_sub {
    my ($var, $name) = @_;
    return '' unless $name;
    my $sub;
    $sub = $C->{Sub}->{$name} if $C;
    $sub ||= $Global::GlobalSub->{$name};
    unless (ref($sub) eq 'CODE') {
        config_warn("% directive subroutine %s not defined.", $var, $name);
    return $sub || '';

Then you can do:

	AddDirective TrackSub  action_from_sub

Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Few blame themselves until they have exhausted all other possibilities.
 -- anonymous

More information about the interchange-users mailing list