Astro-WaveBand
view release on metacpan or search on metacpan
lib/Astro/WaveBand.pm view on Meta::CPAN
# Register an Astro::WaveBand warning category
use warnings::register;
# CVS version: $Revision$
our $VERSION = '0.12';
# Overloading
use overload
'""' => "natural",
'==' => "equals",
'!=' => "not_equals",
'<=>' => "compare",
'fallback' => 1;
# Constants
# Speed of light in m/s
use constant CLIGHT => 299792458;
# list of instruments specific to a telescope
my %TELESCOPE = (
lib/Astro/WaveBand.pm view on Meta::CPAN
if (defined($self->instrument) && defined($comp->instrument)) {
return (($self->natural eq $comp->natural)
&& ($self->instrument eq $comp->instrument));
}
else {
return ($self->natural eq $comp->natural);
}
}
=item B<not_equals>
Compares two C<Astro::WaveBand> objects for inequality.
if ($wb1->not_equals($wb2)) {...}
This method will return 1 if, in the above example, either the
C<natural> method or the C<instrument> method return different
values. If the instrument is undefined for either object, then
the C<natural> method will be used.
This method is overloaded using the != operator, so
if ($wb1 != $wb2) {...}
is functionally the same as the first example.
=cut
sub not_equals {
my $self = shift;
my $comp = shift;
if (!defined($self->instrument) || !defined($comp->instrument)) {
return ($self->natural ne $comp->natural);
}
else {
return (($self->natural ne $comp->natural)
|| ($self->instrument ne $comp->instrument));
}
( run in 2.094 seconds using v1.01-cache-2.11-cpan-0a987023a57 )