DateTime::Format::Baby - Parse and format baby-style time


DateTime-Format-Baby documentation  | view source Contained in the DateTime-Format-Baby distribution.

Index


NAME

Top

DateTime::Format::Baby - Parse and format baby-style time

SYNOPSIS

Top

  use DateTime::Format::Baby;

  my $Baby = DateTime::Format::Baby->new('en');
  my $dt = $Baby->parse_datetime('The big hand is on the twelve and the little hand is on the six.');

  $Baby->language('fr');

  # La grande aiguille est sur le douze et la petite aiguille est sur le six>
  $Baby->format_datetime($dt);

DESCRIPTION

Top

This module understands baby talk in a variety of languages.

METHODS

Top

This class offers the following methods.

* parse_datetime($string)

Given baby talk, this method will return a new DateTime object.

For some languages (en de, es, fr and it) parsing uses a regexp on various synonyms for 'big' and 'little'. For all other languages, the module only understands the same phrase that it would give using format_datetime().

If given baby talk that it can't parse, this method may either die or get confused. Don't try things like "The big and little hands are on the six and five, respectively."

* format_datetime($datetime)

Given a DateTime object, this methods returns baby talk. Remember though that babies only understand time (even then, without am/pm)

* language($language)

When given a language, this method sets its language appropriately.

This method returns the current language. (After processing as above)

* languages()

This method return a list of known languages.

SUPPORT

Top

Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.

NOTE

Top

Baby talk does not implement years, months, days or even AM/PM. It's more for amusement than anything else.

AUTHOR

Top

Rick Measham <rickm@cpan.org> (BigLug on PerlMonks)

This code is a DateTime version of Acme::Time::Baby (copyright 2002 by Abigail) with the ability to parse strings added by Rick Measham.

CONTRIBUTIONS

Top

Abigail's original module contained a language list that is plagarised here. See the documentation for Acme::Time::Baby for language acknowledgements.

If you have additional language data for this module, please also pass it on to Abigail. This module is not meant to replace the original. Rather it is a DateTime port of that module.

COPYRIGHT

Top

SEE ALSO

Top

Acme::Time::Baby

datetime@perl.org mailing list

http://datetime.perl.org/


DateTime-Format-Baby documentation  | view source Contained in the DateTime-Format-Baby distribution.