HTTP::Date parse_date problem

Discussion in 'Perl Misc' started by Paul Tomlinson, Dec 8, 2003.

  1. use HTTP::Date
    .....
    my ($year, $month, $day, $hour, $min, $sec, $tz) = parse_date(time2str());

    why doesn't this work???

    It's driving me mad, does this look like valid perl?
     
    Paul Tomlinson, Dec 8, 2003
    #1
    1. Advertising

  2. Paul Tomlinson <> wrote:
    > use HTTP::Date
    > ....
    > my ($year, $month, $day, $hour, $min, $sec, $tz) = parse_date(time2str());
    >
    > why doesn't this work???


    Note how the HTTP::Date documentation says: "Only the first two
    functions, time2str() and str2time(), are exported by default."

    So:
    my (...) = HTTP::Date::parse_date(time2str());

    or
    use HTTP::Date qw(parse_date time2str);
    my (...) = parse_date(time2str());


    --
    Glenn Jackman
    NCF Sysadmin
     
    Glenn Jackman, Dec 8, 2003
    #2
    1. Advertising

  3. John J. Trammell, Dec 8, 2003
    #3
  4. Glenn Jackman <> wrote:
    > Note how the HTTP::Date documentation says: "Only the first two
    > functions, time2str() and str2time(), are exported by default."
    >
    > use HTTP::Date qw(parse_date time2str);


    Upon reflection, this would be preferable:

    use HTTP::Date qw:)DEFAULT parse_date);


    --
    Glenn Jackman
    NCF Sysadmin
     
    Glenn Jackman, Dec 8, 2003
    #4
  5. Paul Tomlinson

    John Strauss Guest

    On Mon, 8 Dec 2003 15:24:08 -0000
    "Paul Tomlinson" <> wrote:
    >
    > use HTTP::Date
    > ....
    > my ($year, $month, $day, $hour, $min, $sec, $tz) = parse_date(time2str());
    >
    > why doesn't this work???
    >
    > It's driving me mad, does this look like valid perl?
    >
    >


    apart from the missing semicolon on the "use HTTP::Date" line,
    it looks like valid perl.

    otherwise the HTTP::Date docs state that parse_date() is not
    exported by default. try HTTP::Date::parse_date instead.




    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drop the .thetenant to get me via mail
     
    John Strauss, Dec 8, 2003
    #5
  6. Paul Tomlinson wrote:
    > use HTTP::Date
    > ....
    > my ($year, $month, $day, $hour, $min, $sec, $tz)
    > = parse_date(time2str());
    >
    > why doesn't this work???


    Why did you post the question without letting us know which error
    message it results in??

    When testing it I got:
    "Undefined subroutine &main::parse_date called at ..."

    So, I checked the documentation... The rest is explained in Mothra's
    message.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Dec 8, 2003
    #6
  7. Paul Tomlinson

    Mothra Guest

    Hi Paul,

    "Paul Tomlinson" <> wrote in message
    news:br252p$27h7op$-berlin.de...
    > use HTTP::Date
    > ....
    > my ($year, $month, $day, $hour, $min, $sec, $tz) = parse_date(time2str());
    >
    > why doesn't this work???
    >
    > It's driving me mad, does this look like valid perl?

    yep! it is valid perl :)
    after checking the docs for this I found

    This module provides functions that deal the date formats used by the
    HTTP protocol (and then some more). Only the first two functions,
    time2str() and str2time(), are exported by default.

    So, you need to do something like
    use HTTP::Date qw(parse_date time2str);

    hope this helps

    Mothra
     
    Mothra, Dec 8, 2003
    #7
  8. Paul Tomlinson

    Mothra Guest

    Hi Glenn,

    [snipped]

    > Upon reflection, this would be preferable:
    >
    > use HTTP::Date qw:)DEFAULT parse_date);

    yep!! Thats better than my answer :)
    Cool

    Mothra
     
    Mothra, Dec 8, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    645
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,361
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    565
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    754
    Richard Heathfield
    Nov 8, 2003
  5. Matt
    Replies:
    11
    Views:
    425
    Aaron Bertrand [MVP]
    Nov 8, 2003
Loading...

Share This Page