Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

runtime variables and runtime attributes.

by Koschei (Monk)
on Jul 22, 2002 at 02:20 UTC ( [id://183919]=perlquestion: print w/replies, xml ) Need Help??

Koschei has asked for the wisdom of the Perl Monks concerning the following question:

Ok, Perl 5.8.0 introduces runtime application of variable attributes. All fine and dandy. However, I'd like to be able to pass variables in my attribute declarations. For example:

my $bar = 3; my Cat $foo : Legs($bar);

As perldelta (perl58delta for bleaders) says:

In particular, however, this allows variable attributes to be useful for "tie" interfaces, which was a deficiency of earlier releases.

So, how does one actually evaluate the $bar? MODIFY_SCALAR_ATTRIBUTES gets called with a string "Legs($bar)" and no hook into the appropriate namespace.

-- Iain, aka Koschei.
  • Comment on runtime variables and runtime attributes.

Replies are listed 'Best First'.
Re: runtime variables and runtime attributes.
by IlyaM (Parson) on Jul 22, 2002 at 08:13 UTC
    Not sure if it will work but you can try to get access to variables using Devel::LexAlias.

    OTOH after playing with attributes I decided for myself to do not use them because they have too many limitations (my favorite is that Perl insists that the entire attribute be on one line).

    --
    Ilya Martynov (http://martynov.org/)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://183919]
Approved by Elian
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-12-09 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (55 votes). Check out past polls.