|
Data::Faker::DateTime - Data::Faker plugin |
Data::Faker::DateTime - Data::Faker plugin
Perl passes this through to the strftime function of your system library, so it is possible that some of the formatting tokens used here will not work on your system.
my $faker = Data::Faker->new();
print join(' ',$faker->month,$faker->dayofmonth)."\n";
This is bad because you might end up with 'February 31' for example. Instead you should use the timestr utility function to provide you a formatted time for a valid date, or better still, write a plugin function that does it:
my $faker = Data::Faker->new(); print $faker->my_short_date()."\n";
package Data::Faker::MyExtras;
use base qw(Data::Faker);
use Data::Faker::DateTime;
__PACKAGE__->register_plugin(
my_short_date => sub { Data::Faker::DateTime::timestr('%M %e') },
);
Jason Kohles, <email@jasonkohles.com>
Copyright 2004-2005 by Jason Kohles
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
Data::Faker::DateTime - Data::Faker plugin |