AI-MicroStructure
view release on metacpan or search on metacpan
bin/from-folder.pl view on Meta::CPAN
sprintf("/tmp/%s.cache",
$curSysDate));
GetOptions (\%opts, "cache_file=s");
our $cache = {};
our @target = split("\/",$opts{cache_file});
my $set = AI::MicroStructure::ObjectSet->new();
eval {
local $^W = 0; # because otherwhise doesn't pass errors
#`rm $opts{cache_file}`;
$cache = lock_retrieve($opts{cache_file});
$cache = {} unless $cache;
warn "New cache!\n" unless defined $cache;
};
END{
bin/getcat.pl view on Meta::CPAN
use Cache::Memcached::Fast;
use Try::Tiny;
use Data::Dumper;
use Digest::MD5 qw(md5 md5_hex md5_base64);
our $memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 }],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.1,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
max_failures => 1,
max_size => 512 * 1024,
});
our $all = {};
our $json = JSON->new->allow_nonref;
bin/localfiles view on Meta::CPAN
use Data::Dumper;
my $data={};
our $memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 }],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.1,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
max_failures => 1,
max_size => 512 * 1024,
});
my @result = ();
my $rule;
}
sub init {
$memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 }],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.1,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
max_failures => 1,
max_size => 512 * 1024,
});
if(!$#ARGV){
push @ARGV,"any";
}
my $state = AI::MicroStructure::Util::load_config(); my @CWD=$state->{cwd}; my $config=$state->{cfg};
our $structdir = "structures";
our $absstructdir = "$CWD[0]/$structdir";
if ($conf{"export"}) {
my $cwd = $CWD[0];
my $hash = $main->fitnes();
my $url = sprintf("%s/%s/_all_docs", $config->{couchdb}, $config->{db});
print `cd $cwd && mkdir -p relations && wget -O relations/any.json $url && git add relations/any.json $structdir/*.pm && git commit -m 'active memory release' && git tag $hash`; # FIXME check for errors FIXME also that we commit per structure and...
exit;
}
my (@remote, @local);
# real processing starts here
$\ = $/;
my $sep = $conf{whitespace} ? ' ' : $\;
my $j = $main->structures();
bin/micro-relation view on Meta::CPAN
use Cache::Memcached::Fast;
our $memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 }],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.1,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
max_failures => 1,
max_size => 512 * 1024,
});
sub decruft {
bin/micro-relation-test view on Meta::CPAN
my $wiki = WWW::Wikipedia->new(language => $lang);
use Cache::Memcached::Fast;
my $memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 }],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.5,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
compress_methods => [ \&IO::Compress::Gzip::gzip,
\&IO::Uncompress::Gunzip::gunzip ],
max_failures => 3,
failure_timeout => 2,
ketama_points => 150,
nowait => 1,
hash_namespace => 1,
serialize_methods => [ \&Storable::freeze, \&Storable::thaw ],
bin/micro-wiki view on Meta::CPAN
$doc->{book}= [@book] unless(!@book);
$doc->{pdf}= [@pdf] unless(!@pdf);
$doc->{audio}= [@audio] unless(!@audio);
$doc->{related} = quantify $result->related();
$doc->{links} = [sort grep{/http/}@all_links];
#eval '$couchdb->store("$url" ,$doc)' or warn "error: $@\n";
# createJsonFile($url,$doc);
p $doc;
return $doc;
}
}
lib/AI/MicroStructure/RemoteList.pm view on Meta::CPAN
=head1 METHODS
As an ancestor, this class adds the following methods to an
C<AI::MicroStructure> structure:
=over 4
=item remote_list()
Returns the list of items available at the remote source, or an empty
list in case of error.
=item has_remotelist()
Return a boolean indicating if the C<source> key is defined (and therefore
if the structure actually has a remote list).
=item source()
Return the data structure containing the source URLs. This can be quite
different depending on the class: a single scalar (URL), an array
sprintf("%s/%s/%s_.cache",
$PWD,"canned",$curSysDate));
GetOptions (\%opts, "cache_file=s");
our $cache = {};
our @target = split("\/",$opts{cache_file});
ok(my $set = AI::MicroStructure::ObjectSet->new());
eval {
local $^W = 0; # because otherwhise doesn't pass errors
#`rm $opts{cache_file}`;
$cache = lock_retrieve($opts{cache_file});
$cache = {} unless $cache;
warn "New cache!\n" unless defined $cache;
};
END{
sprintf("%s/%s/%s_.cache",
$PWD,"t/canned",$curSysDate));
GetOptions (\%opts, "cache_file=s");
our $cache = {};
our @target = split("\/",$opts{cache_file});
ok(my $set = AI::MicroStructure::ObjectSet->new());
eval {
local $^W = 0; # because otherwhise doesn't pass errors
#`rm $opts{cache_file}`;
$cache = lock_retrieve($opts{cache_file});
$cache = {} unless $cache;
warn "New cache!\n" unless defined $cache;
};
END{
sprintf("/tmp/%s.cache",
$curSysDate));
GetOptions (\%opts, "cache_file=s");
our $cache = {};
our @target = split("\/",$opts{cache_file});
my $set = AI::MicroStructure::ObjectSet->new();
eval {
local $^W = 0; # because otherwhise doesn't pass errors
#`rm $opts{cache_file}`;
$cache = lock_retrieve($opts{cache_file});
$cache = {} unless $cache;
warn "New cache!\n" unless defined $cache;
};
END{
( run in 0.598 second using v1.01-cache-2.11-cpan-65fba6d93b7 )