line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::All::Securftp; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
38672
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
83
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
88
|
|
5
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
205
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
953
|
use IO::All::Securftp::iowrap qw(); |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
72
|
|
8
|
2
|
|
|
2
|
|
849
|
use IO::All 0.30 '-base'; |
|
2
|
|
|
|
|
14276
|
|
|
2
|
|
|
|
|
19
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
const type => "securftp"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
IO::All::Securftp - Securftp handler for IO::All |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$VERSION = '0.001'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use IO::All; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$content < io('securftp://remote@server/path/to/file.ext'); |
25
|
|
|
|
|
|
|
io('Securftp://user@host/path/to/file.ext') > io("$tmpdir/file.ext"); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
io('Securftp://user@host/path/to/file.ext')->print("Hello world: $msg\n"); |
28
|
|
|
|
|
|
|
my $content = io($self->{uri} . "/$filename")->open("<", { get_content => { conversion => 'unix2dos' } })->slurp(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This module extends IO::All for dealing with secure ftp remotes. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 SecureFTP_init |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Called by uri handler of IO::All. The capability of user specified parameters |
39
|
|
|
|
|
|
|
are limited. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub SecureFTP_init |
44
|
|
|
|
|
|
|
{ |
45
|
1
|
|
|
1
|
1
|
1
|
my $self = shift; |
46
|
1
|
|
|
|
|
2
|
bless $self, shift; |
47
|
1
|
50
|
|
|
|
8
|
@_ and $self->name(shift); |
48
|
1
|
|
|
|
|
85
|
$self->_init; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 securftp |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Called by uri handler of IO::All. The capability of user specified parameters |
54
|
|
|
|
|
|
|
are limited. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
1
|
1
|
139
|
sub securftp { my $self=shift; $self->SecureFTP_init(__PACKAGE__, @_) } |
|
1
|
|
|
|
|
4
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 open |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Called whenever a handle shall be opened for reading or writing. Can be |
63
|
|
|
|
|
|
|
triggered manually or automatically. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
$io->open($mode, \%options?) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
As C<$mode> values are "<", ">" and ">>" supported. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The C<%options> hash is passed to L. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub open |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
76
|
0
|
|
|
|
|
|
$self->is_open(1); |
77
|
0
|
0
|
|
|
|
|
my $mode = @_ ? shift : $self->mode ? $self->mode : '<'; |
|
|
0
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$self->mode($mode); |
79
|
0
|
0
|
|
|
|
|
my $opts = @_ ? shift : {}; |
80
|
0
|
|
|
|
|
|
my $sftph = IO::All::Securftp::iowrap->new($self->name, $opts); |
81
|
0
|
0
|
|
|
|
|
if ($mode eq '<') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$sftph->_fetch(); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
elsif ($mode eq '>') { |
85
|
0
|
|
|
|
|
|
$sftph->_preput(); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
elsif ($mode eq '>>') { |
88
|
0
|
|
|
|
|
|
$sftph->_preappend(); |
89
|
|
|
|
|
|
|
} |
90
|
0
|
|
|
|
|
|
$self->io_handle($sftph); |
91
|
0
|
|
|
|
|
|
$self; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Jens Rehsack, C<< >> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 BUGS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
101
|
|
|
|
|
|
|
C, or through the web interface at |
102
|
|
|
|
|
|
|
L. |
103
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress |
104
|
|
|
|
|
|
|
on your bug as I make changes. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SUPPORT |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
perldoc IO::All::Securftp |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
You can also look for information at: |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=over 4 |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * CPAN Ratings |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * Search CPAN |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
L |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=back |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Copyright 2015 Jens Rehsack. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
141
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
142
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SEE ALSO |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; # End of IO::All::Securftp |