view release on metacpan or search on metacpan
lib/Activator/Exception.pm view on Meta::CPAN
use strict;
# override throw to accept shortcut
sub throw {
my ( $pkg, $obj, $code, $extra ) = @_;
$pkg->SUPER::throw( error => $obj,
code => $code,
extra => $extra );
}
# TODO: make this thing do dictionary/lexicon lookups, with support in
# $extra as well. Maybe $extra could "dict-><key>".
# TODO: make this take 2 args, update all of Activator
# NOTE: this is always called from SUPER::as_string
sub full_message {
my $self = shift;
my $msg = $self->description .': ' . $self->error;
my $code = $self->code;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Adapter/Async/OrderedList/Array.pm view on Meta::CPAN
See L<Adapter::Async::OrderedList> for the API.
=cut
sub new {
my $self = shift->SUPER::new(@_);
$self->{data} ||= [];
$self
}
sub clear {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ado/Build.pm view on Meta::CPAN
#in case of installing a plugin, check if folder exists
next unless -d $be;
$self->add_build_element($be);
$self->install_path($be => catdir($prefix, $be));
}
return $self->SUPER::create_build_script();
}
sub process_public_files {
my $self = shift;
for my $asset (@{$self->rscan_dir('public')}) {
lib/Ado/Build.pm view on Meta::CPAN
#Make sure *log files are empty before moving them to blib
_empty_log_files('log');
#Do other interventions before the real build...
$self->SUPER::ACTION_build;
return;
}
sub ACTION_test {
my $self = shift;
#Custom functionality before test
$self->_process_custom_files(catdir('blib', 'etc'), catdir('blib', 'log'))
if -d 'blib';
$self->_process_custom_files('etc', 'log');
$self->SUPER::ACTION_test;
return;
}
sub ACTION_dist {
my $self = shift;
#Make sure *log files are empty before including them into the distro
_empty_log_files('log');
#Do other interventions before the real dist..
$self->SUPER::ACTION_dist;
return;
}
sub ACTION_install {
my $self = shift;
#Custom functionality before installation
#here...
#TODO: Think about what to do with *.conf and *.sqlite files in case of upgrade!!!
#TODO: (upgrade)rotate logs - archive existing log files before emptying.
$self->SUPER::ACTION_install;
#Custom functionality after installation
$self->_process_custom_files($self->install_path('etc'), $self->install_path('log'));
return;
}
lib/Ado/Build.pm view on Meta::CPAN
$self->log_info("Created $readme_md$/");
}
else { Carp::croak("Could not create $readme_md... $!"); }
}
else {
$self->SUPER::do_create_readme();
}
return;
}
1;
lib/Ado/Build.pm view on Meta::CPAN
This method is called in C<Build.PL>.
In this method we also call C<add_build_element> for C<etc> C<public>,
C<templates> and C<log> folders.
Finally we set all the C<install_path>s for the distro
and we call C<$self-E<gt>SUPER::create_build_script>.
=head2 process_etc_files
Moves files found in C<Ado/etc> to C<Ado/blib/etc>.
See L<Module::Build::API/METHODS>
lib/Ado/Build.pm view on Meta::CPAN
Returns void.
=head2 ACTION_build
We put here custom functionality executed around the
C<$self-E<gt>SUPER::ACTION_build>. See the source for details.
=head2 ACTION_test
We put here custom functionality executed around the
C<$self-E<gt>SUPER::ACTION_test>. See the source for details.
=head2 ACTION_dist
We put here custom functionality executed around the
C<$self-E<gt>SUPER::ACTION_dist>. See the sources for details.
=head2 ACTION_install
Changes file permissions to C<0600> of some files
like C<etc/ado.sqlite> and to C<0400> of some files like C<etc/ado.conf>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Affix.pm view on Meta::CPAN
Carp::croak 'Undefined subroutine &' . $_delay{$sub}[6] unless $cv;
delete $_delay{$sub} if defined $_delay{$sub};
return &$cv;
}
#~ elsif ( my $code = $self->can('SUPER::AUTOLOAD') ) {
#~ return goto &$code;
#~ }
elsif ( $sub =~ /DESTROY$/ ) {
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
builder/MyBuilder.pm view on Meta::CPAN
use 5.008008;
use base 'Module::Build::XSUtil';
sub new {
my ( $self, %args ) = @_;
$self->SUPER::new(
%args,
add_to_cleanup => [
'Algorithm-AdaGrad-*', 'MANIFEST.bak', 'lib/Algorithm/*.o',
],
meta_add => { keywords => [qw/AdaGrad/], },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
sub failure {
my ($self, $timestamp) = @_;
$timestamp //= time;
my ($delay, $timeout) = $self->SUPER::failure($timestamp);
# Fix certain values if the check failed max duration/attempts checks
$timeout //= $self->timeout;
if ($delay == -1) {
$self->{_attempts}++;
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
my $self = shift;
# See https://github.com/perlancar/perl-Algorithm-Backoff/issues/1
$self->{_last_delay} = $self->{_prev_delay} //= 0;
return $self->SUPER::_consider_actual_delay(@_);
}
sub _success_or_failure {
my ($self, $is_success, $timestamp) = @_;
# If this is the first time, the _last_timestamp should be set to the start, not
# $timestamp. This will prevent issues with the first attempt causing unnecessary
# delays (ie: waiting 1.4s after the first attempt took longer than that).
$self->{_last_timestamp} //= $self->{_start_timestamp};
my $delay = $self->SUPER::_success_or_failure($is_success, $timestamp);
return $self->_set_last_timeout($delay, $timestamp);
}
#pod =head1 SEE ALSO
#pod
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
#-----------------------------------------------------------------------
##---------------------------------------------------------------
sub MY::constants {
package MY;
my $inherited = shift->SUPER::constants(@_);
return $inherited;
}
##---------------------------------------------------------------
sub MY::depend {
package MY;
my $inherited = shift->SUPER::depend(@_);
$inherited .= (
###-- depends -> README.txt
"\n\n"
.join('',
map {
Makefile.PL view on Meta::CPAN
}
##---------------------------------------------------------------
sub MY::special_targets {
package MY;
my $inherited = shift->SUPER::special_targets(@_);
$inherited .=
"
.SUFFIXES: .pm .pod .rpod .man .txt .html
.pm.html:
Makefile.PL view on Meta::CPAN
}
##---------------------------------------------------------------
sub MY::postamble {
package MY;
my $inherited = shift->SUPER::postamble(@_);
return $inherited;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/XSUtil.pm view on Meta::CPAN
# XXX: We must append to PM inside ExtUtils::MakeMaker->new().
sub init_PM {
my $self = shift;
$self->SUPER::init_PM(@_);
while(my($k, $v) = each %ToInstall){
$self->{PM}{$k} = $v;
}
return;
inc/Module/Install/XSUtil.pm view on Meta::CPAN
# append object file names to CCCMD
sub const_cccmd {
my $self = shift;
my $cccmd = $self->SUPER::const_cccmd(@_);
return q{} unless $cccmd;
if (Module::Install::XSUtil::_is_msvc()){
$cccmd .= ' -Fo$@';
}
inc/Module/Install/XSUtil.pm view on Meta::CPAN
return $cccmd
}
sub xs_c {
my($self) = @_;
my $mm = $self->SUPER::xs_c();
$mm =~ s/ \.c /.cpp/xmsg if $UseCplusplus;
return $mm;
}
sub xs_o {
my($self) = @_;
my $mm = $self->SUPER::xs_o();
$mm =~ s/ \.c /.cpp/xmsg if $UseCplusplus;
return $mm;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/DLX.pm view on Meta::CPAN
# Column structure for DLX
package DLX::Column;
use base 'DLX::Node';
sub new {
my ($class, $col) = @_;
my $self = $class->SUPER::new(undef, $col);
$self->{size} = 0;
$self->{name} = $col;
$self->{column} = $self;
bless $self, $class;
return $self;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/RegressionTree.pm view on Meta::CPAN
$self->{_training_data_hash} = \%feature_values_for_samples_hash;
$self->{_features_and_values_hash} = \%features_and_values_hash;
$self->{_features_and_unique_values_hash} = \%features_and_unique_values_hash;
$self->{_numeric_features_valuerange_hash} = \%numeric_features_valuerange_hash;
$self->{_feature_values_how_many_uniques_hash} = \%feature_values_how_many_uniques_hash;
$self->SUPER::calculate_first_order_probabilities();
}
sub construct_XMatrix_and_YVector_all_data {
my $self = shift;
my $matrix_rows_as_lists = [ map {my @arr = @$_; [map substr($_,index($_,'=')+1), @arr] } map {$self->{_training_data_hash}->{$_}} sort {sample_index($a) <=> sample_index($b)} keys %{$self->{_training_data_hash}} ];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Dependency/MapReduce.pm view on Meta::CPAN
unless ( _CODE($args{'reduce'}) ) {
Carp::croak("The 'reduce' param is not a CODE reference");
}
# Hand off to the parent constructor
my $self = $class->SUPER::new(@_);
# Add the extra attributes
$self->{'map'} = $args{'map'};
$self->{'reduce'} = $args{'reduce'};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Dependency/Objects/Ordered.pm view on Meta::CPAN
use Scalar::Util qw/refaddr/;
use Carp qw/croak/;
sub schedule {
my ( $self, @args ) = @_;
$self->_order($self->SUPER::schedule(@args));
}
sub schedule_all {
my ( $self, @args ) = @_;
$self->_order($self->SUPER::schedule_all(@args));
}
sub _order {
my ( $self, @queue ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Dependency/Ordered.pm view on Meta::CPAN
return undef if grep { ! $source->item($_) } @items;
# The actual items to select will be the same as for the unordered
# version, so we can simplify the algorithm greatly by using the
# normal unordered ->schedule method to get the starting list.
my $rv = $self->SUPER::schedule( @items );
my @queue = $rv ? @$rv : return undef;
# Get a working copy of the selected index
my %selected = %{ $self->{selected} };
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
# This line is here to convince "autouse" into believing we are autousable.
sub can {
($_[1] eq 'import' and caller()->isa('autouse'))
? \&Exporter::import # pacify autouse's equality test
: $_[0]->SUPER::can($_[1]) # normal case
}
# TODO
#
# Exported functions like field and super should be hidden so as not to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Evolutionary/Fitness/ECC.pm view on Meta::CPAN
sub new {
my $class = shift;
my ($number_of_codewords, $min_distance ) = @_;
croak "Too few codewords" if !$number_of_codewords;
croak "Distance too small" if !$min_distance;
my $self = $class->SUPER::new();
bless $self, $class;
$self->initialize();
$self->{'number_of_codewords'} = $number_of_codewords;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Evolutionary/Fitness/ECC.pm view on Meta::CPAN
sub new {
my $class = shift;
my ($number_of_codewords, $min_distance ) = @_;
croak "Too few codewords" if !$number_of_codewords;
croak "Distance too small" if !$min_distance;
my $self = $class->SUPER::new();
bless $self, $class;
$self->initialize();
$self->{'number_of_codewords'} = $number_of_codewords;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/FloodControl.pm view on Meta::CPAN
{
storage => { type => OBJECT },
backend_name => { type => SCALAR, optional => 1 },
limits => { type => HASHREF }
};
my $self = $class->SUPER::new($params);
# be default backend will be selected by storage classname. but you can override it
my $backend_name = __PACKAGE__ . '::Backend::' . ( $self->{backend_name} || ref $self->storage );
load $backend_name;
$self->backend_name($backend_name);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/FuzzyCmeans.pm view on Meta::CPAN
use constant DEFAULT_M => 2.0;
sub new {
my $class = shift;
my $self = $class->SUPER::new( {@_} );
$self->vectors({}) if !$self->vectors;
$self->centroids([]) if !$self->centroids;
$self->memberships({}) if !$self->memberships;
$self->m(DEFAULT_M) if !defined $self->m;
croak '`m\' parameter must be more than 1.0' if $self->m <= 1.0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Genetic/Diploid/Chromosome.pm view on Meta::CPAN
Constructor takes named arguments. Creates a default list of genes and chromosome number.
=cut
sub new {
shift->SUPER::new(
'genes' => [],
'number' => 1,
@_,
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
sub new {
my ($proto, $key, $value) = @_;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new;
$self->{"KeyValuePair::key"} = $key;
$self->{"KeyValuePair::value"} = $value;
return $self;
view all matches for this distribution
view release on metacpan or search on metacpan
builder/MyBuilder.pm view on Meta::CPAN
use 5.008008;
use base 'Module::Build::XSUtil';
sub new {
my ( $self, %args ) = @_;
$self->SUPER::new(
%args,
allow_pureperl => 1,
c_source => 'xs',
xs_files => { './xs/hyperloglog.xs' => './lib/Algorithm/HyperLogLog.xs', },
add_to_cleanup => [
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Kmeanspp.pm view on Meta::CPAN
__PACKAGE__->mk_accessors($_) for qw(vectors centroids clusters);
sub new {
my $class = shift;
my $self = $class->SUPER::new( {@_} );
$self->vectors({}) if !$self->vectors;
$self->centroids([]) if !$self->centroids;
$self->clusters([]) if !$self->clusters;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
bootstrap Algorithm::MarkovChain::GHash $VERSION;
sub new {
my $invocant = shift;
my $class = ref $invocant || $invocant;
my __PACKAGE__ $self = $class->SUPER::new(@_);
$self->{_cstuff} = _new_cstuff();
return $self;
}
sub DESTROY {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/MarkovChain.pm view on Meta::CPAN
sub new {
my $invocant = shift;
my %args = @_;
my $class = ref $invocant || $invocant;
my Algorithm::MarkovChain $self = $class->SUPER::new(@_);
$self->{chains} = {};
$self->{totals} = {};
if ($args{chains}) {
croak "can't use non-hashref as storage"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/NaiveBayes/Model/Frequency.pm view on Meta::CPAN
use strict;
use Algorithm::NaiveBayes::Util qw(sum_hash add_hash max rescale);
use base qw(Algorithm::NaiveBayes);
sub new {
my $self = shift()->SUPER::new(@_);
$self->training_data->{attributes} = {};
$self->training_data->{labels} = {};
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
# longer-running test files will check for.
#
my %args = $self->args;
$ENV{AUTHOR_TESTING} = 1 if (exists $args{Testlong});
$self->SUPER::ACTION_test;
}
SUBCLASS
#my $build = Module::Build->new(
my $build = $class->new(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SAT/Backtracking/Ordered.pm view on Meta::CPAN
sub solve {
my ( $self, $variables, $clauses, $model ) = @_;
$model = Hash::Ordered->new if !defined $model;
return $self->SUPER::solve( $variables, $clauses, $model );
}
# ### update
# Copies the model, then sets `choice` = `value` in the model, and returns it, keeping the order of keys.
sub update {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SpatialIndex/Strategy/MedianQuadTree.pm view on Meta::CPAN
sub _node_split_coords {
my ($self, $node, $bucket, $coords) = @_;
my $items = $bucket->items;
if (@$items == 0) {
# degrade to a quad tree
return $self->SUPER::_node_split_coords($node, $bucket, $coords);
}
my $xmedian = median([map $_->[XI()], @$items]);
my $ymedian = median([map $_->[YI()], @$items]);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alice/HTTP/Request.pm view on Meta::CPAN
}
sub param {
my $self = shift;
if (wantarray) {
return map {decode("utf8", $_)} $self->SUPER::param(@_);
}
else {
return decode("utf8", $self->SUPER::param(@_));
}
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
$abmm->mm_postamble(@_);
}
sub install {
$abmm->can('mm_install')
? $abmm->mm_install(@_)
: shift->SUPER::install(@_);
}
}
# END code inserted by Dist::Zilla::Plugin::AlienBuild
view all matches for this distribution