Date-HolidayParser

 view release on metacpan or  search on metacpan

lib/Date/HolidayParser/iCalendar.pm  view on Meta::CPAN

	my $PosixYear = shift;
	my $name = shift;
	$name =~ s/\s/-/g;

	my $unixtime = POSIX::mktime(0, 0, 0, $FinalYDay, 0, $PosixYear);

	# Generate the UID of the event, this is simply a 
	my $sum = unpack('%32C*', $name);
	# This should be unique enough for our needs.
	# We don't want it to be random, because if someone copies the events to their
	# own calendar, we want DP::iCalendar::Manager to fetch the information from
	# the changed calendar, instead of from the HolidayParser object.
	my $UID = 'D-HP-ICS-'.$FinalYDay.'-'.$PosixYear.'-'.$sum;
	
	$self->_UID_List->{$UID} = {
		UID => $UID,
		DTSTART => iCal_ConvertFromUnixTime($unixtime),
		DTEND => iCal_ConvertFromUnixTime($unixtime+86390), # Yes, this is purposefully not 86400
		SUMMARY => $name,
	};
	return($UID);
}



( run in 0.389 second using v1.01-cache-2.11-cpan-5dc5da66d9d )