Skip to content

Commit

Permalink
Make it easier to install the program. Bump version to 1.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkende committed May 9, 2024
1 parent cbacf40 commit 4c7e578
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 25 deletions.
15 changes: 14 additions & 1 deletion .aspelldict
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,9 +18,19 @@ PODNAME
PTP
PerlEnv
Pipelining
ProhibitAmbiguousNames
ProhibitComplexVersion
ProhibitMagicNumbers
ProhibitNoWarnings
ProhibitOneArgSelect
ProhibitStringyEval
ReadOnlyVar
Readonly
RequireArgUnpacking
RequireConstantVersion
SIG
SafeEnv
TODO
TRE
UTF
Util
Expand Down Expand Up @@ -61,6 +73,7 @@ ns
ownprocess
passwd
perl
perlcritic
perldoc
perllocale
pfn
Expand Down
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
41 changes: 21 additions & 20 deletions README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,35 @@ installed. It usually comes in a B<perl-doc> 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<perldoc> 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<ptp> 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<make> and B<git> 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<ptp> 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<cpan> 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<ptp>
every time you update your system Perl.
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ suggests 're::engine::RE2';
suggests 're::engine::TRE';

on 'test' => sub {
requires 'Benchmark';
suggests 'Benchmark';
suggests 'Time::HiRes';
}
2 changes: 1 addition & 1 deletion lib/App/PTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/App/PTP/Args.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions script/ptp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion t/003-benchmarks.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4c7e578

Please sign in to comment.