Altered to use the new themelanguage method in Output.pm
[koha.git] / addcopyrightstatements.pl
1 #!/usr/bin/perl
2 #
3 # Copyright 2000-2002 Katipo Communications
4 #
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA  02111-1307 USA
19
20 my $copyrightstatement=qq|
21 # Copyright 2000-2002 Katipo Communications
22 #
23 # This file is part of Koha.
24 #
25 # Koha is free software; you can redistribute it and/or modify it under the
26 # terms of the GNU General Public License as published by the Free Software
27 # Foundation; either version 2 of the License, or (at your option) any later
28 # version.
29 #
30 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
31 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
32 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
33 #
34 # You should have received a copy of the GNU General Public License along with
35 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
36 # Suite 330, Boston, MA  02111-1307 USA
37
38 |;
39
40 open (PL, "find -name '*.pl' -o -name '*.pm'|");
41 while (<PL>) {
42     my $filename=$_;
43     chomp $filename;
44     my $holder='';
45     my $newversion='';
46     open (IN, "$filename");
47     my $begin='';
48     my $end='';
49     my $alreaddone=0;
50     while (<IN>) {
51         if ((/^\s*#/ || /^\s*$/ || /^\s*package/) && $end eq '') {
52             $begin.=$_;
53         } else {
54             $end.=$_;
55         }
56         if (/^\s*#\s*Copyright/) {
57             print "$filename already has a copyright statement\n";
58             $alreadydone=1;
59         }
60     }
61     close IN;
62     unless ($alreadydone) {
63         open (OUT, ">$filename");
64         print OUT "$begin$copyrightstatement$end";
65         close OUT;
66     }
67 }