line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of PerlIO-via-GnuPG |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2013 by Chris Weyl. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The GNU Lesser General Public License, Version 2.1, February 1999 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
package PerlIO::via::GnuPG::Maybe; |
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
|
|
1
|
|
670
|
$PerlIO::via::GnuPG::Maybe::AUTHORITY = 'cpan:RSRCHBOY'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
$PerlIO::via::GnuPG::Maybe::VERSION = '0.004'; |
15
|
|
|
|
|
|
|
# ABSTRACT: Layer to decrypt or pass-through unencrypted data on read |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
826
|
use parent 'PerlIO::via::GnuPG'; |
|
1
|
|
|
|
|
299
|
|
|
1
|
|
|
|
|
5
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
7
|
sub _passthrough_unencrypted { 1 } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
!!42; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding UTF-8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=for :stopwords Chris Weyl decrypt |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
PerlIO::via::GnuPG::Maybe - Layer to decrypt or pass-through unencrypted data on read |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 VERSION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This document describes version 0.004 of PerlIO::via::GnuPG::Maybe - released April 14, 2014 as part of PerlIO-via-GnuPG. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use PerlIO::via::GnuPG::Maybe; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# cleartext.txt may or may not be encrypted; |
47
|
|
|
|
|
|
|
# returns the content or dies on any other error. |
48
|
|
|
|
|
|
|
open(my $fh, '<:via(GnuPG::Maybe)', 'cleartext.txt') |
49
|
|
|
|
|
|
|
or die "cannot open! $!"; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my @in = <$fh>; # or whatever... |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This is a L<PerlIO> module to decrypt files transparently. If you try to |
56
|
|
|
|
|
|
|
open and read a file that is not encrypted, we will simply pass that file |
57
|
|
|
|
|
|
|
through unmolested. If you try to open and read one that is encrypted, |
58
|
|
|
|
|
|
|
it tries to decrypt it and pass it back along to you. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
If you're looking for a stricter implementation, see L<PerlIO::via::GnuPG>; |
61
|
|
|
|
|
|
|
it will die if the file is unencrypted. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
It's pretty simple and does not support writing, but works. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
...and if it doesn't, please file an issue :) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=for Pod::Coverage FILL PUSHED |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SEE ALSO |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over 4 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L<PerlIO::via::GnuPG|PerlIO::via::GnuPG> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<PerlIO|PerlIO> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L<PerlIO::via|PerlIO::via> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L<PerlIO::via::GnuPG|PerlIO::via::GnuPG> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SOURCE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The development version is on github at L<http://https://github.com/RsrchBoy/PerlIO-via-GnuPG> |
96
|
|
|
|
|
|
|
and may be cloned from L<git://https://github.com/RsrchBoy/PerlIO-via-GnuPG.git> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 BUGS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
101
|
|
|
|
|
|
|
https://github.com/RsrchBoy/PerlIO-via-GnuPG/issues |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
104
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
105
|
|
|
|
|
|
|
feature. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Chris Weyl <cweyl@alumni.drew.edu> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Chris Weyl. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software, licensed under: |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The GNU Lesser General Public License, Version 2.1, February 1999 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |