Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Moose and OOP in Perl

by moritz (Cardinal)
on May 09, 2013 at 20:00 UTC ( #1032833=note: print w/ replies, xml ) Need Help??


in reply to Moose and OOP in Perl

my %defaults = ( ssl => 1, port => 12345, timeout => 42, ); for my $name (@ldap_attrs) { my $reader = 'get_' . $name; my $writer = 'set_' . $name; my @default; if (exists $defaults{$name}) { @default = (default => $defaults{$name}); } has $name => ( is => 'rw', reader => $reader, writer => $writer, required => 0, @default, ); }

Untested, but something along those lines should work.


Comment on Re: Moose and OOP in Perl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2015-07-31 08:01 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 (275 votes), past polls