1package Astro::App::Satpass2::ParseTime::Date::Manip; 2 3use strict; 4use warnings; 5 6use parent qw{ Astro::App::Satpass2::ParseTime }; 7 8use Astro::App::Satpass2::Utils qw{ 9 back_end 10 load_package 11 __date_manip_backend 12 __parse_class_and_args 13 @CARP_NOT 14}; 15 16our $VERSION = '0.049'; 17 18sub __class_name { 19 return __PACKAGE__; 20} 21 22sub attribute_names { 23 my ( $self ) = @_; 24 return ( $self->SUPER::attribute_names(), qw{ back_end station } ); 25} 26 27sub delegate { 28 my $back_end; 29 defined ( $back_end = __date_manip_backend() ) 30 or return $back_end; 31 return __PACKAGE__ . "::v$back_end"; 32} 33 34sub station { 35 my ( $self, @args ) = @_; 36 if ( @args > 0 ) { 37 not defined $args[0] 38 or $args[0]->isa( 'Astro::Coord::ECI' ) 39 or $self->wail( 'Station must be an Astro::Coord::ECI' ); 40 $self->{station} = $args[0]; 41 $self->__set_back_end_location( $args[0] ); 42 return $self; 43 } 44 return $self->{station}; 45} 46 47sub __back_end_default { 48 my ( undef, $cls ) = @_; 49 return defined $cls ? $cls : 'Date::Manip::Date'; 50} 51 52sub __back_end_validate { 53 my ( $self, $cls ) = @_; 54 $cls->isa( 'Date::Manip::Date' ) 55 or $self->wail( "$cls is not a Date::Manip::Date" ); 56 return; 57} 58 591; 60 61__END__ 62 63=head1 NAME 64 65Astro::App::Satpass2::ParseTime::Date::Manip - Parse time for Astro::App::Satpass2 using Date::Manip 66 67=head1 SYNOPSIS 68 69 my $delegate = Astro::App::Satpass2::ParseTime::Date::Manip->delegate(); 70 71=head1 DETAILS 72 73This class is simply a trampoline for 74L<< Astro::App::Satpass2::ParseTime->new()|Astro::App::Satpass2::ParseTime/new >> to 75determine which Date::Manip class to use. 76 77=head1 METHODS 78 79This class supports the following public methods: 80 81=head2 back_end 82 83 $pt->back_end( 'Date::Manip::Date' ); 84 my $back_end = $pt->back_end(); 85 86This method is both accessor and mutator for the object's back end class 87name. This class must be a subclass of 88L<Date::Manip::Date|Date::Manip::Date>. 89 90=head2 delegate 91 92 my $delegate = Astro::App::Satpass2::ParseTime::Date::Manip->delegate(); 93 94This static method returns the class that should be used based on which 95version of L<Date::Manip|Date::Manip> could be loaded. If 96C<< Date::Manip->VERSION() >> returns a number less than 6, 97'L<Astro::App::Satpass2::ParseTime::Date::Manip::v5|Astro::App::Satpass2::ParseTime::Date::Manip::v5>' 98is returned. If it returns 6 or greater, 99'L<Astro::App::Satpass2::ParseTime::Date::Manip::v6|Astro::App::Satpass2::ParseTime::Date::Manip::v6>' 100is returned. If L<Date::Manip|Date::Manip> can not be loaded, C<undef> 101is returned. 102 103=head2 station 104 105 $pt->station( $satpass2->station() ); 106 my $station = $pt->station(); 107 108This method is both accessor and mutator for the object's station 109attribute. This must be an L<Astro::Coord::ECI|Astro::Coord::ECI> 110object, or C<undef>. 111 112This attribute is used to set the back end's C<location> config item. If 113the back end does not have this config item, the fact is ignored -- 114silently, with any luck. 115 116=head1 SUPPORT 117 118Support is by the author. Please file bug reports at 119L<https://rt.cpan.org/Public/Dist/Display.html?Name=Astro-App-Satpass2>, 120L<https://github.com/trwyant/perl-Astro-App-Satpass2/issues>, or in 121electronic mail to the author. 122 123=head1 AUTHOR 124 125Thomas R. Wyant, III F<wyant at cpan dot org> 126 127=head1 COPYRIGHT AND LICENSE 128 129Copyright (C) 2009-2021 by Thomas R. Wyant, III 130 131This program is free software; you can redistribute it and/or modify it 132under the same terms as Perl 5.10.0. For more details, see the full text 133of the licenses in the directory LICENSES. 134 135This program is distributed in the hope that it will be useful, but 136without any warranty; without even the implied warranty of 137merchantability or fitness for a particular purpose. 138 139=cut 140 141# ex: set textwidth=72 : 142