/[webpac]/trunk2/filter/swish_years.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/filter/swish_years.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (show annotations)
Thu Jun 10 19:22:40 2004 UTC (15 years, 6 months ago) by dpavlin
File size: 559 byte(s)
new trunk for webpac v2

1 # rewrite interval years into separate values for indexing
2 #
3 # e.g. 1998- will be indexed as 1998 1999 2000 2001 2002 2003
4 # 1993-1995 will be 1993 1994 1995
5
6 sub swish_years {
7 my $out = "";
8 foreach (@_) {
9 if (/(\d{4})\s*-\s*(\d{4})/) {
10 my ($from,$to) = ($1,$2);
11 for (my $i=$from; $i<=$to; $i++) {
12 $out .= $i." ";
13 }
14 } elsif (/(\d{4})-/) {
15 my $from = $1;
16 my @t = localtime(time);
17 my $to = $t[5];
18 $to += 1900;
19 for (my $i=$from; $i<=$to; $i++) {
20 $out .= $i." ";
21 }
22 } else {
23 $out .= "$_ ";
24 }
25 }
26 return $out;
27 }
28
29 1;

Properties

Name Value
cvs2svn:cvs-rev 1.1

  ViewVC Help
Powered by ViewVC 1.1.26