diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-15 00:49:57 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-15 00:49:57 +1300 |
commit | e437f5f8921c036d46ec25a4ae541c5d68f19795 (patch) | |
tree | 436d7b39a015346545ec93f82b61773f0f493736 /lib | |
parent | Bump version (diff) | |
download | Mail-Run-Crypt-e437f5f8921c036d46ec25a4ae541c5d68f19795.tar.gz (sig) Mail-Run-Crypt-e437f5f8921c036d46ec25a4ae541c5d68f19795.zip |
Backport to v5.8.1, bump versionv0.05
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Mail/Run/Crypt.pm | 33 |
1 files changed, 16 insertions, 17 deletions
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<https://sanctum.geek.nz/arabesque/series/gnu-linux-crypto/> =item * -Perl v5.10.0 or newer +Perl v5.8.1 or newer =item * @@ -281,10 +284,6 @@ L<Carp|Carp> =item * -L<Const::Fast|Const::Fast> - -=item * - L<English|English> =item * |