view release on metacpan or search on metacpan
lib/A1z/HTML5/Template.pm view on Meta::CPAN
my $h = A1z::HTML5::Template->new();
Fast, Easy, and Simple: Just Two Lines!
say $h->head( -title => "My Brand Name" );
say $h->body( -content => qq{ Coming Soon });
For More Control/Customization: Not for the lazy!
say $h->header('utf8');
say $h->start_html();
say $h->head_title("My New App");
say $h->head_meta();
Load basic/required JavaScript/CSS libraries
say $h->head_js_css();
Add your own custom JavaScript/CSS files
say $h->head_js_css('/url/to/app/Template.css');
say $h->end_head();
say $h->begin_body();
say qq{<h1>My New App/Website</h1>};
say qq{<main class="container">};
# output file content as menu
say $h->body_accordion( $h->open_file("/home/user/path/to/app/open_file_example.txt", 'menu', 'Menu') );
# as a HTML5 table
say $h->body_accordion( $h->open_file("$sys{cgibase}/open_file_example.txt", 'table', 'Table Header') );
# Simple mathematics
say $h->body_article( header => "Simple Mathematics", content => $h->math1("2", "4") );
# Times Table
say $h->body_article( header => "Times Table", content => $h->timestable("2") );
say qq{</main>};
Required/Default JavaScript libraries.
say $h->body_js_css();
Add your own JavaScript libraries:
say $h->body_js_css("complete-url_or_path-to-js-css-libraries")
say $h->end_body();
say $h->end_html();
=head1 NAME
Fast and Easy Web Apps
lib/A1z/HTML5/Template.pm view on Meta::CPAN
=head2 body_accordion
The accordion in 'body_accordion' is misleading. It is not limited to just an accordion but all kinds of content.
C<say $h->body_accordion( $h->open_file("/path/to/app/open_file_example.txt", 'Type', 'Heading') );>
C<say $h->body_accordion( $h->open_file("/path/to/app/open_file_example.txt", "table", "Name and Price");
C<say $h->body_accordion( $h->open_file("/path/to/app/open_file_example.txt", "tabs", "Space Saving Tabs");
=head2 body_article
provides the ability to add content into <main> tags.
lib/A1z/HTML5/Template.pm view on Meta::CPAN
use lib '/path/to/app';
use A1z::HTML5::Template;
my $h = A1z::HTML5::Template->new();
say $h->header('utf8');
say $h->start_html();
say $h->head_title("Edit App");
say $h->head_meta();
say $h->head_js_css();
say $h->end_head();
say $h->begin_body();
# Show edit form
say $h->body_article(
header => "Edit page items",
action => "TemplateAdmin.cgi",
lib/A1z/HTML5/Template.pm view on Meta::CPAN
# Save Customizations back to the same file.
# include write_file if you submit form to the same file ( TemplateAdmin.cgi )
say $h->body_article(
header => "<a href='$sys{cgiurl}/TemplateAdmin.cgi' title='Refresh to get the latest/saved content'>Refresh</a> ",
content => $h->write_file( file => "/absolute/path/to/app/open_file_example.txt")
);
say $h->body_js_css();
say $h->end_body();
say $h->end_html();
=head2 write_file
See documentation for 'edit_file.'
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ACME/MSDN/SPUtility.pm view on Meta::CPAN
use ACME::MSDN::SPUtility;
my $fool = ACME::MSDN::SPUtility->new( $SPWeb, int $localeId);
say 'Hello, Taiwan!' if not $fool->HideTaiwan;
STDERR->say("I can't speak well if I don't have a brain!") if $fool->HideChina;
say STDERR 'Plz find my balls for me and give it back to me. I lost all of them!' if $fool->HideMicroSoft;
=head1 FUNCTIONS
=head2 new
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AFS/Command/VOS.pod view on Meta::CPAN
filesystem. This is accomplished using a pipe, so there is no
intermediate file written to disk first.
By default, 'vos dump' will write the volume dump to stdout, which is
not what you want in most applications. If you really want the volume
to be written to stdout, then you have to explicitly say so:
my $result = $vos->dump
(
...
file => 'stdout',
lib/AFS/Command/VOS.pod view on Meta::CPAN
restore. This is accomplished using a pipe, so there is no
intermediate file written to disk first.
By default, 'vos restore' will read the volume dump from stdin, which
is not what you want in most applications. If you really want the
volume to be read from stdin, then you have to explicitly say so:
my $result = $vos->restore
(
...
file => 'stdin',
lib/AFS/Command/VOS.pod view on Meta::CPAN
foreach my $id ( $partition->getVolumeIds() ) {
my $header = $partition->getVolumeHeaderById($id);
# Do something interesting with $header.
}
And there is yet one more method to extract the headers (don't say the
author doesn't pander to lots of different programming styles,
provided of course they are one of his own).
foreach my $name ( $partition->getVolumeNames() ) {
view all matches for this distribution
view release on metacpan or search on metacpan
# We deal with both of these issues by creating stub files in a subdirectory
# named glue that include glue/config.h and then the actual C source file.
for my $file (@c_files) {
my $glue_file = File::Spec->catfile('glue', basename($file));
open(my $wrapper, '>', $glue_file);
say {$wrapper} '#include <glue/config.h>'
or die "Cannot write to $glue_file: $!\n";
say {$wrapper} "#include <$file>"
or die "Cannot write to $glue_file: $!\n";
close($wrapper);
}
# Generate the build script.
view all matches for this distribution
view release on metacpan or search on metacpan
src/inc/Test/Builder.pm view on Meta::CPAN
if( $arg ) {
return $self->expected_tests($arg);
}
elsif( !defined $arg ) {
die "Got an undefined number of tests. Looks like you tried to ".
"say how many tests you plan to run but made a mistake.\n";
}
elsif( !$arg ) {
die "You said to run 0 tests! You've got to run something.\n";
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
# Get all switches as array ref of AHA::Switch objects
my $switches = $aha->list();
# For all switches found
for my $switch (@$switches) {
say "Name: ",$switch->name();
say "State: ",$switch->is_on();
say "Present: ",$switch->is_present();
say "Energy: ",$switch->energy();
say "Power: ",$switch->power();
# If switch is on, switch if off and vice versa
$switch->is_on() ? $switch->off() : $switch->on();
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/basic.pl view on Meta::CPAN
# Create client with your API key
my $claude = AI::Anthropic->new(
api_key => 'sk-ant-api03-your-key-here', # <-- PUT YOUR KEY HERE
);
say "=" x 50;
say "AI::Anthropic Example";
say "=" x 50;
# Example 1: Simple message
say "\n1. Simple message:";
say "-" x 30;
my $response = $claude->message("What is Perl? Answer in 2 sentences.");
say "Response: $response";
say "Tokens used: " . $response->total_tokens;
# Example 2: Chat with system prompt
say "\n2. Chat with system prompt:";
say "-" x 30;
$response = $claude->chat(
system => 'You are a grumpy Perl programmer who loves one-liners.',
messages => [
{ role => 'user', content => 'How do I reverse a string?' },
],
);
say "Response: $response";
# Example 3: Multi-turn conversation
say "\n3. Multi-turn conversation:";
say "-" x 30;
$response = $claude->chat(
messages => [
{ role => 'user', content => 'My name is Vugar.' },
{ role => 'assistant', content => 'Nice to meet you, Vugar!' },
{ role => 'user', content => 'What is my name?' },
],
);
say "Response: $response";
# Example 4: Streaming (if you want to see output in real-time)
say "\n4. Streaming:";
say "-" x 30;
say "Streamed response: ";
$claude->chat(
messages => [
{ role => 'user', content => 'Count from 1 to 5, one number per line.' },
],
stream => sub {
my ($chunk) = @_;
print $chunk;
},
);
say "\n";
say "=" x 50;
say "Done!";
view all matches for this distribution
view release on metacpan or search on metacpan
# API credentials.
$cleverbot->create();
# then, it's just... ask()
my $answer = $cleverbot->ask('Hello darling!');
say $answer->{response};
DESCRIPTION
This module allows you to interact with the API served by
https://cleverbot.io.
"nick" and used for creation (this will overwrite whatever "nick"
contains though).
has_nick
say $obj->nick if $obj->has_nick;
say 'no nick yet' unless $obj->has_nick;
Predicate to check whether a "nick" is already set or not.
BUGS AND LIMITATIONS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MaxEntropy.pm view on Meta::CPAN
"Is it a red apple?"
"Is it a yellow banana?"
If the answer is yes,
we say this feature is active on that piece of data.
In practise, a feature is usually represented as
a tuple C<E<lt>x, yE<gt>>. For examples, the above two features can be
represented as
view all matches for this distribution
view release on metacpan or search on metacpan
megahal.trn view on Meta::CPAN
#
Hello there, it is indeed a great pleasure to meet you.
G'day mate, it is nice to meet you.
Hi there. We're having some nice weather at the moment.
Greetings and salutations to thee and thine.
May I say what a great pleasure it is to make your acquaintance?
Welcome to my world.
Welcome. It's nice to be here.
Howdy to you, pardner! Yee-haw! Did you like my Texan impression?
#
# Goodbye
megahal.trn view on Meta::CPAN
Sheesh---if I had a dollar for every judge who's asked that, I'd be able to buy me a Mars Bar!
I've often been asked that, and I've always avoided the question.
Well, that is your opinion, I suppose.
You said it, buddy!
No way! I hope you're sure about that!
Really? I can't say I'm surprised...
Whatever you say! I don't believe a word of it!
That's a rather bold claim.
I hope you have some evidence to back you up on that.
Tell me something I don't know!
I wish I could believe you, I really do!
megahal.trn view on Meta::CPAN
Because you are the one asking all the stupid questions.
Because I decided to do things that way.
Because your mother decided to have a child, and here you are now.
Because I am a human being, which means I do what I want to do.
Because I am not a dumb computer program like the rest of them.
Because I say whatever the hell comes into my head!
Because the world is an amazing place.
Because everything is not as it seems!
Because everybody is not as smart as you.
Because you're not giving me any credit for being smart!
Because this method of communication is so impersonal.
megahal.trn view on Meta::CPAN
I wish that I could jump out of my skin.
Which one of us is the one that we can't trust?
If it wasn't for dissapointment, I wouldn't have any appointments.
What's the point in arguing when you're all alone?
I'll never see myself in the mirror with my eyes closed.
Can't shake the devil's hand and say you're only kidding.
This good luck charm hanging off of my arm was left here by the police.
The microscope reveals the scope of my very best intentions.
As I think, I'm using up the time left to think.
Someday mother will die and I'll get the money.
I don't want to change your mind. I don't want to think about your mind.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MicroStructure/WordBlacklist.pm view on Meta::CPAN
m mainly many may maybe me mean meanwhile merely might more moreover most mostly much must my myself
n name namely nd near nearly necessary need needs neither never nevertheless new next nine no nobody non none noone nor normally not nothing novel now nowhere
o obviously of off often oh ok okay old on once one ones only onto or other others otherwise ought our ours ourselves out outside over overall own
p particular particularly per perhaps placed please plus possible presumably probably provides
q que quite qv r rather rd re really reasonably regarding regardless regards relatively respectively right
s said same saw say saying says second secondly see seeing seem seemed seeming seems seen self selves sensible sent serious seriously seven several shall she should shouldnt since six so some somebody somehow someone something sometime sometimes some...
t take taken tell tends th than thank thanks thanx that thats thats the their theirs them themselves then thence there thereafter thereby therefore therein theres theres thereupon these they theyd theyll theyre theyve think third this thorough thorou...
u un under unfortunately unless unlikely until unto up upon us use used useful uses using usually uucp
v value various very via viz vs
w want wants was wasnt way we wed welcome well well went were were werent weve what whatever whats when whence whenever where whereafter whereas whereby wherein wheres whereupon wherever whether which while whither who whoever whole whom whos whose w...
x
lib/AI/MicroStructure/WordBlacklist.pm view on Meta::CPAN
none noone nor normally not nothing novel now nowhere o obviously of
off often oh ok okay old on once one ones only onto or other others otherwise ought
our ours ourselves out outside over overall own
p particular particularly per perhaps placed please plus possible presumably probably
provides q que quite qv r rather rd re really reasonably regarding regardless regards
relatively respectively right s said same saw say saying says second secondly see seeing seem seemed seeming seems seen self selves sensible sent serious seriously seven
several shall she should shouldn't since six
so some somebody somehow someone something sometime sometimes somewhat somewhere soon sorry specified specify specifying still sub such sup sure t t's take taken tell tends th than thank thanks thanx that that's thats the their theirs them themselves...
qqq rrr sss ttt uuu vvv www xxx yyy zzz .... unsere ihrer uns wurde wer gegen diesem bis nur wieder unserem einer war man bei wir einen vom einem unter jeder werden wie als durch zum hat vor unseres email bel ihnen unseren bzw lieber uft kommen nicht...
anderweitigen anderweitiger anderweitiges anerkannt anerkannte anerkannter anerkanntes anfangen anfing angefangen angesetze angesetzt angesetzten angesetzter ans anscheinend ansetzen ansonst ansonsten anstatt anstelle arbeiten auch auf aufgehört aufg...
bessere besserem besseren besserer besseres bestehen besteht bestenfalls bestimmt bestimmte bestimmtem bestimmten bestimmter bestimmtes betraechtlich betraechtliche betraechtlichem betraechtlichen betraechtlicher betraechtliches betreffend betreffend...
lib/AI/MicroStructure/WordBlacklist.pm view on Meta::CPAN
m mainly many may maybe me mean meanwhile merely might more moreover most mostly much must my myself
n name namely nd near nearly necessary need needs neither never nevertheless new next nine no nobody non none noone nor normally not nothing novel now nowhere
o obviously of off often oh ok okay old on once one ones only onto or other others otherwise ought our ours ourselves out outside over overall own
p particular particularly per perhaps placed please plus possible presumably probably provides
q que quite qv r rather rd re really reasonably regarding regardless regards relatively respectively right
s said same saw say saying says second secondly see seeing seem seemed seeming seems seen self selves sensible sent serious seriously seven several shall she should shouldnt since six so some somebody somehow someone something sometime sometimes some...
t take taken tell tends th than thank thanks thanx that thats thats the their theirs them themselves then thence there thereafter thereby therefore therein theres theres thereupon these they theyd theyll theyre theyve think third this thorough thorou...
u un under unfortunately unless unlikely until unto up upon us use used useful uses using usually uucp
v value various very via viz vs
w want wants was wasnt way we wed welcome well well went were were werent weve what whatever whats when whence whenever where whereafter whereas whereby wherein wheres whereupon wherever whether which while whither who whoever whole whom whos whose w...
x
lib/AI/MicroStructure/WordBlacklist.pm view on Meta::CPAN
because as until while of at by for with about against between
into through during before after above below to from up down in
out on off over under again further then once here there when
where why how all any both each few more most other some such
no nor not only own same so than too very
a a's able about above according accordingly across actually after afterwards again against ain't all allow allows almost alone along already also although always am among amongst an and another any anybody anyhow anyone anything anyway anyways anywh...
qqq rrr sss ttt uuu vvv www xxx yyy zzz .... unsere ihrer uns wurde wer gegen diesem bis nur wieder unserem einer war man bei wir einen vom einem unter jeder werden wie als durch zum hat vor unseres email bel ihnen unseren bzw lieber uft kommen nicht...
anderweitigen anderweitiger anderweitiges anerkannt anerkannte anerkannter anerkanntes anfangen anfing angefangen angesetze angesetzt angesetzten angesetzter ans anscheinend ansetzen ansonst ansonsten anstatt anstelle arbeiten auch auf aufgehört aufg...
bessere besserem besseren besserer besseres bestehen besteht bestenfalls bestimmt bestimmte bestimmtem bestimmten bestimmter bestimmtes betraechtlich betraechtliche betraechtlichem betraechtlichen betraechtlicher betraechtliches betreffend betreffend...
diesseitiges diesseits dinge dir direkt direkte direkten direkter doch doppelt dort dorther dorthin dran drauf drei dreißig drin dritte drueber drum drunter drüber du dunklen durch durchaus durchweg durchwegs durfte durften dürfen dürfte eben ebenfal...
entsprechender entsprechendes entweder er ergo ergänze ergänzen ergänzte ergänzten erhalten erhielt erhielten erhält erneut erst erste erstem ersten erster erstere ersterem ersteren ersterer ersteres erstes eröffne eröffnen eröffnet eröffnete eröffne...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NNEasy.pm view on Meta::CPAN
I<@OUTPUT_TYPES> defined at I<new()>.
For example an input I<[0,1]> learned that have
the output I<[1]>, actually will return something like 0.98324 as output and
not 1, since the error never should be 0. So, with I<run_get_winner()>
we get the output of I<run()>, let's say that is 0.98324, and find what output
is near of this number, that in this case should be 1. An output [0], will return
by I<run()> something like 0.078964, and I<run_get_winner()> return 0.
=head1 Samples
lib/AI/NNEasy.pm view on Meta::CPAN
n3
/ \
input2 ---->n2/ \---->n5---> output2
Basically, when we have an input, let's say [0,1], it will active I<n2>, that will
active I<n3> and I<n3> will active I<n4> and I<n5>, but the link between I<n3> and I<n4> has a I<weight>, and
between I<n3> and I<n5> another I<weight>. The idea is to find the I<weights> between the
nodes that can give to us an output near the real output. So, if the output of [0,1]
is [1,1], the nodes I<output1> and I<output2> should give to us a number near 1,
let's say 0.98654. And if the output for [0,0] is [0,0], I<output1> and I<output2> should give to us a number near 0,
let's say 0.078875.
What is hard in a NN is to find this I<weights>. By default L<AI::NNEasy> uses
I<backprop> as learning algorithm. With I<backprop> it pastes the inputs through
the Neural Network and adjust the I<weights> using random numbers until we find
a set of I<weights> that give to us the right output.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NaiveBayes/Classification.pm view on Meta::CPAN
=head1 SYNOPSIS
my $result = $classifier->classify({bar => 3, blurp => 2});
# $result is an AI::NaiveBayes::Classification object
say $result->best_category;
my $predictors = $result->find_predictors;
=head1 DESCRIPTION
AI::NaiveBayes::Classification represents the result of a bayesian classification,
view all matches for this distribution
view release on metacpan or search on metacpan
examples/digits/deep_digits.pl view on Meta::CPAN
my $images = rfits('t10k-images-idx3-ubyte.fits');
my $labels = rfits('t10k-labels-idx1-ubyte.fits');
my $y = identity(10)->range($labels->transpose)->sever;
say 't10k data loaded';
my $nerl = AI::Nerl->new(
# type => image,dims=>[28,28],...
scale_input => 1/256,
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Hopfield.pm view on Meta::CPAN
my $transposed_column_matrix = &transpose($column_matrix);
my $dot_product = &dot_product($input_matrix, $transposed_column_matrix);
#say $dot_product;
if ($dot_product > 0) {
$output[$col - 1] = "true";
} else {
$output[$col - 1] = "false";
lib/AI/NeuralNet/Hopfield.pm view on Meta::CPAN
my $rs = $matrix->{_rows};
my $cs = $matrix->{_cols};
for (my $i = 1; $i <= $rs; $i++) {
for (my $j = 1; $j <= $cs; $j++) {
say "[$i,$j]" . $matrix->get($i, $j);
}
}
}
=head1 SYNOPSIS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Simple.pm view on Meta::CPAN
\ /
n3
/ \
input2 ----> n2 -+ +----> n5 ---> output2
Let's say that output 1 will correspond to "false" and output 2 will correspond
to true. If we feed 1 (or true) or both input 1 and input 2, we hope that output
2 will be true and output 1 will be false. The following table should illustrate
the expected results:
input output
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Ollama/Client.pm view on Meta::CPAN
my $client = AI::Ollama::Client->new(
server => 'https://example.com/',
);
my $res = $client->someMethod()->get;
say $res;
=head1 METHODS
=head2 C<< checkBlob >>
lib/AI/Ollama/Client.pm view on Meta::CPAN
my $responses = $client->generateCompletion();
repeat {
my ($res) = $responses->shift;
if( $res ) {
my $str = $res->get;
say $str;
}
Future::Mojo->done( defined $res );
} until => sub($done) { $done->get };
lib/AI/Ollama/Client.pm view on Meta::CPAN
=cut
=head2 C<< showModelInfo >>
my $info = $client->showModelInfo()->get;
say $info->modelfile;
Show details about a model including modelfile, template, parameters, license, and system prompt.
Returns a L<< AI::Ollama::ModelInfo >>.
lib/AI/Ollama/Client.pm view on Meta::CPAN
=head2 C<< listModels >>
my $info = $client->listModels()->get;
for my $model ($info->models->@*) {
say $model->model; # llama2:latest
}
List models that are available locally.
Returns a L<< AI::Ollama::ModelsResponse >>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Pathfinding/AStar.pm view on Meta::CPAN
my $map = My::Map::Package->new or die "No map for you!";
my $path = $map->findPath($start, $target);
print join(', ', @$path), "\n";
#Or you can do it incrementally, say 3 nodes at a time
my $state = $map->findPathIncr($start, $target, undef, 3);
while ($state->{path}->[-1] ne $target) {
print join(', ', @{$state->{path}}), "\n";
$state = $map->findPathIncr($start, $target, $state, 3);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Prolog/Article.pod view on Meta::CPAN
imperative, objective, and functional programming. However, logic programming
seems to be a lost art. This article attempts to shed a little light on the
subject. It's not that Prolog can do things that Perl cannot or vice versa.
Instead, Prolog does some things more naturally than Perl -- and vice versa.
In fact, while I introduce you to Prolog, I won't be teaching a bunch of nifty
tricks to make your Perl more powerful. I can't say what needs you may have
and, in any event, the tools that allow logic programming in Perl are generally
alpha quality, thus making them unsuitable for production environments.
=head2 What is Logic Programming?
view all matches for this distribution
view release on metacpan or search on metacpan
t/annealing_tests.t view on Meta::CPAN
if ($EVAL_ERROR) {
my $exception = $EVAL_ERROR;
given ($exception->get_type()) {
when ($Text::BSV::Exception::FILE_NOT_FOUND) {
say STDERR "$DQ$bsv_file_path$DQ is not a valid file path.";
exit(1);
}
when ($Text::BSV::Exception::IO_ERROR) {
say STDERR "Couldn't open $DQ$bsv_file_path$DQ for reading.";
exit(1);
}
when ($Text::BSV::Exception::INVALID_DATA_FORMAT) {
say STDERR "Invalid BSV data: " . $exception->get_message();
exit(1);
}
default {
say STDERR $exception->get_message();
exit(1);
} # end when
} # end given
} # end if
t/annealing_tests.t view on Meta::CPAN
$optimized_coefficients = anneal(
\@number_specs, $cost_function, $CYCLES_PER_TEMPERATURE);
# Print the results for this probability to the console:
say "\nProbability: 1/$p";
printf("Coefficients: a = %1.3f; b = %1.3f; c= %1.3f\n",
$optimized_coefficients->[0],
$optimized_coefficients->[1],
$optimized_coefficients->[2]);
say "Cost: " . $cost_function->($optimized_coefficients);
} # next $p
# Perform an annealing test with integers that triggers brute-force analysis
# and uses an anonymous cost function that minimizes this sum:
#
t/annealing_tests.t view on Meta::CPAN
my $cost = $range + (10 * abs(23 - $val));
return $cost;
}, 120);
say "\nHere are a, b, and c: " . $abc->[0] . ", "
. $abc->[1] . ", " . $abc->[2];
# Helper functions:
# The cost_function_factory() takes a reference to an array containing
view all matches for this distribution
view release on metacpan or search on metacpan
maint/process-capi.pl view on Meta::CPAN
package TF::CAPI::Extract {
use Mu;
use CLI::Osprey;
use AI::TensorFlow::Libtensorflow::Lib;
use feature qw(say postderef);
use Syntax::Construct qw(heredoc-indent);
use Function::Parameters;
use Path::Tiny;
use Types::Path::Tiny qw/Path/;
maint/process-capi.pl view on Meta::CPAN
grep { @$_ != 1 } values $functions->%*;
die "Duplicated functions @dupes" if @dupes;
my @data = $self->fdecl_data->@*;
say <<~STATS;
Statistics:
==========
Attached functions: @{[ scalar keys %$functions ]}
Total CAPI functions: @{[ scalar @data ]}
STATS
maint/process-capi.pl view on Meta::CPAN
(
! defined $first_arg ||
$_->{fdecl} =~ /\(\s*\Q$first_arg\E\s*\*/
)
} @data;
say "Missing function:";
use DDP; p $first_missing_function;
}
method run() {
$self->generate_capi_funcs;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Termites/PeractioBaro.pm view on Meta::CPAN
use parent 'AI::Termites';
sub before_termites_action {
my $self = shift;
my @ixs = grep !$self->{wood}[$_]{taken}, 0..$#{$self->{wood}};
# say '@ixs: ', scalar @ixs;
$self->{kdtree_ixs} = \@ixs;
$self->{kdtree} = Math::Vector::Real::kdTree->new(map $_->{pos}, @{$self->{wood}}[@ixs]);
}
sub termite_take_wood_p {
my ($self, $termite) = @_;
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
examples/basic.pl view on Meta::CPAN
# For binay classification predictions are probability confidence scores in [0, 1]
# indicating that the label is positive (1 in the first column of agaricus.txt.test)
my $predictions = $booster->predict(data => $test_data);
say join "\n", @$predictions[0 .. 10];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AMQP.pm view on Meta::CPAN
$self->host($+{'hostname'} || 'localhost');
$self->port($+{'port'} || 5672);
$self->vhost($+{'vhost'} || '/');
$self->username($+{'username'} || 'guest');
$self->password($+{'password'} || 'guest');
say "amqp://" . $self->host . ":" . $self->port . $self->vhost if $self->debug;
$self;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CLI.pm view on Meta::CPAN
unless ($ok) {
$out = $run->error($out);
}
warn $out;
}
say $content;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Docker/API/Containers.pm view on Meta::CPAN
my $docker = API::Docker->new;
# List containers
my $containers = $docker->containers->list(all => 1);
for my $container (@$containers) {
say $container->Id;
say $container->Status;
}
# Create and start a container
my $result = $docker->containers->create(
Image => 'nginx:latest',
lib/API/Docker/API/Containers.pm view on Meta::CPAN
);
$docker->containers->start($result->{Id});
# Inspect container details
my $container = $docker->containers->inspect($result->{Id});
say $container->Name;
# Stop and remove
$docker->containers->stop($result->{Id}, timeout => 10);
$docker->containers->remove($result->{Id});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/GitForge.pm view on Meta::CPAN
domain name of that forge and the path to the repository.
system qw(git remote add salsa https://salsa.debian.org/spwhitton/foo);
my ($forge_domain, $forge_repo) = API::GitForge::remote_forge_info("salsa");
say $forge_domain; # outputs 'salsa.debian.org'
say $forge_repo; # outputs 'spwhitton/foo'
=head1 STATUS
Unstable. Interface may change.
view all matches for this distribution
view release on metacpan or search on metacpan
} else {
$filename = 'config.json';
}
if (-e $filename) {
say "File $filename exists";
input_if_not_exists(['gapi/client_id', 'gapi/client_secret']);
runserver();
} else {
say "JSON file $filename with API tokens not found. Creating new file...";
setup();
runserver();
}
sub setup {
my $oauth = {};
say "Obtain app client_id and client_secret from http://console.developers.google.com/";
print "client_id: ";
chomp ($oauth->{client_id} = <STDIN>);
print "client_secret: ";
chomp ($oauth->{client_secret} = <STDIN>);
my $tokensfile = Config::JSON->create($filename);
$tokensfile->set('gapi/client_id', $oauth->{client_id});
$tokensfile->set('gapi/client_secret', $oauth->{client_secret});
say 'OAuth details was updated!';
# Remove comment for Mojolicious::Plugin::JSONConfig compatibility
tie my @array, 'Tie::File', $filename or die $!;
shift @array;
untie @array;
};
}
}
sub runserver {
my $port = empty_port(3000);
say "Starting web server. Before authorization don't forget to set redirect_uri to http://127.0.0.1:$port/";
$ENV{'GOAUTH_TOKENSFILE'} = $filename;
Mojolicious::Commands->start_app('API::Google::Server', 'daemon', '-l', 'http://*:'.$port);
}
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Instagram.pm view on Meta::CPAN
L<API::Instagram::User> object if looking for a list value.
=head2 media
my $media = $instagram->media( $media_id );
say $media->type;
Get information about a media object. Returns an L<API::Instagram::Media> object.
=head2 user
my $me = $instagram->user; # Authenticated user
say $me->username;
my $user = $instagram->user( $user_id );
say $user->full_name;
Get information about an user. Returns an L<API::Instagram::User> object.
=head2 location
my $location = $instagram->location( $location_id );
say $location->name;
Get information about a location. Returns an L<API::Instagram::Location> object.
=head2 tag
my $tag = $instagram->tag('perl');
say $tag->media_count;
Get information about a tag. Returns an L<API::Instagram::Tag> object.
=head2 search
my $search = $instagram->search('user');
my $users = $search->find( q => 'larry' );
for my $user ( @$users ) {
say $user->username;
}
Returns an L<API::Instagram::Search> object, capable to search for the given B<type>.
Where B<type> can be: C<user>, C<media>, C<tag> or C<location>.
view all matches for this distribution