Debian Codegraph @

lib/Class/DBI/Attribute.pm

raw
1 package Class::DBI::Attribute;
2
3 =head1 NAME
4
5 Class::DBI::Attribute - A value in a column.
6
7 =head1 SYNOPSIS
8
9 my $column = Class::DBI::Attribute->new($column => $value);
10
11 =head1 DESCRIPTION
12
13 This stores the row-value of a certain column in an object.
14 You probably shouldn't be dealing with this directly, and its interface
15 is liable to change without notice.
16
17 =head1 METHODS
18
19 =cut
20
21 use strict;
22 use base 'Class::Accessor::Fast';
23
24 __PACKAGE__->mk_accessors(qw/column current_value known/);
25
26 use overload
27 '""' => sub { shift->current_value },
28 fallback => 1;
29
30 sub new {
31 my ($class, $col, $val) = @_;
32 $class->SUPER::new({
33 column => $col, current_value => $val, known => 1,
34 });
35 }
36
37 1;