|Do you know where your variables are?|
Anyone using Attribute::Default from CPAN?by rovf (Priest)
|on Jun 05, 2008 at 14:12 UTC||Need Help??|
rovf has asked for the wisdom of the Perl Monks concerning the following question:
I would like to use Attribute::Default from CPAN in order to define default arguments for subs in a easily readable way. Here is a simple example which works:
This prints abc xyz, followed by a line saying END. Things stop to work, however, when I use Attribute::Default in a package which itself uses the Exporter; or maybe I just may some silly mistake. Here is the first thing I tried:
This will be called in the following way:
Executing this will output just abc followed by END; i.e. the default argument is not used.
It gets even more bizarre when I handle @ISA by myself instead of letting use base doint it:
I call this as usual,
but now I get the error message:
Well, I guess there is a reason why the perldoc to Attribute::Default says that you need do use base '...' to access it. Anyway, as a last resort I tried to combine the two approaches:
The program for calling it is, not surprisingly:
Now I get the error message:
What is going wrong here?
Ronald Fischer <email@example.com>