Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: DBIx::Class creating get_* and set_* methods

by emazep (Priest)
on Feb 08, 2008 at 06:39 UTC ( #666914=note: print w/ replies, xml ) Need Help??


in reply to DBIx::Class creating get_* and set_* methods

DBIx::Class offers also the set_column and get_column accessors:

$person->set_column('name', 'John'); $name = $person->get_column('name');
It's not exactly what you were asking for, but just in case you feel more comfortable with the get/set prefixes anyway ;-)

Update

It must be specified that they don't have exactly the same semantics of the generated accessors (see the jrockway's reply and the DBIx::Class docs.)

Cheers,
Emanuele.


Comment on Re: DBIx::Class creating get_* and set_* methods
Download Code
Re^2: DBIx::Class creating get_* and set_* methods
by jrockway (Acolyte) on Feb 08, 2008 at 07:08 UTC
    Never use get_column and set_column directly unless you know what the side-effects are. They don't work the same way as using the accessors. Inflation is skipped, resultsets are not returned for relationships, etc.
      Never use get_column and set_column directly unless you know what the side-effects are.
      I would rather say "the absence of side-effects" ;-)
      (That's exactly why I often use them and I find them perfectly adequate to get the columns raw values.)

      Anyway you are right, I should have specified that's not exactly the same semantics of the generated accessors.

      Cheers,
      Emanuele.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2014-08-27 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (237 votes), past polls