/usr/share/perl5/Date/Manip/DM6.pm is in libdate-manip-perl 6.57-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | package Date::Manip::DM6;
# Copyright (c) 1995-2016 Sullivan Beck. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
###########################################################################
###########################################################################
our (@ISA,@EXPORT);
require 5.010000;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
DateManipVersion
Date_Init
ParseDate
ParseDateString
ParseDateDelta
ParseDateFormat
ParseRecur
Date_IsHoliday
Date_IsWorkDay
Date_Cmp
DateCalc
UnixDate
Delta_Format
Date_GetPrev
Date_GetNext
Date_SetTime
Date_SetDateField
Events_List
Date_NextWorkDay
Date_PrevWorkDay
Date_NearestWorkDay
Date_DayOfWeek
Date_SecsSince1970
Date_SecsSince1970GMT
Date_DaysSince1BC
Date_DayOfYear
Date_NthDayOfYear
Date_DaysInMonth
Date_DaysInYear
Date_WeekOfYear
Date_LeapYear
Date_DaySuffix
Date_ConvTZ
Date_TimeZone
);
use strict;
use integer;
use warnings;
our $VERSION;
$VERSION='6.57';
###########################################################################
our ($dmb,$dmt,$date,$delta,$recur,$date2,$dateUT);
use Date::Manip::Date;
$dateUT = new Date::Manip::Date;
$dateUT->config('setdate','now,Etc/GMT');
$date = new Date::Manip::Date;
$date2 = $date->new_date();
$delta = $date->new_delta();
$recur = $date->new_recur();
$dmb = $date->base();
$dmt = $date->tz();
########################################################################
########################################################################
# THESE ARE THE MAIN ROUTINES
########################################################################
########################################################################
sub DateManipVersion {
my($flag) = @_;
return $date->version($flag);
}
sub Date_Init {
my(@args) = @_;
my(@args2);
foreach my $arg (@args) {
if ($arg =~ /^(\S+)\s*=\s*(.*)$/) {
push(@args2,$1,$2);
} else {
warn "ERROR: invalid Date_Init argument: $arg\n";
}
}
$date->config(@args2);
return $date->err();
}
sub ParseDateString {
my($string,@opts) = @_;
$string = '' if (! defined($string));
my $err = $date->parse($string,@opts);
return '' if ($err);
my $ret = $date->value('local');
return $ret;
}
sub ParseDateFormat {
my($format,$string) = @_;
$string = '' if (! defined($string));
my $err = $date->parse_format($format,$string);
return '' if ($err);
my $ret = $date->value('local');
return $ret;
}
sub ParseDate {
my($arg,@opts) = @_;
$arg = '' if (! defined($arg));
my $ref = ref($arg);
my $list = 0;
my @args;
if (! $ref) {
@args = ($arg);
} elsif ($ref eq 'ARRAY') {
@args = @$arg;
$list = 1;
} elsif ($ref eq 'SCALAR') {
@args = ($$arg);
} else {
print "ERROR: Invalid arguments to ParseDate.\n";
return '';
}
while (@args) {
my $string = join(' ',@args);
my $err = $date->parse($string,@opts);
if (! $err) {
splice(@$arg,0,$#args+1) if ($list);
my $ret = $date->value('local');
return $ret;
}
pop(@args);
}
return '';
}
sub ParseDateDelta {
my(@a) = @_;
if (@a < 1 || @a > 2) {
print "ERROR: Invalid number of arguments to ParseDateDelta.\n";
return '';
}
my($args,$mode) = @_;
$args = '' if (! defined($args));
$mode = '' if (! $mode);
$mode = lc($mode);
if ($mode && ($mode ne 'exact' && $mode ne 'semi' && $mode ne 'approx')) {
print "ERROR: Invalid arguments to ParseDateDelta.\n";
return '';
}
my @args;
my $ref = ref($args);
my $list = 0;
if (! $ref) {
@args = ($args);
} elsif ($ref eq 'ARRAY') {
@args = @$args;
$list = 1;
} elsif ($ref eq 'SCALAR') {
@args = ($$args);
} else {
print "ERROR: Invalid arguments to ParseDateDelta.\n";
return '';
}
while (@args) {
my $string = join(' ',@args);
my $err = $delta->parse($string);
if (! $err) {
$delta->convert($mode) if ($mode);
splice(@$args,0,$#args+1) if ($list);
my $ret = $delta->value('local');
return $ret;
}
pop(@args);
}
return '';
}
sub UnixDate {
my($string,@in) = @_;
my(@ret);
my $err = $date->parse($string);
return () if ($err);
foreach my $in (@in) {
push(@ret,$date->printf($in));
}
if (! wantarray) {
return join(" ",@ret);
}
return @ret;
}
sub Delta_Format {
my($string,@args) = @_;
my $err = $delta->parse($string);
return () if ($err);
my($mode,$dec,@in);
if (! defined($args[0])) {
$mode = 'exact';
@in = @args;
shift(@in);
} elsif (lc($args[0]) eq 'exact' ||
lc($args[0]) eq 'approx' ||
lc($args[0]) eq 'semi') {
($mode,$dec,@in) = (@args);
$mode = lc($mode);
} elsif ($args[0] =~ /^\d+$/) {
($mode,$dec,@in) = ('exact',@args);
} else {
$mode = 'exact';
@in = @args;
}
$dec = 0 if (! $dec);
@in = _Delta_Format_old($mode,$dec,@in);
my @ret = ();
foreach my $in (@in) {
push(@ret,$delta->printf($in));
}
if (! wantarray) {
return join(" ",@ret);
}
return @ret;
}
sub _Delta_Format_old {
my($mode,$dec,@in) = @_;
my(@ret);
my $business = $delta->type('business');
foreach my $in (@in) {
my $out = '';
# This will look for old formats (%Xd, %Xh, %Xt) and turn them
# into the new format: %XYZ
while ($in) {
if ($in =~ s/^([^%]+)//) {
$out .= $1;
} elsif ($in =~ /^%[yMwdhms][yMwdhms][yMwdhms]/) {
# It's one of the new formats so don't modify it.
$in =~ s/^%//;
$out .= '%';
} elsif ($in =~ s/^%([yMwdhms])([dht])//) {
my($field,$scope) = ($1,$2);
$out .= '%';
if ($scope eq 'd') {
if ($mode eq 'approx') {
$out .= ".${dec}${field}${field}s";
} elsif ($field eq 'y' || $field eq 'M') {
$out .= ".${dec}${field}${field}M";
} elsif ($mode eq 'semi') {
$out .= ".${dec}${field}${field}s";
} elsif ($field eq 'w' && $business) {
$out .= ".${dec}www";
} elsif (($field eq 'w' || $field eq 'd') && ! $business) {
$out .= ".${dec}${field}${field}d";
} else {
$out .= ".${dec}${field}${field}s";
}
} elsif ($scope eq 'h') {
if ($mode eq 'approx') {
$out .= ".${dec}${field}y${field}";
} elsif ($field eq 'y' || $field eq 'M') {
$out .= ".${dec}${field}y${field}";
} elsif ($mode eq 'semi') {
$out .= ".${dec}${field}w${field}";
} elsif ($field eq 'w') {
$out .= ".${dec}www";
} elsif ($field eq 'd' && ! $business) {
$out .= ".${dec}dwd";
} elsif ($business) {
$out .= ".${dec}${field}d${field}";
} else {
$out .= ".${dec}${field}h${field}";
}
} elsif ($scope eq 't') {
if ($mode eq 'approx') {
$out .= ".${dec}${field}ys";
} elsif ($field eq 'y' || $field eq 'M') {
$out .= ".${dec}${field}yM";
} elsif ($mode eq 'semi') {
$out .= ".${dec}${field}ws";
} elsif ($field eq 'w' && $business) {
$out .= ".${dec}www";
} elsif (($field eq 'w' || $field eq 'd') && ! $business) {
$out .= ".${dec}${field}wd";
} elsif ($business) {
$out .= ".${dec}${field}ds";
} else {
$out .= ".${dec}${field}hs";
}
}
} else {
# It's one of the new formats so don't modify it.
$in =~ s/^%//;
$out .= '%';
}
}
push(@ret,$out);
}
return @ret;
}
sub DateCalc {
my($d1,$d2,@args) = @_;
# Handle \$err arg
my($ref,$errref);
if (@args && ref($args[0])) {
$errref = shift(@args);
$ref = 1;
} else {
$ref = 0;
}
# Parse $d1 and $d2
my ($obj1,$obj2,$err,$usemode);
$usemode = 1;
$obj1 = $date->new_date();
$err = $obj1->parse($d1,'nodelta');
if ($err) {
$obj1 = $date->new_delta();
$err = $obj1->parse($d1);
if ($err) {
$$errref = 1 if ($ref);
return '';
}
$usemode = 0;
}
$obj2 = $date->new_date();
$err = $obj2->parse($d2,'nodelta');
if ($err) {
$obj2 = $date->new_delta();
$err = $obj2->parse($d2);
if ($err) {
$$errref = 2 if ($ref);
return '';
}
$usemode = 0;
}
# Handle $mode
my($mode);
if (@args) {
$mode = shift(@args);
}
if (@args) {
$$errref = 3 if ($ref);
return '';
}
# Apply the $mode to any deltas
if (defined($mode)) {
if (ref($obj1) eq 'Date::Manip::Delta') {
if ($$obj1{'data'}{'gotmode'}) {
if ($mode == 2 || $mode == 3) {
if (! $obj1->type('business')) {
$$errref = 3 if ($ref);
return '';
}
} else {
if ($obj1->type('business')) {
$$errref = 3 if ($ref);
return '';
}
}
} else {
if ($mode == 2 || $mode == 3) {
$obj1->set('mode','business');
} else {
$obj1->set('mode','normal');
}
}
}
if (ref($obj2) eq 'Date::Manip::Delta') {
if ($$obj2{'data'}{'gotmode'}) {
if ($mode == 2 || $mode == 3) {
if (! $obj2->type('business')) {
$$errref = 3 if ($ref);
return '';
}
} else {
if ($obj2->type('business')) {
$$errref = 3 if ($ref);
return '';
}
}
} else {
if ($mode ==2 || $mode == 3) {
$obj2->set('mode','business');
} else {
$obj2->set('mode','normal');
}
}
}
}
# Do the calculation
my $obj3;
if ($usemode) {
$mode = 0 if (! $mode);
if ($mode == 3) {
$mode = 'business';
} elsif ($mode == 2) {
$mode = 'bapprox';
} elsif ($mode) {
$mode = 'approx';
} else {
$mode = 'exact';
}
$obj3 = $obj1->calc($obj2,$mode);
} else {
$obj3 = $obj1->calc($obj2);
}
my $ret = $obj3->value();
return $ret;
}
sub Date_GetPrev {
my($string,$dow,$curr,@time) = @_;
my $err = $date->parse($string);
return '' if ($err);
if (defined($dow)) {
$dow = lc($dow);
if (exists $$dmb{'data'}{'wordmatch'}{'day_char'}{$dow}) {
$dow = $$dmb{'data'}{'wordmatch'}{'day_char'}{$dow};
} elsif (exists $$dmb{'data'}{'wordmatch'}{'day_abb'}{$dow}) {
$dow = $$dmb{'data'}{'wordmatch'}{'day_abb'}{$dow};
} elsif (exists $$dmb{'data'}{'wordmatch'}{'day_name'}{$dow}) {
$dow = $$dmb{'data'}{'wordmatch'}{'day_name'}{$dow};
}
}
if ($#time == 0) {
@time = @{ $dmb->split('hms',$time[0]) };
}
if (@time) {
while ($#time < 2) {
push(@time,0);
}
$date->prev($dow,$curr,\@time);
} else {
$date->prev($dow,$curr);
}
my $ret = $date->value();
return $ret;
}
sub Date_GetNext {
my($string,$dow,$curr,@time) = @_;
my $err = $date->parse($string);
return '' if ($err);
if (defined($dow)) {
$dow = lc($dow);
if (exists $$dmb{'data'}{'wordmatch'}{'day_char'}{$dow}) {
$dow = $$dmb{'data'}{'wordmatch'}{'day_char'}{$dow};
} elsif (exists $$dmb{'data'}{'wordmatch'}{'day_abb'}{$dow}) {
$dow = $$dmb{'data'}{'wordmatch'}{'day_abb'}{$dow};
} elsif (exists $$dmb{'data'}{'wordmatch'}{'day_name'}{$dow}) {
$dow = $$dmb{'data'}{'wordmatch'}{'day_name'}{$dow};
}
}
if ($#time == 0) {
@time = @{ $dmb->split('hms',$time[0]) };
}
if (@time) {
while ($#time < 2) {
push(@time,0);
}
$date->next($dow,$curr,\@time);
} else {
$date->next($dow,$curr);
}
my $ret = $date->value();
return $ret;
}
sub Date_SetTime {
my($string,@time) = @_;
my $err = $date->parse($string);
return '' if ($err);
if ($#time == 0) {
@time = @{ $dmb->split('hms',$time[0]) };
}
while ($#time < 2) {
push(@time,0);
}
$date->set('time',\@time);
my $val = $date->value();
return $val;
}
sub Date_SetDateField {
my($string,$field,$val) = @_;
my $err = $date->parse($string);
return '' if ($err);
$date->set($field,$val);
my $ret = $date->value();
return $ret;
}
sub Date_NextWorkDay {
my($string,$n,$checktime) = @_;
my $err = $date->parse($string);
return '' if ($err);
$date->next_business_day($n,$checktime);
my $val = $date->value();
return $val;
}
sub Date_PrevWorkDay {
my($string,$n,$checktime) = @_;
my $err = $date->parse($string);
return '' if ($err);
$date->prev_business_day($n,$checktime);
my $val = $date->value();
return $val;
}
sub Date_NearestWorkDay {
my($string,$tomorrowfirst) = @_;
my $err = $date->parse($string);
return '' if ($err);
$date->nearest_business_day($tomorrowfirst);
my $val = $date->value();
return $val;
}
sub ParseRecur {
my($string,@args) = @_;
if ($#args == 3) {
my($base,$d0,$d1,$flags) = @args;
@args = ();
push(@args,$flags) if ($flags);
push(@args,$base,$d0,$d1);
}
my $err = $recur->parse($string,@args);
return '' if ($err);
if (wantarray) {
my @dates = $recur->dates();
my @ret;
foreach my $d (@dates) {
my $val = $d->value();
push(@ret,$val);
}
return @ret;
}
my @int = @{ $$recur{'data'}{'interval'} };
my @rtime = @{ $$recur{'data'}{'rtime'} };
my @flags = @{ $$recur{'data'}{'flags'} };
my $start = $$recur{'data'}{'start'};
my $end = $$recur{'data'}{'end'};
my $base = $$recur{'data'}{'base'};
my $r;
if (@int) {
$r = join(':',@int);
}
if (@rtime) {
my @rt;
foreach my $rt (@rtime) {
push(@rt,join(",",@$rt));
}
$r .= '*' . join(':',@rt);
}
$r .= '*' . join(",",@flags);
my $val = (defined($base) ? $base->value() : '');
$r .= "*$val";
$val = (defined($start) ? $start->value() : '');
$r .= "*$val";
$val = (defined($end) ? $end->value() : '');
$r .= "*$val";
return $r;
}
sub Events_List {
my($datestr,@args) = @_;
# First argument is always a date
my $err = $date->parse($datestr);
return [] if ($err);
# Second argument is absent, a date, or 0.
my @list;
my $flag = 0;
my ($date0,$date1);
if (! @args) {
# absent
@list = $date->list_events('dates');
} else {
# a date or 0
my $arg = shift(@args);
$flag = shift(@args) if (@args);
if (@args) {
warn "ERROR: unknown argument list\n";
return [];
}
if (! $arg) {
my($y,$m,$d) = $date->value();
$date2->set('date',[$y,$m,$d,23,59,59]);
@list = $date->list_events(0, 'dates');
} else {
$err = $date2->parse($arg);
if ($err) {
warn "ERROR: invalid argument: $arg\n";
return [];
}
@list = $date->list_events($date2, 'dates');
}
}
# Handle the flag
if (! $flag) {
my @ret = ();
foreach my $e (@list) {
my($d,@n) = @$e;
my $v = $d->value();
push(@ret,$v,[@n]);
}
return \@ret;
}
push(@list,[$date2]);
my %ret;
if ($flag==1) {
while ($#list > 0) {
my($d0,@n) = @{ shift(@list) };
my $d1 = $list[0]->[0];
my $delta = $d0->calc($d1);
foreach $flag (@n) {
$flag = '' if (! defined($flag));
if (exists $ret{$flag}) {
$ret{$flag} = $ret{$flag}->calc($delta);
} else {
$ret{$flag} = $delta;
}
}
}
} elsif ($flag==2) {
while ($#list > 0) {
my($d0,@n) = @{ shift(@list) };
my $d1 = $list[0]->[0];
my $delta = $d0->calc($d1);
$flag = join("+",sort(@n));
if (exists $ret{$flag}) {
$ret{$flag} = $ret{$flag}->calc($delta);
} else {
$ret{$flag} = $delta;
}
}
} else {
warn "ERROR: Invalid flag $flag\n";
return [];
}
foreach my $flag (keys %ret) {
$ret{$flag} = $ret{$flag}->value();
}
return \%ret;
}
########################################################################
# ADDITIONAL ROUTINES
########################################################################
sub Date_DayOfWeek {
my($m,$d,$y) = @_;
return $dmb->day_of_week([$y,$m,$d]);
}
sub Date_SecsSince1970 {
my($m,$d,$y,$h,$mn,$s) = @_;
return $dmb->secs_since_1970([$y,$m,$d,$h,$mn,$s]);
}
sub Date_SecsSince1970GMT {
my($m,$d,$y,$h,$mn,$s) = @_;
$date->set('date',[$y,$m,$d,$h,$mn,$s]);
return $date->secs_since_1970_GMT();
}
sub Date_DaysSince1BC {
my($m,$d,$y) = @_;
return $dmb->days_since_1BC([$y,$m,$d]);
}
sub Date_DayOfYear {
my($m,$d,$y) = @_;
return $dmb->day_of_year([$y,$m,$d]);
}
sub Date_NthDayOfYear {
my($y,$n) = @_;
my @ret = @{ $dmb->day_of_year($y,$n) };
push(@ret,0,0,0) if ($#ret == 2);
return @ret;
}
sub Date_DaysInMonth {
my($m,$y) = @_;
return $dmb->days_in_month($y,$m);
}
sub Date_DaysInYear {
my($y) = @_;
return $dmb->days_in_year($y);
}
sub Date_WeekOfYear {
my($m,$d,$y,$first) = @_;
my($yy,$ww) = $dmb->_week_of_year($first,[$y,$m,$d]);
return 0 if ($yy<$y);
return 53 if ($yy>$y);
return $ww;
}
sub Date_LeapYear {
my($y) = @_;
return $dmb->leapyear($y);
}
sub Date_DaySuffix {
my($d) = @_;
return $$dmb{'data'}{'wordlist'}{'nth_dom'}[$d-1];
}
sub Date_TimeZone {
my($ret) = $dmb->_now('tz');
return $ret;
}
sub Date_ConvTZ {
my($str,$from,$to) = @_;
$from = $dmb->_now('tz') if (! $from);
$to = $dmb->_now('tz') if (! $to);
# Parse the date (ignoring timezone information):
my $err = $dateUT->parse($str);
return '' if ($err);
my $d = [ $dateUT->value() ];
return '' if (! $d);
# Get the timezone for $from. First, we'll assume that
# the date matches exactly (so if the timezone is passed
# in as an abbreviation, we'll try to get the timezone
# that fits the date/abbrev combination). If we can't,
# we'll just assume that the timezone is more generic
# and try it without the date.
my $tmp;
$tmp = $dmt->zone($from,$d);
if (! $tmp) {
$tmp = $dmt->zone($from);
return '' if (! $tmp);
}
$from = $tmp;
$tmp = $dmt->zone($to,$d);
if (! $tmp) {
$tmp = $dmt->zone($to);
return '' if (! $tmp);
}
$to = $tmp;
($err,$d) = $dmt->convert($d,$from,$to);
return '' if ($err);
return $dmb->join('date',$d);
}
sub Date_IsWorkDay {
my($str,$checktime) = @_;
my $err = $date->parse($str);
return '' if ($err);
return $date->is_business_day($checktime);
}
sub Date_IsHoliday {
my($str) = @_;
my $err = $date->parse($str);
return undef if ($err);
if (wantarray) {
my @ret = $date->holiday();
return @ret;
} else {
my $ret = $date->holiday();
return $ret;
}
}
sub Date_Cmp {
my($str1,$str2) = @_;
my $err = $date->parse($str1);
return undef if ($err);
$err = $date2->parse($str2);
return undef if ($err);
return $date->cmp($date2);
}
1;
# Local Variables:
# mode: cperl
# indent-tabs-mode: nil
# cperl-indent-level: 3
# cperl-continued-statement-offset: 2
# cperl-continued-brace-offset: 0
# cperl-brace-offset: 0
# cperl-brace-imaginary-offset: 0
# cperl-label-offset: 0
# End:
|