add proper error handling for all final exec calls
[hband-tools.git] / user-tools / base64url
blobded13be0cd0c428e04226cddcbc8b6a1cb36f09a
1 #!/usr/bin/env perl
3 use warnings;
4 no if ($] >= 5.018), 'warnings' => 'experimental::smartmatch';
5 use MIME::Base64 qw/encode_base64url decode_base64url/;
7 if($ARGV[0] ~~ ['-d', '--decode'])
9 undef $/;
10 print decode_base64url(<STDIN>);
12 elsif(not @ARGV)
14 undef $/;
15 print encode_base64url(<STDIN>);
17 else
19 die "Usage: $0 [-d | --decode]\n";
22 __END__
24 =pod
26 =head1 NAME
28 base64url - Encode to (decode from) Base64-URL encoding
30 =cut