1package WebService::Technorati::BaseTechnoratiObject; 2use strict; 3use utf8; 4 5use vars qw($AUTOLOAD); 6use AutoLoader; 7 8use WebService::Technorati::Exception; 9 10sub AUTOLOAD { 11 my $self=shift; 12 my $change=shift; 13 my $class = ref($self) || $self; 14 my($type,$field) = $AUTOLOAD =~ /.*::((?:s|g)et)([A-Z]\w+)/; 15 if (! defined($field)) { 16 WebService::Technorati::MethodNotImplementedException->throw( 17 "method not implemented: $AUTOLOAD"); 18 } 19 $field = lc($field); 20 $self->_accessible($field) 21 || WebService::Technorati::AccessViolationException->throw( 22 "attribute not accessible in $class: $field $AUTOLOAD"); 23 if ($change && $type eq 'set') { 24 $self->{$field}=$change; 25 } 26 return $self->{$field}; 27} # AUTOLOAD 28 29sub _accessible { 30 my $self = shift; 31 my $class = ref($self) || $self; 32 WebService::Technorati::MethodNotImplementedException->throw( 33 "abstract method '_accessible' not implemented by $class"); 34} 35 361; 37 38__END__ 39