1package SOAP::Lite::Utils; 2use strict; 3 4sub import { 5 my $caller = caller(); 6 no strict qw(refs); 7 *{ "$caller\::__mk_accessors" } = \&__mk_accessors; 8} 9 10sub __mk_accessors { 11 my ($class, @method_from) = @_; 12 no strict 'refs'; 13 for my $method ( @method_from ) { 14 my $field = '_' . $method; 15 *{ "$class\::$method" } = sub { 16 my $self = ref $_[0] ? shift : shift->new(); 17 if (@_) { 18 $self->{$field} = shift; 19 return $self 20 } 21 return $self->{$field}; 22 } 23 } 24} 25 26 271; 28 29__END__ 30