view release on metacpan or search on metacpan
lib/AI/NeuralNet/Simple.pm view on Meta::CPAN
to generate the actual output. There are a variety of activation functions
available with three of the most common being the linear, sigmoid, and tahn
activation functions. For technical reasons, the linear activation function
cannot be used with the type of network that C<AI::NeuralNet::Simple> employs.
This module uses the sigmoid activation function. (More information about
these can be found by reading the information in the L<SEE ALSO> section or by
just searching with Google.)
Once the activation function is applied, the output is then sent through the
next synapse, where it will be multiplied by w4 and the process will continue.
lib/AI/NeuralNet/Simple.pm view on Meta::CPAN
Similar to train, this method allows us to train an entire data set at once.
It is typically faster than calling individual "train" methods. The first
argument is expected to be an array ref of pairs of input and output array
refs.
The second argument is the number of iterations to train the set. If
this argument is not provided here, you may use the C<iterations()> method to
set it (prior to calling C<train_set()>, of course). A default of 10,000 will
be provided if not set.
The third argument is the targeted Mean Square Error (MSE). When provided,
lib/AI/NeuralNet/Simple.pm view on Meta::CPAN
$VAR1 = [
'0.00993729281477686',
'0.990100297418451'
];
That clearly has the second output item being close to 1, so as a helper method
for use with a winner take all strategy, we have ...
=head2 C<winner(\@input)>
This method returns the index of the highest value from inferred results:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Ollama/Client/Impl.pm view on Meta::CPAN
=head3 Options
=over 4
=item C<< insecure >>
Allow insecure connections to the library.
Only use this if you are pulling from your own library during development.
=item C<< name >>
lib/AI/Ollama/Client/Impl.pm view on Meta::CPAN
=head3 Options
=over 4
=item C<< insecure >>
Allow insecure connections to the library.
Only use this if you are pushing to your library during development.
=item C<< name >>
view all matches for this distribution
view release on metacpan or search on metacpan
AI::PBDD::init(100,1000000);
my $v = AI::PBDD::createBDD();
ok(!($v % 2), "first createBDD()");
ok(!($v % 2), "second createBDD()");
AI::PBDD::kill();
}
{
#
is($dmp, "A (B (T) (F)) (F)", "first makeSet()");
$set = AI::PBDD::makeSet(\@vars, 1, 1);
$dmp = DumpBDD($set, \%names);
is($dmp, "B (T) (F)", "second makeSet()");
AI::PBDD::kill();
}
{
my $dmp = DumpBDD($bdd, \%names);
is($dmp, "B (T) (F)", "first exists()");
$bdd = AI::PBDD::exists($bdd3, $bdd2);
$dmp = DumpBDD($bdd, \%names);
is($dmp, "A (T) (F)", "second exists()");
AI::PBDD::kill();
}
{
my $dmp = DumpBDD($bdd, \%names);
is($dmp, "B (T) (F)", "first forall()");
$bdd = AI::PBDD::forall($bdd3, $bdd2);
$dmp = DumpBDD($bdd, \%names);
is($dmp, "A (T) (F)", "second forall()");
AI::PBDD::kill();
}
{
my $dmp = DumpBDD($bdd, \%names);
is($dmp, "B (T) (F)", "first restrict()");
$bdd = AI::PBDD::restrict($bdd3, AI::PBDD::not($bdd1));
$dmp = DumpBDD($bdd, \%names);
is($dmp, "F", "second restrict()");
AI::PBDD::kill();
}
{
my $cnt = AI::PBDD::satCount($bdd);
is($cnt, 2*2**98, "first satCount()");
$cnt = AI::PBDD::satCount($bdd,98);
is($cnt, 2, "second satCount()");
$bdd = AI::PBDD::or($bdd1, $bdd2);
$cnt = AI::PBDD::satCount($bdd);
is($cnt, 3*2**98, "third satCount()");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/PSO.pm view on Meta::CPAN
}
#
# random
# - returns a random number that is between the first and second arguments using the Math::Random module
#
sub random($$) {
my ($min, $max) = @_;
return random_uniform(1, $min, $max)
}
view all matches for this distribution
view release on metacpan or search on metacpan
part of its purpose remains meaningful.
(For example, a function in a library to
compute square roots has a purpose that is
entirely well-defined independent of the
application. Therefore, Subsection 2d requires
that any application-supplied function or table
used by this function must be optional: if the
application does not supply it, the square root
function must still compute square roots.)
These requirements apply to the modified work
as a whole. If identifiable sections of that work
are not derived from the Library, and can be
reasonably considered independent and
separate works in themselves, then this
License, and its terms, do not apply to those
sections when you distribute them as separate
works. But when you distribute the same
sections as part of a whole which is a work
based on the Library, the distribution of the
whole must be on the terms of this License,
whose permissions for other licensees extend
to the entire whole, and thus to each and every
part regardless of who wrote it.
Thus, it is not the intent of this section to claim
rights or contest your rights to work written
entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative
or collective works based on the Library.
version is interface-compatible with the version
that the work was made with.
c) Accompany the work with a written offer,
valid for at least three years, to give the same
user the materials specified in Subsection 6a,
above, for a charge no more than the cost of
performing this distribution.
d) If distribution of the work is made by offering
access to copy from a designated place, offer
the Library by all those who receive copies directly or
indirectly through you, then the only way you could satisfy
both it and this License would be to refrain entirely from
distribution of the Library.
If any portion of this section is held invalid or unenforceable
under any particular circumstance, the balance of the
section is intended to apply, and the section as a whole is
intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe
any patents or other property right claims or to contest
validity of any such claims; this section has the sole purpose
of protecting the integrity of the free software distribution
system which is implemented by public license practices.
Many people have made generous contributions to the wide
range of software distributed through that system in reliance
on consistent application of that system; it is up to the
author/donor to decide if he or she is willing to distribute
software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is
believed to be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted
interfaces, the original copyright holder who places the
view all matches for this distribution
view release on metacpan or search on metacpan
part of its purpose remains meaningful.
(For example, a function in a library to
compute square roots has a purpose that is
entirely well-defined independent of the
application. Therefore, Subsection 2d requires
that any application-supplied function or table
used by this function must be optional: if the
application does not supply it, the square root
function must still compute square roots.)
These requirements apply to the modified work
as a whole. If identifiable sections of that work
are not derived from the Library, and can be
reasonably considered independent and
separate works in themselves, then this
License, and its terms, do not apply to those
sections when you distribute them as separate
works. But when you distribute the same
sections as part of a whole which is a work
based on the Library, the distribution of the
whole must be on the terms of this License,
whose permissions for other licensees extend
to the entire whole, and thus to each and every
part regardless of who wrote it.
Thus, it is not the intent of this section to claim
rights or contest your rights to work written
entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative
or collective works based on the Library.
version is interface-compatible with the version
that the work was made with.
c) Accompany the work with a written offer,
valid for at least three years, to give the same
user the materials specified in Subsection 6a,
above, for a charge no more than the cost of
performing this distribution.
d) If distribution of the work is made by offering
access to copy from a designated place, offer
the Library by all those who receive copies directly or
indirectly through you, then the only way you could satisfy
both it and this License would be to refrain entirely from
distribution of the Library.
If any portion of this section is held invalid or unenforceable
under any particular circumstance, the balance of the
section is intended to apply, and the section as a whole is
intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe
any patents or other property right claims or to contest
validity of any such claims; this section has the sole purpose
of protecting the integrity of the free software distribution
system which is implemented by public license practices.
Many people have made generous contributions to the wide
range of software distributed through that system in reliance
on consistent application of that system; it is up to the
author/donor to decide if he or she is willing to distribute
software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is
believed to be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted
interfaces, the original copyright holder who places the
view all matches for this distribution
view release on metacpan or search on metacpan
and telling the user how to view a copy of this License. (Exception: if the
Program itself is interactive but does not normally print such an announcement,
your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Program, the distribution of the whole must be on
the terms of this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to
work written entirely by you; rather, the intent is to exercise the right to control
the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all the
source code for all modules it contains, plus any associated interface definition
files, plus the scripts used to control compilation and installation of the
not permit royalty-free redistribution of the Program by all those who receive
copies directly or indirectly through you, then the only way you could satisfy
both it and this License would be to refrain entirely from distribution of the
Program.
If any portion of this section is held invalid or unenforceable under any particular
circumstance, the balance of the section is intended to apply and the section as
a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other
property right claims or to contest validity of any such claims; this section has
the sole purpose of protecting the integrity of the free software distribution
system, which is implemented by public license practices. Many people have
made generous contributions to the wide range of software distributed through
that system in reliance on consistent application of that system; it is up to the
author/donor to decide if he or she is willing to distribute software through any
other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries
either by patents or by copyrighted interfaces, the original copyright holder who
places the Program under this License may add an explicit geographical
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Pathfinding/AStar.pm view on Meta::CPAN
=item * Heuristic
=back
Basically you should return an array reference like this: C<[ [$node1, $cost1, $h1], [$node2, $cost2, $h2], [...], ...];> For more information on heuristics and the best ways to calculate them, visit the links listed in the I<SEE ALSO> section below...
As mentioned earlier, AI::Pathfinding::AStar provides two routines named C<findPath> and C<findPathIncr>. C<findPath> requires as input the starting and target node identifiers. It is unimportant what format you choose for your node IDs. As long a...
=head1 PREREQUISITES
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
(
{
name => "first_search"
},
{
name => "second_search",
},
{
name => "third_search",
},
);
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
num_boards => 32_000,
optimize_for => 'speed',
scans_iters_pdls =>
{
first_search => $first_search_pdl,
second_search => $second_search_pdl,
},
quotas => [400, 300, 200],
selected_scans =>
[
AI::Pathfinding::OptimizeMultiple::Scan->new(
id => 'first_search',
cmd_line => "--preset first_search",
),
AI::Pathfinding::OptimizeMultiple::Scan->new(
id => 'second_search',
cmd_line => "--preset second_search",
),
AI::Pathfinding::OptimizeMultiple::Scan->new(
id => 'third_search',
cmd_line => "--preset third_search",
),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Pathfinding/SMAstar/Examples/PalUtils.pm view on Meta::CPAN
my @difference = ();
my %letters_hash = ();
my %letters_seen_hash = ();
my $intersect_num = 0;
my @intersection;
foreach my $element (@$sorted_letters_seen) { $letters_seen_hash{$element}++ }
foreach my $element (@letters) { $letters_hash{$element}++ }
foreach my $element (keys %letters_hash) {
if($letters_seen_hash{$element}){
push(@intersection, $element);
$intersect_num++;
}
else{
push(@difference, $element);
}
}
my @answer = ($intersect_num, @difference);
$memo_cache{$memo_key} = \@answer;
return ($intersect_num, @difference);
}
}
}
lib/AI/Pathfinding/SMAstar/Examples/PalUtils.pm view on Meta::CPAN
my @difference = ();
my %letters_hash = ();
my %letters_seen_hash = ();
my $intersect_num = 0;
my @intersection;
foreach my $element (@$letters_seen) { $letters_seen_hash{$element}++ }
foreach my $element (@letters) { $letters_hash{$element}++ }
foreach my $element (keys %letters_hash) {
if($letters_seen_hash{$element}){
push(@intersection, $element);
$intersect_num++;
}
else{
push(@difference, $element);
}
}
return ($intersect_num, @difference);
}
sub get_cands_from_left
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Perceptron/Simple.pm view on Meta::CPAN
=head1 EXPORT
None by default.
All the subroutines from C<DATA PROCESSING RELATED SUBROUTINES>, C<NERVE DATA RELATED SUBROUTINES> and C<NERVE PORTABILITY RELATED SUBROUTINES> sections are importable through tags or manually specifying them.
The tags available include the following:
=over 4
=item C<:process_data> - subroutines under C<DATA PROCESSING RELATED SUBROUTINES> section.
=item C<:local_data> - subroutines under C<NERVE DATA RELATED SUBROUTINES> section.
=item C<:portable_data> - subroutines under C<NERVE PORTABILITY RELATED SUBROUTINES> section.
=back
Most of the stuff are OO.
lib/AI/Perceptron/Simple.pm view on Meta::CPAN
=head1 PERCEPTRON DATA
The perceptron/neuron data is stored using the C<Storable> module.
See C<Portability of Nerve Data> section below for more info on some known issues.
=head1 DATA PROCESSING RELATED SUBROUTINES
These subroutines can be imported using the tag C<:process_data>.
lib/AI/Perceptron/Simple.pm view on Meta::CPAN
This part is about saving the data of the nerve. These subroutines can be imported using the C<:local_data> tag.
B<The subroutines are to be called in the procedural way>. No checking is done currently.
See C<PERCEPTRON DATA> and C<KNOWN ISSUES> sections for more details on the subroutines in this section.
=head2 preserve ( ... )
The parameters and usage are the same as C<save_perceptron>. See the next subroutine.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/PredictionClient/CPP/PredictionGrpcCpp.pm view on Meta::CPAN
std::string to_base64(std::string text);
};
PredictionClient::PredictionClient(std::string server_port)
: stub_(PredictionService::NewStub(grpc::CreateChannel(
server_port, grpc::InsecureChannelCredentials()))) {}
std::string PredictionClient::callPredict(std::string serialized_request_object) {
PredictRequest predictRequest;
PredictResponse response;
ClientContext context;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Prolog/Engine.pm view on Meta::CPAN
=head1 CLASS METHODS
=head2 C<new($query, $database)>
This creates a new Prolog engine. The first argument must be of type
C<AI::Prolog::Term> and the second must be a database created by
C<AI::Prolog::Parser::consult>.
my $database = Parser->consult($some_prolog_program);
my $query = Term->new('steals(badguy, X).');
my $engine = Engine->new($query, $database);
view all matches for this distribution
view release on metacpan or search on metacpan
maint/process-notebook.pl view on Meta::CPAN
iperl nbconvert.iperl $SRC | sponge -a $DST;
## Edit to NAME
perl -0777 -pi -e 's/(=head1 NAME\n+)$ENV{SRC_BASENAME}/\1$ENV{PODNAME}/' $DST
## Edit to local section link (Markdown::Pod does not yet recognise this).
perl -pi -E 's,\QL<CPANFILE|#CPANFILE>\E,L<CPANFILE|/CPANFILE>,g' $DST
## Add
## =head1 CPANFILE
##
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Termites/PeractioBaro.pm view on Meta::CPAN
my $pos = $termite->{pos};
my $near = $self->{near};
my $wood_ix = $self->{kdtree}->find_nearest_neighbor($pos, $near);
if (defined $wood_ix) {
# say "one near $pos, $near";
my $second = $self->{kdtree}->find_nearest_neighbor($pos, $near, $wood_ix);
return $self->{kdtree_ixs}[$wood_ix] unless defined $second;
# say "two near $wood_ix - $second";
}
undef
}
sub termite_leave_wood_p {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/XGBoost/Booster.pm view on Meta::CPAN
Gradient of your objective function (Reference to an array)
=item hess
Hessian of your objective function, that is, second order gradient (Reference to an array)
=back
=head2 predict
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
$| = 1;
select $ofh;
my $Query = join("\r\n", # "CRLF"
"GET $Desired HTTP/1.1",
# Do we need a Host: header with an "AbsoluteURI?"
# not needed: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.2
# but this is trumped by an Apache error message invoking RFC2068 sections 9 and 14.23
"Host: $HostName",
"User-Agent: $agent",
"Connection: close",
'','') ;
print SOCK $Query or croak "could not print to miniget socket";
sessions approximately once every 2000 invocations. Adjust this
with the C<freq> parameter. C<0> will suppress housekeeping entirely.
=item maxage
Minimum time in seconds since C<$AIS_STASH{last_access}> that will
trigger session deletion at housekeeping time. Defaults to C<72*60*60>.
=head1 ENDING SESSIONS
view all matches for this distribution
view release on metacpan or search on metacpan
my ${aname};
my %attrib;
# Retrieve the attributes associated with the device from the ODM
# Two lines are returned, the attribute names are returned on the
# first line, the attribute values returned on the second.
my @lines = `lsattr -EOl ${_[0]}`;
chomp(${lines[0]});
${lines[0]} =~ s/^#//g;
my (@attr_name) = split(/:/,${lines[0]});
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
1.1 (released on Tue Jun 16 16:39:00 CDT 2009)
1.0 (released 2000-07-03)
=head1 BUGS
With version 1.1 this module was rewritten from scratch. It has been tested on p570/p595 LPAR hardware and on several older stand-alone servers. This version works slower that version 1.0 because it relies on prtconf command which takes several secon...
=head1 TO-DO
=over 2
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ALBD.pm view on Meta::CPAN
# are the co-occurrence matrices explicitMatrix and implicitMatrix. These
# matrices have dimensions vocabulary size by vocabulary size. Each row
# corresponds to the all co-occurrences for a single CUI. Each column of that
# row corresponding to a co-occurrence with a single CUI. Since the matrices
# tend to be sparse, they are stored as hashes of hashes, where the the first
# key is for a row, and the second key is for a column. The keys of each hash
# are the indeces within the matrix. The hash values are the number of
# co-ocurrences for that CUI pair (e.g. ${${$explicit{C0000000}}{C1111111} = 10
# means that CUI C0000000 and C1111111 co-occurred 10 times).
#
# Now with an understanding of the data strucutres, below is a breif
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ALPM/Conf.pm view on Meta::CPAN
# Call the appropriate hook for each type of token...
if(/$COMMENT_MATCH/){
;
}elsif(/$SECTION_MATCH/){
$hooks->{'section'}->($1);
}elsif(/$FIELD_MATCH/){
my($name, $val) = ($1, $2);
if(length $val){
my $apply = $hooks->{'field'}{$name};
$apply->($val) if($apply);
}
}else{
die "Invalid line in config file, not a comment, section, or field\n";
}
};
}
sub _parse
lib/ALPM/Conf.pm view on Meta::CPAN
return;
}
sub _mlisthooks
{
my($dbsref, $sectref) = @_;
# Setup hooks for 'Include'ed file parsers...
return {
'section' => sub {
my $file = shift;
die q{Section declaration is not allowed in Include-ed file\n($file)\n};
},
'field' => {
'Server' => sub { _addmirror($dbsref, shift, $$sectref) }
},
};
}
my %CFGOPTS = (
lib/ALPM/Conf.pm view on Meta::CPAN
'Architecture' => 'arch',
);
sub _confhooks
{
my($optsref, $sectref) = @_;
my %hooks;
while(my($fld, $opt) = each %CFGOPTS){
$hooks{$fld} = sub {
my $val = shift;
die qq{$fld can only be set in the [options] section\n}
unless($$sectref eq 'options');
$optsref->{$opt} = $val;
};
}
return %hooks;
}
lib/ALPM/Conf.pm view on Meta::CPAN
return $new;
}
sub _setsiglvl
{
my($dbs, $sect, $siglvl) = @_;
my $db = _getdb($dbs, $sect);
$db->{'siglvl'} = $siglvl;
return;
}
sub _parse_siglvl
lib/ALPM/Conf.pm view on Meta::CPAN
return $opt;
}
sub _addmirror
{
my($dbs, $url, $sect) = @_;
die "Section has not previously been declared, cannot set URL\n" unless($sect);
my $db = _getdb($dbs, $sect);
push @{$db->{'mirrors'}}, $url;
return;
}
lib/ALPM/Conf.pm view on Meta::CPAN
sub parse
{
my($self) = @_;
my (%opts, @dbs, $currsect, $defsiglvl);
my %fldhooks = (
_confhooks(\%opts, \$currsect),
_nullhooks(@NULL_OPTS),
'Server' => sub { _addmirror(\@dbs, shift, $currsect) },
'Include' => sub {
die "Cannot have an Include directive in the [options] section\n"
if($currsect eq 'options');
# An include directive spawns its own little parser...
_parse(shift, _mlisthooks(\@dbs, \$currsect));
},
'SigLevel' => sub {
if($currsect eq 'options'){
$defsiglvl = _parse_siglvl(shift);
}else{
_setsiglvl(\@dbs, $currsect, _parse_siglvl(shift));
}
},
($self->{'cfields'} ? %{$self->{'cfields'}} : ()),
);
my %hooks = (
'field' => \%fldhooks,
'section' => sub { $currsect = shift; }
);
_parse($self->{'path'}, \%hooks);
return _applyopts(\%opts, \@dbs);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AMF/Connection.pm view on Meta::CPAN
See the sample usage synopsis above to start using the module.
=head1 DATE TYPE SUPPORT
The latest 0.79 version of Storable::AMF added basic date support with the new_date() and perl_date() utilitiy functions. This is just great. Internally an AMF Date Type represents a timestamp in milliseconds since the epoch in UTC ("neutral") timezo...
use Storable::AMF qw(new_date perl_date);
and make sure any date passed to an AMF::Connection as parameter is encoded with new_date().
=head2 OPEN ISSUES AND SHORTCOMINGS
There is still an issue when arbitrary Date structures are returned from an AMF server to an AMF::Connection (E.g. as part of values of structured AMF Objects). In this case, the AMF::Connection does not try to reparse the Perl object structure retur...
All this means that an AMF::Connection client application can not rely on those Date returned by the server as being Perl timestamps (seconds since the epoch) and will need explicitly call perl_date() or divide the timestamp by 1000 *explicitly*.
=head2 USING OLD Storable::AMF VERSIONS
In older versions (pre 0.79) of Storable::AMF there was no support for the AMF0/AFM3 Date Type, and everything was being passed as string to the server (E.g. "2010-09-22T02:34:00"). Or as double (number) if the date was in timestamp seconds since the...
=head1 MAPPING OBJECTS
By combining the power of Perl bless {}, $package_name syntax and the Storable::AMF freeze()/thaw() interface, it is possible to pass arbitrary structured AMF Objects the corresponding AMF server can interpret. This is possible due a simple Perl obje...
lib/AMF/Connection.pm view on Meta::CPAN
=head1 METHODS
=head2 new ($endpoint)
Create new AMF::Connection object. An endpoint can be specified as the only parameter. Or set in a second moment with the setEndpoint() method.
=head2 call ($operation, $arguments)
Call the remote service method with given parameters/arguments on the set endpoint and return an AMF::Connection::MessageBody response. Or an array of responses if requsted (wantarray call scope). The $arguments is generally an array reference, but t...
view all matches for this distribution
view release on metacpan or search on metacpan
doc/examples/petmarket/petmarket/api/cartservice.pm view on Meta::CPAN
{
my @columns = ("shippingoid", "shippingname", "shippingdescription", "shippingprice", "shippingdays");
my @names = ("Ground", "2nd Day Air", "Next Day Air", "3 Day Select");
my @descriptions = (
"Prompt, dependable, low-cost ground delivery makes Ground an excellent choice for all your routine shipments. Ground reaches every address throughout the 48 contiguous states.",
"2nd Day Air provides guaranteed on-time delivery to every address throughout the United States (excluding intra-Alaska shipments) and Puerto Rico by the end of the second business day. This service is an economical alternative for time-sensi...
"Next Day Air features fast, reliable delivery to every address in all 50 states and Puerto Rico. We guarantee delivery by 10:30 a.m., noon, or end of day the next business day depending on destination (noon or 1:30 p.m. on Saturdays).",
"The ideal mix of economy and guaranteed on-time delivery, 3 Day Select guarantees delivery within three business days to and from every address in the 48 contiguous states."
);
my @prices = (13.00, 26.00, 39.00, 18.00);
my @days = (6, 2, 1, 3);
view all matches for this distribution
view release on metacpan or search on metacpan
my $net_44_regexp = '^44\.';
# We do not accept routes less specific than /15
my $minimum_prefix_len = 15;
# tcp window to set
my $tcp_window = 840;
# time (in seconds) to use routes which are no longer advertised
# - this is set to a large value, so that if the rip advertisements
# from mirrorshades stop, the network won't go down right away.
my $route_ttl = 7*24*60*60;
my %current_routes;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ANSI/Palette.pm view on Meta::CPAN
background_underline_256(226, 33, "This is a test for background_underline_256\n");
background_italic_256(118, 33, "This is a test for background_italic_256\n");
=head1 EXPORT
A list of functions that can be exported. You can delete this section
if you don't export anything, such as for a purely object-oriented module.
=head2 reset
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
can be controlled via the control port.
To configure AOLserver's control port, use settings similar to the following
ones:
ns_section "ns/server/${servername}/module/nscp"
ns_param address myhostname
ns_param port 3334
ns_param echopassword 1
ns_param cpcmdlogging 1
ns_section "ns/server/${servername}/module/nscp/users"
ns_param user "username:3G5/H31peci.o:"
# That's "username:password"
ns_section "ns/server/${servername}/modules"
ns_param nscp ${bindir}/nscp.so
This lets AOLserver enable the control port on server C<myhostname> on port
3334. Authentication is on, the username is C<username> and the
password is C<password> (hashed to C<3G5/H31peci.o> with a program
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
The control port C<address> as defined in the configuration.
=item Timeout
Number of seconds after which the client will time out if the
server doesn't send a response.
=item User
User name for control port login defaults to the empty string
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Basecamp.pm view on Meta::CPAN
# ABSTRACT: Basecamp.com API Client
package API::Basecamp;
use Data::Object::Class;
use Data::Object::Signatures;
use Data::Object::Library qw(
lib/API/Basecamp.pm view on Meta::CPAN
extends 'API::Client';
our $VERSION = '0.06'; # VERSION
our $DEFAULT_URL = "https://basecamp.com";
# ATTRIBUTES
has account => (
is => 'rw',
lib/API/Basecamp.pm view on Meta::CPAN
);
# DEFAULTS
has '+identifier' => (
default => 'API::Basecamp (Perl)',
required => 0,
);
has '+url' => (
default => $DEFAULT_URL,
lib/API/Basecamp.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
API::Basecamp - Basecamp.com API Client
=head1 VERSION
version 0.06
=head1 SYNOPSIS
use API::Basecamp;
my $basecamp = API::Basecamp->new(
username => 'USERNAME',
password => 'PASSWORD',
identifier => 'APPLICATION NAME',
account => 'ACCOUNT NUMBER',
);
$basecamp->debug(1);
$basecamp->fatal(1);
my $project = $basecamp->projects('605816632');
my $results = $project->fetch;
# after some introspection
$project->update( ... );
=head1 DESCRIPTION
This distribution provides an object-oriented thin-client library for
interacting with the Basecamp (L<http://basecamp.com>) API. For usage and
documentation information visit L<https://github.com/basecamp/bcx-api>.
API::Basecamp is derived from L<API::Client> and inherits all of it's
functionality. Please read the documentation for API::Client for more usage
information.
=head1 ATTRIBUTES
=head2 account
$basecamp->account;
$basecamp->account('ACCOUNT');
The account attribute should be set to the account holder's account ID number.
=head2 identifier
$basecamp->identifier;
$basecamp->identifier('IDENTIFIER');
The identifier attribute should be set to a string that identifies your application.
=head2 password
$basecamp->password;
$basecamp->password('PASSWORD');
The password attribute should be set to the account holder's password.
=head2 username
$basecamp->username;
$basecamp->username('USERNAME');
The username attribute should be set to the account holder's username.
=head2 debug
$basecamp->debug;
$basecamp->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$basecamp->fatal;
$basecamp->fatal(1);
The fatal attribute if true promotes 4xx and 5xx server response codes to
exceptions, a L<API::Client::Exception> object.
=head2 retries
$basecamp->retries;
$basecamp->retries(10);
The retries attribute determines how many times an HTTP request should be
retried if a 4xx or 5xx response is received. This attribute defaults to 0.
=head2 timeout
$basecamp->timeout;
$basecamp->timeout(5);
The timeout attribute determines how long an HTTP connection should be kept
alive. This attribute defaults to 10.
=head2 url
$basecamp->url;
$basecamp->url(Mojo::URL->new('https://basecamp.com'));
The url attribute set the base/pre-configured URL object that will be used in
all HTTP requests. This attribute expects a L<Mojo::URL> object.
=head2 user_agent
$basecamp->user_agent;
$basecamp->user_agent(Mojo::UserAgent->new);
The user_agent attribute set the pre-configured UserAgent object that will be
used in all HTTP requests. This attribute expects a L<Mojo::UserAgent> object.
=head1 METHODS
=head2 action
my $result = $basecamp->action($verb, %args);
# e.g.
$basecamp->action('head', %args); # HEAD request
$basecamp->action('options', %args); # OPTIONS request
$basecamp->action('patch', %args); # PATCH request
The action method issues a request to the API resource represented by the
object. The first parameter will be used as the HTTP request method. The
arguments, expected to be a list of key/value pairs, will be included in the
request if the key is either C<data> or C<query>.
=head2 create
my $results = $basecamp->create(%args);
# or
$basecamp->POST(%args);
The create method issues a C<POST> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 delete
my $results = $basecamp->delete(%args);
# or
$basecamp->DELETE(%args);
The delete method issues a C<DELETE> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 fetch
my $results = $basecamp->fetch(%args);
# or
$basecamp->GET(%args);
The fetch method issues a C<GET> request to the API resource represented by the
object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head2 update
my $results = $basecamp->update(%args);
# or
$basecamp->PUT(%args);
The update method issues a C<PUT> request to the API resource represented by
the object. The arguments, expected to be a list of key/value pairs, will be
included in the request if the key is either C<data> or C<query>.
=head1 RESOURCES
=head2 accesses
$basecamp->projects('605816632')->accesses;
The accesses method returns a new instance representative of the API
I<Accesses> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/accesses.md>.
=head2 attachments
$basecamp->attachments;
The attachments method returns a new instance representative of the API
I<Attachments> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/attachments.md>.
=head2 calendar_events
$basecamp->calendar_events;
The calendar_events method returns a new instance representative of the API
I<Calendar Events> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/calendar_events.md>.
=head2 calendars
$basecamp->calendars;
The calendars method returns a new instance representative of the API
I<Calendars> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/calendars.md>.
=head2 comments
$basecamp->projects('605816632')->comments;
The comments method returns a new instance representative of the API
I<Comments> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/comments.md>.
=head2 documents
$basecamp->documents;
The documents method returns a new instance representative of the API
I<Documents> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/documents.md>.
=head2 events
$basecamp->events;
The events method returns a new instance representative of the API
I<Events> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/events.md>.
=head2 groups
$basecamp->groups;
The groups method returns a new instance representative of the API
I<Groups> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/groups.md>.
=head2 messages
$basecamp->projects('605816632')->messages;
The messages method returns a new instance representative of the API
I<Messages> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/messages.md>.
=head2 people
$basecamp->people;
The people method returns a new instance representative of the API
I<People> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/people.md>.
=head2 project_templates
$basecamp->project_templates;
The project_templates method returns a new instance representative of the API
I<Project Templates> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/project_templates.md>.
=head2 projects
$basecamp->projects;
The projects method returns a new instance representative of the API
I<Projects> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/projects.md>.
=head2 stars
$basecamp->stars;
The stars method returns a new instance representative of the API
I<Stars> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/stars.md>.
=head2 todo_lists
$basecamp->todo_lists;
The todo_lists method returns a new instance representative of the API
I<Todo Lists> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/todolists.md>.
=head2 todos
$basecamp->projects('605816632')->todos;
The todos method returns a new instance representative of the API
I<Todos> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/todos.md>.
=head2 topics
$basecamp->topics;
The topics method returns a new instance representative of the API
I<Topics> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/topics.md>.
=head2 uploads
$basecamp->projects('605816632')->uploads;
The uploads method returns a new instance representative of the API
I<Uploads> resource requested. This method accepts a list of path
segments which will be used in the HTTP request. The following documentation
can be used to find more information. L<https://github.com/basecamp/bcx-api/blob/master/sections/uploads.md>.
=head1 AUTHOR
Al Newkirk <anewkirk@ana.io>
view all matches for this distribution