App-Memcached-CLI
view release on metacpan or search on metacpan
lib/App/Memcached/CLI/Main.pm view on Meta::CPAN
return;
}
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;
}
GetOptions(
\my %opts, 'addr|a=s', 'timeout|t=i',
'debug|d', 'help|h', 'man',
) or return +{};
if (defined $opts{debug}) {
$App::Memcached::CLI::DEBUG = 1;
}
lib/App/Memcached/CLI/Util.pm view on Meta::CPAN
use strict;
use warnings;
use 5.008_001;
use Exporter 'import';
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::CLI;
use App::Memcached::CLI::Constants ':all';
use version; our $VERSION = 'v0.9.5';
sub looks_like_addr {
my $string = shift;
return $string if is_unixsocket($string);
my $hostname = $string;
if ($hostname =~ m/([^\s:]+):\d+/) {
$hostname = $1;
}
return $string if gethostbyname($hostname);
return;
lib/App/Memcached/CLI/Util.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
App::Memcached::CLI::Util - Utility functions for memcached-cli
=head1 SYNOPSIS
use App::Memcached::CLI::Util ':all';
if (looks_like_addr($given)) {
...
}
my $addr = is_unixsocket($given) ? $given : create_addr($hostname);
debug "foo";
=head1 DESCRIPTION
This module provides utility functions for other modules.
=head1 LICENSE
( run in 0.532 second using v1.01-cache-2.11-cpan-64827b87656 )