| JavaScript-Code documentation | Contained in the JavaScript-Code distribution. |
JavaScript::Code::Accessor - A Accessor Class
use base qw[ JavaScript::Code::Accessor ];
Accessor Class
Takes a hash or a hashref as initialization arguments.
Sascha Kiefer, esskar@cpan.org
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| JavaScript-Code documentation | Contained in the JavaScript-Code distribution. |
package JavaScript::Code::Accessor; use strict; use vars qw[ $VERSION ]; use base qw[ Class::Accessor::Chained::Fast ]; use Carp (); use Scalar::Util (); $VERSION = '0.08';
sub new { my $obj = shift; my $class = ref $obj || $obj; return $class->SUPER::new( $class->__args(@_) ); } sub __args { my $self = shift; return {} unless @_; my $ref = @_ ? Scalar::Util::reftype( $_[0] ) || '' : ''; my %args = $ref eq 'HASH' ? %{ shift() } : @_; return \%args; }
1;