ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-FCP/FCP.pm
(Generate patch)

Comparing Net-FCP/FCP.pm (file contents):
Revision 1.30 by root, Fri May 14 16:12:26 2004 UTC vs.
Revision 1.31 by root, Fri May 14 16:28:20 2004 UTC

77$VERSION = 0.7; 77$VERSION = 0.7;
78 78
79no warnings; 79no warnings;
80 80
81use Net::FCP::Metadata; 81use Net::FCP::Metadata;
82use Net::FCP::Util qw(tolc touc xeh);
82 83
83our $EVENT = Net::FCP::Event::Auto::; 84our $EVENT = Net::FCP::Event::Auto::;
84 85
85sub import { 86sub 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
97sub touc($) {
98 local $_ = shift;
99 1 while s/((?:^|_)(?:svk|chk|uri)(?:_|$))/\U$1/;
100 s/(?:^|_)(.)/\U$1/g;
101 $_;
102}
103
104sub 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
113sub 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
119Create a new virtual FCP connection to the given host and port (default 100Create a new virtual FCP connection to the given host and port (default

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines