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/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
view release on metacpan or search on metacpan
examples/langford/Langford.pm view on Meta::CPAN
next if $value == 1 && $pos + 2 > $n;
push @{$self->{row_data_}}, { value => $value, left_pos => $pos };
$self->{problem_}->add_row([$value - 1, $n + $pos, $n + $pos + $value + 1]);
}
}
return bless $self, $class;
}
sub problem {
my ($self) = @_;
return $self->{problem_};
view all matches for this distribution
view release on metacpan or search on metacpan
const pi => 3.14, ten => 10;
package Foo;
use Alias;
sub new { bless {foo => 1, _bar => [2, 3]}, $_[0] }
sub a_method {
my $s = attr shift;
# $foo, @_bar are now local aliases for
# $_[0]{foo}, @{$_[0]{_bar}} etc.
}
user-supplied names. Values that are references will get dereferenced into
their base types. This means that a value of C<[1,2,3]> with a name of
"foo" will be made available as C<@foo>, not C<$foo>.
The exception to this rule is the default behavior of the C<attr> function,
which will not dereference values which are blessed references (aka
objects). See L<$Alias::Deref> for how to change this default behavior.
=head2 Functions
=over 4
=item attr
Given a hash reference, aliases the values of the hash to the names that
correspond to the keys. It always returns the supplied value. The aliases
are local to the enclosing block. If any of the values are unblessed
references, they are available as their dereferenced types. Thus the action
is similar to saying:
alias %{$_[0]}
etc., without actually declaring the attributes).
=item $Alias::Deref
Controls the implicit dereferencing behavior of C<attr>. If it is set to
"" or 0, C<attr> will not dereference blessed references. If it is a true
value (anything but "", 0, or a CODE reference), all references will be
made available as their dereferenced types, including values that may be
objects. The default is "".
This option can be used as a filter if it is set to a CODE reference, in
# hash/object attributes
package Foo;
use Alias;
sub new {
bless
{ foo => 1,
bar => [2,3],
buz => { a => 4},
privmeth => sub { "private" },
easymeth => sub { die "to recurse or to die, is the question" },
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
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
t/000-report-versions.t view on Meta::CPAN
# Implementation
# Create an empty YAML::Tiny object
sub new {
my $class = shift;
bless [ @_ ], $class;
}
# Create an object from a file
sub read {
my $class = ref $_[0] ? ref shift : shift;
t/000-report-versions.t view on Meta::CPAN
}
# Create an object from a string
sub read_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless [], $class;
my $string = $_[0];
unless ( defined $string ) {
return $self->_error("Did not provide a string to load");
}
t/000-report-versions.t view on Meta::CPAN
# Failed to load Scalar::Util
eval <<'END_PERL';
sub refaddr {
my $pkg = ref($_[0]) or return undef;
if (!!UNIVERSAL::can($_[0], 'can')) {
bless $_[0], 'Scalar::Util::Fake';
} else {
$pkg = undef;
}
"$_[0]" =~ /0x(\w+)/;
my $i = do { local $^W; hex $1 };
bless $_[0], $pkg if defined $pkg;
$i;
}
END_PERL
} else {
Scalar::Util->import('refaddr');
view all matches for this distribution
view release on metacpan or search on metacpan
corpus/libpalindrome/ltmain.sh view on Meta::CPAN
func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands, which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
corpus/libpalindrome/ltmain.sh view on Meta::CPAN
func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands, which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
view all matches for this distribution
view release on metacpan or search on metacpan
corpus/lib/Alien/Foo2/ConfigData.pm view on Meta::CPAN
'install_type' => 'share',
'msys' => 0,
'name' => 'libfoo2',
'original_prefix' => '/home/user/.cpanm/work/1456299506.4021/Alien-Foo2-0.12/blib/lib/auto/share/dist/Alien-Foo2',
'pkgconfig' => {
'_manual' => bless( {
'keywords' => {
'Cflags' => '-I${pcfiledir}/lib/libfoo2-3.2.1/include',
'Libs' => '-L${pcfiledir}/lib -lfoo2',
'Version' => ''
},
'package' => 'libfoo2',
'vars' => {
'pcfiledir' => '/home/user/.cpanm/work/1456299506.4021/Alien-Foo2-0.12/blib/lib/auto/share/dist/Alien-Foo2'
}
}, 'Alien::Base::PkgConfig' ),
'libfoo2' => bless( {
'keywords' => {
'Cflags' => '-I${includedir}',
'Description' => 'Library supporting Foreign Function Interfaces',
'Libs' => '-L${toolexeclibdir} -lfoo2',
'Name' => 'libfoo2',
view all matches for this distribution