Changeset 11778 for lang/perl/Punc
- Timestamp:
- 05/17/08 20:38:17 (6 months ago)
- Location:
- lang/perl/Punc/trunk/lib/Punc
- Files:
-
- 2 modified
-
Client.pm (modified) (1 diff)
-
Client/Request.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Punc/trunk/lib/Punc/Client.pm
r11777 r11778 45 45 module => $module, 46 46 }); 47 48 return $client->init; 47 49 } 48 50 -
lang/perl/Punc/trunk/lib/Punc/Client/Request.pm
r11749 r11778 9 9 our $AUTOLOAD; 10 10 11 sub new { 12 my ( $class, $args ) = @_; 11 use Moose; 13 12 14 my $confdir = $args->{conf}->{confdir}; 13 has 'conf' => ( is => 'rw', isa => 'HashRef' ); 14 has 'hosts' => ( is => 'rw', isa => 'ArrayRef' ); 15 has 'module' => ( is => 'rw', isa => 'Str' ); 16 has 'method' => ( is => 'rw', isa => 'Str' ); 17 has 'args' => ( is => 'rw', isa => 'HashRef' ); 18 19 has 'client' => ( 20 is => 'rw', 21 isa => 'JSON::RPC::Client', 22 default => sub { JSON::RPC::Client->new }, 23 ); 24 25 sub init { 26 my ( $self, $args ) = @_; 27 28 my $confdir = $self->conf->{confdir}; 15 29 16 30 $ENV{HTTPS_VERSION} = 3; … … 22 36 ); 23 37 24 $args->{client} = JSON::RPC::Client->new; 25 26 bless $args, $class; 27 } 38 return $self; 39 }; 28 40 29 41 sub request { … … 31 43 32 44 my $response = Punc::Client::Response->new; 33 for my $host ( @{ $self-> {hosts}} ) {45 for my $host ( @{ $self->hosts } ) { 34 46 35 47 my $url = "https://$host:7080/$self->{module}"; 36 48 my $callobj = { 37 method => $self-> {method},38 params => $self-> {args},49 method => $self->method, 50 params => $self->args, 39 51 }; 40 52 41 my $res = $self-> {client}->call($url, $callobj) or warn @?;53 my $res = $self->client->call($url, $callobj) or warn @?; 42 54 43 55 if( $res ) { … … 58 70 return if $method eq 'DESTROY'; 59 71 60 $self-> {method} = $method;61 $self-> {args} = $args;72 $self->method($method); 73 $self->args($args); 62 74 63 if ( $self-> {module} eq 'file' and $self->{method}eq 'copy' ) {75 if ( $self->module eq 'file' and $self->method eq 'copy' ) { 64 76 open my $fh, '<', $args->{src} or die $!; 65 77 $args->{content} = do { local $/; <$fh> };
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)