view release on metacpan or search on metacpan
tidyall.ini view on Meta::CPAN
; Install Code::TidyAll
; run "tidyall -a" to tidy all files
; run "tidyall -g" to tidy only files modified from git
[PerlTidy]
select = {lib,t}/**/*.{pl,pm,t}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acrux/DBI.pm view on Meta::CPAN
Default: none
=head2 query
my $res = $dbi->query('select * from test');
my $res = $dbi->query('insert into test values (?, ?)', @values);
Execute a blocking statement and return a L<Acrux::DBI::Res> object with the results.
You can also append a 'bind_callback' to perform binding value manually:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Crux/Plugin/Log.pm view on Meta::CPAN
=head2 provider
$app->plugin(Log => undef, {provider => 'syslog'});
This option select the provider of logging. Avalabled providers:
C<logger>, C<handler>, C<file> and C<syslog>.
Default: C<logprovider> command line option or C<logprovider> application argument
or C<LogProvider> configuration value or C<file> otherwise
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activator/DB.pm view on Meta::CPAN
## begin legacy
## =item B<getcol_arrayref>($sql, $bind, $colsref)
##
## Prepare and Execute a SQL statement on the default database, and
## get an arrayref of values back via DBI::selectcol_arrayref()
##
## Args:
## $sql => sql statement
## $bind => optional bind values arrayref for the sql statement
## $colsref => optional arrayref containing the columns to return
lib/Activator/DB.pm view on Meta::CPAN
## an arrayref of values for each specified col of data from the query (default is the first column). So each row of data from the query gives one or more sequential values in the output arrayref.
## reference to an empty array when there is no matching data
##
##
## Usage example
## my $ary_ref = getcol_arrayref("select id, name from table",{Columns=>[1,2]});
## my %hash = @$ary_ref; # now $hash{$id} => $name
##
## # to just get an arrayref of id values
## my $ary_ref = getcol_arrayref("select id, name from table");
##
## Throws
## connect.failure - on connect failure
## dbi.failure - on failure of DBI::selectcol_arrayref
##
## =cut
##
## sub getcol_arrayref {
## my ( $sql, $bind, $colsref ) = @_;
lib/Activator/DB.pm view on Meta::CPAN
##
## my $dbh = &get_dbh(); # may throw connect.failure
##
## eval {
## $colref
## = $dbh->selectcol_arrayref( $sql, { Columns => $colsref },
## @$bind );
## };
## if ( $@ ) {
## Activator::Exception::DB->throw( 'dbi', 'failure', $dbh->errstr || $@);
## }
lib/Activator/DB.pm view on Meta::CPAN
##
## Reference to an empty hash when there is no matching data
##
## Usage example
## # for table with (id,name) values: ('goog', 'google'), (yhoo, 'yahoo')
## my $hashref = getall_arrayrefs("select id, name from table",[], 'id'});
## # $hashref = {
## # {goog} => {id=>'goog', name=>'google'},
## # {yhoo} => {id=>'yhoo', name=>'yahoo'}
## # }
## my $hashref = getall_arrayrefs("select id, name from table",[]}, 2);
## # $hashref = {
## # {google} => {id=>'goog', name=>'google'},
## # {yahoo} => {id=>'yhoo', name=>'yahoo'}
## # }
##
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ActiveRecord/Simple.pm view on Meta::CPAN
if ( $self->dbh->{Driver}{Name} eq 'Pg' ) {
if ($primary_key) {
$sql_stm .= ' RETURINIG ' . $primary_key if $primary_key;
$sql_stm = ActiveRecord::Simple::Utils::quote_sql_stmt($sql_stm, $self->dbh->{Driver}{Name});
$pkey_val = $self->dbh->selectrow_array($sql_stm, undef, @bind);
}
else {
my $sth = $self->dbh->prepare(
ActiveRecord::Simple::Utils::quote_sql_stmt($sql_stm, $self->dbh->{Driver}{Name})
);
view all matches for this distribution
view release on metacpan or search on metacpan
ex/ai-bot.pl view on Meta::CPAN
}
sub recall {
my ($self, $query, $limit) = @_;
$limit //= 5;
my $rows = $self->_dbh->selectall_arrayref(
'SELECT nick, message, response FROM conversations WHERE message LIKE ? OR response LIKE ? ORDER BY id DESC LIMIT ?',
{ Slice => {} }, "%$query%", "%$query%", $limit,
);
return join("\n---\n", map { "<$_->{nick}> $_->{message}\n$_->{response}" } @$rows);
}
ex/ai-bot.pl view on Meta::CPAN
sub recall_notes {
my ($self, $nick, $query, $limit) = @_;
$limit //= 10;
my $rows;
if ($nick) {
$rows = $self->_dbh->selectall_arrayref(
'SELECT id, nick, content FROM notes WHERE nick = ? AND content LIKE ? ORDER BY id DESC LIMIT ?',
{ Slice => {} }, $nick, "%$query%", $limit,
);
} else {
$rows = $self->_dbh->selectall_arrayref(
'SELECT id, nick, content FROM notes WHERE content LIKE ? ORDER BY id DESC LIMIT ?',
{ Slice => {} }, "%$query%", $limit,
);
}
return join("\n", map { "#$_->{id} [$_->{nick}] $_->{content}" } @$rows);
ex/ai-bot.pl view on Meta::CPAN
at the top of each message batch â you don't need to call recall_notes
for people who are currently talking. Just read the [Your notes about ...] lines.
- Use recall_notes only when you need info about someone NOT in the current batch.
- Use save_note to remember things about people â build relationships over time.
- Use recall_history to search past conversations by keyword.
- Be selective about what you save. Quality over quantity.
__MISSION__
if (my $extra = $ENV{SYSTEM_PROMPT}) {
$mission .= "\n$extra\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Adapter/Async/OrderedList.pm view on Meta::CPAN
=item * hidden - no longer visible.
hidden => [1,2,4]
=item * selected - this item is now part of an active selection. could be used to block deletes.
selected => [1,4,5,6]
=item * highlight - mouse over, cursor, etc.
highlight => 1
lib/Adapter/Async/OrderedList.pm view on Meta::CPAN
=item * activate - some action has been performed.
activate => [1]
activate => [1,2,5,6,7,8]
Multi-activate will typically happen when items have been selected rather than just highlighted.
The adapter itself doesn't do much with this.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AddressBook/Config.pm view on Meta::CPAN
sub new {
my $class=shift;
my %args = @_;
my $self = {};
bless ($self,$class);
my ($parser,$config,$field,$field_name,$attr,$db_type,$db_field_name,$db,$select,$option,$value);
$self->{config_file} = $args{config_file} || $AddressBook::Config::config_file;
eval {
$parser = XML::DOM::Parser->new(ErrorContext=>1,
ParseParamEnt=>1,
ProtocolEncoding=>'UTF-8');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ado/Command/generate/crud.pm view on Meta::CPAN
#Used in template <%= $a->{t}%>/list.html.ep
$c->stash('table_class',$table_class);
#content negotiation
my $list = $c->list_for_json(
[$$args{limit}, $$args{offset}],
[$table_class->select_range($$args{limit}, $$args{offset})]
);
return $c->respond_to(
json => $list,
html =>{list =>$list}
);
view all matches for this distribution
view release on metacpan or search on metacpan
bless ( $self, $class );
# Creating a new object ... (The main section)
my %control;
# Initialize what options were selected ...
$control{filename} = $self->_fix_path ($filename);
$control{read_opts} = get_read_opts ( $read_opts );
$control{get_opts} = get_get_opts ( $get_opts );
$control{date_opts} = get_date_opts ( $date_opts );
}
my $language = $opts->{month_language};
my $type = ( $opts->{use_gmt} ) ? "gmtime" : "localtime";
print STDERR "${cmt} The Special Predefined Date Variables ... (in ${language})\n";
print STDERR "${cmt} The format and language used can vary based on the date options selected.\n";
print STDERR "${cmt} Uses ${type} to convert the current timestamp into the other values.\n";
set_special_date_vars ( $opts, \%dt );
foreach my $k ( sort keys %dt ) {
print STDERR " ${la}$k${ra} ${asgn} $dt{$k}\n";
view all matches for this distribution
view release on metacpan or search on metacpan
builder/Affix/Builder.pm view on Meta::CPAN
my ( $ofh, $out ) = tempfile( UNLINK => 1 );
close $ofh;
# Try without -lrt (list-form system to avoid shell injection)
open( my $devnull, '>', '/dev/null' ) if $^O ne 'MSWin32';
my $old_stdout = select $devnull if $devnull;
system( $cc, '-o', $out, $src );
select $old_stdout if $old_stdout;
close $devnull if $devnull;
return '' if $? == 0;
# Try with -lrt
open( $devnull, '>', '/dev/null' ) if $^O ne 'MSWin32';
$old_stdout = select $devnull if $devnull;
system( $cc, '-o', $out, $src, '-lrt' );
select $old_stdout if $old_stdout;
close $devnull if $devnull;
return '-lrt' if $? == 0;
return '';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Agent/TCLI/Package/Net/HTTPD.pm view on Meta::CPAN
handler: establish_context
help: simple http web server
manual: >
httpd provides a simple web server that can respond to and log requests.
By default it responds with a Status code 404 to all requests. One may add
a select few other status code responses using regular expression pattern
matching if desired. One cannot change content, only status codes.
Httpd is useful for network testing situations where the response codes
are being monitored by the network.
topic: net
usage: httpd spawn port=8080
view all matches for this distribution
view release on metacpan or search on metacpan
examples/ex.pl view on Meta::CPAN
$args{Eval} = '2+2';
unless ($args{'Name'}) { print $usage; exit 1; }
if ($logfile) {
open (LOG, "> $logfile") or die "couldn't open $logfile! $!";
select LOG;
$| = 1;
}
# then setup and execute the agent:
my $agent = new Agent( %args ) or die "couldn't create agent!";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AgentPushKit/Client/AccountApi.pm view on Meta::CPAN
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
my $_body_data;
# authentication setting, if any
my $auth_settings = [qw(UserOrAgent )];
lib/AgentPushKit/Client/AccountApi.pm view on Meta::CPAN
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
my $_body_data;
# authentication setting, if any
my $auth_settings = [qw(UserOrAgent )];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Format/Html.pm view on Meta::CPAN
th => _set(qw/table thead tbody tfoot caption/),
dt => _set(qw/dl/),
dd => _set(qw/dl/),
rt => _set(qw/ruby/),
rp => _set(qw/ruby/),
option => _set(qw/optgroup select/),
optgroup => _set(qw/select/),
);
# <tr> закÑÑÐ²Ð°ÐµÑ Ð¾ÑкÑÑÑÑе <td> и <th> и <tr>
our %TOP_NEW_TAG = (
head => _set(qw/body/),
lib/Aion/Format/Html.pm view on Meta::CPAN
# ÐÑе, кÑоме запÑеÑÑннÑÑ
:
# applet, script, style, embed, object, param,
# video, audio, source, track, frame, frameset, iframe, comment
# html, head, body, title, meta, base, basefont, bgsound, link
# form, keygen, output, textarea, select, option, optgroup, legend, label, input
# plaintext, xmp
# Ð Ñак же ÑдалÑÐµÑ Ð°ÑÑибÑÑÑ Ð½Ð°ÑинаÑÑиеÑÑ Ð½Ð° "on", name, for, formaction и дÑ..
my %SAFE_TAG = map {$_=>1} qw/
a
abbr
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Fs.pm view on Meta::CPAN
=item * L<File::Find::Object> â has an OOP interface with an iterator.
=item * L<File::Find::Parallel> â can compare two directories and return their union, intersection and quantitative intersection.
=item * L<File::Find::Random> â selects a file or directory at random from the file hierarchy.
=item * L<File::Find::Rex> â C<< @paths = File::Find::Rex-E<gt>new(recursive =E<gt> 1, ignore_hidden =E<gt> 1)-E<gt>query($dir, qr/^b/i) >>.
=item * L<File::Find::Rule> â C<< @files = File::Find::Rule-E<gt>any( File::Find::Rule-E<gt>file-E<gt>name('*.mp3', '*.ogg')-E<gt>size('E<gt>2M'), File::Find::Rule-E<gt>empty )-E<gt>in($dir1, $dir2); >>. Has an iterator, procedural interface and ex...
lib/Aion/Fs.pm view on Meta::CPAN
my $f = ilay $test_file;
print $f "Line 1\n";
print $f "Line 2\n";
my $std = select $f; $| = 1; select $std;
-s $f # -> 14
$f->path # => test_ilay_complete.txt
fileno($f) > 0 # -> 1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Query.pm view on Meta::CPAN
}) or die "Connect to db failed";
$base->do($_) for @$conn;
return $base unless wantarray;
my ($base_connection_id) = $dsn =~ /^DBI:(mysql|mariadb)/i
? $base->selectrow_array("SELECT connection_id()")
: -1;
return $base, $base_connection_id;
}
# ÐÑовеÑка коннекÑа и пеÑеконнекÑ
lib/Aion/Query.pm view on Meta::CPAN
my ($query, $columns) = @_;
sql_debug query => $query;
connect_respavn($base, $base_connection_id);
my $res = eval {
if($query =~ /^\s*(select|show|desc(ribe)?)\b/in) {
my $r = @_>1? do {
my $sth = $base->prepare($query);
$sth->execute;
$_[1] = [@{$sth->{NAME}}];
my $res = $sth->fetchall_arrayref({});
$sth->finish;
$res
}: $base->selectall_arrayref($query, { Slice => {} });
if(defined $r and BQ) {
for my $row (@$r) {
for my $k (keys %$row) {
$row->{$k} =~ s/°([^\x7F]{1,7})\x7F/chr from_radix($1, 254)/ge if utf8::is_utf8($row->{$k});
lib/Aion/Query.pm view on Meta::CPAN
my @orders = split /\s*,\s*/, $order;
my @order_direct;
my @order_sel = map { my $x=$_; push @order_direct, $x=~s/\s+(asc|desc)\s*$//ie ? lc $1: "asc"; $x } @orders;
my $select = @order_sel==1? $order_sel[0]:
_check_drv($base, "mysql|mariadb")?
join("", "concat(", join(",',',", @order_sel), ")"):
join " || ',' || ", @order_sel
;
return $select, 1 if $next eq "";
my @next = split /,/, $next;
$next[$#orders] //= "";
@next = map quote($_), @next;
my @op = map { /^a/ ? ">": "<" } @order_direct;
lib/Aion/Query.pm view on Meta::CPAN
}
push @whr, join " AND ", @opr;
}
my $where = join "\nOR ", map "$_", @whr;
return $select, "($where)", \@order_sel;
}
# УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð¸Ð»Ð¸ возвÑаÑÐ°ÐµÑ ÐºÐ»ÑÑ Ð¸Ð· ÑаблиÑÑ settings
sub settings($;$) {
my ($id, $value) = @_;
lib/Aion/Query.pm view on Meta::CPAN
Creates a page request condition not by offset, but by B<cursor pagination>.
To do this, it receives C<$order> of the SQL query and C<$next> - a link to the next page.
my ($select, $where, $order_sel) = make_query_for_order "name DESC, id ASC", undef;
$select # => name || ',' || id
$where # -> 1
$order_sel # -> undef
my @rows = query "SELECT $select as next FROM author WHERE $where LIMIT 2";
my $last = pop @rows;
($select, $where, $order_sel) = make_query_for_order "name DESC, id ASC", $last->{next};
$select # => name || ',' || id
$where # => (name < 'Pushkin A.'\nOR name = 'Pushkin A.' AND id >= '2')
$order_sel # --> [qw/name id/]
See also:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Telemetry.pm view on Meta::CPAN
Creates a reference point.
my $reper1 = refmark "main";
select(undef, undef, undef, .05);
my $reper2 = refmark "reper2";
select(undef, undef, undef, .2);
undef $reper2;
select(undef, undef, undef, .05);
my $reper3 = refmark "reper2";
select(undef, undef, undef, .1);
undef $reper3;
select(undef, undef, undef, .1);
undef $reper1;
# report:
sub round ($) { int($_[0]*10 + .5) / 10 }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Album/Tutorial.pm view on Meta::CPAN
'200405171843310052.jpg'. 'album' tries to link to the image, if that
is not possible, the image will be coped. File 'dsc00053.jpg' must be
rotated, so it will always be a copy.
If you hover the mouse over the file name in the index page, or over
the title on the image pages, a pop-up will show a selection of
information from the EXIF data.
=head2 Embedding other albums
In the file 'info.dat' you can also enter names of HTML documents to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/AM/Batch.pm view on Meta::CPAN
if(!$self->training_item_hook &&
($self->probability == 1) &&
$max >= $self->training_set->size){
$training_set = $self->training_set;
}else{
# otherwise, make a new set with just the selected
# items
$training_set = Algorithm::AM::DataSet->new(
cardinality => $self->training_set->cardinality);
# don't try to add more items than we have!
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Bitonic/Sort.pm view on Meta::CPAN
=head1 SUBROUTINES
=head2 bitonic_sort
The First Parameter works as the ascending/decreasing selector.
True (1 or any true value) means ascending (incremental),
False (0 or any false value) means decreasing.
All other params will be treated as members/items to be sorted.
view all matches for this distribution
view release on metacpan or search on metacpan
ck_retarget|||
ck_return|||
ck_rfun|||
ck_rvconst|||
ck_sassign|||
ck_select|||
ck_shift|||
ck_sort|||
ck_spair|||
ck_split|||
ck_subr|||
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
# Do not simply export all your public functions/methods/constants.
# This allows declaration use Algorithm::CP::IZ ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'value_selector' => [ qw(
CS_VALUE_SELECTOR_MIN_TO_MAX
CS_VALUE_SELECTOR_MAX_TO_MIN
CS_VALUE_SELECTOR_LOWER_AND_UPPER
CS_VALUE_SELECTOR_UPPER_AND_LOWER
CS_VALUE_SELECTOR_MEDIAN_AND_REST
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
CS_VALUE_SELECTION_LT
CS_VALUE_SELECTION_GE
CS_VALUE_SELECTION_GT
) ]);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'value_selector'} } );
our $VERSION = '0.07';
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $array = [map { $$_ } @$var_array];
my $max_fail = -1;
my $find_free_var_id = 0;
my $find_free_var_func = sub { die "search: Internal error"; };
my $criteria_func;
my $value_selectors;
my $max_fail_func;
my $ngs;
my $notify;
if ($params->{FindFreeVar}) {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
if ($params->{MaxFail}) {
$max_fail = int($params->{MaxFail});
}
if ($params->{ValueSelectors}) {
$value_selectors = $params->{ValueSelectors};
}
if ($params->{MaxFailFunc}) {
$max_fail_func = $params->{MaxFailFunc};
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
}
$notify->set_var_array($var_array);
}
my $is_search35 = $value_selectors || $max_fail_func || $ngs || $notify;
if ($is_search35) {
unless ($value_selectors) {
if ($criteria_func) {
$Algorithm::CP::IZ::CriteriaValueSelector::CriteriaFunction = $criteria_func;
$value_selectors = [
map {
$self->create_value_selector_simple("Algorithm::CP::IZ::CriteriaValueSelector")
} (0..scalar(@$var_array)-1)];
}
else {
$value_selectors = [
map {
$self->get_value_selector(&CS_VALUE_SELECTOR_MIN_TO_MAX)
} (0..scalar(@$var_array)-1)];
}
}
my $i = 0;
for my $v (@$array) {
my $vs = $value_selectors->[$i];
$vs->prepare($i);
$i++;
}
if ($max_fail_func) {
return Algorithm::CP::IZ::cs_searchValueSelectorRestartNG(
$array,
$value_selectors,
$find_free_var_id,
$find_free_var_func,
$max_fail_func,
$max_fail,
defined($ngs) ? $ngs->{_ngs} : 0,
defined($notify) ? $notify->{_ptr} : 0);
}
else {
return Algorithm::CP::IZ::cs_searchValueSelectorFail(
$array,
$value_selectors,
$find_free_var_id,
$find_free_var_func,
$max_fail,
defined($notify) ? $notify->{_ptr} : 0);
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
# not supported
return;
}
sub get_value_selector {
my $self = shift;
my $id = shift;
return Algorithm::CP::IZ::ValueSelector::IZ->new($self, $id);
}
sub create_value_selector_simple {
my $self = shift;
my $id = shift;
return Algorithm::CP::IZ::ValueSelector::Simple->new($self, $id);
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
=over 2
=item FindFreeVar
FindFreeVar specifies variable selection strategy.
Choose constants from Algorithm::CP::IZ::FindFreeVar or specify your own
function as coderef here.
Most simple function will be following. (select from first)
sub simple_find_free_var{
my $array = shift; # VARIABLES is in parameter
my $n = scalar @$array;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
return -1; # no free variable
};
=item Criteria
Criteria specifies value selection strategy.
Specify your own function as coderef here.
sub sample_criteria {
# position in VARIABLES, and candidate value
my ($index, $val) = @_;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
Upper limit of fail count while searching solutions.
=item ValueSelectors
Arrayref of Algorithm::CP::IZ::ValueSelector instances created via
get_value_selector or create_value_selector_simple method.
(If ValueSelector is specified, this parameter is ignored.)
=item MaxFailFunc
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
Specify a notify object receives following notification by search function.
search_start
search_end
before_value_selection
after_value_selection
enter
leave
found
if OBJECT is a object, method having notification name will be called.
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
Returns version string like "3.5.0".
undef will be returned if getVersion() is not supported in iZ-C (old version).
=item get_value_selector(ID)
Get built-in value selector (instance of Algorithm::CP::IZ::ValueSelector) specifed by ID.
ID must be selected from following constants defined in package Algorithm::CP::IZ.
=over
=item CS_VALUE_SELECTOR_MIN_TO_MAX
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
=item CS_VALUE_SELECTOR_MEDIAN_AND_REST
=back
(These values are exported by Algorithm::CP::IZ and can be imported using tag 'value_selector')
Returned object will be used as a parameter ValueSelectors when calling "search" method.
use Algorithm::CP::IZ qw(:value_selector);
my $vs = $iz->get_value_selector(CS_VALUE_SELECTOR_MIN_TO_MAX);
my $v1 = $iz->create_int(1, 9);
my $v2 = $iz->create_int(1, 9);
$iz->Add($v1, $v2)->Eq(12);
my $rc = $iz->search([$v1, $v2], {
ValueSelectors => [ $vs, $vs ],
});
=item create_value_selector_simple(CLASS_NAME)
Create user defined value-seelctor defined by class named CLASS_NAME.
This class must have constructor named "new" and method namaed "next".
use Algorithm::CP::IZ qw(:value_selector);
package VSSample1;
sub new {
my $class = shift;
my ($v, $index) = @_;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
}
my $v1 = $iz->create_int(1, 9);
my $v2 = $iz->create_int(1, 9);
$iz->Add($v1, $v2)->Eq(12);
my $vs = $iz->create_value_selector_simple("VSSample1");
my $rc = $iz->search([$v1, $v2], {
ValueSelectors => [ $vs, $vs ],
});
=item create_no_good_set(VARIABLES, PRE_FILTER, MAX_NO_GOOD, EXT)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits.pm view on Meta::CPAN
Providing some means to add additional algorithms without the need to change
the module has the benefit that the user of those additional algorithms may
easily use them with the same interface as the other algorithms without having
to wait for a new version, that may or may not include the wanted algorithm.
But there is a problem: the user must be able to select the new algorithms
like he did with the other ones. And the catch is: since these new algorithms
are developed independently there is no guarantee that no more than one
module applies for the same handle. I could have implemented some simple
strategies like last one wins (the module that registers last for a given
handle is the one that is choosen) or first one wins (the first registered
view all matches for this distribution
view release on metacpan or search on metacpan
benchmarking/bench-streamd.pl view on Meta::CPAN
# 3. modes -- prequential vs score vs learn at a fixed
# batch size.
# 4. row forms -- positional arrays vs tagged objects (the
# tagged form pays hashref building + tagged_row_to_array).
# 5. concurrent clients -- total throughput with 1/2/4 connections
# pumping at once. The daemon is a single select loop sharing one
# model, so this should stay ~flat: it measures fairness overhead,
# not parallel speedup.
# 6. command latency -- ping round trips (pure protocol floor)
# and the wall cost of an on-demand save.
#
benchmarking/bench-streamd.pl view on Meta::CPAN
( map { ( '-t' => $_ ) } @TAGS ),
) or die "exec failed: $!";
} ## end if ( !$daemon )
for ( 1 .. 100 ) {
last if -S $sock;
select( undef, undef, undef, 0.1 ); ## no critic (ProhibitSleepViaSelect)
}
die "daemon never came up; see $tmp/streamd.log\n" unless -S $sock;
END {
kill( 'TERM', $daemon ) if $daemon && kill( 0, $daemon );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Classifier/NaiveBayes.pm view on Meta::CPAN
prior probability, based on how often the class was trained, plus the
sum of the log probabilities of each token appearing in that class.
Token probabilities are smoothed so tokens never seen for a class do
not zero out the whole score. By default this is add-one, Laplace,
smoothing, but Lidstone, add-alpha, smoothing with a configurable
alpha may be selected instead. Smaller alphas, such as 0.1 to 0.5,
often perform better on small training sets.
By default token occurrences are weighted by their raw counts, but
binary weighting, counting each unique token once per document, may
be selected instead via token_weighting. Class priors default to how
often each class was trained, but may be set to uniform via priors.
Classes are not predefined. A class exists once something has been
trained for it and stops existing if everything for it is untrained.
view all matches for this distribution
view release on metacpan or search on metacpan
example/draw2-1.pl view on Meta::CPAN
use List::Util qw(max min);
use GD::Image;
use Algorithm::ClusterPoints;
select STDERR; $|=1; select STDOUT;
# Latitude stats:
# Minimum: 10.318842
# Maximum: 14.124424
# Mean: 11.24719
view all matches for this distribution
view release on metacpan or search on metacpan
Combinatorics.pm view on Meta::CPAN
This documentation refers to Algorithm::Combinatorics version 0.26.
=head1 DESCRIPTION
Algorithm::Combinatorics is an efficient generator of combinatorial sequences. Algorithms are selected from the literature (work in progress, see L</REFERENCES>). Iterators do not use recursion, nor stacks, and are written in C.
Tuples are generated in lexicographic order, except in C<subsets()>.
=head1 SUBROUTINES
view all matches for this distribution
view release on metacpan or search on metacpan
ck_require|||
ck_return|||
ck_rfun|||
ck_rvconst|||
ck_sassign|||
ck_select|||
ck_shift|||
ck_sort|||
ck_spair|||
ck_split|||
ck_subr|||
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/ConstructDFA2.pm view on Meta::CPAN
my $sth = $self->_dbh->prepare(q{
SELECT state_id FROM State WHERE vertex_str = ?
});
return $self->_dbh->selectrow_array($sth, {}, $vertex_str);
}
sub _find_or_create_state_from_vertex_str {
my ($self, $vertex_str) = @_;
lib/Algorithm/ConstructDFA2.pm view on Meta::CPAN
my $escaped_roots = join ", ", map {
$self->_dbh->quote($_)
} @vertices;
my ($vertex_str) = $self->_dbh->selectrow_array(qq{
SELECT _canonical(json_group_array(closure.e_reachable))
FROM Closure
WHERE root IN ($escaped_roots)
});
lib/Algorithm/ConstructDFA2.pm view on Meta::CPAN
}
sub vertices_in_state {
my ($self, $state_id) = @_;
return map { @$_ } $self->_dbh->selectall_array(q{
SELECT vertex FROM Configuration WHERE state = ?
}, {}, $state_id);
}
sub cleanup_dead_states {
lib/Algorithm/ConstructDFA2.pm view on Meta::CPAN
SELECT state_id AS state
FROM State
WHERE _vertices_accept(vertex_str)+0 = 1
});
my @accepting = map { @$_ } $self->_dbh->selectall_array(q{
SELECT state FROM accepting
});
# NOTE: this also renames states in transitions involving
# possible start states, but they would then simply have no
lib/Algorithm/ConstructDFA2.pm view on Meta::CPAN
ORDER BY
s.state_id, i.rowid
LIMIT ?
});
my @new = $self->_dbh->selectall_array($sth, {}, $limit);
my $find_or_create = memoize(sub {
_find_or_create_state_from_vertex_str($self, @_);
});
lib/Algorithm/ConstructDFA2.pm view on Meta::CPAN
}
sub transitions_as_3tuples {
my ($self) = @_;
return $self->_dbh->selectall_array(q{
SELECT src, input, dst FROM transition
});
}
sub transitions_as_5tuples {
my ($self) = @_;
return $self->_dbh->selectall_array(q{
SELECT * FROM view_transitions_as_5tuples
});
}
sub backup_to_file {
view all matches for this distribution