in reply to Re: Variable Name Mistery. Who calls?
in thread Variable Name Mistery. Who calls?
So far, so good. But the problem is, that at some point, when I initialize a 'new' object, I define for it a list of available parameters, which will be then used as that object method. So, what I want is to raise a warning when I try to do something likesub AUTOLOAD { my $_call = our $AUTOLOAD; $_call =~ s/.*:://; my $self = shift; my $param = shift; ... $self->{$_call} = $_param || return $self->{$_call}; }
I want to avoid things like passing the var name to the constructor function or things like that... Thats why I been thinking that *maybe* there was a way to know the name of the variable that called to a package.my $o = Foo->new(); #create new object $o->Available_Param_List(["one", "two"]); #methods that should be avai +lable to $o $o->one('this will work ok'); $o->nope('this should print a warn on saying that nope is not availabl +e for $o');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Variable Name Mistery. Who calls?
by ikegami (Patriarch) on Oct 25, 2006 at 19:16 UTC | |
|
Re^3: Variable Name Mistery. Who calls?
by cephas (Pilgrim) on Oct 25, 2006 at 19:26 UTC | |
by porta (Sexton) on Oct 25, 2006 at 22:17 UTC | |
by ikegami (Patriarch) on Oct 26, 2006 at 02:19 UTC | |
|
Re^3: Variable Name Mistery. Who calls?
by ysth (Canon) on Oct 26, 2006 at 00:01 UTC |