forked from briandfoy/PerlPowerTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
246 additions
and
5,469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
=pod | ||
|
||
=encoding utf8 | ||
|
||
=head1 What is PerlPowerTools.exe ? | ||
|
||
F<perlpowertools.exe> provides all PerlPowerTools packaged as a single standalone | ||
Windows executable (no dependencies). Perl interpreter included. | ||
|
||
As BusyBox, if the executable is renamed / hardlinked / symlinked as one of the | ||
tools, it will behave as that tool automatically. | ||
|
||
=head2 How to call the tools? | ||
|
||
bin/cat # the standard way | ||
bin/perlpowertools cat # with helper script | ||
packed/perlpowertools.exe cat # from standalone executable | ||
packed/cat.exe # perlpowertools.exe renamed as cat.exe | ||
|
||
=head2 How to read the doc? | ||
|
||
bin/perldoc cat # cat documentation | ||
bin/perlpowertools perldoc cat # cat documentation | ||
packed/perlpowertools.exe perldoc perlpowertools # PerlPowerTools documentation | ||
packed/perlpowertools.exe perldoc perldoc # perldoc documentation | ||
|
||
=head2 How to find the version? | ||
|
||
bin/perlpowertools -V # PerlPowerTools module version | ||
packed/perlpowertools.exe -V # PerlPowerTools module version | ||
|
||
=head2 How does it work? | ||
|
||
bin/perlpowertools # dispatcher/frontend (has same behaviour packed or not) | ||
bin/perldoc # custom 'perldoc' (has same behaviour packed or not) | ||
util/packer # bundles everything together with PAR::Packer | ||
|
||
The build script F<util/packer> uses PAR::Packer to package the content of `bin` | ||
and generate F<packed/perlpowertools.exe> (about 11MB). When executed, this file | ||
unzip itself into a temporary directory (meaning fhe first run takes a few seconds). | ||
|
||
PAR will execute the tool from `bin` with same name as the executable (without extension). | ||
The executable MUST be called 'perlpowertools.exe' or 'one-of-the-tools.exe', otherwise | ||
PAR won't know what to run. | ||
|
||
=head2 Can I add my own scripts? | ||
|
||
Yes, copy them into `bin` and run F<util/packer>. | ||
|
||
=head2 Notes | ||
|
||
=over | ||
|
||
=item - The executable is detected by some antivirus software. | ||
|
||
=item - Modulinos need a patch to work, please see F<PROGRAMMING_STYLE.md>. | ||
|
||
=item - Feedbacks of any kind are very welcomed and encouraged. | ||
|
||
=back | ||
|
||
C<kaldor AT cpan.org> | ||
|
||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ | |
=begin metadata | ||
Name: perlpowertools | ||
Description: a program launcher for Perl Power Tools | ||
Author: kal247, https://github.com/kal247 | ||
License: artistic2 | ||
Description: helper script for PerlPowerTools | ||
Author: jul, [email protected] | ||
License: Artistic License 2.0 | ||
=end metadata | ||
|
@@ -18,11 +18,14 @@ use warnings; | |
use utf8; | ||
use Getopt::Std; | ||
use File::Basename; | ||
use Cwd 'abs_path'; | ||
use Cwd qw (abs_path cwd); | ||
my $ppt_dir; | ||
BEGIN { $ppt_dir = dirname(abs_path($0)) . '/..' }; | ||
use lib $ppt_dir . '/lib'; | ||
use PerlPowerTools; | ||
|
||
our $VERSION = qw( 1.024 ); | ||
our $VERSION = $PerlPowerTools::VERSION; | ||
my $program = 'perlpowertools'; | ||
my @tools = qw( addbib apply ar arch arithmetic asa awk banner basename bc cal cat chgrp ching chmod chown clear cmp col colrm comm cp cut date dc deroff diff dirname du echo ed env expand expr factor false file find fish fmt fold fortune from glob grep hangman head id install join kill ln lock look ls mail man maze mimedecode mkdir mkfifo moo morse nl od par paste patch perldoc pig ping pom ppt pr primes printenv printf pwd rain random rev rm rmdir robots rot13 shar sleep sort spell split strings sum tac tail tar tee test time touch tr true tsort tty uname unexpand uniq units unpar unshar uudecode uuencode wc what which whois words wump xargs yes ); | ||
my $usage = <<EOF; | ||
Usage: $program [-hVl] | ||
|
@@ -44,17 +47,26 @@ my $list = $options{l} || 0; | |
|
||
die $usage if $help; | ||
die $VERSION . "\n" if $version; | ||
die join ("\n", @tools) . "\n" if $list; | ||
|
||
my $tool = shift || ''; | ||
|
||
######## | ||
# MAIN # | ||
######## | ||
|
||
my $tool = shift || ''; | ||
my $ppt_bin = defined $ENV{PAR_TEMP} ? "$ENV{PAR_TEMP}/inc/script" : dirname(abs_path($0)); | ||
my $cwd = cwd; | ||
chdir $ppt_bin; | ||
my @tools = glob("*"); | ||
chdir $cwd; | ||
@tools = grep { $_ ne "$program" } @tools; | ||
|
||
die join ("\n", @tools) . "\n" if $list; | ||
die $usage if not grep { $tool eq $_ } @tools; | ||
|
||
my $file = defined $ENV{PAR_TEMP} ? "$ENV{PAR_TEMP}/inc/script/$tool" : dirname(abs_path($0)) . "/$tool"; | ||
my $file = "$ppt_bin/$tool"; | ||
$0 = $tool; # for usage/warning/error messages | ||
package PerlPowerTools::Packed; # change caller(0), for modulinos | ||
my $return = do $file; | ||
die $@ if $@; | ||
die "$file: $!" unless defined $return; | ||
|
Oops, something went wrong.