[SCM] Debian packaging of libclass-dbi-lite-perl branch, master, updated. debian/1.022-1-3-gf2aee1b
Onur Aslan
onuraslan at gmail.com
Mon Oct 31 08:45:16 UTC 2011
The following commit has been merged in the master branch:
commit f2aee1ba6b0e69e7dd27786d071d2e5dc03fb0a8
Author: Onur Aslan <onuraslan at gmail.com>
Date: Mon Oct 31 10:43:11 2011 +0200
Revert "importing upstream"
This reverts commit 91451e1875c42a295d1260738a8caaadb2babc80.
diff --git a/Changes b/Changes
index 106de14..17ea067 100644
--- a/Changes
+++ b/Changes
@@ -1,11 +1,5 @@
Revision history for Perl extension Class::DBI::Lite.
-1.023 2011-10-27
- - Now if you want to override the default 'getter' or 'setter' behavior for a
- field in your objects, you can do so by defining _set_foo( $self, $val ) or
- _get_foo( $self ).
- - Thanks Eric for the idea! ehayes.inflection++
-
1.022 2011-09-19
- POD change from app::* to App::db::* namespace.
diff --git a/META.yml b/META.yml
index 297214d..26223fc 100644
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Class-DBI-Lite
-version: 1.023
+version: 1.022
abstract: Lightweight ORM for Perl
license: Perl
author:
diff --git a/lib/Class/DBI/Lite.pm b/lib/Class/DBI/Lite.pm
index 77e8aa9..481c3b0 100644
--- a/lib/Class/DBI/Lite.pm
+++ b/lib/Class/DBI/Lite.pm
@@ -18,7 +18,7 @@ use overload
bool => sub { eval { $_[0]->id } },
fallback => 1;
-our $VERSION = '1.023';
+our $VERSION = '1.022';
our $meta;
our %DBI_OPTIONS = (
@@ -158,10 +158,13 @@ sub _init_meta
# Install the column accessors:
foreach my $col ( grep { $_ ne $pk } $class->columns )
{
- my $setter = "_set_$col";
- my $getter = "_get_$col";
- *{"$class\::$setter"} = sub {
- my ($s, $newval) = @_;
+ *{"$class\::$col"} = sub {
+ my $s = shift;
+
+ exists($s->{$col}) or $s->_flesh_out;
+ if( @_ )
+ {
+ my $newval = shift;
no warnings 'uninitialized';
return $newval if $newval eq $s->{$col};
$s->_call_triggers( "before_set_$col", $s->{$col}, $newval );
@@ -169,16 +172,11 @@ sub _init_meta
oldval => $s->{$col}
};
return $s->{$col} = $newval;
- };
- *{"$class\::$getter"} = sub {
- shift->{$col};
- };
-
- *{"$class\::$col"} = sub {
- my $s = shift;
-
- exists($s->{$col}) or $s->_flesh_out;
- @_ ? $s->$setter( @_ ) : $s->$getter( @_ );
+ }
+ else
+ {
+ return $s->{$col};
+ }# end if()
};
}# end foreach()
}# end _init_meta()
@@ -1887,15 +1885,6 @@ To save those changes to the database you must call C<update>:
=back
-=head2 Overriding Setters and Getters
-
-The accessors/mutators ("setters" and "getters") can be individually overridden
-within your entity class by implementing C<_set_foo($self, $value)> or
-C<_get_foo($self)> methods.
-
-B<NOTE:> In practice this may be more useful for the C<_get_*> methods, as the C<_set_*>
-methods are usually best left to triggers.
-
=head2 id
Always returns the value of the object's primary column.
diff --git a/t/testdb b/t/testdb
index dddd626..0d0e366 100644
Binary files a/t/testdb and b/t/testdb differ
--
Debian packaging of libclass-dbi-lite-perl
More information about the Pkg-perl-cvs-commits
mailing list