CPAN-Mini-Inject-Remote
view release on metacpan or search on metacpan
lib/CPAN/Mini/Inject/Remote.pm view on Meta::CPAN
=head2 add
Calls the add function on the remote server
=cut
sub add {
my $self = shift;
my %args = validate(@_,
{
module_name => {
type => SCALAR,
},
author_id => {
type => SCALAR,
},
version => {
type => SCALAR,
},
file_name => {
type => SCALAR,
},
}
);
if (not -r $args{file_name})
{
croak "Module file is not readable";
}
my $ua = $self->_useragent();
my $response = $ua->request(POST $self->{remote_server}.'/add',
Content_Type => 'form-data',
Content => [
module => $args{module_name},
authorid => $args{author_id},
version => $args{version},
file => [$args{file_name}],
]
);
if (not $response->is_success())
{
#croak 'Add failed. ' . Dumper($response);
warn 'Add failed. ' . $response->status_line . "\n";
}
return $response;
} # end of method add
=head2 update
Calls the update function on the remote server
=cut
sub update {
my $self = shift;
my %args = validate(@_,
{
}
);
my $ua = $self->_useragent();
my $response = $ua->request(POST $self->{remote_server}.'/update');
if (not $response->is_success())
{
#croak 'Update failed. ' . Dumper($response);
warn 'Update failed. ' . $response->status_line . "\n";
}
return $response;
} # end of method update
=head2 inject
Calls the inject function on the remote server
=cut
sub inject {
my $self = shift;
my %args = validate(@_,
{
}
);
my $ua = $self->_useragent();
my $response = $ua->request(POST $self->{remote_server}.'/inject');
if (not $response->is_success())
{
#croak 'Inject failed. ' . Dumper($response);
warn 'Inject failed. ' . $response->status_line . "\n";
}
return $response;
} # end of method inject
=head1 CONFIGURATION FILE
the sample configuration file ~/.mcpani_remote over SSL:
remote_server: https://mcpani.your.org
SSL_cert_file: ~/.certs/your.crt
SSL_key_file: ~/.certs/your.key
SSL_ca_file: #!perl -MCACertOrg::CA -e 'print CACertOrg::CA::SSL_ca_file()'
you want to export your.crt and your.key from your.p12:
( run in 1.729 second using v1.01-cache-2.11-cpan-13bb782fe5a )