From e437f5f8921c036d46ec25a4ae541c5d68f19795 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 15 Oct 2017 00:49:57 +1300 Subject: Backport to v5.8.1, bump version It may be possible to go back further, but I'm tying myself in knots trying. Might have another go later. Dropped Const::Fast dependency even though it can be installed on 5.8.1; seems silly for one numeric constant. Just told Perl::Critic to turn a blind eye. --- Changes | 4 ++++ Makefile.PL | 5 ++--- README.markdown | 5 ++--- bin/runcrypt | 15 ++++++--------- lib/Mail/Run/Crypt.pm | 33 ++++++++++++++++----------------- t/instantiate.t | 2 +- 6 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Changes b/Changes index 06446f3..b41333c 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,10 @@ Revision history for Perl module Mail::Run::Crypt This project began life as a monolithic Perl script. It does much the same thing now but it's refactored out into an application and a module. +0.05 2017-10-15 + + - Backport to Perl v5.8.1 + 0.04 2017-10-14 - Another documentation fix diff --git a/Makefile.PL b/Makefile.PL index e41f722..9132104 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -10,7 +10,7 @@ WriteMakefile( ABSTRACT_FROM => 'lib/Mail/Run/Crypt.pm', LICENSE => 'artistic_2', PL_FILES => {}, - MIN_PERL_VERSION => '5.010', + MIN_PERL_VERSION => '5.008_001', CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '0', }, @@ -19,7 +19,6 @@ WriteMakefile( }, PREREQ_PM => { 'Carp' => 0, - 'Const::Fast' => 0, 'English' => 0, 'File::stat' => 0, 'Getopt::Long::Descriptive' => 0, @@ -32,7 +31,7 @@ WriteMakefile( 'meta-spec' => { version => 2 }, provides => { 'Mail::Run::Crypt' => { - version => '0.04', + version => '0.05', file => 'lib/Mail/Run/Crypt.pm', }, }, diff --git a/README.markdown b/README.markdown index fcf89a1..765fec9 100644 --- a/README.markdown +++ b/README.markdown @@ -4,7 +4,7 @@ Mail::Run::Crypt - Encrypt and mail output from command runs # VERSION -Version 0.04 +Version 0.05 # DESCRIPTION @@ -131,9 +131,8 @@ of this series: # DEPENDENCIES -- Perl v5.10.0 or newer +- Perl v5.8.1 or newer - [Carp](https://metacpan.org/pod/Carp) -- [Const::Fast](https://metacpan.org/pod/Const::Fast) - [English](https://metacpan.org/pod/English) - [IPC::Run3](https://metacpan.org/pod/IPC::Run3) - [Mail::GnuPG](https://metacpan.org/pod/Mail::GnuPG) diff --git a/bin/runcrypt b/bin/runcrypt index 4b7dfe5..f00c472 100755 --- a/bin/runcrypt +++ b/bin/runcrypt @@ -7,8 +7,7 @@ use warnings; use utf8; # Require this version of Perl -# 5.010 for defined-or operator -use 5.010; +use 5.008_001; # Import required modules use Carp; @@ -18,7 +17,7 @@ use Getopt::Long::Descriptive; use Mail::Run::Crypt; # Specify package version -our $VERSION = '0.04'; +our $VERSION = '0.05'; # Name ourselves our $SELF = 'runcrypt'; @@ -36,21 +35,21 @@ my ( $opt, $usage ) = describe_options( # Key ID defaults to environment RUNCRYPT_KEYID if set [ 'keyid|k=s', 'GnuPG key ID', - { default => $ENV{RUNCRYPT_KEYID} // undef }, + { default => $ENV{RUNCRYPT_KEYID} || undef }, ], # Key passphrase file defaults to environment RUNCRYPT_PASSFILE if set [ 'passfile|p=s', 'Path to GnuPG passphrase file', - { default => $ENV{RUNCRYPT_PASSFILE} // undef }, + { default => $ENV{RUNCRYPT_PASSFILE} || undef }, ], # MAILTO address defaults to environment MAILTO if set [ 'mailto|m=s', 'Mail destination address (MAILTO)', - { default => $ENV{RUNCRYPT_MAILTO} // $ENV{MAILTO} // undef }, + { default => $ENV{RUNCRYPT_MAILTO} || $ENV{MAILTO} || undef }, ], # Instance name (for email subjects) defaults to $SELF @@ -118,8 +117,6 @@ __END__ =pod -=encoding utf8 - =for stopwords runcrypt decrypt stdout stderr GPG GnuPG OpenPGP tradename licensable MERCHANTABILITY passfile @@ -255,7 +252,7 @@ L =item * -Perl 5.10 or newer +Perl v5.8.1 or newer =item * diff --git a/lib/Mail/Run/Crypt.pm b/lib/Mail/Run/Crypt.pm index 2fa1bb8..e3210fd 100644 --- a/lib/Mail/Run/Crypt.pm +++ b/lib/Mail/Run/Crypt.pm @@ -6,22 +6,20 @@ use warnings; use utf8; # Require this version of Perl -# 5.010 for defined-or operator -use 5.010; +use 5.008_001; # Import required modules use Carp; -use Const::Fast; use English '-no_match_vars'; use IPC::Run3; use Mail::GnuPG; use MIME::Entity; # Specify package verson -our $VERSION = '0.04'; +our $VERSION = '0.05'; # Default exit value -const our $DEFAULT_EXIT => 127; +our $DEFAULT_EXIT = 127; ## no critic (ProhibitMagicNumbers) # Oldschool constructor sub new { @@ -36,11 +34,11 @@ sub new { # Default the instance name to the package name if it wasn't given; # runcrypt(1) will pass it in - $self->{name} //= $class; + defined $self->{name} or $self->{name} = $class; # We default to encrypting but not signing - $self->{encrypt} //= 1; - $self->{sign} //= 0; + defined $self->{encrypt} or $self->{encrypt} = 1; + defined $self->{sign} or $self->{sign} = 0; # If signing, we need a key ID and a passphrase if ( $self->{sign} ) { @@ -83,7 +81,14 @@ sub run { } # Return the value of the most recently run command, or 1 otherwise -sub bail { return shift->{exit} // $DEFAULT_EXIT } +sub bail { + my $self = shift; + my $exit = + defined $self->{exit} + ? $self->{exit} + : $DEFAULT_EXIT; + return $exit; +} # Send the message to the address in $ENV{MAILTO} sub _mail { @@ -127,15 +132,13 @@ __END__ mailserver decrypt runcrypt GPG OpenPGP tradename licensable MERCHANTABILITY mailto keyid -=encoding utf8 - =head1 NAME Mail::Run::Crypt - Encrypt and mail output from command runs =head1 VERSION -Version 0.04 +Version 0.05 =head1 DESCRIPTION @@ -273,7 +276,7 @@ L =item * -Perl v5.10.0 or newer +Perl v5.8.1 or newer =item * @@ -281,10 +284,6 @@ L =item * -L - -=item * - L =item * diff --git a/t/instantiate.t b/t/instantiate.t index 1b7058c..6a55fe0 100644 --- a/t/instantiate.t +++ b/t/instantiate.t @@ -8,7 +8,7 @@ use Test::More tests => 1; use Mail::Run::Crypt; -our $VERSION = '0.04'; +our $VERSION = '0.05'; my $mrc = Mail::Run::Crypt->new( mailto => 'nobody@example.com' ); -- cgit v1.2.3