Subject: | Object-oriented checks in DT::E::Sunrise, contents of documentation |
It would be nice if you add a paragraph to your module's
documentation: what happens beyond the polar circle?
Does the module croak? Does the module return undef?
How should the module user code the script?
Other minor changes are included in the attached
diff file.
Jean Forget
--- /home/p80/modules/DateTime-Event-Sunrise-0.0501/lib/DateTime/Event/Sunrise.pm Wed Mar 31 17:18:45 2004
+++ /var/tmp/DateTime/Event/Sunrise.new Fri Sep 10 07:16:48 2004
@@ -126,7 +126,7 @@
my $dt = shift;
my $class = ref($dt);
- if ( $class ne 'DateTime' ) {
+ if ( ! $dt->isa('DateTime') ) {
croak("Dates need to be DateTime objects");
}
my ( undef, $tmp_set ) = _sunrise( $self, $dt );
@@ -158,7 +158,7 @@
my $dt = shift;
my $class = ref($dt);
- if ( $class ne 'DateTime' ) {
+ if ( ! $dt->isa('DateTime') ) {
croak("Dates need to be DateTime objects");
}
my ( $tmp_rise, undef ) = _sunrise( $self, $dt );
@@ -190,7 +190,7 @@
my $dt = shift;
my $class = ref($dt);
- if ( $class ne 'DateTime' ) {
+ if ( ! $dt->isa('DateTime') ) {
croak("Dates need to be DateTime objects");
}
my ( $tmp_rise, $tmp_set ) = _sunrise( $self, $dt );
@@ -297,7 +297,7 @@
my $self = shift;
my $dt = shift;
croak( "Dates need to be DateTime objects (" . ref($dt) . ")" )
- unless ( ref($dt) eq 'DateTime' );
+ unless ( $dt->isa('DateTime') );
my ( undef, $tmp_set ) = _sunrise( $self, $dt );
return $tmp_set if $tmp_set > $dt;
my $d = DateTime::Duration->new(
@@ -827,6 +827,9 @@
return ( $seconds_rise, $seconds_set );
}
+1;
+__END__
+
=head1 NAME
DateTime::Event::Sunrise - Perl DateTime extension for computing the sunrise/sunset on a given day
@@ -1107,6 +1110,6 @@
DateTime::SpanSet documentation
-=cut
-1;
+Paul Schlyter's page at http://home.tiscali.se/pausch/english.html
+=cut