Created
November 27, 2012 08:39
-
-
Save need4spd/4153166 to your computer and use it in GitHub Desktop.
perl class로 만들어 개발하기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package DEVYONGSIK::File; | |
use strict; | |
use warnings; | |
sub new { | |
my $self = {}; | |
$self->{FILE_NAME} = undef; | |
$self->{SRC_DIR} = undef; | |
$self->{DST_DIR} = undef; | |
$self->{IP_LIST} = []; | |
bless($self); | |
return $self; | |
} | |
sub file_name { | |
my $self = shift; | |
if (@_) { $self->{FILE_NAME} = shift} | |
return $self->{FILE_NAME}; | |
} | |
sub src_dir { | |
my $self = shift; | |
if (@_) { $self->{SRC_DIR} = shift} | |
return $self->{SRC_DIR}; | |
} | |
sub dst_dir { | |
my $self = shift; | |
if (@_) { $self->{DST_DIR} = shift} | |
return $self->{DST_DIR}; | |
} | |
sub ip_list { | |
my $self = shift; | |
if (@_) { @{ $self->{IP_LIST}} = @_} | |
return @{$self->{IP_LIST}}; | |
} | |
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use lib "/custom/lib/"; | |
use HTTP::Request::Common qw(POST); | |
use LWP::UserAgent; | |
require HTTP::Headers; | |
my $ua = LWP::UserAgent->new; | |
my $req=POST 'http://url', | |
header=>'header', | |
contents-type=>'text/html', | |
Content => [key1=>'value1', key2=>'value2'..]; | |
print $ua->request($req)->as_string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use DEVYONGSIK::File; | |
//생성 | |
my $file = DEVYONGSIK::File->new(); | |
//set | |
$file->file_name($data); | |
$file->src_dir($dir); | |
$file->dst_dir($dir); | |
my @ip_list = ~~~ 배열; | |
$file->ip_list(@ip_list); | |
#get | |
$file->file_name; | |
$file->src_dir; | |
$file->dst_dir; | |
$file->ip_list; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment