App-Chart

 view release on metacpan or  search on metacpan

lib/App/Chart/TZ.pm  view on Meta::CPAN


#------------------------------------------------------------------------------

my @sympred_timezone_list = ();

sub for_symbol {
  my ($class, $symbol) = @_;
  if ($symbol) {
    App::Chart::symbol_setups ($symbol);
    foreach my $elem (@sympred_timezone_list) {
      if ($elem->[0]->match ($symbol)) {
        return $elem->[1];
      }
    }
  }
  return $class->loco;
}

sub setup_for_symbol {
  my ($timezone, $sympred) = @_;
  push @sympred_timezone_list, [$sympred,$timezone];
}


#------------------------------------------------------------------------------

1;
__END__

=for stopwords TZs

=head1 NAME

App::Chart::TZ -- timezone object

=head1 SYNOPSIS

 use App::Chart::TZ;
 my $timezone = App::Chart::TZ->new (name => 'Some Where',
                                     choose => [ 'abc','def', ]);

 print $timezone->name(),"\n";

=head1 DESCRIPTION

A C<App::Chart::TZ> object represents a certain timezone.  It has a
place name and is implemented as a C<TZ> environment variable setting to be
used, with a set of TZs to try.

Stock and commodity symbols have an associated timezones, setup by their
handler code and then looked up here.

=head1 FUNCTIONS

=over 4

=cut

=item App::Chart::TZ::validate ($obj)

Check that C<$obj> is a C<App::Chart::TZ> object, throw an error if
not.

=item C<< App::Chart::TZ->loco >>

Return a timezone object representing the local timezone (which means
leaving C<TZ> at its initial setting).

=item C<< App::Chart::TZ->chicago >>

=item C<< App::Chart::TZ->london >>

=item C<< App::Chart::TZ->newyork >>

=item C<< App::Chart::TZ->sydney >>

=item C<< App::Chart::TZ->tokyo >>

Timezone objects for these respective places.

=back

=head1 TIMEZONES FOR SYMBOLS

=over 4

=item App::Chart::TZ->for_symbol ($symbol)

Return the timezone associated with C<$symbol>.

=item $timezone->setup_for_symbol ($sympred)

Record C<$timezone> as the timezone for symbols matched by the
C<App::Chart::Sympred> object C<$sympred>.

=back



( run in 0.618 second using v1.01-cache-2.11-cpan-39bf76dae61 )