summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl.straw/bin/cpaninject.bat
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-03-01 01:54:19 +0000
committerNorbert Preining <preining@logic.at>2010-03-01 01:54:19 +0000
commit904fd0757fe037dbfbf156b31f72e5ff5c7cd796 (patch)
tree36f000ab754854574aad17c01d9cd9ac739f1053 /Master/tlpkg/tlperl.straw/bin/cpaninject.bat
parent402bd194f686177d2dfca24f7c4766434c514141 (diff)
commit more files of the tlperl.straw dir, still not complete
git-svn-id: svn://tug.org/texlive/trunk@17244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl.straw/bin/cpaninject.bat')
-rwxr-xr-xMaster/tlpkg/tlperl.straw/bin/cpaninject.bat153
1 files changed, 153 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl.straw/bin/cpaninject.bat b/Master/tlpkg/tlperl.straw/bin/cpaninject.bat
new file mode 100755
index 00000000000..ddbeeff5dd2
--- /dev/null
+++ b/Master/tlpkg/tlperl.straw/bin/cpaninject.bat
@@ -0,0 +1,153 @@
+@rem = '--*-Perl-*--
+@echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+@rem ';
+#!/usr/bin/perl
+#line 15
+
+=pod
+
+=head1 NAME
+
+cpaninject - Inject a distribution for installation via the CPAN shell
+
+=head1 SYNOPSIS
+
+ # Add the distribution
+ cpaninject myperlmodule.tar.gz
+
+ # And then install it from the cpan shell
+ cpan> install LOCAL/myperlmodule.tar.gz
+
+=head1 DESCRIPTION
+
+B<cpaninject> is a small front-end application for the L<CPAN::Inject>
+module.
+
+It takes any arbitrary Perl distribution tarball (open source or
+otherwise) and injects it into the local CPAN file cache, smoothing
+some metadata files to make it look as if it came from CPAN.
+
+It makes use the officially blessed "Reserved Local CPAN Author" id
+"LOCAL" as the author the distributions are added under.
+
+To use the program, just run F<cpaninject> F<mytarball.tar.gz> to add it,
+then the CPAN shell to install it (with full automatic recursive
+dependency installation).
+
+The key here being the recursive dependency installation, which you are
+now able to do even for installing non-CPAN modules.
+
+This simplifies the installation process a little, and makes things easier
+on someone that just wants to install a single commercial or non-CPAN
+Perl module that might have a dozen or more CPAN dependencies.
+
+=cut
+
+package cpaninject;
+
+use strict;
+use Params::Util '_STRING';
+use CPAN::Inject;
+
+use vars qw{$VERSION};
+BEGIN {
+ $VERSION = '0.11';
+}
+
+
+
+
+
+#####################################################################
+# Configuration
+
+unless ( @ARGV ) {
+ error("Usage: cpaninject ./any/Perl-Distribution-1.00.tar.gz");
+}
+
+# Get the file name
+my $file = _STRING(shift @ARGV);
+unless ( $file ) {
+ error("Did not provide a file name");
+}
+unless ( -f $file ) {
+ error("File '$file' does not exist");
+}
+unless ( -r $file ) {
+ error("No permissions to read '$file'");
+}
+
+# Create the injector
+my $cpan = eval { CPAN::Inject->from_cpan_config };
+if ( $@ ) {
+ my $message = $@;
+ $message =~ s/^(.+)\s+at line.+$/$1/;
+ error( $message );
+}
+
+# Add the file
+my $path = $cpan->add( file => $file );
+message( "Injected $file ok.\n" );
+message( "The following command will install it from the CPAN shell.\n" );
+message( "\n" );
+message( "cpan> install $path\n" );
+message( "\n" );
+exit(0);
+
+
+
+
+
+#####################################################################
+# Support Functions
+
+sub message ($) {
+ print ' ' . $_[0];
+}
+
+sub error (@) {
+ print ' ' . join '', map { "$_\n" } ('', @_, '');
+ exit(255);
+}
+
+=pod
+
+=head1 SUPPORT
+
+All bugs should be filed via the bug tracker at
+
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPAN-Inject>
+
+For other issues, or commercial enhancement and support, contact the author
+
+=head1 AUTHOR
+
+Adam Kennedy E<lt>adamk@cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+L<CPAN::Mini::Inject>
+
+=head1 COPYRIGHT
+
+Copyright 2006 Adam Kennedy.
+
+This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+The full text of the license can be found in the
+LICENSE file included with this module.
+
+=cut
+
+__END__
+:endofperl