Comments on: How I pass parameters to my programs in perl http://www.imaginarybillboards.com/?p=42 Imagined things Tue, 11 Aug 2009 12:46:59 +0000 hourly 1 https://wordpress.org/?v=6.0.9 By: admin http://www.imaginarybillboards.com/?p=42&cpage=1#comment-3 Tue, 11 Aug 2009 12:46:59 +0000 http://www.imaginarybillboards.com/?p=42#comment-3 Two reasons, neither good.

1- Was just lazy and copied the code from the calling cron job.
2- Didn’t know about most of those, and now I do, and will probably switch to one of them really soon.

Thanks, this is helpful!

]]>
By: Chas. Owens http://www.imaginarybillboards.com/?p=42&cpage=1#comment-2 Tue, 11 Aug 2009 05:12:13 +0000 http://www.imaginarybillboards.com/?p=42#comment-2 Your code leaves me with 3 questions:

1. why shell out to the date command (making the script slower and less portable) when we have localtime and POSIX::strftime?
2. why are you escaping %? (it doesn’t interpolate)?
3. why use a non-standard date option to get yesterday?

What is so wrong with

    my $today = DateTime->now->ymd;

or

    use POSIX qw/strftime/;
    my $today = strftime “%Y-%m-%d”, localtime;

and

    my $yesterday = DateTime->now->subtract( days => 1 )->ymd;

or

    $ENV{TZ} = “EST+28”;
    my $yesterday = strftime(“%Y-%m-%d”, localtime), “\n”;

]]>