MToken::Client - Client for interaction with MToken server
Version 1.02
use MToken::Client; my $clinet = MToken::Client->new( url => "https://localhost:8642", username => "username", # optional password => "password", # optional pwcache => "/path/to/pwcache.tmp", pwcache_ttl => 300, # 5 min. Default max_redirects => 2, # Default: 10 connect_timeout => 3, # Default: 10 sec inactivity_timeout => 5, # Default: 30 sec request_timeout => 10, # Default: 5 min (300 sec) ); my $status = $client->check(); if ($status) { print STDOUT $client->res->body; } else { print STDERR $clinet->error; }
Client for interaction with MToken server
my $clinet = MToken::Client->new( url => "https://localhost:8642", username => "username", # optional password => "password", # optional pwcache => "/path/to/pwcache.tmp", pwcache_ttl => 300, # 5 min. Default max_redirects => 2, # Default: 10 connect_timeout => 3, # Default: 10 sec inactivity_timeout => 5, # Default: 30 sec request_timeout => 10, # Default: 5 min (300 sec) );
Returns client
Maximum number of redirects the user agent will follow before it fails. Default - 10
Default password for basic authentication
Full path to file of password cache
Time to Live of pwcache file. Default - 300 sec
Timeout for connections, requests and inactivity periods in seconds.
The Mojo UserAgent object
Full URL of the WEB Server
Default username for basic authentication
my $status = $client->check; my $status = $client->check(URL);
Returns check-status of server. 0 - Error; 1 - Ok
$client->cleanup;
Cleanup all variable data in object and returns client object
my $code = $clinet->code;
Returns HTTP code of the response
my $userinfo = $client->credentials($MOJO_URL_OBJECT, 1)
Gets credentials for User Agent
my $status = $client->download(TOKEN_NAME => TARBALL_FILE_PATH);
Request for download file from server by file path. The method returns status of operation: 0 - Error; 1 - Ok
print $clinet->error;
Returns error string
my $status = $clinet->info(); my $status = $clinet->info( TOKEN_NAME );
Request for getting information about token storage or about list of stored token tarballs.
my $status = $client->remove(TOKEN_NAME => TARBALL_FILE_NAME);
Request for deleting of the file on server by filename. The method returns status of operation: 0 - Error; 1 - Ok
my $request = $clinet->req;
Returns Mojo::Message::Request object
my $json = $clinet->request("METHOD", "PATH", ...ATTRIBUTES...);
Send request
my $response = $clinet->res;
Returns Mojo::Message::Response object
my $status = $clinet->status;
Returns object status value. 0 - Error; 1 - Ok
my $trace = $client->trace; print $client->trace("New trace record");
Gets trace stack or pushes new trace record to trace stack
my $status = $clinet->tx($tx);
Works with Mojo::Transaction object, interface with it
my $ua = $clinet->ua;
Returns Mojo::UserAgent object
my $status = $client->upload(TOKEN_NAME => TARBALL_FILE_PATH);
Request for uploading of tarball on server. The method returns status of operation: 0 - Error; 1 - Ok
my $url_object = $clinet->url;
Returns Mojo::URL object
See Changes file
Changes
Mojolicious
See TODO file
TODO
CTK, Mojo::UserAgent
Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>
Copyright (C) 1998-2021 D&D Corporation. All Rights Reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE file and https://dev.perl.org/licenses/
LICENSE
To install MToken, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MToken
CPAN shell
perl -MCPAN -e shell install MToken
For more information on module installation, please visit the detailed CPAN module installation guide.