|
Lines 907-925
sub AUTOLOAD {
Link Here
|
| 907 |
|
907 |
|
| 908 |
my @columns = @{$self->_columns()}; |
908 |
my @columns = @{$self->_columns()}; |
| 909 |
if ( grep { $_ eq $method } @columns ) { |
909 |
if ( grep { $_ eq $method } @columns ) { |
|
|
910 |
|
| 910 |
# Lazy definition of get/set accessors like $item->barcode; note that it contains $method |
911 |
# Lazy definition of get/set accessors like $item->barcode; note that it contains $method |
| 911 |
my $accessor = sub { |
912 |
my $accessor = sub { |
| 912 |
my $self = shift; |
913 |
my $self = shift; |
| 913 |
if ( @_ ) { |
914 |
if (@_) { |
| 914 |
$self->_result()->set_column( $method, @_); |
915 |
$self->_result()->set_column( $method, @_ ); |
| 915 |
return $self; |
916 |
return $self; |
| 916 |
} else { |
917 |
} else { |
| 917 |
return $self->_result()->get_column( $method ); |
918 |
return $self->_result()->get_column($method); |
| 918 |
} |
919 |
} |
| 919 |
}; |
920 |
}; |
| 920 |
no strict 'refs'; |
921 |
no strict 'refs'; |
| 921 |
*{$AUTOLOAD} = $accessor; |
922 |
*{$AUTOLOAD} = $accessor; |
| 922 |
return $accessor->($self, @_); |
923 |
return $accessor->( $self, @_ ); |
| 923 |
} |
924 |
} |
| 924 |
|
925 |
|
| 925 |
my @known_methods = qw( is_changed id in_storage get_column discard_changes make_column_dirty ); |
926 |
my @known_methods = qw( is_changed id in_storage get_column discard_changes make_column_dirty ); |
| 926 |
- |
|
|