Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 2014-11-21 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (114 votes), past polls