File: Attribute.pm

package info (click to toggle)
libclass-dbi-perl 3.0.17-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 548 kB
  • ctags: 251
  • sloc: perl: 2,118; makefile: 6
file content (37 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Class::DBI::Attribute;

=head1 NAME

Class::DBI::Attribute - A value in a column.

=head1 SYNOPSIS

	my $column = Class::DBI::Attribute->new($column => $value);

=head1 DESCRIPTION

This stores the row-value of a certain column in an object.
You probably shouldn't be dealing with this directly, and its interface
is liable to change without notice.

=head1 METHODS

=cut

use strict;
use base 'Class::Accessor::Fast';

__PACKAGE__->mk_accessors(qw/column current_value known/);

use overload
	'""' => sub { shift->current_value },
	fallback => 1;

sub new {
	my ($class, $col, $val) = @_;
	$class->SUPER::new({ 
		column => $col, current_value => $val, known => 1,
	});
}

1;