Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: a loop for creating subroutines?

by LanX (Canon)
on Aug 28, 2012 at 08:47 UTC ( #990176=note: print w/ replies, xml ) Need Help??


in reply to Re^2: a loop for creating subroutines?
in thread a loop for creating subroutines?

I've shown you two ways and the second works for objects too. (in perl package == class)

Don't know too much about moose.

But if you ask for "the cleanest" approach, better avoid metaprogramming!

Just define two getters and use a fat comma to get rid of the quoting.

$object->cell(light => 10); $object->time(light => $timestamp);

I like metaprogramming, but here it's over the top.

And this certainly works with moose too!

Cheers Rolf


Comment on Re^3: a loop for creating subroutines?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990176]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (17)
As of 2015-07-07 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls