Algorithm-ConsistentHash-Ketama
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$class =~ s/^\Q$args{prefix}\E:://;
$args{name} ||= $class;
$args{version} ||= $class->VERSION;
unless ( $args{path} ) {
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
$args{wrote} = 0;
bless( \%args, $class );
}
sub call {
my ($self, $method) = @_;
my $obj = $self->load($method) or return;
splice(@_, 0, 2, $obj);
goto &{$obj->can($method)};
}
sub load {
inc/Module/Install/Base.pm view on Meta::CPAN
#line 42
sub new {
my $class = shift;
unless ( defined &{"${class}::call"} ) {
*{"${class}::call"} = sub { shift->_top->call(@_) };
}
unless ( defined &{"${class}::load"} ) {
*{"${class}::load"} = sub { shift->_top->load(@_) };
}
bless { @_ }, $class;
}
#line 61
sub AUTOLOAD {
local $@;
my $func = eval { shift->_top->autoload } or return;
goto &$func;
}
inc/Module/Install/Base.pm view on Meta::CPAN
package Module::Install::Base::FakeAdmin;
use vars qw{$VERSION};
BEGIN {
$VERSION = $Module::Install::Base::VERSION;
}
my $fake;
sub new {
$fake ||= bless(\@_, $_[0]);
}
sub AUTOLOAD {}
sub DESTROY {}
# Restore warning handler
BEGIN {
$SIG{__WARN__} = $SIG{__WARN__}->();
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
$self->version( ExtUtils::MM_Unix->parse_version($file) );
# for version integrity check
$self->makemaker_args( VERSION_FROM => $file );
}
sub abstract_from {
require ExtUtils::MM_Unix;
my ( $self, $file ) = @_;
$self->abstract(
bless(
{ DISTNAME => $self->name },
'ExtUtils::MM_Unix'
)->parse_abstract($file)
);
}
# Add both distribution and module name
sub name_from {
my ($self, $file) = @_;
if (
lib/Algorithm/ConsistentHash/Ketama/Bucket.pm view on Meta::CPAN
package Algorithm::ConsistentHash::Ketama::Bucket;
use strict;
sub new {
my ($class, %args) = @_;
my $self = bless {%args}, $class;
return $self;
}
sub label { $_[0]->{label} }
sub weight { $_[0]->{weight} }
1;
__END__
} else {
croak(\"not a ketama object\");
}
}
OUTPUT
T_PERLKETAMA
if (!$var) /* if null */
SvOK_off($arg); /* then return as undef instead of reaf to undef */
else {
/* setup $arg as a ref to a blessed hash hv */
MAGIC *mg;
HV *hv = newHV();
const char *classname = \"Algorithm::ConsistentHash::Ketama\";
/* take (sub)class name to use from class_sv if appropriate */
if (SvMAGICAL(class_sv))
mg_get(class_sv);
if (SvOK( class_sv ) && sv_derived_from(class_sv, classname ) ) {
if(SvROK(class_sv) && SvOBJECT(SvRV(class_sv))) {
classname = sv_reftype(SvRV(class_sv), TRUE);
} else {
classname = SvPV_nolen(class_sv);
}
}
sv_setsv($arg, sv_2mortal(newRV_noinc((SV*)hv)));
(void)sv_bless($arg, gv_stashpv(classname, TRUE));
mg = sv_magicext((SV*)hv, NULL, PERL_MAGIC_ext, &PerlKetama_vtbl, (char*) $var, 0);
mg->mg_flags |= MGf_DUP;
}
( run in 1.274 second using v1.01-cache-2.11-cpan-de7293f3b23 )