… | |
… | |
77 | $VERSION = 0.7; |
77 | $VERSION = 0.7; |
78 | |
78 | |
79 | no warnings; |
79 | no warnings; |
80 | |
80 | |
81 | use Net::FCP::Metadata; |
81 | use Net::FCP::Metadata; |
|
|
82 | use Net::FCP::Util qw(tolc touc xeh); |
82 | |
83 | |
83 | our $EVENT = Net::FCP::Event::Auto::; |
84 | our $EVENT = Net::FCP::Event::Auto::; |
84 | |
85 | |
85 | sub import { |
86 | sub import { |
86 | shift; |
87 | shift; |
… | |
… | |
90 | $EVENT = "Net::FCP::Event::$1"; |
91 | $EVENT = "Net::FCP::Event::$1"; |
91 | eval "require $EVENT"; |
92 | eval "require $EVENT"; |
92 | } |
93 | } |
93 | } |
94 | } |
94 | die $@ if $@; |
95 | die $@ if $@; |
95 | } |
|
|
96 | |
|
|
97 | sub touc($) { |
|
|
98 | local $_ = shift; |
|
|
99 | 1 while s/((?:^|_)(?:svk|chk|uri)(?:_|$))/\U$1/; |
|
|
100 | s/(?:^|_)(.)/\U$1/g; |
|
|
101 | $_; |
|
|
102 | } |
|
|
103 | |
|
|
104 | sub tolc($) { |
|
|
105 | local $_ = shift; |
|
|
106 | 1 while s/(SVK|CHK|URI)([^_])/$1\_$2/i; |
|
|
107 | 1 while s/([^_])(SVK|CHK|URI)/$1\_$2/i; |
|
|
108 | s/(?<=[a-z])(?=[A-Z])/_/g; |
|
|
109 | lc $_; |
|
|
110 | } |
|
|
111 | |
|
|
112 | # the opposite of hex |
|
|
113 | sub xeh($) { |
|
|
114 | sprintf "%x", $_[0]; |
|
|
115 | } |
96 | } |
116 | |
97 | |
117 | =item $fcp = new Net::FCP [host => $host][, port => $port][, progress => \&cb] |
98 | =item $fcp = new Net::FCP [host => $host][, port => $port][, progress => \&cb] |
118 | |
99 | |
119 | Create a new virtual FCP connection to the given host and port (default |
100 | Create a new virtual FCP connection to the given host and port (default |
… | |
… | |
274 | cipher => $cipher || "Twofish"); |
255 | cipher => $cipher || "Twofish"); |
275 | }); |
256 | }); |
276 | |
257 | |
277 | =item $txn = $fcp->txn_generate_svk_pair |
258 | =item $txn = $fcp->txn_generate_svk_pair |
278 | |
259 | |
279 | =item ($public, $private) = @{ $fcp->generate_svk_pair } |
260 | =item ($public, $private, $crypto) = @{ $fcp->generate_svk_pair } |
280 | |
261 | |
281 | Creates a new SVK pair. Returns an arrayref with the public key, the |
262 | Creates a new SVK pair. Returns an arrayref with the public key, the |
282 | private key and a crypto key, which is just additional entropy. |
263 | private key and a crypto key, which is just additional entropy. |
283 | |
264 | |
284 | [ |
265 | [ |