rakheek has asked for the wisdom of the Perl Monks concerning the following question:

Hi Wise and helpful monks, I am trying to use Date::Calc mainly for check_date and Add_Delta_Days functions. Should I use use Date::Calc qw(all); Please advise, Regards, Rakhee
  • Comment on How do I use date::calc in a efficient way

Replies are listed 'Best First'.
Re: How do I use date::calc in a efficient way
by Your Mother (Archbishop) on Apr 13, 2010 at 18:29 UTC

    In addition to toolic's fine advice sometimes I like to fully qualify the calls; exporting nothing. Especially where the module is used in a single point in a longish bit of code. Saves a trip/grep around. So-

    use Date::Calc (); # 500 lines of unrelated fun. my @what_what = Date::Calc::Today_and_Now();

    (update, added comment, fixed typo.)

Re: How do I use date::calc in a efficient way
by toolic (Bishop) on Apr 13, 2010 at 17:58 UTC
    If you do not care about namespace collisions, you can just use the :all tag to import all symbols:
    use Date::Calc qw(:all);

    Generally, it is better practice to only import the functions you need:

    use Date::Calc qw(check_date Add_Delta_Days);
      Thank you Monk. That was exactly what I was looking for. I will import only the functions I need. Regards, Rakhee