diff options
-rw-r--r-- | README.markdown | 7 | ||||
-rwxr-xr-x | bin/croncrypt | 23 | ||||
-rw-r--r-- | share/man/man1/croncrypt.1 | 2 |
3 files changed, 7 insertions, 25 deletions
diff --git a/README.markdown b/README.markdown index 217d0c6..5ca520b 100644 --- a/README.markdown +++ b/README.markdown @@ -26,15 +26,14 @@ Put the `croncrypt` binary somewhere in your `crontab`’s `PATH`, and install the following Perl modules: * `Carp` -* `IPC::Open3` +* `IPC::Run3` * `Mail::GnuPG` * `MIME::Entity` -* `Symbol` On Debian-derived systems, this should do the trick: - # aptitude install perl-base perl-modules \ - libmail-gnupg-perl libmime-tools-perl + # aptitude install perl-base perl-modules libmail-gnupg-perl \ + libmime-tools-perl libipc-run3-perl License ------- diff --git a/bin/croncrypt b/bin/croncrypt index 3d903e0..a47069b 100755 --- a/bin/croncrypt +++ b/bin/croncrypt @@ -38,10 +38,9 @@ our $VERSION = 0.1; # Pull in some required modules use Carp; -use IPC::Open3; +use IPC::Run3; use Mail::GnuPG; use MIME::Entity; -use Symbol 'gensym'; # Bail if run without arguments if ( !@ARGV ) { @@ -73,25 +72,9 @@ my $recipient = $ENV{MAILTO}; my $key = $ENV{CRONCRYPT_KEYID}; my $passphrase = $ENV{CRONCRYPT_PASSPHRASE}; -# Establish filehandles; need to specifically create symbol for stderr -my ( $stdin, $stdout, $stderr ); -$stderr = gensym; - # Run the command in the arguments and wait for it to finish -my $pid = open3( $stdin, $stdout, $stderr, @ARGV ); -waitpid $pid, 0; - -# Read any and all output and errors -my @output = <$stdout>; -my @errors = <$stderr>; - -# Close the filehandles, placating Perl::Critic with return checks -close $stdin - or croak('Could not close stdin'); -close $stdout - or croak('Could not close stdout'); -close $stderr - or croak('Could not close stderr'); +my ( @output, @errors ); +run3( \@ARGV, undef, \@output, \@errors ); # If there was output, mail it if (@output) { diff --git a/share/man/man1/croncrypt.1 b/share/man/man1/croncrypt.1 index 41ea87a..dd5b508 100644 --- a/share/man/man1/croncrypt.1 +++ b/share/man/man1/croncrypt.1 @@ -21,7 +21,7 @@ Don't use your own GPG key for signing! I recommend you create a dedicated key just for Croncrypt, and sign it locally with gpg --lsign so that your software trusts it locally. .SH SEE ALSO -gpg(1), gpg-agent(1), Mail::GnuPG(3pm), MIME::Entity(3pm) +gpg(1), gpg-agent(1), IPC::Run3(3pm), Mail::GnuPG(3pm), MIME::Entity(3pm) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> |