in reply to Re: goto and AUTOLOADed methods
in thread goto and AUTOLOADed methods

I frequently use it for "plugins" where I have a directory full of files with subroutines, and AUTOLOAD just runs 'require' to pull it in, but the subroutines in the files look normal, and everything is easy to use/debug.

Replies are listed 'Best First'.
Re3: goto and AUTOLOADed methods
by dragonchild (Archbishop) on Aug 01, 2003 at 13:44 UTC
    Couldn't you be better served by making those files into modules/objects and choosing which one(s) you want at the beginning, making it clearer to your maintainer(s) (which often is you) exactly what's going on?

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      I use the same technique - in my case it is for a database abstraction layer, where each file/subroutine describes a db access method, like this:
      package DBAccess; use strict; use Sybase::CTlib; sub addMaillog { my $self = shift; my %args = @_; my $config = { name => 'addMaillog', param => { token => { type => CS_CHAR_TYPE, opt => 0}, email => { type => CS_CHAR_TYPE, opt => 0}, action => { type => CS_CHAR_TYPE, opt => 0}, }, output => [ { name => 'maillog', cols => [qw(maillogId)], }], server => 'main', database => 'rpc', }; $self->execute($config, \%args); } 1;
      Each file only has this description, and everything else is handled by the rest of the package.

      It makes adding/modifying database requests very easy, though the fact that they are all stored procedure calls simplyfies things as well. There are no doubt other ways to do this, but it works fine for me at the moment.

      Note that this is based on Sybase::CTlib, but it could very well be built using DBI/DBD::Sybase as well.

      Michael