Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jk2addict (4946)

jk2addict
  (email not shown publicly)
http://today.icantfocus.com/blog/
AOL IM: chrislaco (Add Buddy, Send Message)
Yahoo! ID: chrislaco@sbcglobal.net (Add User, Send Message)
Jabber: laco@scribblewerks.com

Journal of jk2addict (4946)

Sunday November 27, 2005
09:51 PM

Class::Data::Accessor

[ #27761 ]

Over the last view days of converting Handel from CDBI from DBIC, I took another look at Class::Accessor and Class::Data::Inheritable. One of the things I found myself wanting was something that did both the inheritable class data and supported instance data using the same accessor.

Well, as it turns out, Matt Trout had such a thing sitting in the repo. After some pod tweaking and slight dist preparation, Class::Data::Accessor 0.01 is coming to a CPAN mirror nearest you.

Its usage is roughly:

package Base;
use base qw/Class::Data:Accessor/;
__PACKAGE__->mk_classaccessor('AutoCommit' => 1);
 
print Base->AutoCommit; # prints 1
 
package BetterBase;
use base qw/Base/;
print BetterBase->AutoCommit; #prints 1
 
__PACKAGE__->AutoCommit(0);
print BetterBase->AutoCommit; #prints 0
print Base->AutoCommit; # prints 1
 
my $base = BetterBase->yournew();
print $base->AutoCommit; # prints 1
 
$base->AutoCommit(1);
print $base->AutoCommit; # prints 1

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.