Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.541.190 Times

DateTime::Format::Builder::Tutorial 0.7807

  Date Added: August 21, 2010  |  Visits: 701


Report Broken Link
Printer Friendly Version

Product Homepage
Download (77 downloads)

DateTime::Format::Builder::Tutorial is a quick class on using Builder. CREATING A CLASS As most people who are writing modules know, you start a package with a package declaration and some indication of module version: package DateTime::Format::ICal; our $VERSION = 0.04; After that, you call Builder with some options. There are only a few (detailed later). Right now, were only interested in parsers. use DateTime::Format::Builder ( parsers => { ... } ); The parsers option takes a reference to a hash of method names and specifications: parsers => { parse_datetime => ... , parse_datetime_with_timezone => ... , ... } Builder will create methods in your class, each method being a parser that follows the given specifications. It is strongly recommended that one method is called parse_datetime, be it a Builder created method or one of your own. In addition to creating any of the parser methods it also creates a new() method that can instantiate (or clone) objects of this class. This behaviour can be modified with the constructor option, but we dont need to know that yet. Each value corresponding to a method name in the parsers list is either a single specification, or a list of specifications. Well start with the simple case. parse_briefdate => { params => [ qw( year month day ) ], regex => qr/^(dddd)(dd)(dd)$/, }, This will result in a method named parse_briefdate which will take strings in the form 20040716 and return DateTime objects representing that date. A user of the class might write: use DateTime::Format::ICal; my $date = "19790716"; my $dt = DateTime::Format::ICal->parse_briefdate( $date ); print "My birth month is ", $dt->month_name, "n"; The regex is applied to the input string, and if it matches, then $1, $2, ... are mapped to the params given and handed to DateTime->new(). Essentially: my $rv = DateTime->new( year => $1, month => $2, day => $3 ); There are more complicated things one can do within a single specification, but well cover those later. Often, youll want a method to be able to take one string, and run it against multiple parser specifications. It would be very irritating if the user had to work out what format the datetime string was in and then which method was most appropriate. So, Builder lets you specify multiple specifications: parse_datetime => [ { params => [ qw( year month day hour minute second ) ], regex => qr/^(dddd)(dd)(dd)T(dd)(dd)(dd)$/, }, { params => [ qw( year month day hour minute ) ], regex => qr/^(dddd)(dd)(dd)T(dd)(dd)$/, }, { params => [ qw( year month day hour ) ], regex => qr/^(dddd)(dd)(dd)T(dd)$/, }, { params => [ qw( year month day ) ], regex => qr/^(dddd)(dd)(dd)$/, }, ], Its an arrayref of specifications. A parser will be created that will try each of these specifications sequentially, in the order you specified..

Requirements: No special requirements
Platforms: Linux
Keyword: Class Datetime Datetimeformatbuildertutorial Dd Ical Libraries Method Month Month Day Parse Programming Year Year Month Day
Users rating: 0/10

License: Freeware Size: 48.13 KB
More Reviews or Write Review

Libraries  -  iCal::Parser 1.14
iCal::Parser is a Perl module to parse iCalendar files into a data structure. SYNOPSIS use iCal::Parser my $parser=iCal::Parser->new(); my $hash=$parser->parse($file); $parser->parse($another_file); my $combined=$parser->calendar; my...
28.67 KB  
Miscellaneous  -  Class with default method handler 1.0
This script is a class whose objects can handle undefined method calls, passing them on to a default handler.
Development Tools  -  xmlParser for XML Tools 1.1
Class w/examples to provide a method to easily extract data from XML files
10 KB  
Libraries  -  DateTime::Cron::Simple 0.2
DateTime::Cron::Simple is a Perl module that can parse a cron entry and check against current time. SYNOPSIS use DateTime::Cron::Simple; $c = DateTime::Cron::Simple->new($cron); $boolean = $c->validate_time; $c->new_cron($cron); This...
3.07 KB  
Miscellaneous  -  Simple Singleton 1.0
This script is an implementation of the singleton without using the __new__ class but by implementing the __call__ method in the metaclass.
Information Lookup  -  MB Personal Numerology 1.0
MB Personal Numerology Software is a wonderful numerology tool that lets you know your personal numerology numbers including your personal day number, personal month number and also your personal year number. Apart from telling you these personal...
MS Office Add-Ins  -  Excel Calendar Template 1.3
This free Excel calendar template allows you to quickly and easily create a monthly calendar by simply choosing a year and month. You can also choose a color scheme for your calendar using simple form controls. Use this Excel calendar spreadsheet...
60 KB  
MS Office Add-Ins  -  SMTP/POP3 Email Engine for Delphi 5.0
This free Excel calendar template allows you to quickly and easily create a monthly calendar by simply choosing a year and month. You can also choose a color scheme for your calendar using simple form controls. Use this Excel calendar spreadsheet...
60 KB  
Calendars & Scheduling Tools  -  VICalendar 1.0
- select any date - press a long vertical button at right side to open / close an edit window - enter a note for selected date - all dates with note will be shown bold - press OK to save all notes to archive file - next time when you start...
Programming  -  cbear
The 'cbear' framework is a set of libraries and common utilities for different programming languages and platforms.
675.81 KB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB  
Libraries  -  App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>...
54.27 KB