Hebrew calendar software creators: can you notify this list when updating the calendar?

Hebrew calendar software creators: can you notify this list when updating the calendar?

Shlomi Fish shlomif at iglu.org.il
Thu Apr 15 10:54:03 IDT 2010


Hi Kobi,

some comments on your Perl code:

On Thursday 15 Apr 2010 07:22:31 kobi zamir wrote:
> > 3. Is there a way to semi automatically create the non regular dates,
> > such as the postponed date of the holocaust day?  Is there a known
> > authoritative sites to pick these dates from?
> 
> there are some fully automated ways :-) :
> I. the command line hdate:
> hdate -H 2010
> will print all the holidays for the year 2010
> 
> II. a python/perl script using libhdate will generate a list of holidays:
> an example of such a python script is attached in earlier post in this
> discussion. here is a perl example:
> 
> # apt-get install libhdate-perl
> #-------------------------------------------
> 

Always add "use strict;" and "use warnings;" at the beginning of the file, 
after the shabang. Then fix all the errors that they report.

> use hdate;
> 

I realise it's probably too late to change it, but Perl module names should 
start with a capital letter - not with a lowercase ones. Modules that start 
with a lowercase letters are pragmas. 

> $h = hdatec::new_Hdate();
> 

Why does "use hdate" import the "hdatec::" namespace? This is inconsistent.

> hdatec::Hdate_set_gdate($h,1,1,2010);
> 

This would better be written as:

{{{
$h->set_gdate(1,1,2010);
}}}

It won't work in this case, but could be food for thought for a future 
release.

> $julian = hdatec::Hdate_get_julian($h);
> 
> for($i = 0; $i < 365; $i++) {
> 	hdatec::Hdate_set_jd($h, $julian + $i);
> 
> 	$day = hdatec::Hdate_get_gday($h);
> 	$month = hdatec::Hdate_get_gmonth($h);
> 	$holyday = hdatec::Hdate_get_holyday_string($h, 1);
> 
> 	if ($holyday) {

English nit: it's "holiday" - not "holyday".

> 		print $day . "/" . $month . " " . $holyday . "\n";

This is better done using interpolation:

[code]
print "$day/$month $holiday\n";
[/code]

In the general case one should be careful not to introduce code/markup 
injections:

http://community.livejournal.com/shlomif_tech/35301.html

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .



More information about the Linux-il mailing list