| 1 |
#!perl -w |
| 2 |
# $Id: use-devel-checklib,v 1.9 2008/03/12 19:52:50 drhyde Exp $ |
| 3 |
|
| 4 |
use strict; |
| 5 |
|
| 6 |
$/ = undef; |
| 7 |
|
| 8 |
use File::Spec; |
| 9 |
use Devel::CheckLib; |
| 10 |
|
| 11 |
warn "----------------------- [WARNING] --------\n"; |
| 12 |
warn "THIS SCRIPT WAS DEPRECATED.\n"; |
| 13 |
warn "YOU SHOULD USE configure_requires INSTEAD.\n"; |
| 14 |
warn "---------- [/WARNING] --------------------\n"; |
| 15 |
|
| 16 |
my @files = grep { -f $_ } qw(Makefile.PL Build.PL); |
| 17 |
push @files, 'Makefile.PL' unless(@files); |
| 18 |
|
| 19 |
my @libs = @ARGV; |
| 20 |
|
| 21 |
mkdir 'inc'; |
| 22 |
mkdir 'inc/Devel'; |
| 23 |
|
| 24 |
open(CHECKLIBPM, $INC{'Devel/CheckLib.pm'}) || |
| 25 |
die("Can't read $INC{'Devel/CheckLib.pm'}: $!"); |
| 26 |
(my $checklibpm = <CHECKLIBPM>) =~ s/package Devel::CheckLib/package #\nDevel::CheckLib/; |
| 27 |
close(CHECKLIBPM); |
| 28 |
open(CHECKLIBPM, '>'.File::Spec->catfile(qw(inc Devel CheckLib.pm))) || |
| 29 |
die("Can't write inc/Devel/CheckLib.pm: $!"); |
| 30 |
print CHECKLIBPM $checklibpm; |
| 31 |
close(CHECKLIBPM); |
| 32 |
|
| 33 |
print "Copied Devel::CheckLib to inc/ directory\n"; |
| 34 |
|
| 35 |
foreach my $file (@files) { |
| 36 |
open(FILE, $file) || next; |
| 37 |
my $contents = <FILE>; |
| 38 |
close(FILE); |
| 39 |
open(FILE, ">$file") || die("Can't write $file\n"); |
| 40 |
print FILE q{use lib qw(inc); |
| 41 |
use Devel::CheckLib; |
| 42 |
|
| 43 |
# Prompt the user here for any paths and other configuration |
| 44 |
|
| 45 |
check_lib_or_exit( |
| 46 |
# fill in what you prompted the user for here |
| 47 |
lib => [qw(}.join(' ', @libs).q{)] |
| 48 |
); |
| 49 |
}; |
| 50 |
print FILE "\n\n$contents"; |
| 51 |
close(FILE); |
| 52 |
print "Updated/created $file\n"; |
| 53 |
} |
| 54 |
|
| 55 |
open(MANIFEST, 'MANIFEST') || warn("Couldn't read MANIFEST, will create one\n"); |
| 56 |
my $manifest = <MANIFEST>; |
| 57 |
close(MANIFEST); |
| 58 |
open(MANIFEST, '>MANIFEST') || die("Couldn't write MANIFEST\n"); |
| 59 |
print MANIFEST "inc/Devel/CheckLib.pm\n$manifest"; |
| 60 |
close(MANIFEST); |
| 61 |
print "Updated/created MANIFEST\n"; |
| 62 |
|
| 63 |
=head1 NAME |
| 64 |
|
| 65 |
use-devel-checklib - (DEPRECATED)a script to package Devel::CheckLib with your code. |
| 66 |
|
| 67 |
=head1 DESCRIPTION |
| 68 |
|
| 69 |
This script was DEPRECATED. |
| 70 |
|
| 71 |
If you need to depend on this library, you should use `configure_requires` in Makefile.PL or Build.PL instead. |
| 72 |
|
| 73 |
=head1 WARNINGS, BUGS and FEEDBACK |
| 74 |
|
| 75 |
This script has not been thoroughly tested. You should check by |
| 76 |
hand that it has done what you expected after running it. |
| 77 |
|
| 78 |
If you use Module::Build::Compat to write a Makefile.PL, then you |
| 79 |
will need to re-run this script whenever you have generated a new |
| 80 |
Makefile.PL. |
| 81 |
|
| 82 |
I welcome feedback about my code, including constructive criticism. |
| 83 |
Bug reports should be made using L<http://rt.cpan.org/> or by email. |
| 84 |
|
| 85 |
=head1 SEE ALSO |
| 86 |
|
| 87 |
L<Devel::CheckLib> |
| 88 |
|
| 89 |
=head1 AUTHOR |
| 90 |
|
| 91 |
David Cantrell E<lt>F<[email protected]>E<gt> |
| 92 |
|
| 93 |
=head1 COPYRIGHT and LICENCE |
| 94 |
|
| 95 |
Copyright 2007 David Cantrell |
| 96 |
|
| 97 |
This software is free-as-in-speech software, and may be used, |
| 98 |
distributed, and modified under the same conditions as perl itself. |
| 99 |
|
| 100 |
=head1 CONSPIRACY |
| 101 |
|
| 102 |
This module is also free-as-in-mason software. |
| 103 |
|
| 104 |
=cut |