Class-DBI-Lite

 view release on metacpan or  search on metacpan

lib/Class/DBI/Lite/AdHocEntity.pm  view on Meta::CPAN


package 
Class::DBI::Lite::AdHocEntity;

use strict;
use warnings 'all';
use base 'Class::DBI::Lite';
use Carp 'confess';


#==============================================================================
sub new
{
  my ($class, %args) = @_;
  
  return bless \%args, $class;
}# end new()


#==============================================================================
sub create { confess "Cannot call 'create' on a @{[ __PACKAGE__ ]}" }
sub update { confess "Cannot call 'update' on a @{[ __PACKAGE__ ]}" }
sub delete { confess "Cannot call 'delete' on a @{[ __PACKAGE__ ]}" }


#==============================================================================
sub AUTOLOAD
{
  my $s = shift;
  
  our $AUTOLOAD;
  my ($key) = $AUTOLOAD =~ m/([^:]+)$/;
  
  return unless exists $s->{data}->{$key};
  
  # Read-only access:
  $s->{data}->{$key};
}# end AUTOLOAD()


#==============================================================================
sub DESTROY
{
  my $s = shift;
  
  undef( %$s );
}# end DESTROY()

1;# return true:



( run in 0.611 second using v1.01-cache-2.11-cpan-f56aa216473 )