I have an OO module that has some 100+ slots in the hash.
most are all for holding command line input. Any command
line switch get entered into the hash without the -
ex: command_line -abc -def
is abc and def in the hash.
Keeping with good OO methodology I need a method to access each element
without building a method for each.
EX:
sub abc {
my ($c,$set) = @_;
my $name = (caller(0))[3];
$c->{$name} = $set if defined $set;
return $c->{$name};
}
in an XS file I have :
OnlyArb(np,stop=0)
Laff::Node np
Laff::Node stop
ALIAS:
OnlyArb = lARB
OnlyAttr = lATTR
OnlyCircle = lCIRCLE
OnlyClf = lCLF
OnlyConnect = lCONNECT
OnlyCpd = lCPD
OnlyCpr = lCPR
OnlyDtext = lDTEXT
OnlyName = lNAME
OnlyPath = lPATH
OnlyPort = lPORT
OnlyPrel = lPREL
OnlyRect = lRECT
OnlySnam = lSNAM
OnlySxcall = lSXCALL
OnlyText = lTEXT
OnlyXcall = lXCALL
CODE:
{
do
{
np = (stop) ? LaffNodeNext(np,stop)
: LaffNodeNext(np,NULL);
} while (np && np->type != ix);
RETVAL = np;
}
OUTPUT:
RETVAL
This gives me one routine that I can access all data. ix is the l*
How can I do this in my OO package?
I've looked out on CPAN and searched for Alias. There is an alias
module
but they deal with data, not subroutines.
So how do I duplicate teh ALIAS and ix in perl for what has been done
in XS?
--
=========+=========+=========+=========+=========+=========+=========+
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methology Group
Dallas, Texas
214-480-4455
[EMAIL PROTECTED]
=========+=========+=========+=========+=========+=========+=========+