CTK::Net - Network working
Version 1.00
$Revision: 69 $
my %ftpct = ( ftphost => '192.168.1.1', ftpuser => 'login', ftppassword => 'password', ftpdir => '~/dir01', #ftpattr => {}, ); my %uaopt = ( agent => "Mozilla/4.0", max_redirect => 10, requests_redirectable => ['GET','HEAD','POST'], keep_alive => 1, env_proxy => 1, ); my %httpct = ( method => 'GET', url => 'http://example.com', #login => 'login', #password => 'password', #utf8 => 1, ); $c->fetch( -connect => {%ftpct}, # Connect data -protocol => 'ftp', # Protocol: ftp / sftp -dir => $DATADIR, # Destination directory -cmd => 'copyuniq', # Command: copy / copyuniq / move / moveuniq -mode => 'bin', # Transfer mode: ascii / binary (bin) -list => qr//, # Source mask (regular expression, filename or ArrayRef of files) ); my $stat = $c->fetch( -connect => {%httpct}, # Connect data -uaopt => {%uaopt}, # Options UserAgent (optional) -protocol => 'http', # Protocol: http / https -dir => $DATADIR, # Destination directory #-file => '123.html', # Filename (optional) #-uacode => sub { }, # Handler (code) of LWP::UserAgent (optional) #-reqcode => sub { }, # Handler (code) of HTTP::Request (optional) #-rescode => sub { }, # Handler (code) of HTTP::Response (optional) ); debug("STATUS: ",$stat); # Simple sample my $html = $c->fetch( -connect => { method => 'GET', url => 'http://google.com/robots.txt', }, -protocol => 'http', #-utf8 => 1, ); debug("DATA:\n\n",$html,"\n"); $c->store( -connect => {%ftpct}, # Connect data -protocol => 'ftp', # Protocol: ftp / sftp -dir => $DATADIR, # Source directory -cmd => 'copyuniq', # Command: copy / copyuniq / move / moveuniq -mode => 'bin', # Transfer mode: ascii / binary (bin) -file => 'sample.t', # Source mask (regular expression, filename or ArrayRef of files) );
Using handlers, for sample:
-rescode => sub { debug(CTK::Net::_debug_http(@_)) }, or -rescode => sub { debug($c->debug_http(@_)) },
* Use SSH (SFTP)
Serz Minus (Lepenkov Sergey) http://serzik.ru <minus@mail333.com>
Copyright (C) 1998-2012 D&D Corporation. All Rights Reserved
This program is free software; you can redistribute it and/or modify it under the same terms and conditions as Perl itself.
This program is distributed under the GNU LGPL v3 (GNU Lesser General Public License version 3).
See LICENSE file
LICENSE
To install CTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CTK
CPAN shell
perl -MCPAN -e shell install CTK
For more information on module installation, please visit the detailed CPAN module installation guide.