DateTime::Event::Klingon - Determine events of Klingon cultural significance


DateTime-Event-Klingon documentation Contained in the DateTime-Event-Klingon distribution.

Index


Code Index:

NAME

Top

DateTime::Event::Klingon - Determine events of Klingon cultural significance

VERSION

Top

Version 1.0

SYNOPSIS

Top

    use DateTime;
    use DateTime::Event::Klingon qw/Heghlu'meH QaQ jajvam'a'/;

    my $dt = DateTime->now;
    print 'Today ', Heghlu'meH QaQ jajvam'a'($dt) ? 'is' : 'is not', 
        " a good day to die!\n";  

DESCRIPTION

Top

Use this module to determine dates and times with special significance to the Star Trek universe's Klingons.

Function names are given in tlhIngan Hol. No functions are exported by default.

FUNCTIONS

Top

Heghlu'meH QaQ jajvam'a' ($dt)

Is today a good day to die? Given a DateTime object, this function will return true if it is and false if it is not.

AUTHOR

Top

Jaldhar H. Vyas, <jaldhar at braincells.com>

BUGS

Top

Please report any other bugs or feature requests to bug-datetime-event-klingon at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DateTime-Event-Klingon. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc DateTime::Event::Klingon

You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTime-Event-Klingon

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/DateTime-Event-Klingon

* CPAN Ratings

http://cpanratings.perl.org/d/DateTime-Event-Klingon

* Search CPAN

http://search.cpan.org/dist/DateTime-Event-Klingon

SEE ALSO

Top

DateTime

COPYRIGHT & LICENSE

Top


DateTime-Event-Klingon documentation Contained in the DateTime-Event-Klingon distribution.
# $Id: /svn/DateTime-Event-Klingon/tags/VERSION_1_0_1/lib/DateTime/Event/Klingon.pm 323 2008-04-01T06:37:25.246199Z jaldhar  $
package DateTime::Event::Klingon;

use warnings;
use strict;
use Carp qw/croak/;
use Filter::Util::Call;
use UNIVERSAL qw/isa/;

our $VERSION = '1.0';

sub import {
    my ( $self, @args ) = @_;

    my $joinedargs = join q{ }, @args;
    if ( $joinedargs =~ /Heghlu'meH\ QaQ\ jajvam'a'/mx ) {
        {
            no strict 'refs';
            my $caller = caller;

            *{"${caller}::_heghlu_meh_qaq_jajvam_a_"}
                = \&{'_heghlu_meh_qaq_jajvam_a_'};
        }

        return filter_add(
            sub {
                my $count = 0;
                my $status;
                my $data = q{};
                while ( $status = filter_read() ) {
                    if ( $status < 0 ) {
                        return $status;
                    }
                    if ( $status == 0 ) {
                        last;
                    }
                    $data .= $_;
                    $count++;
                    $_ = q{};
                }
                if ( $count == 0 ) {
                    return 0;
                }
                $_ = $data;
                s{ Heghlu'meH\ QaQ\ jajvam'a'(\s*\() }
                                  { _heghlu_meh_qaq_jajvam_a_$1  }gmx;
                return $count;
            }
        );
    }
}

sub _heghlu_meh_qaq_jajvam_a_ {
    my ($dt) = @_;

    if ( !isa( $dt, 'DateTime' ) ) {
        croak q{Hab SoSlI' Quch!};
    }
    return 1;
}

1;    # End of DateTime::Event::Klingon