diff --git a/.aspelldict b/.aspelldict index 506d9ee..889c9a2 100644 --- a/.aspelldict +++ b/.aspelldict @@ -1,8 +1,10 @@ -personal_ws-1.1 en 98 +personal_ws-1.1 en 111 AliasVar CMD CPAN CRLF +CentOS +DESTINSTALLBIN EOF FindBin GetOptionsFromArray @@ -16,9 +18,19 @@ PODNAME PTP PerlEnv Pipelining +ProhibitAmbiguousNames +ProhibitComplexVersion +ProhibitMagicNumbers +ProhibitNoWarnings +ProhibitOneArgSelect +ProhibitStringyEval ReadOnlyVar +Readonly +RequireArgUnpacking +RequireConstantVersion SIG SafeEnv +TODO TRE UTF Util @@ -61,6 +73,7 @@ ns ownprocess passwd perl +perlcritic perldoc perllocale pfn diff --git a/Changes b/Changes index 65334fc..a3aec36 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl distribution App-PTP +1.13 - 2024-05-09 + - Make the program be easier to install from CPAN. + 1.12 - 2024-02-16 - Use perl_dist_setup to setup the distribution - Add --sq, --dq, and --ds modes to help work with shell escaping. diff --git a/README.pod b/README.pod index 05d41e5..b067733 100644 --- a/README.pod +++ b/README.pod @@ -36,34 +36,35 @@ installed. It usually comes in a B package on most systems. =head3 Requirements -Building and installing this program only requires Perl modules from the -standard library. So as long as you have Perl installed (which should be the -case by default on almost all system), you should be able to install ptp using -one of the method below. This program requires Perl version 5.22 or above. You -can check which Perl you have installed with the following command: +To install this program you need Perl and its cpanminus package manager. The +B program is recommended but not required. You can these dependencies +with one of the following command lines, depending on your OS: - perl -v + # On Debian, Ubuntu, Mint, etc. + sudo apt-get install perl cpanminus perl-doc build-essential + + # On Red Hat, Fedora, CentOS, etc. + sudo yum install perl Perl-App-cpanminus perl-doc gcc make + +=head3 Installing from CPAN (recommanded) + +This program is available on CPAN (the Perl package manager). So, to install +B automatically using CPAN, you can just run the following command: + + sudo cpanm App::PTP -n -L /usr/local --man-pages --install-args 'DESTINSTALLBIN=/usr/local/bin' =head3 Installing from the Git sources -To install the program manually from Git, you can run the following commands -(you do need to have the B and B program installed): +To install the program manually from Git, you can run the following commands: git clone https://github.com/mkende/ptp.git cd ptp + cpanm --installdeps . -n --with-configure perl Makefile.PL make - make test + # Optionally: + # make test sudo make install -=head3 Installing from CPAN - -This module is available on CPAN (the Perl package manager). The CPAN command -should be installed on any system that has Perl (which, again, should mostly be -any system at all). So, to install B automatically using CPAN, you can just -run the following command: - - cpan App::PTP - -Note: if this is the first time that you run the B command, you will be -asked to configure it. The default answer to most questions is usually fine. +Note that this approach is discouraged because you will need to reinstall B +every time you update your system Perl. diff --git a/cpanfile b/cpanfile index d98d305..bffbe6b 100644 --- a/cpanfile +++ b/cpanfile @@ -50,6 +50,6 @@ suggests 're::engine::RE2'; suggests 're::engine::TRE'; on 'test' => sub { - requires 'Benchmark'; + suggests 'Benchmark'; suggests 'Time::HiRes'; } diff --git a/lib/App/PTP.pm b/lib/App/PTP.pm index fb0a08c..c676e49 100644 --- a/lib/App/PTP.pm +++ b/lib/App/PTP.pm @@ -11,7 +11,7 @@ use Data::Dumper; use File::Find; use Safe; -our $VERSION = '1.12'; +our $VERSION = '1.13'; $Data::Dumper::Terse = 1; # Don't output variable names. $Data::Dumper::Sortkeys = 1; # Sort the content of the hash variables. diff --git a/lib/App/PTP/Args.pm b/lib/App/PTP/Args.pm index 9bdfbe6..b6e423f 100755 --- a/lib/App/PTP/Args.pm +++ b/lib/App/PTP/Args.pm @@ -90,7 +90,7 @@ sub reset_global { sub set_output { my (undef, $f) = @_; if (defined $options{output}) { - die "Only a single occurence of --output or --append is allowed.\n"; + die "Only a single occurrence of --output or --append is allowed.\n"; } $options{output} = $f; } diff --git a/script/ptp b/script/ptp index e7f9ab3..6778314 100755 --- a/script/ptp +++ b/script/ptp @@ -4,6 +4,8 @@ use 5.022; use strict; use warnings; +use lib '/usr/local/lib/perl5'; + use App::PTP; our $VERSION = $App::PTP::VERSION; ## no critic (ProhibitComplexVersion, RequireConstantVersion) diff --git a/t/003-benchmarks.t b/t/003-benchmarks.t index a06f29e..1a5008a 100755 --- a/t/003-benchmarks.t +++ b/t/003-benchmarks.t @@ -7,13 +7,20 @@ no warnings 'experimental::smartmatch'; use App::PTP::Args; use App::PTP::Commands qw(do_perl do_grep do_substitute do_sort); -use Benchmark qw(:hireswallclock :all); +use English; use Test::More; if ($ENV{HARNESS_ACTIVE}) { plan skip_all => 'Benchmarks need to be run explicitly.'; } +BEGIN { + eval 'use Benchmark qw(:hireswallclock :all)'; + if ($EVAL_ERROR) { + skip_all('TheBenchmark module is required'); + } +} + my $content_size = 5000; my @content = ('abcdefgh') x $content_size;