App-Memcached-Tool
view release on metacpan or search on metacpan
v0.9.4 2016-03-26T08:53:38Z
- Fix Bug: in "dump_all" command, set expiration time 0 correctly for data
which never expires.
v0.9.3 2016-03-24T15:50:47Z
- Minor improve:
- Refactor. Better handling of response from Memcached
- Exclude available MODE strings from Util::looks_like_addr() targets
v0.9.2 2016-03-22T22:21:04Z
- Minor improve. Close connection explicitly.
v0.9.1 2016-03-22T16:58:25Z
- Update documentation.
v0.9.0 2016-03-22T16:45:12Z
lib/App/Memcached/Tool/CLI.pm view on Meta::CPAN
$params{addr}, timeout => $params{timeout}
);
bless \%params, $class;
}
sub parse_args {
my $class = shift;
my %params; # will be passed to new()
if (defined $ARGV[0] and looks_like_addr($ARGV[0])) {
$params{addr} = shift @ARGV;
}
if (defined $ARGV[0] and first { $_ eq $ARGV[0] } MODES()) {
$params{mode} = shift @ARGV;
}
GetOptions(
\my %opts, 'addr|a=s', 'mode|m=s', 'timeout|t=i',
'debug|d', 'help|h', 'man',
) or return +{};
lib/App/Memcached/Tool/Util.pm view on Meta::CPAN
use strict;
use warnings;
use 5.008_001;
use Exporter 'import';
use List::Util qw(first);
use POSIX 'strftime';
use Time::HiRes 'gettimeofday';
our @EXPORT_OK = qw(
looks_like_addr
create_addr
is_unixsocket
debug
);
our %EXPORT_TAGS = (all => \@EXPORT_OK);
use App::Memcached::Tool;
use App::Memcached::Tool::Constants ':all';
use version; our $VERSION = 'v0.9.4';
sub looks_like_addr {
my $string = shift;
return $string if is_unixsocket($string);
my $hostname = $string;
if (first { $_ eq $string } MODES()) {
return;
}
if ($hostname =~ m/([^\s:]+):\d+/) {
$hostname = $1;
}
lib/App/Memcached/Tool/Util.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
App::Memcached::Tool::Util - Utility function set
=head1 SYNOPSIS
use App::Memcached::Tool::Util ':all';
if (looks_like_addr($given)) {
...
}
my $addr = is_unixsocket($given) ? $given : create_addr($hostname);
debug "foo";
=head1 DESCRIPTION
App::Memcached::Tool::Util provides utility functions for other modules.
=head1 LICENSE
( run in 0.328 second using v1.01-cache-2.11-cpan-64827b87656 )