Dan Muey wrote:
>
>
> Basically I use the ParentName's $obj inside my functions
> and they are expecting it as the first arg.
>
> $obj->MyModule::function($arg); would be the coolest way
> (leaving my functions as sub function instead of sub
> NameSpace::Evil::function)
>
> Is this possible or am I just batty!?
>
Absolutely on the mark! Bravo!
Then catch it in the function with:
my $self = shift;
What is left of the parameter list after shifting out the object
reference is the parameter list as appears inside the parentheses of
the call to the function:
$my_object->my_sub($whats_this, $who_knows, $why_bother);
sub my_sub {
my $self = shift;
my ($whats_this, $who_knows, $why_bother) = @_
... #do stuff with $whats_this, $who_knows, and $why_bother
}
It makes for great typographic convenience, too, when you are
prototyping/testing your objects.
Joseph
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]