Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Class::Accessor and Damian's PBP

by nothingmuch (Priest)
on Feb 24, 2006 at 00:11 UTC ( #532428=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Class::Accessor and Damian's PBP
in thread Class::Accessor and Damian's PBP

Class::DBI has a way to make this interface for your persistent objects:

$row_obj->set_field("foo"); $row_obj->get_field(); # instead of $row_obj->field("foo"); $row->obj_field();
That's what you meant, right?

Look for mutator_name and accessor_name - this is under http://search.cpan.org/~tmtm/Class-DBI-v3.0.14/lib/Class/DBI.pm#Changing_Your_Column_Accessor_Method_Names.

Specifically, look at

sub mutator_name_for { my ($class, $column) = @_; return "set_" . $column->accessor; }
And copy over the implementation of the code that uses mutator_name to create write only accessors and readonly accessors.
-nuffin
zz zZ Z Z #!perl


Comment on Re^3: Class::Accessor and Damian's PBP
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://532428]
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: (8)
As of 2014-07-26 03:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls