view release on metacpan or search on metacpan
lib/Algorithm/RandomPointGenerator.pm view on Meta::CPAN
my ($class, %args) = @_;
my @params = keys %args;
croak "\nYou have used a wrong name for a keyword argument " .
"--- perhaps a misspelling\n"
if check_for_illegal_params(@params) == 0;
bless {
_hist_file => $args{input_histogram_file} || croak("histogram file required"),
_bbox_file => $args{bounding_box_file} || croak("bounding box file required"),
_N => $args{number_of_points} || 2000,
_how_many_to_discard => $args{how_many_to_discard} || 500,
_debug => $args{debug} || 0,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/RectanglesContainingDot.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = { rects => [],
names => [] };
bless $self, $class;
}
sub _reset { delete shift->{div} }
sub add_rectangle {
view all matches for this distribution
view release on metacpan or search on metacpan
RectanglesContainingDot_XS.xs view on Meta::CPAN
if (SvROK(klass))
stash = SvSTASH(klass);
else
stash = gv_stashsv(klass, 1);
sv_bless(rv, stash);
}
return rv;
}
return &PL_sv_undef;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Retry.pm view on Meta::CPAN
if (exists $attrspec->{$attr}{default}) {
$args{$attr} //= $attrspec->{$attr}{default};
}
}
$args{_attempts} = 0;
bless \%args, $class;
}
sub _success_or_failure {
my ($self, $is_success, $timestamp) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SAT/Backtracking.pm view on Meta::CPAN
# `[['blue', 'green'], ['green', '-yellow']]`
our $VERSION = "0.13";
sub new {
return bless {}, shift;
}
sub solve {
# ### solve
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SVM.pm view on Meta::CPAN
=cut
sub new {
my ($class, %args) = @_;
my $self = bless({ }, $class);
# Ensure we have a valid SVM type.
$args{Type} = 'C-SVC' if(! exists($args{Type}));
my $svmtype = $SVM_TYPES{$args{Type}};
croak("Invalid SVM type: $args{Type}") if(! defined($svmtype));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SVMLight.pm view on Meta::CPAN
__PACKAGE__->bootstrap( $VERSION );
sub new {
my $package = shift;
my $self = bless {
@_,
features => {},
rfeatures => [undef],
}, $package;
$self->_xs_init;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$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;
view all matches for this distribution
view release on metacpan or search on metacpan
example/15.pl view on Meta::CPAN
#solves the classic fifteen puzzle using bfs
package fifteen;
sub new {return bless {}}
sub set_position {my $self = shift;
my $string = shift;
my @lines = split /\n/, $string;
my $row = 0;
foreach my $line (@lines) {
view all matches for this distribution
view release on metacpan or search on metacpan
SetCovering.pm view on Meta::CPAN
rows => [],
prepared => 0,
combos => [],
};
bless $self, $class;
}
##############################################
sub add_row {
##############################################
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SixDegrees.pm view on Meta::CPAN
_source_left => {},
_source_right => {},
_sources => [],
_investigated => {},
};
return bless $self,$class;
}
=head1 FUNCTIONS
=head2 forward_data_source( name => \&sub, @args );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SkipList.pm view on Meta::CPAN
LASTKEY => undef, # last key used by next_key
LASTINSRT => undef, # cached insertion fingers
DUPLICATES => 0, # allow duplicates?
};
bless $self, $class;
$self->_set_p( DEF_P ); # initializes P_LEVELS
$self->_set_k( DEF_K );
if (@_) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SlidingWindow/Dynamic.pm view on Meta::CPAN
my $alloc = exists $args{alloc} ? $args{alloc} : 8;
_check_alloc($alloc);
$alloc = int($alloc);
my $self = bless {
buf => [ (undef) x $alloc ],
head => 0,
size => 0,
}, $class;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SlidingWindow.pm view on Meta::CPAN
# --- initialize backing store ---
my @buf;
$#buf = $capacity - 1; # preallocate fixed storage
my $self = bless {
_cap => 0 + $capacity,
_buf => \@buf,
_head => 0,
_size => 0,
_on_evict => $on_evict,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SlopeOne.pm view on Meta::CPAN
our $VERSION = '0.004'; # VERSION
sub new {
my ($class) = @_;
return bless {
diffs => {},
freqs => {},
} => $class;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{prefix}/$args{path}.pm";
bless(\%args, $class);
}
#line 210
sub call {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SpatialIndex/Storage/Redis.pm view on Meta::CPAN
use warnings;
use Carp qw(confess);
our $VERSION = '0.01';
use Scalar::Util qw(blessed);
use Redis;
use parent 'Algorithm::SpatialIndex::Storage';
use Sereal::Encoder;
use Sereal::Decoder;
lib/Algorithm/SpatialIndex/Storage/Redis.pm view on Meta::CPAN
if not defined $prefix;
$self->{prefix} = $prefix;
# Setup (de)serializers
my $enc = $opt->{encoder};
if (blessed($enc)) {
$self->{encoder} = $enc;
}
else {
$self->{encoder} = Sereal::Encoder->new(ref($enc) eq 'HASH' ? $enc : ());
}
my $dec = $opt->{decoder};
if (blessed($dec)) {
$self->{decoder} = $dec;
}
else {
$self->{decoder} = Sereal::Decoder->new(ref($dec) eq 'HASH' ? $dec : ());
}
# Connect to Redis
my $conn = $opt->{conn};
if (blessed($conn)) {
$self->{redisconn} = $conn;
}
else {
$self->{redisconn} = Redis->new(%$conn);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SpatialIndex.pm view on Meta::CPAN
sub new {
my $class = shift;
my %opt = @_;
my $self = bless {
limit_x_low => -100,
limit_x_up => 100,
limit_y_low => -100,
limit_y_up => 100,
limit_z_low => -100,
view all matches for this distribution
view release on metacpan or search on metacpan
sv_2uv_flags||5.009001|
sv_2uv|5.004000||p
sv_add_arena|||
sv_add_backref|||
sv_backoff|||
sv_bless|||
sv_cat_decode||5.008001|
sv_catpv_mg|5.004050||p
sv_catpvf_mg_nocontext|||pvn
sv_catpvf_mg|5.006000|5.004000|pv
sv_catpvf_nocontext|||vn
view all matches for this distribution
view release on metacpan or search on metacpan
sv_2uv_flags||5.009001|
sv_2uv|5.004000||p
sv_add_arena|||
sv_add_backref|||
sv_backoff|||
sv_bless|||
sv_cat_decode||5.008001|
sv_catpv_mg|5.004050||p
sv_catpvf_mg_nocontext|||pvn
sv_catpvf_mg|5.006000|5.004000|pv
sv_catpvf_nocontext|||vn
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/TSort.pm view on Meta::CPAN
my $array = $_[0]->( $_[1] );
return $array ? @$array : ();
}
package Algorithm::TSort::Guard;
sub new{
return bless $_[1], $_[0];
}
sub DESTROY { $_[0]->() };
}
sub Graph($$) {
lib/Algorithm/TSort.pm view on Meta::CPAN
chomp $line;
next unless $line =~ m/\S/;
my ( $node, @deps ) = split ' ', $line;
$c{$node} = \@deps;
}
return bless \%c, 'Algorithm::TSort::ADJ';
}
elsif ( $what eq 'ADJSUB' ) {
return bless \( my $s = $data ), 'Algorithm::TSort::ADJSUB';
}
elsif ( $what eq 'ADJSUB_ARRAYREF' ) {
return bless $data, 'Algorithm::TSort::ADJSUB_ARRAYREF';
}
elsif ( $what eq 'ADJ' ) {
my %c = %$data;
return bless \%c, 'Algorithm::TSort::ADJ';
}
else {
require Carp;
Carp::croak("Graph: don't know about \$what='$what'");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/TicketClusterer.pm view on Meta::CPAN
my ($class, %args) = @_;
my @params = keys %args;
croak "\nYou have used a wrong name for a keyword argument " .
"--- perhaps a misspelling\n"
if _check_for_illegal_params(@params) == 0;
bless {
_excel_filename => $args{excel_filename},
_which_worksheet => $args{which_worksheet},
_raw_tickets_db => $args{raw_tickets_db},
_processed_tickets_db => $args{processed_tickets_db},
_synset_cache_db => $args{synset_cache_db},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/TravelingSalesman/BitonicTour.pm view on Meta::CPAN
=cut
sub new {
my $class = shift;
my $self = bless { _tour => {}, _points => {} }, $class;
return $self;
}
=head2 $ts->add_point($x,$y)
view all matches for this distribution
view release on metacpan or search on metacpan
e/timing.pl view on Meta::CPAN
sub new ($@) {
my($class,@children) = @_;
my $self = { _children => [@children],
_number => ++$Number };
bless $self,$class;
}
sub children {
my($self) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/TrunkClassifier/CommandProcessor.pm view on Meta::CPAN
"--useall" => {"numArgs" => 0, "var" => $useallRef, "value" => 1},
"-h" => {"numArgs" => 0, "sub" => \&commandHelp},
"--help" => {"numArgs" => 0, "sub" => \&commandHelp}
);
my $self = {"input" => $datafileRef};
bless($self, $class);
return $self;
}
#Description: Command processor loop
#Parameters: Command line arguments
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/VSM.pm view on Meta::CPAN
my ($class, %args) = @_;
my @params = keys %args;
croak "\nYou have used a wrong name for a keyword argument " .
"--- perhaps a misspelling\n"
if _check_for_illegal_params(@params) == 0;
bless {
_corpus_directory => $args{corpus_directory} || "",
_save_model_on_disk => $args{save_model_on_disk} || 0,
_break_camelcased_and_underscored => exists $args{break_camelcased_and_underscored} ?
$args{break_camelcased_and_underscored} : 1,
_corpus_vocab_db => $args{corpus_vocab_db} || "corpus_vocab_db",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/VectorClocks.pm view on Meta::CPAN
sub new {
my $class = shift;
my($arg) = @_;
my $self = UNIVERSAL::isa($arg, $class) ? $arg
: { clocks => $class->json->jsonToObj($arg || '{}') };
bless $self, $class;
}
sub serialize {
my $self = shift;
$self->json->objToJson($self->clocks);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Viterbi.pm view on Meta::CPAN
sub new
{
my $class = shift;
my $self = {@_};
bless $self, $class;
$self->{unknown_transition_prob} = 0 if (!defined($self->{unknown_transition_prob}));
$self->{start_state} = '$' if (!defined($self->{start_state}));
return $self;
lib/Algorithm/Viterbi.pm view on Meta::CPAN
print Dumper($v);
will produce:
$VAR1 = bless( {
'transition' => {
'sunny' => {
'sunny' => '0.5',
'rainy' => '0.25'
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Voting/Ballot.pm view on Meta::CPAN
}
my %valid = (
candidate => 0,
);
my %args = validate(@_, \%valid);
return bless \%args, $class;
}
=head2 $ballot->candidate()
Returns a scalar (presumably a string, although this is not enforced)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/WordLevelStatistics.pm view on Meta::CPAN
use vars qw($VERSION);
$VERSION = '0.03';
sub new {
my $class = shift;
return bless {
version => $VERSION,
}, $class;
}
# computes the statistical level of a single word (given its spectrum and the total number of words in the text)
view all matches for this distribution