Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made example scripts UTF8 compliant

  • Loading branch information...
commit af8fb3912f891b1d1b16e48d807b5930087033e1 1 parent 89e57b6
@mschmitt mschmitt authored
Showing with 16 additions and 10 deletions.
  1. +7 −4 example/feiertage.pl
  2. +9 −6 example/werktage-diff.pl
View
11 example/feiertage.pl
@@ -1,15 +1,18 @@
#!/usr/bin/perl -w
use strict;
use warnings;
+use utf8;
use Date::Holidays::DE qw(holidays);
+binmode STDOUT, ":utf8";
+
# Sample script for Date::Holidays::DE by Martin Schmitt <mas at scsy dot de>
# Assign full names to the internal aliases from Date::Holidays::DE
# See the manpage for a list of all aliases.
my %feiertagsnamen = (
'neuj' => 'Neujahrstag',
- 'hl3k' => 'Hl. 3 Könige',
+ 'hl3k' => 'Hl. 3 Könige',
'romo' => 'Rosenmontag',
'fadi' => 'Faschingsdienstag',
'karf' => 'Karfreitag',
@@ -20,11 +23,11 @@
'himm' => 'Himmelfahrtstag',
'fron' => 'Fronleichnam',
'1mai' => 'Maifeiertag',
- 'mari' => 'Mariä Himmelfahrt',
+ 'mari' => 'Mariä Himmelfahrt',
'3okt' => 'Tag der deutschen Einheit',
'refo' => 'Reformationstag',
'alhe' => 'Allerheiligen',
- 'buss' => 'Buß- und Bettag',
+ 'buss' => 'Buß- und Bettag',
'heil' => 'Heiligabend',
'wei1' => '1. Weihnachtstag',
'wei2' => '2. Weihnachtstag',
@@ -42,7 +45,7 @@
YEAR => $naechstes
)};
-print "Feiertage für $naechstes:\n";
+print "Feiertage für $naechstes:\n";
print "-------------------\n";
foreach (@feiertage){
View
15 example/werktage-diff.pl
@@ -1,9 +1,12 @@
#!/usr/bin/perl -w
use strict;
use warnings;
+use utf8;
use Date::Holidays::DE qw(holidays);
use Date::Business;
+binmode STDOUT, ":utf8";
+
# Sample script for integration of Date::Holidays::DE with Date::Business
# Script by Martin Schmitt <mas at scsy dot de>
@@ -11,9 +14,9 @@
# Calculate the difference between two dates using three different
# methods from Date::Business
-my $startdate = "20030414"; # Monday before Easter 2003
-my $enddate = "20030428"; # Monday after Easter monday 2003
-my $year = "2003"; # Not particularly elaborate, but okay for now
+my $startdate = "20100329"; # Monday before Easter 2010
+my $enddate = "20100412"; # Monday after Easter monday 2010
+my $year = "2010"; # Not particularly elaborate, but okay for now
print "Abstand zwischen $startdate und $enddate...\n";
@@ -23,7 +26,7 @@
my $start1 = new Date::Business(DATE => $startdate);
my $end1 = new Date::Business(DATE => $enddate);
my $diff1 = $end1->diff($start1);
-print "$diff1 Tage (Wochenenden und Feiertage unberücksichtigt)\n";
+print "$diff1 Tage (Wochenenden und Feiertage unberücksichtigt)\n";
# 2. Excluding weekends (Should be 10 days difference)
#
@@ -31,7 +34,7 @@
my $start2 = new Date::Business(DATE => $startdate);
my $end2 = new Date::Business(DATE => $enddate);
my $diff2 = $end2->diffb($start2);
-print "$diff2 Tage (Wochenenden berücksichtigt, Feiertage unberücksichtigt)\n";
+print "$diff2 Tage (Wochenenden berücksichtigt, Feiertage unberücksichtigt)\n";
# 3. Excluding weekends and holidays (Should be 8 days difference)
#
@@ -56,6 +59,6 @@ sub business_holiday{
my $end3 = new Date::Business(DATE => $enddate,
HOLIDAY => \&business_holiday);
my $diff3 = $end3->diffb($start3);
-print "$diff3 Tage (Wochenenden und Feiertage berücksichtigt)\n";
+print "$diff3 Tage (Wochenenden und Feiertage berücksichtigt)\n";
exit 0;
Please sign in to comment.
Something went wrong with that request. Please try again.