i am sorry Steve...actually I miswrote DateTime instead of DateManip...

i saw your code using DateTime but I before I posted this, I was trying
using DateManip...but while testing the code, I found out that DateManip is
not installed...

i tried executing your code as well but even DateTime is not installed in my
Linux box..

while trying to install both DateTime and DateManip in my machine, it is
giving some network error..."Url not found..."

need to figure out a way to install them..

On Tue, Aug 18, 2009 at 11:22 PM, Steve Bertrand <st...@ibctech.ca> wrote:

> Mihir Kamdar wrote:
> > thanks all.....and how will be the code like for my requirement if i use
> > DateTime...
>
> I truly thought that you might have attempted to try the complete
> cut/paste-able program I wrote and made slight changes to fit your
> "requirement". Even if not, at least testing it would have been nice.
>
> The code I gave you earlier is put verbatim below, with additional
> functions.
>
>
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use DateTime::Format::Strptime;
>
> my $EXTRACTION_LAYOUT = '@16 A1 @40 A9';
>
> VOUCHER_RECORD:
>
> while ( my $record = <DATA> ) {
>
>    my ( $important_num, $date_string )
>        = unpack $EXTRACTION_LAYOUT, $record;
>
>    next VOUCHER_RECORD if $important_num != 2;
>
>    my $static_date = DateTime->new(
>                        year => 2009,
>                        month => 3,
>                        day => 31
>                        );
>
>
>    # turn the extracted date string into a DateTime object
>
>    my $date_formatter
>        = new DateTime::Format::Strptime( pattern => '%d-%b-%y' );
>
>    my $voucher_date
>        = $date_formatter->parse_datetime($date_string);
>
>
>    # compare the DateTime compiled dates
>
>    if ( DateTime->compare( $static_date, $voucher_date )) {
>
>        # - put your record/store functions code in this space.
>        # - depending on what you want to do, these comments
>        #   are within the code block that ensures that your 2nd
>        #   field is equal to '2', and that the 5th field is less
>        #   than Mar 31, 2009
>
>        # - depending on how you want to "store" the information,
>        #   I might suggest http://perldoc.perl.org/Storable.html
>    }
> }
>
> __END__
>
> Please at least copy/paste my code and try it if you've been able to
> install DateTime. Use the example in my earlier post, as it also
> contains the data which is properly formatted.
>
> To be bluntly honest, I'm quite proud of my tiny code snip. I had to
> research/try the patterns for DateTime to get them right, and counted
> with my finger to position the layout properly.
>
> ...I am completely flabbergasted with your response.
>
> See kids, the post I am responding to is not proper list etiquette!
>
> Steve
>

Reply via email to