Astro-App-Satpass2

 view release on metacpan or  search on metacpan

lib/Astro/App/Satpass2/ParseTime/Date/Manip.pm  view on Meta::CPAN

package Astro::App::Satpass2::ParseTime::Date::Manip;

use strict;
use warnings;

use parent qw{ Astro::App::Satpass2::ParseTime };

use Astro::App::Satpass2::Utils qw{
    back_end
    load_package
    __date_manip_backend
    __parse_class_and_args
    @CARP_NOT
};
use Astro::Coord::ECI::Utils 0.112 qw{ greg_time_gm };

our $VERSION = '0.057';

sub __class_name {
    return __PACKAGE__;
}

sub attribute_names {
    my ( $self ) = @_;
    return ( $self->SUPER::attribute_names(), qw{ back_end station } );
}

sub delegate {
    my $back_end;
    defined ( $back_end = __date_manip_backend() )
	or return $back_end;
    return __PACKAGE__ . "::v$back_end";
}

{
    my $epoch_offset = greg_time_gm( 0, 0, 0, 1, 0, 1970 );

    sub __epoch_offset {
	return $epoch_offset;
    }
}

sub station {
    my ( $self, @args ) = @_;
    if ( @args > 0 ) {
	not defined $args[0]
	    or $args[0]->isa( 'Astro::Coord::ECI' )
	    or $self->wail( 'Station must be an Astro::Coord::ECI' );
	$self->{station} = $args[0];
	$self->__set_back_end_location( $args[0] );
	return $self;
    }
    return $self->{station};
}

sub __back_end_default {
    my ( undef, $cls ) = @_;
    return defined $cls ? $cls : 'Date::Manip::Date';
}

sub __back_end_validate {
    my ( $self, $cls ) = @_;
    $cls->isa( 'Date::Manip::Date' )
	or $self->wail( "$cls is not a Date::Manip::Date" );
    return;
}

1;

__END__

=head1 NAME

Astro::App::Satpass2::ParseTime::Date::Manip - Parse time for Astro::App::Satpass2 using Date::Manip

=head1 SYNOPSIS

 my $delegate = Astro::App::Satpass2::ParseTime::Date::Manip->delegate();

=head1 DETAILS

This class is simply a trampoline for
L<< Astro::App::Satpass2::ParseTime->new()|Astro::App::Satpass2::ParseTime/new >> to
determine which Date::Manip class to use.



( run in 0.973 second using v1.01-cache-2.11-cpan-98e64b0badf )