NAME
Astro::App::Satpass2::Copier - Object copying functionality for Astro::App::Satpass2
SYNOPSIS
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;
DETAILS
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.
METHODS
This class supports the following public methods:
Accessors and Mutators
warner
$obj->warner( undef );
my $warner = $obj->warner();
This method is both accessor and mutator for the warner
attribute.
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.)
If no argument is passed, it is an accessor, returning the warner object. If no such object has been assigned, one will be generated.
attribute_names
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:
sub attribute_names {
my ( $self ) = @_;
return ( $self->SUPER::attribute_names(), qw{ foo bar baz } );
}
clone
my $clone = $obj->clone();
This method returns a clone of the original object, taken using Clone::clone()
.
Overrides may
call SUPER::clone()
. If they do not they bear complete responsibility for producing a correct clone of the original object.
copy
$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.
create_attribute_methods
__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.
SUPPORT
Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.
AUTHOR
Thomas R. Wyant, III wyant at cpan dot org
COPYRIGHT AND LICENSE
Copyright (C) 2010-2012 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.