Astro::App::Satpass2::Copier - Object copying functionality for Astro::App::Satpass2
package Astro::App::Satpass2::Foo; use strict; use warnings; use base qw{ Astro::App::Satpass2::Copier }; sub new { ... } sub attribute_names { return ( qw{ bar baz } ); } __PACKAGE__->create_attribute_methods(); 1;
This class is private to the Astro::App::Satpass2 package. The author reserves the right to modify it in any way or retract it without prior notice.
This class supports the following public methods:
$obj->warner( undef ); my $warner = $obj->warner();
This method is both accessor and mutator for the warner attribute.
warner
If an argument is passed, it must be either an Astro::App::Satpass2::Warner (either class or object), or undef (which causes a new Astro::App::Satpass2::Warner object to be created.)
undef
If no argument is passed, it is an accessor, returning the warner object. If no such object has been assigned, one will be generated.
print join( ', ', $obj->attribute_names() ), "\n";
This method returns the names of the object's attribute_names.
Subclasses should override this. Immediate subclasses should call SUPER::attribute_names(), and indirect subclasses must call SUPER::attribute_names(). A subclass' override would look something like this:
SUPER::attribute_names()
sub attribute_names { my ( $self ) = @_; return ( $self->SUPER::attribute_names(), qw{ foo bar baz } ); }
say 'I am a ', $obj->class_name_of_record();
This method returns the class name of record of the object. By default this is simply the name of the object's class (i.e. ref $obj, but subclasses can override this to hide implementation details.
ref $obj
my $clone = $obj->clone();
This method returns a clone of the original object, taken using Clone::clone().
Clone::clone()
Overrides may call SUPER::clone(). If they do not they bear complete responsibility for producing a correct clone of the original object.
may
SUPER::clone()
$obj->copy( $copy );
This method copies the attribute values of the original object into the attribute_names of the copy object. The original object is returned.
The copy object need not be the same class as the original, but it must support all attributes the original supports.
__PACKAGE__->create_attribute_methods();
This method may be called exactly once by the subclass to create accessor/mutator methods. This method assumes that the object is based on a hash reference, and stores attribute values in same-named keys in the hash. The created methods have the same names as the attributes. They are accessors if called without arguments, and mutators returning the original object if called with arguments. Methods already in existence when this method is called will not be overridden.
$obj->init( name => value ... );
This method sets multiple attributes. It dies if any of the names does not represent a legal attribute name. It returns the invocant.
Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.
Thomas R. Wyant, III wyant at cpan dot org
Copyright (C) 2010-2014 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Astro::App::Satpass2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Astro::App::Satpass2
CPAN shell
perl -MCPAN -e shell install Astro::App::Satpass2
For more information on module installation, please visit the detailed CPAN module installation guide.