http://www.perlmonks.org?node_id=770576

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

Dear monks,

my $date = Date::Indian->new( ymd => '2009:6:11', tz => '5:30', locn => '78:18 17:12' );

I am calling new function in Date::Indian module. As of my knowledge, I understand from the variable name, the third argument of the function mentioning location. Please correct me, if my understand is wrong.

Also explain me, How the value is given for this argument?. For example, the value for tz is based on timezone. Similarly how it is given for this variable?.

Replies are listed 'Best First'.
Re: Date::Indian module
by afoken (Chancellor) on Jun 11, 2009 at 11:40 UTC

    I was tempted to write "RTFM", but in this case, the FM is not very fine. I guess that locn is latitude and longitude, as stated in a comment in the source:

    locn  => undef,   # ex: locn  =>'82:30E 17:25N'

    Reading the source is somewhat frightening. It contains at three undocumented packages without a reasonable prefix (Sun, Moon, Util), and its full of magic numbers without any explaining comment. There are lots of debugging artefacts. It completely lacks any sanity checks, and at least the example in the comment cited above is wrong. Looking at the code of sub _dolocn, the locn should not contain letters.

    You should better treat Date::Indian as pre-alpha code, i.e. avoid it for production use.

    You could try to contact the author, but I would not hope for an answer. His last upload is dated "27 Aug 2003".

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Date::Indian module
by syphilis (Archbishop) on Jun 11, 2009 at 12:07 UTC
Re: Date::Indian module
by jaldhar (Vicar) on Jun 11, 2009 at 17:43 UTC

    This module is a huge mess. How bad is it? Even the name is wrong. It doesn't deal with "Indian dates" but a particular kind of luni-solar calendar which only one of the several traditionally used in India. And even then it only gives you the basic numbers you need to actually calculate the date. One of these days I will actually release DateTime::Calendar::Indic to CPAN and working with various traditional Indian calendars will be much easier. In the meantime, if you really want to use this module, you call the constructor like this:

    my $date = Date::Indian->new( ymd => "YYYY-MM-DD", # month = 1-12 tz => 'HH:MM', # time offset from +Greenwich. Negative if West of Greenwich locn => 'HH:MMD HH:MMD', # longitude and latitude, D = + E or W for longitude and N or S for latitude );

    --
    જલધર

A reply falls below the community's threshold of quality. You may see it by logging in.