Jupiterhost.Net wrote: > > > david wrote: > >> Jupiterhost.Net wrote: >> >> >>>Hello list, >>> >>>I was looking into the best way (and for what reasons) you'd create an >>>"alais" function. >>> >>>For example: >>> >>>If you want foo() and bar() to be able to be used interchangeably would >>> it be best to do: >>> >>> sub foo { return "Howdy $_[0]"; } >>> sub bar { return foo(@_); } >>> >>>or do a typeglob: >>> >>> sub foo { return "Howdy $_[0]"; } >>> *bar = \&foo; >>> >> >> >> for these simple examples, it doesn't matter much and i would go with the >> first method. functionality wise, they are pretty much the same but there >> are differences that you might want to observe when your foo function >> gets more complicated. for example, the first method has an extra >> function call which means it's a tiny bit slower and more importantly, >> the stock frame will be different and caller return different trace for >> this purpose so you might want to consider 'goto &foo' instead. if none >> of those matters to > > So that woudl be: > sub foo { return "Howdy $_[0]"; } > sub bar { goto &foo; } > ?? >
yes > > goto() just kind of uses the current @_ if I remeber right, correct? > that's one feature of goto &foo and another has to do with transfering the current call to another so caller is fooled to believe the function is actually called directly > > I'll have to perldoc -f goto since > I'm not realy familiar with it and its own issues :) > always a good idea david -- s$s*$+/<tgmecJ"ntgR"tgjvqpC"vuwL$;$;=qq$ \x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65 \x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72 \x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32 \x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74 \x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>