view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
$self->test_requires( $module => $version );
}
}
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
# numbers (eg, 5.006001 or 5.008009).
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
if ( ref($v) ) {
# Numify
$v = $v + 0;
}
return $v;
}
sub add_metadata {
my $self = shift;
my %hash = @_;
for my $key (keys %hash) {
warn "add_metadata: $key is not prefixed with 'x_'.\n" .
"Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/;
$self->{values}->{$key} = $hash{$key};
}
}
######################################################################
# MYMETA Support
sub WriteMyMeta {
die "WriteMyMeta has been deprecated";
}
sub write_mymeta_yaml {
my $self = shift;
# We need YAML::Tiny to write the MYMETA.yml file
unless ( eval { require YAML::Tiny; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_data {
my $self = shift;
# If there's no existing META.yml there is nothing we can do
return undef unless -f 'META.yml';
# We need Parse::CPAN::Meta to load the file
unless ( eval { require Parse::CPAN::Meta; 1; } ) {
return undef;
}
# Merge the perl version into the dependencies
my $val = $self->Meta->{values};
my $perl = delete $val->{perl_version};
if ( $perl ) {
$val->{requires} ||= [];
my $requires = $val->{requires};
# Canonize to three-dot version after Perl 5.6
if ( $perl >= 5.006 ) {
$perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
}
unshift @$requires, [ perl => $perl ];
}
# Load the advisory META.yml file
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
# Overwrite the non-configure dependency hashes
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
if ( exists $val->{requires} ) {
$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
}
if ( exists $val->{build_requires} ) {
$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
}
return $meta;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@SCHWIGON/@Basic/MetaYAML",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@SCHWIGON/@Basic/License",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@SCHWIGON/@Basic/Readme",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::ExtraTests",
"name" : "@SCHWIGON/@Basic/ExtraTests",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@SCHWIGON/@Basic/ExecDir",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@SCHWIGON/@Basic/ShareDir",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
"name" : "@SCHWIGON/@Basic/MakeMaker",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@SCHWIGON/@Basic/Manifest",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@SCHWIGON/@Basic/TestRelease",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@SCHWIGON/@Basic/ConfirmRelease",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@SCHWIGON/@Basic/UploadToCPAN",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@SCHWIGON/MetaConfig",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@SCHWIGON/MetaJSON",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "@SCHWIGON/PkgVersion",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@SCHWIGON/PodSyntaxTests",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::NoTabsTests",
"name" : "@SCHWIGON/NoTabsTests",
"version" : "0.01"
},
{
"class" : "Dist::Zilla::Plugin::PodCoverageTests",
"name" : "@SCHWIGON/PodCoverageTests",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::MetaResources",
"name" : "@SCHWIGON/MetaResources",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::Authority",
"name" : "@SCHWIGON/Authority",
"version" : "1.006"
},
{
"class" : "Dist::Zilla::Plugin::EOLTests",
"name" : "@SCHWIGON/EOLTests",
"version" : "0.02"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
"name" : "@SCHWIGON/PodWeaver",
"version" : "3.101641"
},
{
"class" : "Dist::Zilla::Plugin::AutoPrereqs",
"name" : "@SCHWIGON/AutoPrereqs",
"version" : "4.300023"
},
{
"class" : "Dist::Zilla::Plugin::Git::Describe",
"name" : "@SCHWIGON/Git::Describe",
"version" : "0.002"
},
{
"class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
"name" : "@SCHWIGON/CheckChangesHasContent",
"version" : "0.006"
},
{
"class" : "Dist::Zilla::Plugin::NextRelease",
"name" : "@SCHWIGON/NextRelease",
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
Makefile.PL
MANIFEST
README
t/ABNF-Grammar.t
t/ABNF-Validator.t
t/ABNF-Generator-Liar.t
t/ABNF-Generator-Honest.t
t/data/test.abnf
lib/ABNF/Grammar.pm
lib/ABNF/Validator.pm
lib/ABNF/Generator.pm
lib/ABNF/Generator/Liar.pm
lib/ABNF/Generator/Honest.pm
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
eg/filelist.pm view on Meta::CPAN
# -*- perl -*-
# example filelist
# $Id: filelist.pm,v 1.1 2010/11/01 19:04:21 jaw Exp $
package Local::MrMagoo::FileList;
use AC::ISOTime;
use AC::Yenta::Direct;
use JSON;
use strict;
my $YDBFILE = "/data/files.ydb";
sub get_file_list {
my $config = shift;
# get files + metadata from yenta
my $yenta = AC::Yenta::Direct->new( 'files', $YDBFILE );
# the job config is asking for files that match:
my $syst = $config->{system};
my $tmax = $config->{end}; # time_t
my $tmin = $config->{start}; # time_t
# the keys in yenta are of the form: 20100126150139_[...]
my $start = isotime($tmin); # 1286819830 => 20101011T175710Z
$start =~ s/^(\d+)T(\d+).*/$1$2/; # 20101011T175710Z => 20101011175710
my @files = grep {
# does this file match the request?
($_->{subsystem} eq $syst) &&
($_->{end_time} >= $tmin) &&
($_->{start_time} <= $tmax)
} map {
# get meta-data on this file. data is json encoded
my $d = $yenta->get($_);
$d = $d ? decode_json($d) : {};
# convert space seperated locations to arrayref
$d->{location} = [ (split /\s+/, $d->{location}) ];
$d;
} $yenta->getrange($start, undef); # get all files from $start to now
return \@files;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AC/Yenta/Client.pm view on Meta::CPAN
# -*- perl -*-
# Copyright (c) 2009 AdCopy
# Author: Jeff Weisberg
# Created: 2009-Apr-07 11:37 (EDT)
# Function: for other programs to talk to yentad
#
# $Id$
package AC::Yenta::Client;
use AC::Yenta::Conf;
use AC::DC::Protocol;
use AC::Import;
use AC::Misc;
use Sys::Hostname;
use JSON;
use Digest::SHA 'sha1';
use Socket;
use strict;
require 'AC/protobuf/yenta_check.pl';
require 'AC/protobuf/yenta_getset.pl';
our @EXPORT = 'timet_to_yenta_version'; # imported from Y/Conf
my $HOSTNAME = hostname();
my %MSGTYPE =
(
yenta_get => { num => 7, reqc => 'ACPYentaGetSet', resc => 'ACPYentaGetSet' },
yenta_distrib => { num => 8, reqc => 'ACPYentaDistRequest', resc => 'ACPYentaDistReply' },
yenta_check => { num => 9, reqc => 'ACPYentaCheckRequest', resc => 'ACPYentaCheckReply' },
);
for my $name (keys %MSGTYPE){
my $r = $MSGTYPE{$name};
AC::DC::Protocol->add_msg( $name, $r->{num}, $r->{reqc}, $r->{resc});
}
# one or more of:
# new( host, port )
# new( servers => [ { host, port }, ... ] )
# new( server_file )
sub new {
my $class = shift;
my $me = bless {
debug => sub{ },
host => 'localhost',
proto => AC::DC::Protocol->new(),
copies => 1,
@_,
}, $class;
$me->{server_file} ||= $me->{altfile}; # compat
die "servers or server_file?\n" unless $me->{servers} || $me->{server_file};
return $me;
}
sub get {
my $me = shift;
my $map = shift;
my $key = shift;
my $ver = shift;
my $req = $me->{proto}->encode_request( {
type => 'yenta_get',
msgidno => rand(0xFFFFFFFF),
want_reply => 1,
}, {
data => [ {
map => $map,
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
ignore.txt
lib/ACL/Lite.pm
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
README
t/00-load.t
t/01-simple.t
t/boilerplate.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ACME/2026.pm view on Meta::CPAN
package ACME::2026;
use 5.008003;
use strict;
use warnings;
use Carp qw(croak);
use Exporter 'import';
use File::Temp qw(tempfile);
use JSON::PP ();
use POSIX qw(strftime);
=head1 NAME
ACME::2026 - Checklists for glorious 2026 goals
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
our @EXPORT_OK = qw(
plan_new plan_load plan_save
add_item update_item delete_item get_item
add_note complete_item skip_item reopen_item
items stats
);
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
=head1 SYNOPSIS
use ACME::2026 qw(:all);
my $plan = plan_new(
title => '2026',
storage => '2026.json',
autosave => 1,
);
my $id = add_item($plan, 'Run a marathon',
list => 'Health',
due => '2026-10-01',
tags => [qw/fitness endurance/],
priority => 2,
);
complete_item($plan, $id, note => 'Signed up for NYC');
my @open = items($plan, status => 'todo', list => 'Health', sort => 'due');
plan_save($plan);
=head1 DESCRIPTION
ACME::2026 is a tiny functional API for keeping 2026 checklists. It stores
plans as plain Perl hashrefs and can persist them to JSON.
=head1 DATA MODEL
Plan hashref:
{
title => '2026',
items => [ ... ],
next_id => 1,
created_at => '2026-01-01T12:00:00Z',
updated_at => '2026-01-01T12:00:00Z',
storage => '2026.json',
autosave => 1,
}
Item hashref:
{
id => 1,
title => 'Run a marathon',
status => 'todo',
list => 'Health',
tags => ['fitness'],
priority => 2,
due => '2026-10-01',
notes => [ { note => 'Signed up', at => '2026-02-10T09:00:00Z' } ],
created_at => '2026-01-01T12:00:00Z',
updated_at => '2026-02-10T09:00:00Z',
}
Status values are C<todo>, C<done>, or C<skipped>. Dates are ISO 8601 strings
(C<YYYY-MM-DD> or C<YYYY-MM-DDTHH:MM:SSZ>).
=head1 FUNCTIONS
=head2 plan_new
my $plan = plan_new(%opts);
Creates a new plan hashref. Supported options:
title - plan title (default: 2026)
storage - JSON path used by plan_save and autosave
autosave - boolean, save after mutating operations
=head2 plan_load
my $plan = plan_load($path, %opts);
Loads a JSON file from C<$path>. The plan is normalized to ensure required
fields exist. You can override C<title> or C<autosave> with C<%opts>.
=head2 plan_save
plan_save($plan);
plan_save($plan, $path);
Writes the plan as JSON. Uses C<$plan-E<gt>{storage}> if no path is provided.
=head2 add_item
my $id = add_item($plan, $title, %opts);
Adds an item and returns its id. Supported options:
list, tags (arrayref or string), priority, due, note
=head2 update_item
my $item = update_item($plan, $id, %attrs);
Updates a few fields in place: C<title>, C<list>, C<tags>, C<priority>, C<due>.
Use C<add_note> or the status helpers for notes and status changes.
=head2 delete_item
my $item = delete_item($plan, $id);
Removes an item and returns it.
=head2 get_item
my $item = get_item($plan, $id);
Returns the item or C<undef> if it does not exist.
=head2 add_note
add_note($plan, $id, $note);
Appends a note with a timestamp.
=head2 complete_item
complete_item($plan, $id, %opts);
Sets the status to C<done>. If C<note> is supplied, it is added.
=head2 skip_item
skip_item($plan, $id, %opts);
Sets the status to C<skipped>. If C<note> is supplied, it is added.
=head2 reopen_item
reopen_item($plan, $id, %opts);
Sets the status back to C<todo>. If C<note> is supplied, it is added.
=head2 items
my @items = items($plan, %filters);
Filters items with any of:
status, list, tag, tags, priority, min_priority, max_priority,
due_before, due_after, sort
For C<tag> or C<tags>, any matching tag is enough. C<sort> supports:
C<due>, C<priority>, C<created>, C<updated>, or C<title>. Prefix with C<->
for descending order.
=head2 stats
my $stats = stats($plan, %filters);
Returns a hashref with C<total>, C<todo>, C<done>, C<skipped>, and
C<complete_pct>.
=cut
sub plan_new {
my %opts = _normalize_opts(@_);
my $now = _now();
my $plan = {
title => defined $opts{title} ? $opts{title} : '2026',
items => [],
next_id => 1,
created_at => $now,
updated_at => $now,
storage => $opts{storage},
autosave => $opts{autosave} ? 1 : 0,
};
return $plan;
}
sub plan_load {
my ($path, %opts) = @_;
croak 'plan_load requires a path' unless defined $path && length $path;
my $json = _read_file($path);
my $data = eval { JSON::PP->new->decode($json) };
croak "Failed to decode JSON from $path: $@" if $@;
_normalize_plan($data);
$data->{storage} = $path;
$data->{title} = $opts{title} if exists $opts{title};
$data->{autosave} = $opts{autosave} ? 1 : 0 if exists $opts{autosave};
return $data;
}
sub plan_save {
my ($plan, $path) = @_;
_ensure_plan($plan);
$path ||= $plan->{storage};
croak 'plan_save requires a path or plan storage' unless defined $path && length $path;
_normalize_plan($plan);
my $encoder = JSON::PP->new->canonical(1)->pretty(1);
my $json = $encoder->encode($plan);
_write_file_atomic($path, $json);
return 1;
}
sub add_item {
my ($plan, @args) = @_;
_ensure_plan($plan);
my ($title, %opts);
if (@args % 2 == 1) {
$title = shift @args;
%opts = @args;
} else {
%opts = @args;
$title = $opts{title};
}
croak 'add_item requires a title' unless defined $title && length $title;
_reject_unknown('add_item', \%opts, qw(title list tags tag priority due note));
my $now = _now();
my $item = {
id => $plan->{next_id}++,
title => $title,
status => 'todo',
list => defined $opts{list} ? $opts{list} : 'General',
tags => _normalize_tags($opts{tags}, $opts{tag}),
priority => defined $opts{priority} ? $opts{priority} : 3,
due => $opts{due},
notes => [],
created_at => $now,
updated_at => $now,
};
push @{ $plan->{items} }, $item;
if (defined $opts{note}) {
_add_note($plan, $item, $opts{note});
} else {
_touch($plan);
}
_maybe_autosave($plan);
return $item->{id};
}
sub update_item {
my ($plan, $id, %attrs) = @_;
_ensure_plan($plan);
my $item = _find_item($plan, $id);
croak "No item with id $id" unless $item;
_reject_unknown('update_item', \%attrs, qw(title list tags tag priority due));
my $changed = 0;
for my $key (qw(title list priority due)) {
next unless exists $attrs{$key};
$item->{$key} = $attrs{$key};
view all matches for this distribution
view release on metacpan or search on metacpan
{
"abstract" : "Fake module with a prereq that is a core module for testing CPANPLUS",
"author" : [
"Chris Williams <chris@bingosnet.co.uk>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "ACME-CPANPLUS-Module-With-Core-PreReq",
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.59",
"Test::More" : "0.47"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
"Pod::Coverage::TrustPod" : "0",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08"
}
},
"runtime" : {
"requires" : {
"Config" : "0",
"Errno" : "0",
"perl" : "5.006"
}
},
"test" : {
"requires" : {
"File::Spec" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0.47"
}
}
},
"release_status" : "stable",
"resources" : {
"homepage" : "https://github.com/bingos/acme-cpanplus-module-with-core-prereq",
"repository" : {
"type" : "git",
"url" : "https://github.com/bingos/acme-cpanplus-module-with-core-prereq.git",
"web" : "https://github.com/bingos/acme-cpanplus-module-with-core-prereq"
}
},
"version" : "0.06",
"x_serialization_backend" : "Cpanel::JSON::XS version 3.0227"
}
view all matches for this distribution
view release on metacpan or search on metacpan
{
"abstract" : "Module abstract placeholder text",
"author" : [
"Paul G Webster <paul.g.webster@googlemail.com>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
"license" : [
"bsd"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "ACME-Dzil-Test-daemon",
"no_index" : {
"directory" : [
"eg",
"examples",
"inc",
"share",
"t",
"xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
"File::Spec" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0",
"Test::Pod" : "1.41"
}
},
"test" : {
"recommends" : {
"CPAN::Meta" : "2.120900"
},
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"Test::More" : "0"
}
}
},
"provides" : {
"ACME::Dzil::Test::daemon" : {
"file" : "lib/ACME/Dzil/Test/daemon.pm",
"version" : "0.001"
}
},
"release_status" : "stable",
"version" : "0.001",
"x_generated_by_perl" : "v5.32.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.27",
"x_spdx_expression" : "BSD"
}
view all matches for this distribution
view release on metacpan or search on metacpan
{
"abstract" : "Module abstract placeholder text",
"author" : [
"Paul G Webster <paul.g.webster@googlemail.com>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
"license" : [
"bsd"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "ACME-Dzil-Test-daemon2",
"no_index" : {
"directory" : [
"eg",
"examples",
"inc",
"share",
"t",
"xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
"File::Spec" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0",
"Test::Pod" : "1.41"
}
},
"test" : {
"recommends" : {
"CPAN::Meta" : "2.120900"
},
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"Test::More" : "0"
}
}
},
"provides" : {
"ACME::Dzil::Test::daemon2" : {
"file" : "lib/ACME/Dzil/Test/daemon2.pm",
"version" : "0.001"
}
},
"release_status" : "stable",
"version" : "0.001",
"x_generated_by_perl" : "v5.32.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.27",
"x_spdx_expression" : "BSD"
}
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
ignore.txt
lib/ACME/MBHall.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/01-sum.t
t/boilerplate.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
lib/ACME/MyFirstModule/SETHS.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
lib/ACME/ltharris.pm
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
$self->test_requires( $module => $version );
}
}
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
# numbers (eg, 5.006001 or 5.008009).
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
if ( ref($v) ) {
# Numify
$v = $v + 0;
}
return $v;
}
sub add_metadata {
my $self = shift;
my %hash = @_;
for my $key (keys %hash) {
warn "add_metadata: $key is not prefixed with 'x_'.\n" .
"Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/;
$self->{values}->{$key} = $hash{$key};
}
}
######################################################################
# MYMETA Support
sub WriteMyMeta {
die "WriteMyMeta has been deprecated";
}
sub write_mymeta_yaml {
my $self = shift;
# We need YAML::Tiny to write the MYMETA.yml file
unless ( eval { require YAML::Tiny; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_data {
my $self = shift;
# If there's no existing META.yml there is nothing we can do
return undef unless -f 'META.yml';
# We need Parse::CPAN::Meta to load the file
unless ( eval { require Parse::CPAN::Meta; 1; } ) {
return undef;
}
# Merge the perl version into the dependencies
my $val = $self->Meta->{values};
my $perl = delete $val->{perl_version};
if ( $perl ) {
$val->{requires} ||= [];
my $requires = $val->{requires};
# Canonize to three-dot version after Perl 5.6
if ( $perl >= 5.006 ) {
$perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
}
unshift @$requires, [ perl => $perl ];
}
# Load the advisory META.yml file
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
# Overwrite the non-configure dependency hashs
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
if ( exists $val->{requires} ) {
$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
}
if ( exists $val->{build_requires} ) {
$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
}
return $meta;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
examples/port-probe-multi.pl
examples/port-probe.pl
ignore.txt
INSTALL
lib/AE/AdHoc.pm
Makefile.PL
MANIFEST
README
t/00-load.t
t/10-basic.t
t/11-begin-end.t
t/12-nested-dies.t
t/13-null-timeout.t
t/14-xargs.t
t/15-goals.t
t/16-goals2.t
t/17-goals-leftover.t
t/boilerplate.t
t/manifest.t
t/pod-coverage.t
t/pod.t
t/18-all-leftover.t
t/19-soft-timeout.t
t/20-ae_action.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
pod/v2/afsperlvos.pod
pod/v2/Makefile.inp
pod/v2/README
pod/v2/zpod2html
README
src/ACL/ACL.pm
src/ACL/Makefile.PL
src/ACL/t/ACL.t
src/AFS.pm
src/AFS.xs
src/afs_prototypes.h
src/BOS/BOS.pm
src/BOS/Makefile.PL
src/BOS/t/BOS.t
src/Cell/Cell.pm
src/Cell/Makefile.PL
src/Cell/t/Cell.t
src/CM/CM.pm
src/CM/Makefile.PL
src/CM/t/CM.t
src/com_err.h
src/FS/FS.pm
src/FS/Makefile.PL
src/FS/t/FS.t
src/inc/Test/Builder.pm
src/inc/Test/More.pm
src/inc/version.pm
src/inc/version/vpp.pm
src/KAS/KAS.pm
src/KAS/Makefile.PL
src/KAS/t/KAS.t
src/KTC_EKEY/KTC_EKEY.pm
src/KTC_EKEY/Makefile.PL
src/KTC_EKEY/t/KTC_EKEY.t
src/KTC_PRINCIPAL/KTC_PRINCIPAL.pm
src/KTC_PRINCIPAL/Makefile.PL
src/KTC_PRINCIPAL/t/KTC_PRINCIPAL.t
src/KTC_TOKEN/KTC_TOKEN.pm
src/KTC_TOKEN/Makefile.PL
src/KTC_TOKEN/t/KTC_TOKEN.t
src/Makefile.PL
src/ppport.h
src/PTS/Makefile.PL
src/PTS/PTS.pm
src/PTS/t/PTS.t
src/t/AFS.t
src/t/pod.t
src/typemap
src/Utils/Makefile.PL
src/Utils/t/Utils.t
src/Utils/Utils.pm
src/VLDB/Makefile.PL
src/VLDB/t/VLDB.t
src/VLDB/VLDB.pm
src/VOS/Makefile.PL
src/VOS/t/VOS.t
src/VOS/VOS.pm
test_ptype
TODO
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
{
"abstract" : "Activation functions for neural networks in Perl",
"author" : [
"Ulisses Manzo Castello <umcastello@gmail.com>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "AI-ActivationFunctions",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"Exporter" : "0",
"PDL" : "0",
"Test::More" : "0"
}
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"type" : "git",
"url" : "https://github.com/seuusuario/ai-activationfunctions.git",
"web" : "https://github.com/seuusuario/ai-activationfunctions"
}
},
"version" : "0.01",
"x_serialization_backend" : "JSON::PP version 4.16"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Anthropic.pm view on Meta::CPAN
package AI::Anthropic;
use strict;
use warnings;
use 5.010;
our $VERSION = '0.01';
use Carp qw(croak);
use JSON::PP;
use HTTP::Tiny;
use MIME::Base64 qw(encode_base64);
# Constants
use constant {
API_BASE => 'https://api.anthropic.com',
API_VERSION => '2023-06-01',
DEFAULT_MODEL => 'claude-sonnet-4-20250514',
};
=head1 NAME
AI::Anthropic - Perl interface to Anthropic's Claude API
=head1 SYNOPSIS
use AI::Anthropic;
my $claude = AI::Anthropic->new(
api_key => 'sk-ant-api03-your-key-here',
);
# Simple message
my $response = $claude->message("What is the capital of France?");
print $response; # prints response text
# Chat with history
my $response = $claude->chat(
messages => [
{ role => 'user', content => 'Hello!' },
{ role => 'assistant', content => 'Hello! How can I help you today?' },
{ role => 'user', content => 'What is 2+2?' },
],
);
# With system prompt
my $response = $claude->chat(
system => 'You are a helpful Perl programmer.',
messages => [
{ role => 'user', content => 'How do I read a file?' },
],
);
# Streaming
$claude->chat(
messages => [ { role => 'user', content => 'Tell me a story' } ],
stream => sub {
my ($chunk) = @_;
print $chunk;
},
);
=head1 DESCRIPTION
AI::Anthropic provides a Perl interface to Anthropic's Claude API.
It supports all Claude models including Claude 4 Opus, Claude 4 Sonnet,
and Claude Haiku.
=head1 METHODS
=head1 AUTHOR
Vugar Bakhshaliyev <d7951500@gmail.com>
=head1 LICENSE
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head2 new
my $claude = AI::Anthropic->new(
api_key => 'your-api-key', # required (or use ANTHROPIC_API_KEY env)
model => 'claude-sonnet-4-20250514', # optional
max_tokens => 4096, # optional
timeout => 120, # optional, seconds
);
=cut
sub new {
my ($class, %args) = @_;
my $api_key = $args{api_key} // $ENV{ANTHROPIC_API_KEY}
or croak "API key required. Set api_key parameter or ANTHROPIC_API_KEY environment variable";
my $self = {
api_key => $api_key,
model => $args{model} // DEFAULT_MODEL,
max_tokens => $args{max_tokens} // 4096,
timeout => $args{timeout} // 120,
api_base => $args{api_base} // API_BASE,
_http => HTTP::Tiny->new(
timeout => $args{timeout} // 120,
),
_json => JSON::PP->new->utf8->allow_nonref,
};
return bless $self, $class;
}
=head2 message
Simple interface for single message:
my $response = $claude->message("Your question here");
my $response = $claude->message("Your question", system => "You are helpful");
print $response->text;
=cut
sub message {
my ($self, $content, %opts) = @_;
croak "Message content required" unless defined $content;
return $self->chat(
messages => [ { role => 'user', content => $content } ],
%opts,
);
}
=head2 chat
Full chat interface:
my $response = $claude->chat(
messages => \@messages, # required
system => $system_prompt, # optional
model => $model, # optional, overrides default
max_tokens => $max_tokens, # optional
temperature => 0.7, # optional, 0.0-1.0
stream => \&callback, # optional, for streaming
tools => \@tools, # optional, for function calling
);
=cut
sub chat {
my ($self, %args) = @_;
my $messages = $args{messages}
or croak "messages parameter required";
# Build request body
my $body = {
model => $args{model} // $self->{model},
max_tokens => $args{max_tokens} // $self->{max_tokens},
messages => $self->_normalize_messages($messages),
};
# Optional parameters
$body->{system} = $args{system} if defined $args{system};
$body->{temperature} = $args{temperature} if defined $args{temperature};
$body->{tools} = $args{tools} if defined $args{tools};
lib/AI/Anthropic.pm view on Meta::CPAN
}
sub _image_from_file {
my ($self, $path) = @_;
open my $fh, '<:raw', $path
or croak "Cannot open image file '$path': $!";
local $/;
my $data = <$fh>;
close $fh;
# Detect media type
my $media_type = 'image/png';
if ($path =~ /\.jpe?g$/i) {
$media_type = 'image/jpeg';
} elsif ($path =~ /\.gif$/i) {
$media_type = 'image/gif';
} elsif ($path =~ /\.webp$/i) {
$media_type = 'image/webp';
}
return {
type => 'image',
source => {
type => 'base64',
media_type => $media_type,
data => encode_base64($data, ''),
},
};
}
sub _image_from_url {
my ($self, $url) = @_;
return {
type => 'image',
source => {
type => 'url',
url => $url,
},
};
}
sub _request {
my ($self, $body) = @_;
my $response = $self->{_http}->post(
$self->{api_base} . '/v1/messages',
{
headers => $self->_headers,
content => $self->{_json}->encode($body),
}
);
return $self->_handle_response($response);
}
sub _stream_request {
my ($self, $body, $callback) = @_;
$body->{stream} = \1; # JSON true
my $full_text = '';
my $response_data;
# HTTP::Tiny doesn't support streaming well, so we use a data callback
my $response = $self->{_http}->post(
$self->{api_base} . '/v1/messages',
{
headers => $self->_headers,
content => $self->{_json}->encode($body),
data_callback => sub {
my ($chunk, $res) = @_;
# Parse SSE events
for my $line (split /\n/, $chunk) {
next unless $line =~ /^data: (.+)/;
my $data = $1;
next if $data eq '[DONE]';
eval {
my $event = $self->{_json}->decode($data);
if ($event->{type} eq 'content_block_delta') {
my $text = $event->{delta}{text} // '';
$full_text .= $text;
$callback->($text) if $callback;
} elsif ($event->{type} eq 'message_stop') {
$response_data = $event;
}
};
}
},
}
);
unless ($response->{success}) {
return $self->_handle_response($response);
}
# Return a response object with the full text
return AI::Anthropic::Response->new(
text => $full_text,
raw_response => $response_data,
);
}
sub _headers {
my ($self) = @_;
return {
'Content-Type' => 'application/json',
'x-api-key' => $self->{api_key},
'anthropic-version' => API_VERSION,
};
}
sub _handle_response {
my ($self, $response) = @_;
my $data;
view all matches for this distribution
view release on metacpan or search on metacpan
Changes
Makefile.PL
MANIFEST
README
t/AI-Calibrate-1.t
t/AI-Calibrate-pathologies.t
t/AI-Calibrate-NB.t
t/AI-Calibrate-KL.t
lib/AI/Calibrate.pm
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Chat.pm view on Meta::CPAN
package AI::Chat;
use strict;
use warnings;
use Carp;
use HTTP::Tiny;
use JSON::PP;
our $VERSION = '0.6';
$VERSION = eval $VERSION;
my $http = HTTP::Tiny->new;
# Create Chat object
sub new {
my $class = shift;
my %attr = @_;
$attr{'error'} = '';
$attr{'api'} = 'OpenAI' unless $attr{'api'};
$attr{'error'} = 'Invalid API' unless $attr{'api'} eq 'OpenAI';
$attr{'error'} = 'API Key missing' unless $attr{'key'};
$attr{'model'} = 'gpt-4o-mini' unless $attr{'model'};
return bless \%attr, $class;
}
# Define endpoints for APIs
my %url = (
'OpenAI' => 'https://api.openai.com/v1/chat/completions',
);
# Define HTTP Headers for APIs
my %header = (
'OpenAI' => &_get_header_openai,
);
# Returns true if last operation was success
sub success {
my $self = shift;
return !$self->{'error'};
}
# Returns error if last operation failed
sub error {
my $self = shift;
return $self->{'error'};
}
# Header for calling OpenAI
sub _get_header_openai {
my $self = shift;
$self->{'key'} = '' unless defined $self->{'key'};
return {
'Authorization' => 'Bearer ' . $self->{'key'},
'Content-type' => 'application/json'
};
}
# Get a reply from a single prompt
sub prompt {
my ($self, $prompt, $temperature) = @_;
$self->{'error'} = '';
unless ($prompt) {
view all matches for this distribution
view release on metacpan or search on metacpan
name = AI-Classifier
author = Zbigniew Lukasiak <zlukasiak@opera.com>, Tadeusz SoÅnierz <tsosnierz@opera.com>
license = Perl_5
copyright_holder = Opera Software ASA
copyright_year = 2012
version = 0.03
[@Basic]
[AutoPrereqs]
[Prereqs]
Moose = 1.15
MooseX::Storage = 0.25
File::Find::Rule = 0.32
AI::NaiveBayes = 0.01
[TestRelease]
[PkgVersion]
[MetaNoIndex]
directory = t/lib
directory = examples
[InstallGuide]
[MetaJSON]
[MetaResources]
repository.web = http://github.com/operasoftware/AI-Classifier
repository.type = git
[NextRelease]
format = %-9v %{yyyy-MM-dd}d
[CheckChangeLog]
[PodSyntaxTests]
[PodCoverageTests]
[PodWeaver]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/CleverbotIO.pm view on Meta::CPAN
package AI::CleverbotIO;
use strict;
use warnings;
{ our $VERSION = '0.002'; }
use Moo;
use Ouch;
use Log::Any ();
use Data::Dumper;
use JSON::PP qw< decode_json >;
has endpoints => (
is => 'ro',
default => sub {
return {
ask => 'https://cleverbot.io/1.0/ask',
create => 'https://cleverbot.io/1.0/create',
};
},
);
has key => (
is => 'ro',
required => 1,
);
has logger => (
is => 'ro',
lazy => 1,
builder => 'BUILD_logger',
);
has nick => (
is => 'rw',
lazy => 1,
predicate => 1,
);
has user => (
is => 'ro',
required => 1,
);
has ua => (
is => 'ro',
lazy => 1,
builder => 'BUILD_ua',
);
sub BUILD_logger {
return Log::Any->get_logger;
}
sub BUILD_ua {
my $self = shift;
require HTTP::Tiny;
return HTTP::Tiny->new;
}
sub ask {
my ($self, $question) = @_;
my %ps = (
key => $self->key,
text => $question,
user => $self->user,
);
$ps{nick} = $self->nick if $self->has_nick;
return $self->_parse_response(
$self->ua->post_form($self->endpoints->{ask}, \%ps));
}
view all matches for this distribution
view release on metacpan or search on metacpan
"Vincent Lequertier <vi.le@autistici.org>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "AI-ConfusionMatrix",
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
"Test::More" : "0",
"Test::Pod" : "1.41"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"Exporter" : "0",
"Tie::File" : "0",
"strict" : "0",
"warnings" : "0"
}
},
"test" : {
"requires" : {
"File::Temp" : "0",
"Test::More" : "0"
}
}
},
"provides" : {
"AI::ConfusionMatrix" : {
"file" : "lib/AI/ConfusionMatrix.pm",
"version" : "0.010"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"mailto" : "bug-ai-confusionmatrix@rt.cpan.org",
"web" : "http://rt.cpan.org/NoAuth/Bugs.html?AI-ConfusionMatrix"
},
"repository" : {
"type" : "git",
"url" : "https://gitlab.com/vi.le/perl-ai-confusionmatrix.git",
"web" : "https://gitlab.com/vi.le/perl-ai-confusionmatrix"
}
},
"version" : "0.010",
"x_generated_by_perl" : "v5.28.2",
"x_serialization_backend" : "JSON::PP version 4.02"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Embedding.pm view on Meta::CPAN
package AI::Embedding;
use strict;
use warnings;
use HTTP::Tiny;
use JSON::PP;
use Data::CosineSimilarity;
our $VERSION = '1.11';
$VERSION = eval $VERSION;
my $http = HTTP::Tiny->new;
# Create Embedding object
sub new {
my $class = shift;
my %attr = @_;
$attr{'error'} = '';
$attr{'api'} = 'OpenAI' unless $attr{'api'};
$attr{'error'} = 'Invalid API' unless $attr{'api'} eq 'OpenAI';
$attr{'error'} = 'API Key missing' unless $attr{'key'};
$attr{'model'} = 'text-embedding-ada-002' unless $attr{'model'};
return bless \%attr, $class;
}
# Define endpoints for APIs
my %url = (
'OpenAI' => 'https://api.openai.com/v1/embeddings',
);
# Define HTTP Headers for APIs
my %header = (
'OpenAI' => &_get_header_openai,
);
# Returns true if last operation was success
sub success {
my $self = shift;
return !$self->{'error'};
}
# Returns error if last operation failed
sub error {
my $self = shift;
return $self->{'error'};
}
# Header for calling OpenAI
sub _get_header_openai {
my $self = shift;
$self->{'key'} = '' unless defined $self->{'key'};
return {
'Authorization' => 'Bearer ' . $self->{'key'},
'Content-type' => 'application/json'
};
}
# Fetch Embedding response
sub _get_embedding {
my ($self, $text) = @_;
my $response = $http->post($url{$self->{'api'}}, {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
}
}
sub test_requires_from {
my $self = shift;
my $content = Module::Install::_readperl($_[0]);
my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
$self->test_requires( $module => $version );
}
}
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
# numbers (eg, 5.006001 or 5.008009).
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
if ( ref($v) ) {
# Numify
$v = $v + 0;
}
return $v;
}
######################################################################
# MYMETA Support
sub WriteMyMeta {
die "WriteMyMeta has been deprecated";
}
sub write_mymeta_yaml {
my $self = shift;
# We need YAML::Tiny to write the MYMETA.yml file
unless ( eval { require YAML::Tiny; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_data {
my $self = shift;
# If there's no existing META.yml there is nothing we can do
return undef unless -f 'META.yml';
# We need Parse::CPAN::Meta to load the file
unless ( eval { require Parse::CPAN::Meta; 1; } ) {
return undef;
}
# Merge the perl version into the dependencies
my $val = $self->Meta->{values};
my $perl = delete $val->{perl_version};
if ( $perl ) {
$val->{requires} ||= [];
my $requires = $val->{requires};
# Canonize to three-dot version after Perl 5.6
if ( $perl >= 5.006 ) {
$perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
}
unshift @$requires, [ perl => $perl ];
}
# Load the advisory META.yml file
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
# Overwrite the non-configure dependency hashs
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
if ( exists $val->{requires} ) {
$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
}
if ( exists $val->{build_requires} ) {
$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
}
return $meta;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/FANN/Evolving.pm
lib/AI/FANN/Evolving/Chromosome.pm
lib/AI/FANN/Evolving/Experiment.pm
lib/AI/FANN/Evolving/Factory.pm
lib/AI/FANN/Evolving/Gene.pm
lib/AI/FANN/Evolving/TrainData.pm
LICENSE
Makefile.PL
MANIFEST This list of files
MYMETA.json
MYMETA.yml
README.md
script/aivolver
t/00-load.t
t/01-run.t
t/02-data.t
t/03-fann-wrapper.t
t/perl-critic.t
t/perlcriticrc
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
"Math::Random" : "0.72",
"Storable" : "2.05",
"Struct::Compare" : "0",
"Tie::Array::Packed" : "0.13",
"UNIVERSAL::require" : "0"
}
}
},
"release_status" : "stable",
"resources" : {
"homepage" : "https://github.com/d-strzelec/AI-Genetic-Pro",
"repository" : {
"type" : "git",
"url" : "https://github.com/d-strzelec/AI-Genetic-Pro.git",
"web" : "https://github.com/d-strzelec/AI-Genetic-Pro"
}
},
"version" : "1.009",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.032001"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::GatherDir",
"config" : {
"Dist::Zilla::Plugin::GatherDir" : {
"exclude_filename" : [],
"exclude_match" : [],
"follow_symlinks" : 0,
"include_dotfiles" : 0,
"prefix" : "",
"prune_directory" : [],
"root" : "."
}
},
"name" : "GatherDir",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "PruneCruft",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::PruneFiles",
"name" : "PruneFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "ManifestSkip",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "MetaYAML",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "MetaJSON",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "License",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : 1
}
},
"name" : "MakeMaker",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "Manifest",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "PkgVersion",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::ReadmeFromPod",
"name" : "ReadmeFromPod",
"version" : "0.37"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "MetaConfig",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "runtime",
"type" : "requires"
}
},
"name" : "Prereqs",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::GithubMeta",
"name" : "GithubMeta",
"version" : "0.58"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
"config" : {
"Dist::Zilla::Plugin::Git::Commit" : {
"add_files_in" : [],
"commit_msg" : "Release v%v%n%n%c",
"signoff" : 0
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExtraTestFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":PerlExecFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":AllFiles",
"version" : "6.017"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":NoFiles",
"version" : "6.017"
}
],
"zilla" : {
"class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : 0
},
"version" : "6.017"
}
},
"x_generated_by_perl" : "v5.32.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.25",
"x_spdx_expression" : "LGPL-2.1"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Image.pm view on Meta::CPAN
package AI::Image;
use strict;
use warnings;
use strict;
use warnings;
use Carp;
use HTTP::Tiny;
use JSON::PP;
our $VERSION = '0.1';
$VERSION = eval $VERSION;
my $http = HTTP::Tiny->new;
# Create Image object
sub new {
my $class = shift;
my %attr = @_;
$attr{'error'} = '';
$attr{'api'} = 'OpenAI' unless $attr{'api'};
$attr{'error'} = 'Invalid API' unless $attr{'api'} eq 'OpenAI';
$attr{'error'} = 'API Key missing' unless $attr{'key'};
$attr{'model'} = 'dall-e-2' unless $attr{'model'};
$attr{'size'} = '512x512' unless $attr{'size'};
return bless \%attr, $class;
}
# Define endpoints for APIs
my %url = (
'OpenAI' => 'https://api.openai.com/v1/images/generations',
);
# Define HTTP Headers for APIs
my %header = (
'OpenAI' => &_get_header_openai,
);
# Returns true if last operation was success
sub success {
my $self = shift;
return !$self->{'error'};
}
# Returns error if last operation failed
sub error {
my $self = shift;
return $self->{'error'};
}
# Header for calling OpenAI
sub _get_header_openai {
my $self = shift;
$self->{'key'} = '' unless defined $self->{'key'};
return {
'Authorization' => 'Bearer ' . $self->{'key'},
'Content-type' => 'application/json'
};
}
# Get URL from image prompt
sub image {
my ($self, $prompt) = @_;
my $response = $http->post($url{$self->{'api'}}, {
view all matches for this distribution
view release on metacpan or search on metacpan
"requires" : {
"Module::Build" : "0.28"
}
},
"develop" : {
"requires" : {
"File::Spec" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0",
"Test::Pod" : "1.41"
}
},
"test" : {
"recommends" : {
"CPAN::Meta" : "2.120900"
},
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"Test2::V0" : "0.000060",
"Test::More" : "0"
}
}
},
"provides" : {
"AI::ML" : {
"file" : "lib/AI/ML.pm",
"version" : "0.001"
},
"AI::ML::Expr" : {
"file" : "lib/AI/ML/Expr.pm",
"version" : "0.001"
},
"AI::ML::LinearRegression" : {
"file" : "lib/AI/ML/LinearRegression.pm",
"version" : "0.001"
},
"AI::ML::LogisticRegression" : {
"file" : "lib/AI/ML/LogisticRegression.pm",
"version" : "0.001"
},
"AI::ML::NeuralNetwork" : {
"file" : "lib/AI/ML/NeuralNetwork.pm",
"version" : "0.001"
}
},
"release_status" : "stable",
"version" : "0.001",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.026001"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@Starter/MetaYAML",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@Starter/MetaJSON",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@Starter/License",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
"config" : {
"Dist::Zilla::Role::FileWatcher" : {
"version" : "0.006"
}
},
"name" : "@Starter/ReadmeAnyFromPod",
"version" : "0.163250"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@Starter/PodSyntaxTests",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::Test::ReportPrereqs",
"name" : "@Starter/Test::ReportPrereqs",
"version" : "0.027"
},
{
"class" : "Dist::Zilla::Plugin::Test::Compile",
"config" : {
"Dist::Zilla::Plugin::Test::Compile" : {
"bail_out_on_fail" : 0,
"fail_on_warning" : "author",
"fake_home" : 0,
"filename" : "xt/author/00-compile.t",
"module_finder" : [
":InstallModules"
],
"needs_display" : 0,
"phase" : "develop",
"script_finder" : [
":PerlExecFiles"
],
"skips" : [],
"switch" : []
}
},
"name" : "@Starter/Test::Compile",
"version" : "2.058"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@Starter/Manifest",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@Starter/PruneCruft",
"version" : "6.010"
},
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExtraTestFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":PerlExecFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":AllFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":NoFiles",
"version" : "6.010"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
"version" : "6.010"
}
],
"zilla" : {
"class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : 0
},
"version" : "6.010"
}
},
"x_serialization_backend" : "Cpanel::JSON::XS version 3.0239"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MXNet/Initializer.pm view on Meta::CPAN
package AI::MXNet::InitDesc;
use Mouse;
use AI::MXNet::Function::Parameters;
=head1 NAME
AI::MXNet::InitDesc - A container for the initialization pattern serialization.
=head2 new
Parameters
---------
name : str
name of variable
attrs : hash ref of str to str
attributes of this variable taken from AI::MXNet::Symbol->attr_dict
=cut
has 'name' => (is => 'ro', isa => 'Str', required => 1);
has 'attrs' => (is => 'rw', isa => 'HashRef[Str]', lazy => 1, default => sub { +{} });
use overload '""' => sub { shift->name };
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
return $class->$orig(name => $_[0]) if @_ == 1;
return $class->$orig(@_);
};
# Base class for Initializers
package AI::MXNet::Initializer;
use Mouse;
use AI::MXNet::Base qw(:DEFAULT pzeros pceil);
use AI::MXNet::NDArray;
use JSON::PP;
use overload "&{}" => sub { my $self = shift; sub { $self->call(@_) } },
'""' => sub {
my $self = shift;
my ($name) = ref($self) =~ /::(\w+)$/;
encode_json(
[lc $name,
$self->kwargs//{ map { $_ => "".$self->$_ } $self->meta->get_attribute_list }
]);
},
fallback => 1;
has 'kwargs' => (is => 'rw', init_arg => undef, isa => 'HashRef');
has '_verbose' => (is => 'rw', isa => 'Bool', lazy => 1, default => 0);
has '_print_func' => (is => 'rw', isa => 'CodeRef', lazy => 1,
default => sub {
return sub {
my $x = shift;
return ($x->norm/sqrt($x->size))->asscalar;
};
}
);
=head1 NAME
AI::MXNet::Initializer - Base class for all Initializers
=head2 register
Register an initializer class to the AI::MXNet::Initializer factory.
=cut
=head2 set_verbosity
Switch on/off verbose mode
Parameters
----------
$verbose : bool
switch on/off verbose mode
$print_func : CodeRef
A function that computes statistics of initialized arrays.
Takes an AI::MXNet::NDArray and returns a scalar. Defaults to mean
absolute value |x|/size(x)
=cut
method set_verbosity(Bool $verbose=0, CodeRef $print_func=)
{
$self->_verbose($verbose);
$self->_print_func($print_func) if defined $print_func;
}
method _verbose_print($desc, $init, $arr)
{
if($self->_verbose and defined $self->_print_func)
{
AI::MXNet::Logging->info('Initialized %s as %s: %s', $desc, $init, $self->_print_func->($arr));
}
}
my %init_registry;
method get_init_registry()
lib/AI/MXNet/Initializer.pm view on Meta::CPAN
use AI::MXNet::Base;
extends 'AI::MXNet::Initializer';
method _init_weight($name, $arr)
{
my $pdl_type = PDL::Type->new(DTYPE_MX_TO_PDL->{ 'float32' });
my $weight = pzeros(
PDL::Type->new(DTYPE_MX_TO_PDL->{ 'float32' }),
$arr->size
);
my $shape = $arr->shape;
my $size = $arr->size;
my $f = pceil($shape->[3] / 2)->at(0);
my $c = (2 * $f - 1 - $f % 2) / (2 * $f);
for my $i (0..($size-1))
{
my $x = $i % $shape->[3];
my $y = ($i / $shape->[3]) % $shape->[2];
$weight->index($i) .= (1 - abs($x / $f - $c)) * (1 - abs($y / $f - $c));
}
$arr .= $weight->reshape(reverse @{ $shape });
}
__PACKAGE__->register;
package AI::MXNet::LSTMBias;
=head1 NAME
AI::MXNet::LSTMBias - Custom initializer for LSTM cells.
=cut
=head1 DESCRIPTION
Initializes all biases of an LSTMCell to 0.0 except for
the forget gate's bias that is set to a custom value.
Parameters
----------
forget_bias: float,a bias for the forget gate.
Jozefowicz et al. 2015 recommends setting this to 1.0.
=cut
use Mouse;
extends 'AI::MXNet::Initializer';
has 'forget_bias' => (is => 'ro', isa => 'Num', required => 1);
method _init_weight(Str $name, AI::MXNet::NDArray $arr)
{
$arr .= 0;
# in the case of LSTMCell the forget gate is the second
# gate of the 4 LSTM gates, we modify the according values.
my $num_hidden = int($arr->shape->[0] / 4);
$arr->slice([$num_hidden, 2*$num_hidden-1]) .= $self->forget_bias;
}
__PACKAGE__->register;
package AI::MXNet::FusedRNN;
use Mouse;
use JSON::PP;
extends 'AI::MXNet::Initializer';
=head1 NAME
AI::MXNet::FusedRNN - Custom initializer for fused RNN cells.
=cut
=head1 DESCRIPTION
Initializes parameters for fused rnn layer.
Parameters
----------
init : Initializer
initializer applied to unpacked weights.
All parameters below must be exactly the same as ones passed to the
FusedRNNCell constructor.
num_hidden : int
num_layers : int
mode : str
bidirectional : bool
forget_bias : float
=cut
has 'init' => (is => 'rw', isa => 'Str|AI::MXNet::Initializer', required => 1);
has 'forget_bias' => (is => 'ro', isa => 'Num', default => 1);
has [qw/num_hidden
num_layers/] => (is => 'ro', isa => 'Int', required => 1);
has 'mode' => (is => 'ro', isa => 'Str', required => 1);
has 'bidirectional' => (is => 'ro', isa => 'Bool', default => 0);
sub BUILD
{
my $self = shift;
if(not blessed $self->init)
{
my ($klass, $kwargs);
eval {
($klass, $kwargs) = @{ decode_json($self->init) };
};
confess("FusedRNN failed to init $@") if $@;
$self->init($self->get_init_registry->{ lc $klass }->new(%$kwargs));
}
}
method _init_weight($name, $arr)
{
my $cell = AI::MXNet::RNN::FusedCell->new(
num_hidden => $self->num_hidden,
num_layers => $self->num_layers,
mode => $self->mode,
bidirectional => $self->bidirectional,
forget_bias => $self->forget_bias,
prefix => ''
);
my $args = $cell->unpack_weights({ parameters => $arr });
for my $name (keys %{ $args })
{
view all matches for this distribution