6 # Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
8 # (Except where explictly superceded by other copyright notices)
10 # This work is made available to you under the terms of Version 2 of
11 # the GNU General Public License. A copy of that license should have
12 # been provided with this software, but in any event can be snarfed
15 # This work is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # Unless otherwise specified, all modifications, corrections or
21 # extensions to this work which alter its source code become the
22 # property of Best Practical Solutions, LLC when submitted for
23 # inclusion in the work.
30 Copyright (c) 1996-2003 Jesse Vincent <jesse\@bestpractical.com>
32 (Except where explictly superceded by other copyright notices)
34 This work is made available to you under the terms of Version 2 of
35 the GNU General Public License. A copy of that license should have
36 been provided with this software, but in any event can be snarfed
39 This work is distributed in the hope that it will be useful, but
40 WITHOUT ANY WARRANTY; without even the implied warranty of
41 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 General Public License for more details.
44 Unless otherwise specified, all modifications, corrections or
45 extensions to this work which alter its source code become the
46 property of Best Practical Solutions, LLC when submitted for
47 inclusion in the work.
54 my @MAKE = qw(Makefile);
56 File::Find::find({ no_chdir => 1, wanted => \&tag_pm}, 'lib');
57 File::Find::find({ no_chdir => 1, wanted => \&tag_mason}, 'html');
58 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'sbin');
59 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'bin');
60 tag_makefile ('Makefile');
61 tag_makefile ('README');
67 next if ($pm =~ /images/);
68 open(FILE,"<$pm") || die "Failed to open $pm";
69 my $file = (join "", <FILE>);
76 if ($file =~ /^%# BEGIN LICENSE BLOCK/ms) {
77 print "has license section";
78 $file =~ s/^%# BEGIN LICENSE BLOCK(.*?)%# END LICENSE BLOCK/%# BEGIN LICENSE BLOCK\n$pmlic%# END LICENSE BLOCK/ms;
82 print "no license section";
83 $file ="%# BEGIN LICENSE BLOCK\n$pmlic%# END LICENSE BLOCK\n". $file;
85 $file =~ s/%# END LICENSE BLOCK(\n+)/%# END LICENSE BLOCK\n/mg;
91 open (FILE, ">$pm") || die "couldn't write new file";
100 open(FILE,"<$pm") || die "Failed to open $pm";
101 my $file = (join "", <FILE>);
103 my $pmlic = $LICENSE;
108 if ($file =~ /^# BEGIN LICENSE BLOCK/ms) {
109 print "has license section";
110 $file =~ s/^# BEGIN LICENSE BLOCK(.*?)# END LICENSE BLOCK/# BEGIN LICENSE BLOCK\n$pmlic# END LICENSE BLOCK/ms;
114 print "no license section";
115 $file ="# BEGIN LICENSE BLOCK\n$pmlic# END LICENSE BLOCK\n". $file;
117 $file =~ s/# END LICENSE BLOCK(\n+)/# END LICENSE BLOCK\n/mg;
123 open (FILE, ">$pm") || die "couldn't write new file";
132 next unless $pm =~ /\.pm\z/s;
133 open(FILE,"<$pm") || die "Failed to open $pm";
134 my $file = (join "", <FILE>);
136 my $pmlic = $LICENSE;
141 if ($file =~ /^# BEGIN LICENSE BLOCK/ms) {
142 print "has license section";
143 $file =~ s/^# BEGIN LICENSE BLOCK(.*?)# END LICENSE BLOCK/# BEGIN LICENSE BLOCK\n$pmlic# END LICENSE BLOCK/ms;
147 print "no license section";
148 $file ="# BEGIN LICENSE BLOCK\n$pmlic# END LICENSE BLOCK\n". $file;
150 $file =~ s/# END LICENSE BLOCK(\n+)/# END LICENSE BLOCK\n/mg;
156 open (FILE, ">$pm") || die "couldn't write new file $pm";
165 return unless (-f $pm);
166 open(FILE,"<$pm") || die "Failed to open $pm";
167 my $file = (join "", <FILE>);
169 my $pmlic = $LICENSE;
170 $pmlic =~ s/^/# /msg;
173 if ($file =~ /^# BEGIN LICENSE BLOCK/ms) {
174 print "has license section";
175 $file =~ s/^# BEGIN LICENSE BLOCK(.*?)# END LICENSE BLOCK/# BEGIN LICENSE BLOCK\n$pmlic# END LICENSE BLOCK/ms;
179 print "no license section";
180 if ($file =~ /^(#!.*?)\n/) {
182 my $lic ="# BEGIN LICENSE BLOCK\n$pmlic# END LICENSE BLOCK\n";
183 $file =~ s/^(#!.*?)\n/$1\n$lic/;
187 $file =~ s/# END LICENSE BLOCK(\n+)/# END LICENSE BLOCK\n\n/mg;
191 open (FILE, ">$pm") || die "couldn't write new file";