1#!/usr/bin/perl
2
3use strict;
4use CPAN;
5use File::Basename ();
6use Getopt::Long ();
7use IO::File;
8
9my $CPAN = '/Volumes/XDisk/build/Roots/CPAN.roots/CPAN~obj'; #OBJROOT
10my $Modules = 'Modules';
11my $PerlLicense = <<EOF;
12Licensed under the same terms as Perl:
13http://perldoc.perl.org/perlartistic.html
14http://perldoc.perl.org/perlgpl.html
15EOF
16my $YAMLLicense = <<EOF;
17This software is released under the MIT license cited below.
18
19The libsyck code bundled with this library is released by "why the
20lucky stiff", under a BSD-style license. See the COPYING file for
21details.
22
23The "MIT" License
24
25Permission is hereby granted, free of charge, to any person obtaining
26a copy of this software and associated documentation files (the
27"Software"), to deal in the Software without restriction, including
28without limitation the rights to use, copy, modify, merge, publish,
29distribute, sublicense, and/or sell copies of the Software, and to
30permit persons to whom the Software is furnished to do so, subject
31to the following conditions:
32
33The above copyright notice and this permission notice shall be
34included in all copies or substantial portions of the Software.
35
36THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
39IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
40ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
41CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
42WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43
44EOF
45my $YAMLCOPYING = "$CPAN/5.10/YAML-Syck-1.07/COPYING";
46my $F = IO::File->new($YAMLCOPYING) or die "Can't open $YAMLCOPYING\n";
47$YAMLLicense .= join('', $F->getlines);
48undef($F);
49
50my %outdated = (
51    'Compress-Zlib-1.42' => 'http://search.cpan.org/CPAN/authors/id/P/PM/PMQS/Compress-Zlib-1.42.tar.gz',
52    'XML-LibXML-Common-0.13' => 'http://search.cpan.org/CPAN/authors/id/P/PH/PHISH/XML-LibXML-Common-0.13.tar.gz',
53);
54my %modules = (
55    'Algorithm-Annotate-0.10' => {
56	license => 'Perl',
57	licensestr => $PerlLicense,
58    },
59    'Algorithm-Diff-1.1902' => {
60	license => 'Perl',
61	licensestr => $PerlLicense,
62    },
63    'App-CLI-0.07' => {
64	license => 'Perl',
65	licensestr => $PerlLicense,
66    },
67    'App-CLI-0.08' => {
68	license => 'Perl',
69	licensestr => $PerlLicense,
70	date => '2010-03-15',
71    },
72    'Archive-Tar-1.38' => {
73	license => 'Perl',
74	licensestr => $PerlLicense,
75    },
76    'Archive-Zip-1.26' => {
77	license => 'Perl',
78	licensefile => "$CPAN/5.8/Archive-Zip-1.26/LICENSE",
79    },
80    'Archive-Zip-1.30' => {
81	date => '2010-03-15',
82	license => 'Perl',
83	licensefile => "$CPAN/5.10/Archive-Zip-1.30/LICENSE",
84    },
85    'Authen-SASL-2.12' => {
86	license => 'Perl',
87	licensestr => $PerlLicense,
88    },
89    'Authen-SASL-2.14' => {
90	license => 'Perl',
91	licensestr => $PerlLicense,
92	date => '2010-03-15',
93    },
94    'BerkeleyDB-0.36' => {
95	license => 'Perl',
96	licensestr => $PerlLicense,
97    },
98    'BerkeleyDB-0.42' => {
99	license => 'Perl',
100	licensestr => $PerlLicense,
101	date => '2010-03-15',
102    },
103    'Bit-Vector-6.4' => {
104	license => 'Perl',
105	licensestr => $PerlLicense,
106    },
107    'Bit-Vector-7.1' => {
108	license => 'Perl',
109	licensestr => $PerlLicense,
110	date => '2010-03-15',
111    },
112    'Carp-Clan-6.00' => {
113	license => 'Perl',
114	licensestr => $PerlLicense,
115    },
116    'Carp-Clan-6.04' => {
117	license => 'Perl',
118	licensestr => $PerlLicense,
119	date => '2010-03-15',
120    },
121    'Class-Accessor-0.31' => {
122	license => 'Perl',
123	licensestr => $PerlLicense,
124    },
125    'Class-Accessor-0.34' => {
126	license => 'Perl',
127	licensestr => $PerlLicense,
128	date => '2010-03-15',
129    },
130    'Class-Autouse-1.29' => {
131	license => 'Perl',
132	licensefile => "$CPAN/5.10/Class-Autouse-1.29/LICENSE",
133    },
134    'Class-Data-Inheritable-0.08' => {
135	license => 'Perl',
136	licensestr => $PerlLicense,
137    },
138    'Compress-Bzip2-2.09' => {
139	license => 'Other',
140	licensefile => "$CPAN/5.10/Compress-Bzip2-2.09/bzlib-src/LICENSE",
141    },
142    'Compress-Zlib-1.42' => {
143	license => 'Perl',
144	licensestr => $PerlLicense,
145    },
146    'Convert-ASN1-0.22' => {
147	license => 'Perl',
148	licensestr => $PerlLicense,
149    },
150    'Convert-BinHex-1.119' => {
151	license => 'Perl',
152	licensestr => $PerlLicense,
153    },
154    'Convert-TNEF-0.17' => {
155	license => 'Perl',
156	licensestr => $PerlLicense,
157    },
158    'Convert-UUlib-1.12' => {
159	license => 'Perl',
160	licensestr => $PerlLicense,
161    },
162    'Convert-UUlib-1.33' => {
163	license => 'Perl',
164	licensestr => $PerlLicense,
165	date => '2010-03-15',
166    },
167    'DBD-SQLite-1.14' => {
168	license => 'Perl',
169	licensestr => $PerlLicense,
170    },
171    'DBD-SQLite-1.29' => {
172	date => '2010-03-15',
173	license => 'Perl',
174	licensefile => "$CPAN/5.10/DBD-SQLite-1.29/LICENSE",
175    },
176    'DBI-1.607' => {
177	license => 'Perl',
178	licensestr => $PerlLicense,
179    },
180    'DBI-1.609' => {
181	license => 'Perl',
182	licensestr => $PerlLicense,
183	date => '2010-03-15',
184    },
185    'Data-Hierarchy-0.34' => {
186	license => 'Perl',
187	licensestr => $PerlLicense,
188    },
189    'Date-Calc-5.4' => {
190	license => 'Perl',
191	licensestr => $PerlLicense,
192    },
193    'Date-Calc-6.3' => {
194	license => 'Perl',
195	licensestr => $PerlLicense,
196	date => '2010-03-15',
197    },
198    'Digest-HMAC-1.01' => {
199	license => 'Perl',
200	licensestr => $PerlLicense,
201    },
202    'Digest-HMAC-1.02' => {
203	license => 'Perl',
204	licensestr => $PerlLicense,
205	date => '2010-03-15',
206    },
207    'Digest-SHA1-2.11' => {
208	license => 'Perl',
209	licensestr => $PerlLicense,
210    },
211    'Digest-SHA1-2.12' => {
212	license => 'Perl',
213	licensestr => $PerlLicense,
214	date => '2010-03-15',
215    },
216    'Expect-1.21' => {
217	license => 'Perl',
218	licensestr => $PerlLicense,
219    },
220    'ExtUtils-CBuilder-0.24' => {
221	license => 'Perl',
222	licensestr => $PerlLicense,
223    },
224    'File-Slurp-9999.13' => {
225	license => 'Perl',
226	licensestr => $PerlLicense,
227    },
228    'File-chdir-0.1002' => {
229	license => 'Perl',
230	licensefile => "$CPAN/5.10/File-chdir-0.1002/LICENSE",
231    },
232    'FreezeThaw-0.43' => {
233	license => 'Perl',
234	licensestr => $PerlLicense,
235    },
236    'FreezeThaw-0.50' => {
237	license => 'Perl',
238	licensestr => $PerlLicense,
239	date => '2010-03-15',
240    },
241    'GSSAPI-0.26' => {
242	license => 'Perl',
243	licensestr => $PerlLicense,
244    },
245    'HTML-Parser-3.59' => {
246	license => 'Perl',
247	licensestr => $PerlLicense,
248    },
249    'HTML-Parser-3.64' => {
250	license => 'Perl',
251	licensestr => $PerlLicense,
252	date => '2010-03-15',
253    },
254    'HTML-Tagset-3.20' => {
255	license => 'Perl',
256	licensestr => $PerlLicense,
257    },
258    'IO-Digest-0.10' => {
259	license => 'Perl',
260	licensestr => $PerlLicense,
261    },
262    'IO-Pager-0.06' => {
263	license => 'Other',
264	licensestr => <<EOF,
265* Thou shalt not claim ownership of unmodified materials.
266
267* Thou shalt not claim whole ownership of modified materials.
268
269* Thou shalt grant the indemnity of the provider of materials.
270
271* Thou shalt use and dispense freely without other restrictions.
272EOF
273    },
274    'IO-Socket-INET6-2.56' => {
275	license => 'Perl',
276	licensestr => $PerlLicense,
277    },
278    'IO-Socket-INET6-2.57' => {
279	license => 'Perl',
280	licensestr => $PerlLicense,
281	date => '2010-03-15',
282    },
283    'IO-Socket-SSL-1.22' => {
284	license => 'Perl',
285	licensestr => $PerlLicense,
286    },
287    'IO-Socket-SSL-1.32' => {
288	license => 'Perl',
289	licensestr => $PerlLicense,
290	date => '2010-03-15',
291    },
292    'IO-String-1.08' => {
293	license => 'Perl',
294	licensestr => $PerlLicense,
295    },
296    'IO-Stty-.02' => {
297	license => 'Perl',
298	licensestr => $PerlLicense,
299    },
300    'IO-Tty-1.07' => {
301	license => 'Perl',
302	licensestr => $PerlLicense,
303    },
304    'IO-Tty-1.08' => {
305	license => 'Perl',
306	licensestr => $PerlLicense,
307	date => '2010-03-15',
308    },
309    'IO-Zlib-1.09' => {
310	license => 'Perl',
311	licensestr => $PerlLicense,
312    },
313    'IO-stringy-2.110' => {
314	license => 'Perl',
315	licensestr => $PerlLicense,
316    },
317    'Internals-1.1' => {
318	license => 'Perl',
319	licensestr => $PerlLicense,
320    },
321    'List-MoreUtils-0.22' => {
322	license => 'Perl',
323	licensestr => $PerlLicense,
324    },
325    'Locale-Maketext-Lexicon-0.77' => {
326	license => 'MIT',
327	licensefile => "$CPAN/5.8/Locale-Maketext-Lexicon-0.77/LICENSE",
328    },
329    'Locale-Maketext-Lexicon-0.79' => {
330	date => '2010-03-15',
331	license => 'MIT',
332	licensefile => "$CPAN/5.10/Locale-Maketext-Lexicon-0.79/LICENSE",
333    },
334    'Locale-Maketext-Simple-0.18' => {
335	license => 'Perl',
336	licensestr => $PerlLicense,
337    },
338    'MIME-tools-5.427' => {
339	license => 'Perl',
340	licensestr => $PerlLicense,
341    },
342    'MLDBM-2.01' => {
343	license => 'Perl',
344	licensestr => $PerlLicense,
345    },
346    'MLDBM-2.04' => {
347	license => 'Perl',
348	licensestr => $PerlLicense,
349	date => '2010-03-15',
350    },
351    'Mac-AppleEvents-Simple-1.18' => {
352	license => 'Perl',
353	licensestr => $PerlLicense,
354    },
355    'Mac-Apps-Launch-1.93' => {
356	license => 'Perl',
357	licensestr => $PerlLicense,
358    },
359    'Mac-Carbon-0.77' => {
360	license => 'Perl',
361	licensestr => $PerlLicense,
362    },
363    'Mac-Carbon-0.82' => {
364	license => 'Perl',
365	licensestr => $PerlLicense,
366	date => '2010-03-15',
367    },
368    'Mac-Errors-1.14' => {
369	license => 'Perl',
370	licensefile => "$CPAN/5.10/Mac-Errors-1.14/LICENSE",
371    },
372    'Mac-Glue-1.30' => {
373	license => 'Perl',
374	licensestr => $PerlLicense,
375    },
376    'Mac-OSA-Simple-1.09' => {
377	license => 'Perl',
378	licensestr => $PerlLicense,
379    },
380    'Mail-SPF-Query-1.999.1' => {
381	license => 'Perl',
382	licensestr => $PerlLicense,
383    },
384    'MailTools-2.04' => {
385	license => 'Perl',
386	licensestr => $PerlLicense,
387    },
388    'MailTools-2.06' => {
389	license => 'Perl',
390	licensestr => $PerlLicense,
391	date => '2010-03-15',
392    },
393    'Module-Build-0.31012' => {
394	license => 'Perl',
395	licensefile => "$CPAN/5.8/Module-Build-0.31012/LICENSE",
396    },
397    'Net-CIDR-Lite-0.20' => {
398	license => 'Perl',
399	licensestr => $PerlLicense,
400    },
401    'Net-DNS-0.65' => {
402	license => 'Perl',
403	licensestr => $PerlLicense,
404    },
405    'Net-DNS-0.66' => {
406	license => 'Perl',
407	licensestr => $PerlLicense,
408	date => '2010-03-15',
409    },
410    'Net-IP-1.25' => {
411	license => 'Perl',
412	licensestr => $PerlLicense,
413    },
414    'Net-SSLeay-1.35' => {
415	license => 'OpenSSL',
416	licensefile => '/Network/Servers/xs1/release/Software/Barolo/Updates/NewestBarolo/Projects/OpenSSL098/src/LICENSE',
417    },
418    'Net-SSLeay-1.36' => {
419	license => 'OpenSSL',
420	licensefile => '/Network/Servers/xs1/release/Software/Barolo/Updates/NewestBarolo/Projects/OpenSSL098/src/LICENSE',
421	date => '2010-03-15',
422    },
423    'Net-Server-0.97' => {
424	license => 'Perl',
425	licensestr => $PerlLicense,
426    },
427    'Package-Constants-0.02' => {
428	license => 'Perl',
429	licensestr => $PerlLicense,
430    },
431    'Path-Class-0.16' => {
432	license => 'Perl',
433	licensestr => $PerlLicense,
434    },
435    'Path-Class-0.18' => {
436	license => 'Perl',
437	licensestr => $PerlLicense,
438	date => '2010-03-15',
439    },
440    'PerlIO-eol-0.14' => {
441	license => 'Perl',
442	licensestr => $PerlLicense,
443    },
444    'PerlIO-gzip-0.18' => {
445	license => 'Perl',
446	licensestr => $PerlLicense,
447    },
448    'PerlIO-via-Bzip2-0.02' => {
449	license => 'Perl',
450	licensestr => $PerlLicense,
451    },
452    'PerlIO-via-dynamic-0.13' => {
453	license => 'Perl',
454	licensestr => $PerlLicense,
455    },
456    'PerlIO-via-symlink-0.05' => {
457	license => 'Perl',
458	licensestr => $PerlLicense,
459    },
460    'Pod-Readme-0.09' => {
461	license => 'Perl',
462	licensestr => $PerlLicense,
463    },
464    'Proc-Reliable-1.16' => {
465	license => 'Perl',
466	licensestr => $PerlLicense,
467    },
468    'Regexp-Common-2.122' => {
469	license => 'Perl/BSD/MIT',
470	licensefilelist => [
471	    "$CPAN/5.8/Regexp-Common-2.122/COPYRIGHT",
472	    "$CPAN/5.8/Regexp-Common-2.122/COPYRIGHT.AL",
473	    "$CPAN/5.8/Regexp-Common-2.122/COPYRIGHT.AL2",
474	    "$CPAN/5.8/Regexp-Common-2.122/COPYRIGHT.BSD",
475	    "$CPAN/5.8/Regexp-Common-2.122/COPYRIGHT.MIT",
476	],
477    },
478    'Regexp-Common-2010010201' => {
479	license => 'Perl/BSD/MIT',
480	licensefilelist => [
481	    "$CPAN/5.10/Regexp-Common-2010010201/COPYRIGHT",
482	    "$CPAN/5.10/Regexp-Common-2010010201/COPYRIGHT.AL",
483	    "$CPAN/5.10/Regexp-Common-2010010201/COPYRIGHT.AL2",
484	    "$CPAN/5.10/Regexp-Common-2010010201/COPYRIGHT.BSD",
485	    "$CPAN/5.10/Regexp-Common-2010010201/COPYRIGHT.MIT",
486	],
487	date => '2010-03-15',
488    },
489    'Socket6-0.23' => {
490	license => 'Other',
491	licensestr => <<EOF,
492Redistribution and use in source and binary forms, with or without
493modification, are permitted provided that the following conditions
494are met:
4951. Redistributions of source code must retain the above copyright
496   notice, this list of conditions and the following disclaimer.
4972. Redistributions in binary form must reproduce the above copyright
498   notice, this list of conditions and the following disclaimer in the
499   documentation and/or other materials provided with the distribution.
5003. Neither the name of the project nor the names of its contributors
501   may be used to endorse or promote products derived from this software
502   without specific prior written permission.
503#
504THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
505ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
506IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
507ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
508FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
509DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
510OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
511HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
512LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
513OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
514SUCH DAMAGE.
515EOF
516    },
517    'Sub-Uplevel-0.2002' => {
518	license => 'Perl',
519	licensefile => "$CPAN/5.8/Sub-Uplevel-0.2002/LICENSE",
520    },
521    'Sub-Uplevel-0.22' => {
522	date => '2010-03-15',
523	license => 'Perl',
524	licensefile => "$CPAN/5.10/Sub-Uplevel-0.22/LICENSE",
525    },
526    'Sys-Hostname-Long-1.4' => {
527	license => 'Perl',
528	licensestr => $PerlLicense,
529    },
530    'TermReadKey-2.30' => {
531	license => 'Other',
532	licensestr => <<EOF,
533Copyright (C) 1994-1999 Kenneth Albanowski.
5342001-2005 Jonathan Stowe and others
535
536Unlimited distribution and/or modification is allowed as long as this
537copyright notice remains intact.
538EOF
539    },
540    'Test-Exception-0.27' => {
541	license => 'Perl',
542	licensestr => $PerlLicense,
543    },
544    'Test-Exception-0.29' => {
545	license => 'Perl',
546	licensestr => $PerlLicense,
547	date => '2010-03-15',
548    },
549    'Test-Pod-1.26' => {
550	license => 'Perl',
551	licensestr => $PerlLicense,
552    },
553    'Test-Pod-1.42' => {
554	license => 'Perl',
555	licensestr => $PerlLicense,
556	date => '2010-03-15',
557    },
558    'Time-Epoch-0.02' => {
559	license => 'Perl',
560	licensestr => $PerlLicense,
561    },
562    'Time-Progress-1.4' => {
563	license => 'Perl',
564	licensestr => $PerlLicense,
565    },
566    'Time-Progress-1.5' => {
567	license => 'Perl',
568	licensestr => $PerlLicense,
569	date => '2010-03-15',
570    },
571    'TimeDate-1.16' => {
572	license => 'Perl',
573	licensestr => $PerlLicense,
574    },
575    'TimeDate-1.20' => {
576	license => 'Perl',
577	licensestr => $PerlLicense,
578	date => '2010-03-15',
579    },
580    'UNIVERSAL-require-0.11' => {
581	license => 'Perl',
582	licensestr => $PerlLicense,
583    },
584    'UNIVERSAL-require-0.13' => {
585	license => 'Perl',
586	licensestr => $PerlLicense,
587	date => '2010-03-15',
588    },
589    'URI-1.37' => {
590	license => 'Perl',
591	licensestr => $PerlLicense,
592    },
593    'URI-1.53' => {
594	license => 'Perl',
595	licensestr => $PerlLicense,
596	date => '2010-03-15',
597    },
598    'Unix-Syslog-1.1' => {
599	license => 'Artistic',
600	licensefile => "$CPAN/5.10/Unix-Syslog-1.1/Artistic",
601    },
602    'XML-LibXML-1.69' => {
603	license => 'Perl',
604	licensefile => "$CPAN/5.8/XML-LibXML-1.69/LICENSE",
605    },
606    'XML-LibXML-1.70' => {
607	date => '2010-03-15',
608	license => 'Perl',
609	licensefile => "$CPAN/5.10/XML-LibXML-1.70/LICENSE",
610    },
611    'XML-LibXML-Common-0.13' => {
612	license => 'Perl',
613	licensefile => "$CPAN/5.8/XML-LibXML-Common-0.13/LICENSE",
614    },
615    'XML-NamespaceSupport-1.09' => {
616	license => 'Perl',
617	licensestr => $PerlLicense,
618    },
619    'XML-NamespaceSupport-1.10' => {
620	license => 'Perl',
621	licensestr => $PerlLicense,
622	date => '2010-03-15',
623    },
624    'XML-Parser-2.36' => {
625	license => 'Perl',
626	licensestr => $PerlLicense,
627    },
628    'XML-SAX-0.96' => {
629	license => 'Perl',
630	licensefile => "$CPAN/5.10/XML-SAX-0.96/LICENSE",
631    },
632    'XML-Simple-2.18' => {
633	license => 'Perl',
634	licensestr => $PerlLicense,
635    },
636    'XML-Writer-0.606' => {
637	license => 'MIT',
638	licensefile => "$CPAN/5.10/XML-Writer-0.606/LICENSE",
639    },
640    'XML-XPath-1.13' => {
641	license => 'Perl',
642	licensestr => $PerlLicense,
643    },
644    'YAML-Syck-1.05' => {
645	license => 'MIT/BSD',
646	licensestr => $YAMLLicense,
647    },
648    'YAML-Syck-1.07' => {
649	license => 'MIT/BSD',
650	licensestr => $YAMLLicense,
651	date => '2010-03-15',
652    },
653    'libwww-perl-5.813' => {
654	license => 'Perl',
655	licensestr => $PerlLicense,
656    },
657    'libwww-perl-5.834' => {
658	license => 'Perl',
659	licensestr => $PerlLicense,
660	date => '2010-03-15',
661    },
662    'perl-ldap-0.36' => {
663	license => 'Perl',
664	licensestr => $PerlLicense,
665    },
666    'perl-ldap-0.40' => {
667	license => 'Perl',
668	licensestr => $PerlLicense,
669	date => '2010-03-15',
670    },
671    'version-0.76' => {
672	license => 'Perl',
673	licensestr => $PerlLicense,
674    },
675);
676
677my $URLprefix = 'http://search.cpan.org/CPAN/authors/id';
678
679my $write;
680Getopt::Long::GetOptions('w' => \$write);
681
682sub nameVers {
683    my $x = shift;
684    my @parts = split('-', $x);
685    my $vers = pop(@parts);
686    (join('-', @parts), $vers)
687}
688
689CPAN::HandleConfig->load;
690CPAN::Shell::setup_output;
691CPAN::Index->reload;
692
693my($dist, $name, $vers, $url);
694my($OUT, $license);
695my @svncmd = qw(svn add);
696
697$OUT = \*STDOUT if !$write;
698for my $m (sort(keys(%modules))) {
699    printf "Looking for %s\n", $m;
700    my($n, $v) = nameVers($m);
701    $url = $outdated{$m};
702    if(!defined($url)) {
703	my $found;
704	my $mname = $n;
705	$mname =~ s/-/::/g;
706	for my $mod (CPAN::Shell->expand("Module", "/$mname/")) {
707	    $dist = $mod->distribution;
708	    next unless defined($dist);
709	    ($name, $vers) = nameVers($dist->base_id);
710	    next unless $name eq $mname;
711	    print "    Found $name-$vers\n";
712	    $found = $dist;
713	    last;
714	}
715	if(!defined($found)) {
716	    for my $dist (CPAN::Shell->expand("Distribution", "/\/$n-/")) {
717		($name, $vers) = nameVers($dist->base_id);
718		next unless $name eq $n;
719		print "    Found $name-$vers\n";
720		$found = $dist;
721		last
722	    }
723	    if(!defined($found)) {
724		print "***Can't find $m\n";
725		next;
726	    }
727	}
728	$url = $found->pretty_id;
729	my $base = $found->base_id;
730	$url =~ s/$base/$m/ unless $base eq $m;
731	my $a = substr($url, 0, 1);
732	my $a2 = substr($url, 0, 2);
733	$url = join('/', $URLprefix, $a, $a2, $url);
734    }
735    if($write) {
736	$OUT = IO::File->new("$Modules/$m/oss.partial", 'w');
737	if(!defined($OUT)) {
738	    warn "***Can't create $Modules/$m/oss.partial\n";
739	    next;
740	}
741    }
742    my $h = $modules{$m};
743    die "$m: no license\n" unless defined($h->{license});
744    print $OUT <<EOF;
745<dict>
746        <key>OpenSourceProject</key>
747        <string>$n</string>
748        <key>OpenSourceVersion</key>
749        <string>$v</string>
750        <key>OpenSourceWebsiteURL</key>
751        <string>http://search.cpan.org/</string>
752        <key>OpenSourceURL</key>
753        <string>$url</string>
754EOF
755
756    if(defined($h->{date})) {
757	print $OUT <<EOF;
758        <key>OpenSourceImportDate</key>
759        <string>$h->{date}</string>
760EOF
761    }
762    print $OUT <<EOF;
763        <key>OpenSourceLicense</key>
764        <string>$h->{license}</string>
765        <key>OpenSourceLicenseFile</key>
766        <string>CPAN.txt</string>
767</dict>
768EOF
769    if($write) {
770	undef($OUT);
771	$license = "$Modules/$m/LICENSE";
772    }
773    my @list;
774    if(defined($h->{licensefilelist})) {
775	@list = @{$h->{licensefilelist}};
776    } elsif(defined($h->{licensefile})) {
777	push(@list, $h->{licensefile});
778    }
779    if(scalar(@list) > 0) {
780	if(!$write) {
781	    print "License Files:\n";
782	}
783	for(@list) {
784	    if($write) {
785		system("cat $_ >> $license") == 0 or die "\"cat $_ >> $license\" failed\n";
786	    } else {
787		if(!-f $_) {
788		    warn "***No $_\n";
789		    next;
790		print "    $_\n";
791	    }
792	}
793    } else {
794	die "$m: no licensestr\n" unless defined($h->{licensestr});
795	if($write) {
796	    $OUT = IO::File->new($license, 'w') or die "Can't create $license\n";
797	    print $OUT $h->{licensestr};
798	    undef($OUT);
799	} else {
800	    print "=========== License String ==========\n";
801	    print $h->{licensestr};
802	    print "=====================================\n";
803	}
804    }
805    if($write) {
806	system(@svncmd, $license, "$Modules/$m/oss.partial") == 0 or die "\"@svncmd $license $Modules/$m/oss.partial\" failed\n";
807    }
808}
809