Simple/Result/RowObject.pm untested

filter: Statementstmt 0.0% 0 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 11 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
BEGIN
2.0
CRAP 2.0
1 package DBIx::Simple::Result::RowObject;
2 use base 'Object::Accessor';
3 sub new {
4 my ($class, %args) = @_;
5  
6 my $self = $class->SUPER::new;
7 $self->mk_accessors(keys %args);
8 $self->$_( $args{$_} ) for keys %args;
9  
10 return $self;
11 }
12  
13 1;
14  
15 =head1 NAME
16  
17 DBIx::Simple::Result::RowObject - Simple result row object class
18  
19 =head1 DESCRIPTION
20  
21 This class is the default for the C<object> and C<objects> result object
22 methods. Mainly, it provides syntactic sugar at the expense of performance.
23  
24 Instead of writing
25  
26 my $r = $db->query('SELECT foo, bar FROM baz')->hash;
27 do_something_with $r->{foo}, $r->{bar};
28  
29 you may write
30  
31 my $r = $db->query('SELECT foo, bar FROM baz')->object;
32 do_something_with $r->foo, $r->bar;
33  
34 This class is a subclass of Object::Accessor, which provides per-object (rather
35 than per-class) accessors. Your records must not have columns names like these:
36  
37 * can
38 * ls_accessors
39 * ls_allow
40 * mk_accessor
41 * mk_clone
42 * mk_flush
43 * mk_verify
44 * new
45 * register_callback
46 * ___autoload
47 * ___callback
48 * ___debug
49 * ___error
50 * ___get
51 * ___set
52  
53 And of course DESTROY and AUTOLOAD, and anything that new versions of
54 Object::Accessor might add.
55  
56 =head1 DBIx::Simple::OO
57  
58 DBIx::Simple::OO is a third party module by Jos Boumans that provided C<object>
59 and C<objects> to DBIx::Simple. Similar functionality is now built in, in part
60 inspired by DBIx::Simple:OO.
61  
62 Using DBIx::Simple 1.33 or newer together with DBIx::Simple::OO 0.01 will
63 result in method name clash. DBIx::Simple::Result::RowObject was written to be
64 compatible with DBIx::Simple::OO::Item, except for the name, so C<isa> calls
65 still need to be changed.
66  
67 In practice, DBIx::Simple 1.33 makes DBIx::Simple::OO obsolete.
68  
69 =head1 AUTHOR
70  
71 Juerd Waalboer <juerd@cpan.org> <http://juerd.nl/>
72  
73 =head1 SEE ALSO
74  
75 L<DBIx::Simple>