view release on metacpan or search on metacpan
lib/App/Phoebe/Ijirait.pm view on Meta::CPAN
my $bytes = encode_json $data;
my $dir = $server->{wiki_dir};
write_binary("$dir/ijirait.json", $bytes);
}
sub cleanup() {
my $now = time;
my %people = map { $_->{location} => 1 } @{$data->{people}};
for my $room (@{$data->{rooms}}) {
my @words;
for my $word (@{$room->{words}}) {
lib/App/Phoebe/Ijirait.pm view on Meta::CPAN
}
$room->{words} = \@words;
}
}
sub backup() {
my $stream = shift;
my $bytes = encode_json $data;
$bytes =~ s/"fingerprint":"[^"]+"/"fingerprint":""/g;
success($stream, "application/json+gzip");
$stream->write(gzip $bytes);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Pod.pm view on Meta::CPAN
#
# Misc Support
#
sub uniq(@) {
my %h;
grep { not $h{$_}++ } @_;
}
#
view all matches for this distribution
view release on metacpan or search on metacpan
t/positive.t view on Meta::CPAN
use warnings FATAL => 'all';
use strict;
use Test::More;
sub do_test($$$) {
my $expected = shift;
my $result = shift;
my $test_name = shift;
if ($result =~ $expected) {
pass $test_name;
t/positive.t view on Meta::CPAN
fail $test_name;
print STDERR "Got:\n$result";
}
}
sub do_pass($$) {
do_test(qr/Result: PASS/s, shift, shift);
}
sub do_fail($$) {
do_test(qr/Result: FAIL/s, shift, shift);
}
my $basic_command = 'prove -PPassEnv -Q testData/target.t';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Rakubrew/Build.pm view on Meta::CPAN
chdir $repo;
run "$GIT fetch";
chdir $back;
}
sub _check_build_dependencies() {
_check_git();
_check_perl();
}
sub _check_git {
view all matches for this distribution
view release on metacpan or search on metacpan
share/ppt/cp.pl view on Meta::CPAN
use File::Basename;
use File::Find;
use Getopt::Std;
####### S U B R O U T I N E S ###############
sub insufficientArgs($);
sub printUsage();
sub checkArgs(@);
sub findCopy; ## used by find()
sub copyFile($$); ## used by find()
$main::opt_f = undef; ## used and set by getopts()
$main::opt_i = undef; ## used and set by getopts()
$main::opt_p = undef; ## used and set by getopts()
$main::opt_v = undef; ## used and set by getopts() not standard, but may be helpful
share/ppt/cp.pl view on Meta::CPAN
}
}
################################################################################
### This copies a single file
sub copyFile($$)
{ ## source, target
my ($path, $target) = @_;
$path = uc $path if (! $cp::CASE_SENSITIVE);
$target = uc $target if (! $cp::CASE_SENSITIVE);
if ((defined $main::opt_i) && (-e $target)) ## used if '-i' option was given
share/ppt/cp.pl view on Meta::CPAN
}
}
################################################################################
## print Insufficient arguments error
sub insufficientArgs($)
{
my $arg_num = ($_[0] + 1); ## num to display
print STDERR "cp: Insufficient arguments ($arg_num)\n";
$cp::EXIT_STATUS++;
}
################################################################################
sub printUsage()
{
print STDERR <<EOE
Usage: cp [-fivp] file1 file2
cp [-fivp] file1... filex dir
cp [-fivp] dir1... dirx dir
share/ppt/cp.pl view on Meta::CPAN
EOE
}
################################################################################
sub checkArgs(@)
{
my $target = $_[$#_];
if ($#_ > 1) ### cp'ing > 1 thing target has to be an existing directory
{
if (! -e $target) ## has to be an existing directory... sorry it's over
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/SeismicUnixGui/sunix/header/header_values.pm view on Meta::CPAN
=head2 sub get_number
=cut
sub get_number() {
my ($self) = @_;
if ( defined $header_values->{_base_file_name}
&& $header_values->{_base_file_name} ne $empty_string
view all matches for this distribution
view release on metacpan or search on metacpan
devdata/Menlo-CLI-Compat.v1.9022.pm.txt view on Meta::CPAN
if ($INC{"App/FatPacker/Trace.pm"}) {
require version::vpp;
}
sub qs($) {
Menlo::Util::shell_quote($_[0]);
}
sub determine_home {
my $class = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/SimpleBackuper/Backup.pm view on Meta::CPAN
const my $SIZE_OF_TOP_FILES => 10;
const my $SAVE_DB_PERIOD => 60 * 60;
const my $PRINT_PROGRESS_PERIOD => 60;
sub _proc_uid_gid($$$) {
my($uid, $gid, $uids_gids) = @_;
my $last_uid_gid = @$uids_gids ? $uids_gids->unpack( $uids_gids->[-1] )->{id} : 0;
my $user_name = getpwuid($uid);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/SlideServer.pm view on Meta::CPAN
# Files supplied by the user to override the distribution
has serve_dir => sub { path(shift->home) };
# Choose the first of
sub slides_source_file($self, $value=undef) {
$self->{slides_source_file}= $value if defined $value;
$self->{slides_source_file} // do {
my ($src)= grep -f $_,
$self->serve_dir->child('slides.html'),
$self->serve_dir->child('slides.md'),
lib/App/SlideServer.pm view on Meta::CPAN
has ['cache_token', 'page_dom', 'slides_dom'];
sub build_slides($self, %opts) {
my ($html, $token)= $self->load_slides_html(if_changed => $self->cache_token);
return 0 unless defined $html; # undef if source file unchanged
my ($page, @slides)= $self->extract_slides_dom($html);
$self->log->info("Loaded ".@slides." slides from ".$self->slides_source_file);
$page= $self->merge_page_assets($page);
lib/App/SlideServer.pm view on Meta::CPAN
$self->on_slides_changed(\@slides_diff) if @slides_diff;
return \@slides;
}
sub load_slides_html($self, %opts) {
my $srcfile= $self->slides_source_file;
defined $srcfile
or croak "No source file; require slides.md or slides.html in serve_dir '".$self->serve_dir."'\n";
# Allow literal data with a scalar ref
my ($content, $change_token);
lib/App/SlideServer.pm view on Meta::CPAN
$change_token= $st->mtime;
}
return wantarray? ($content, $change_token) : $content;
}
sub monitor_source_changes($self, $enable=1) {
if ($enable) {
my $f= $self->slides_source_file;
-f $f or croak "No such file '$f'";
# TODO: wrap inotify in an object with a more convenient API and detect things like file renames
$self->{_inotify} //= do {
lib/App/SlideServer.pm view on Meta::CPAN
$self->slides_source_monitor(undef);
}
}
sub markdown_to_html($self, $md, %opts) {
return markdown($md, extensions => (
HOEDOWN_EXT_TABLES | HOEDOWN_EXT_FENCED_CODE | HOEDOWN_EXT_AUTOLINK | HOEDOWN_EXT_STRIKETHROUGH
| HOEDOWN_EXT_UNDERLINE | HOEDOWN_EXT_QUOTE | HOEDOWN_EXT_SUPERSCRIPT | HOEDOWN_EXT_NO_INTRA_EMPHASIS
)
);
}
sub _node_is_slide($self, $node, $tag) {
return $tag eq 'div' && ($node->{class}//'') =~ /\bslide\b/;
}
sub _node_starts_slide($self, $node, $tag) {
return $tag eq 'h1' || $tag eq 'h2' || $tag eq 'h3';
}
sub _node_splits_slide($self, $node, $tag) {
return $tag eq 'hr';
}
sub extract_slides_dom($self, $html, %opts) {
my $dom= Mojo::DOM->new($html);
my @head_tags= qw( head title script link style base meta );
my @move_to_head;
my $slide_root= $dom->at('div.slides') || $dom->at('body') || $dom;
for my $tag (@head_tags) {
lib/App/SlideServer.pm view on Meta::CPAN
}
return ($dom, @slides);
}
sub merge_page_assets($self, $srcdom, %opts) {
my $page= Mojo::DOM->new($self->share_dir->child('page_template.html')->slurp);
if (my $srchead= $srcdom->at('head')) {
my $pagehead= $page->at('head');
# Prevent conflicting tags (TODO, more...)
if (my $title= $srchead->at('title')) {
lib/App/SlideServer.pm view on Meta::CPAN
}
return $page;
}
sub update_published_state($self, @new_attrs) {
$self->published_state->%* = ( $self->published_state->%*, @new_attrs );
$_->send({ json => { state => $self->published_state } })
for values $self->viewers->%*;
}
sub startup($self) {
$self->build_slides;
$self->presenter_key;
$self->static->paths([ $self->serve_dir->child('public'), $self->share_dir->child('public') ]);
$self->routes->get('/' => sub($c){ $c->app->serve_page($c) });
$self->routes->websocket('/slidelink.io' => sub($c){ $c->app->init_slidelink($c) });
}
sub serve_page($self, $c, %opts) {
if (!defined $self->page_dom || $self->cache_token) {
eval { $self->build_slides; 1 }
or $self->log->error($@);
}
# Merge the empty page with all currently-visible slides,
lib/App/SlideServer.pm view on Meta::CPAN
}
$c->render(text => ''.$combined);
}
sub init_slidelink($self, $c) {
my $id= $c->req->request_id;
$self->viewers->{$id}= $c;
my $mode= $c->req->param('mode');
my $key= $c->req->param('key');
my %roles= ( follow => 1 );
lib/App/SlideServer.pm view on Meta::CPAN
#my $keepalive= Mojo::IOLoop->recurring(60 => sub { $viewers{$id}->send([1, 0, 0, 0, WS_PING, '']); });
#$c->stash(keepalive => $keepalive);
}
sub on_viewer_message($self, $c, $msg) {
my $id= $c->req->request_id;
$self->log->debug(sprintf "client %s %s msg=%s", $id, $c->tx->original_remote_address//'', $msg//'');
if ($c->stash('roles') =~ /\blead\b/) {
if (defined $msg->{extern}) {
}
lib/App/SlideServer.pm view on Meta::CPAN
}
}
# if ($c->stash('roles') =~ /\b
}
sub on_viewer_disconnect($self, $c) {
my $id= $c->req->request_id;
#Mojo::IOLoop->remove($keepalive);
delete $self->viewers->{$id};
$self->update_published_state(viewer_count => scalar keys $self->viewers->%*);
}
sub on_page_changed($self) {
$_->send({ json => { page_changed => 1 } })
for values $self->viewers->%*;
}
sub on_slides_changed($self, $changed) {
my @changes= map +{ idx => $_, html => $self->slides_dom->[$_] }, @$changed;
for my $viewer (values $self->viewers->%*) {
$viewer->send({ json => { slides_changed => \@changes } })
}
}
lib/App/SlideServer.pm view on Meta::CPAN
use Exporter 'import';
our @EXPORT_OK= qw( mojo2logany );
# Utility method to create a Mojo logger that logs to Log::Any
sub mojo2logany($logger= undef) {
require Mojo::Log;
require Log::Any;
if (defined $logger && !ref $logger) {
$logger= Log::Any->get_logger(category => $logger);
} elsif (!defined $logger) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
$default_object ||= $default_class->new;
return $default_object;
}
my $import_called = 0;
sub import() {
$import_called = 1;
my $class = (grep /^-base$/i, @_)
? scalar(caller)
: $_[0];
if (not defined $default_class) {
inc/Test/Base.pm view on Meta::CPAN
$caller =~ s/.*:://;
croak "Too late to call $caller()"
}
}
sub find_my_self() {
my $self = ref($_[0]) eq $default_class
? splice(@_, 0, 1)
: default_object();
return $self, @_;
}
sub blocks() {
(my ($self), @_) = find_my_self(@_);
croak "Invalid arguments passed to 'blocks'"
if @_ > 1;
croak sprintf("'%s' is invalid argument to blocks()", shift(@_))
inc/Test/Base.pm view on Meta::CPAN
}
return (@blocks);
}
sub next_block() {
(my ($self), @_) = find_my_self(@_);
my $list = $self->_next_list;
if (@$list == 0) {
$list = [@{$self->block_list}, undef];
$self->_next_list($list);
inc/Test/Base.pm view on Meta::CPAN
$block->run_filters;
}
return $block;
}
sub first_block() {
(my ($self), @_) = find_my_self(@_);
$self->_next_list([]);
$self->next_block;
}
sub filters_delay() {
(my ($self), @_) = find_my_self(@_);
$self->_filters_delay(defined $_[0] ? shift : 1);
}
sub no_diag_on_only() {
(my ($self), @_) = find_my_self(@_);
$self->_no_diag_on_only(defined $_[0] ? shift : 1);
}
sub delimiters() {
(my ($self), @_) = find_my_self(@_);
$self->check_late;
my ($block_delimiter, $data_delimiter) = @_;
$block_delimiter ||= $self->block_delim_default;
$data_delimiter ||= $self->data_delim_default;
$self->block_delim($block_delimiter);
$self->data_delim($data_delimiter);
return $self;
}
sub spec_file() {
(my ($self), @_) = find_my_self(@_);
$self->check_late;
$self->_spec_file(shift);
return $self;
}
sub spec_string() {
(my ($self), @_) = find_my_self(@_);
$self->check_late;
$self->_spec_string(shift);
return $self;
}
sub filters() {
(my ($self), @_) = find_my_self(@_);
if (ref($_[0]) eq 'HASH') {
$self->_filters_map(shift);
}
else {
inc/Test/Base.pm view on Meta::CPAN
push @$filters, @_;
}
return $self;
}
sub filter_arguments() {
$Test::Base::Filter::arguments;
}
sub have_text_diff {
eval { require Text::Diff; 1 } &&
$Text::Diff::VERSION >= 0.35 &&
$Algorithm::Diff::VERSION >= 1.15;
}
sub is($$;$) {
(my ($self), @_) = find_my_self(@_);
my ($actual, $expected, $name) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
if ($ENV{TEST_SHOW_NO_DIFFS} or
not defined $actual or
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
inc/Test/Base.pm view on Meta::CPAN
sub END {
run_compare() unless $Have_Plan or $DIED or not $import_called;
}
sub run_compare() {
(my ($self), @_) = find_my_self(@_);
$self->_assert_plan;
my ($x, $y) = $self->_section_names(@_);
local $Test::Builder::Level = $Test::Builder::Level + 1;
for my $block (@{$self->block_list}) {
inc/Test/Base.pm view on Meta::CPAN
is($block->$x, $block->$y, $block->name ? $block->name : ());
}
}
}
sub run_is() {
(my ($self), @_) = find_my_self(@_);
$self->_assert_plan;
my ($x, $y) = $self->_section_names(@_);
local $Test::Builder::Level = $Test::Builder::Level + 1;
for my $block (@{$self->block_list}) {
inc/Test/Base.pm view on Meta::CPAN
$block->name ? $block->name : ()
);
}
}
sub run_is_deeply() {
(my ($self), @_) = find_my_self(@_);
$self->_assert_plan;
my ($x, $y) = $self->_section_names(@_);
for my $block (@{$self->block_list}) {
next unless exists($block->{$x}) and exists($block->{$y});
inc/Test/Base.pm view on Meta::CPAN
$block->name ? $block->name : ()
);
}
}
sub run_like() {
(my ($self), @_) = find_my_self(@_);
$self->_assert_plan;
my ($x, $y) = $self->_section_names(@_);
for my $block (@{$self->block_list}) {
next unless exists($block->{$x}) and defined($y);
inc/Test/Base.pm view on Meta::CPAN
$block->name ? $block->name : ()
);
}
}
sub run_unlike() {
(my ($self), @_) = find_my_self(@_);
$self->_assert_plan;
my ($x, $y) = $self->_section_names(@_);
for my $block (@{$self->block_list}) {
next unless exists($block->{$x}) and defined($y);
inc/Test/Base.pm view on Meta::CPAN
};
}
return $spec;
}
sub _strict_warnings() {
require Filter::Util::Call;
my $done = 0;
Filter::Util::Call::filter_add(
sub {
return 0 if $done;
inc/Test/Base.pm view on Meta::CPAN
$done = 1;
}
);
}
sub tie_output() {
my $handle = shift;
die "No buffer to tie" unless @_;
tie $handle, 'Test::Base::Handle', $_[0];
}
inc/Test/Base.pm view on Meta::CPAN
$ENV{TEST_SHOW_NO_DIFFS} = 1;
}
package Test::Base::Handle;
sub TIEHANDLE() {
my $class = shift;
bless \ $_[0], $class;
}
sub PRINT {
inc/Test/Base.pm view on Meta::CPAN
sub AUTOLOAD {
return;
}
sub block_accessor() {
my $accessor = shift;
no strict 'refs';
return if defined &$accessor;
*$accessor = sub {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Sqitch/Command/add.pm view on Meta::CPAN
as => 'bool',
) // 0;
},
);
sub _check_script($) {
my $file = file shift;
hurl add => __x(
'Template {template} does not exist',
template => $file,
view all matches for this distribution
view release on metacpan or search on metacpan
bin/staticperl view on Meta::CPAN
$|=1;
our ($TRACER_W, $TRACER_R);
sub find_incdir($) {
for (@INC) {
next if ref;
return $_ if -e "$_/$_[0]";
}
undef
}
sub find_inc($) {
my $dir = find_incdir $_[0];
return "$dir/$_[0]"
if defined $dir;
bin/staticperl view on Meta::CPAN
use common::sense;
use Config;
use Digest::MD5;
sub cache($$$) {
my ($variant, $src, $filter) = @_;
if (length $CACHE and 2048 <= length $src and defined $variant) {
my $file = "$CACHE/" . Digest::MD5::md5_hex "$CACHEVER\x00$variant\x00$src";
view all matches for this distribution
view release on metacpan or search on metacpan
local/lib/perl5/Module/ScanDeps.pm view on Meta::CPAN
},
);
# }}}
sub path_to_inc_name($$) {
my $path = shift;
my $warn = shift;
my $inc_name;
if ($path =~ m/\.pm$/io) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/ht-provider.t view on Meta::CPAN
docroot => ["$tmp"],
);
is_deeply [sort $provider->list_templates], [sort qw/hello.tmpl/],
'got all expected templates via list_templates';
sub is_rendered($$) {
my $out = $provider->render_template($_[0], $ctx);
chomp $out;
is $out, $_[1],
$_[2] || "$_[0] renders to $_[1]";
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/mason-provider.t view on Meta::CPAN
my $ctx = App::TemplateServer::Context->new( data => { world => 'world' } );
my $provider = App::TemplateServer::Provider::Mason->new(docroot => ["$tmp"]);
is_deeply [sort $provider->list_templates], [sort qw/mason.html/],
'got all expected templates via list_templates';
sub is_rendered($$) {
my $out = $provider->render_template($_[0], $ctx);
chomp $out;
is $out, $_[1],
$_[2] || "$_[0] renders to $_[1]";
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/tt-provider.t view on Meta::CPAN
my $provider = App::TemplateServer::Provider::TT->new(docroot => ["$tmp"]);
is_deeply [sort $provider->list_templates],
[sort qw\include.tt plain.tt try_include.tt subdir/foo.tt\],
'got all expected templates via list_templates';
sub is_rendered($$) {
my $out = $provider->render_template($_[0], $ctx);
chomp $out;
is $out, $_[1],
$_[2] || "$_[0] renders to $_[1]";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/TimeTracker/Gtk3StatusIcon.pm view on Meta::CPAN
$loop->add( $file );
Gtk3->main if $run;
}
sub get_current_task() {
my $task = App::TimeTracker::Data::Task->current($TRACKER_HOME);
if ($task) {
return {
status => 'busy',
lines => [
view all matches for this distribution
view release on metacpan or search on metacpan
lib/UnifdefPlus.pm view on Meta::CPAN
my $TRUE_PTRN = qr/(?:\b(?:$SIMPLIFIED_PREFIX|$RESOLVED_PREFIX)?[1-9][0-9]*|0x[1-9][0-9]*|TRUE)\b/;
my $FALSE_PTRN = qr/(?:\b(?:$SIMPLIFIED_PREFIX|$RESOLVED_PREFIX|)0|0x0|NULL|FALSE)\b/;
sub getValue($) {
my $string = shift;
return $1 if ($string =~ /^(?:$RESOLVED_PREFIX|$SIMPLIFIED_PREFIX)(\d+)$/);
return $string if ($string =~ /^([1-9][0-9]*)$/);
return $string if ($string =~ /^0$/);
return hex $string if ($string =~ /^0x[0-9A-Fa-f]+$/);
lib/UnifdefPlus.pm view on Meta::CPAN
return 1 if ($string eq "TRUE");
return 0 if ($string eq "FALSE");
return "unknown";
}
sub isNumber_($) {
my $string = shift;
return getValue($string) ne "unknown";
}
sub trim($) {
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
sub trimWs($) {
my $string = shift;
#my ($ws1, $ws2);
$string =~ /^(\s*)(\S*(?:\s+\S+)*)(\s*)$/;
return ($1,$2,$3);
}
lib/UnifdefPlus.pm view on Meta::CPAN
# condition is the text following that.
#
# returns: ($ifStmnt, $simplifiedCond, $rss)
# simplifiedCond is $RESOLVED_TRUE, $RESOLVED_FALSE, or the simplified expression
#
sub makefileSimplifyIf()
{
my $self = shift;
my $ifStmt = shift;
my $condition = shift;
my $lang = $self->{lang};
lib/UnifdefPlus.pm view on Meta::CPAN
# returns: ($simplifiedexpr, $rss, $match)
# where $match is one of:
# MATCH_RESOLVED - if expressions were resolved and match
# NO_MATCH_RESOLVED - if experssions were resolved and can not match
# MATCH_UNKNOWN - otherwise.
sub makefileCompareExprs() {
my $self = shift;
my $origExprsStr = shift;
my ($openBrace, $closeBrace, $comma) = ("","",""); #includes whitespace
my ($expr1Quote, $expr2Quote, $ws) = ("","","");
my ($expr1,$expr2);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/WRT/EntryStore.pm view on Meta::CPAN
A path should match C<$RENDERABLE_EXPR> and not be an index file.
=cut
sub all_renderable() {
my ($self) = shift;
return grep {
(index($_, '/index', -6) == -1)
&&
m/$RENDERABLE_EXPR/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/XScreenSaver/DBus.pm view on Meta::CPAN
has log => ( is => 'lazy', builder => sub { Log::Any->get_logger } );
sub run($self) {
$self->logind->start();
$self->saver->start();
$self->reactor->run;
}
view all matches for this distribution
view release on metacpan or search on metacpan
FAINT CYAN " ($Script)\n" ;
return 1 ;
}
}
sub tableOutput( ) {
## 2. 度æ°nã®ç°ãªãæååããå
·ä½çã«ã©ããªå¤ã§ãã£ããã
while ( my( $str, $cnt) = each %str2cnt ) {
push @{ $cnt2strs {$cnt} }, $str ;
}
my $msep = $o{2} ? "\n" : "\t" ;
view all matches for this distribution
view release on metacpan or search on metacpan
script/arxiv2bib view on Meta::CPAN
($man) && do {
pod2usage(-verbose => 2);
exit;
};
sub entry2hsh($entry) {
my %h;
for (qw(id updated published title summary)) {
$h{$_} = $entry->at($_)->text;
}
$h{'authors'} = $entry->find('author name')->map('text');
script/arxiv2bib view on Meta::CPAN
$h{'abs'} = $entry->at('link[type="text/html"]')->{'href'};
$h{'pdf'} = $entry->at('link[type="application/pdf"]')->{'href'};
return \%h;
}
sub hsh2strings($h,$label) {
my $authors = $h->{'authors'}->join(', ');
my $title = $h->{'title'};
my $year = ($h->{'published'} =~ /^(\d*)/) && $1;
my $id = $h->{'id'};
$label//= ($id =~ /.*\/(.*)/) && $1;
return [$label,$authors,$title,$year,$id];
}
sub hsh2bbtx($h,$label) {
my ($l,$authors,$title,$year,$id) = @{hsh2strings($h,$label)};
my $msg = << "EOF";
\@misc{$l,
Author = {$authors},
Title = {$title},
script/arxiv2bib view on Meta::CPAN
}
EOF
return $msg;
}
sub hsh2ams($h,$label) {
my ($l,$authors,$title,$year,$id) = @{hsh2strings($h,$label)};
my $msg = << "EOF";
\\bib{$l}{misc}{
author={$authors},
title={$title},
script/arxiv2bib view on Meta::CPAN
}
EOF
return $msg;
}
sub renderEntry($entry,$label,$type) {
(exists $type->{raw}) && return Dumper(entry2hsh($entry));
(exists $type->{amsrefs}) && return hsh2ams(entry2hsh($entry),$label);
return hsh2bbtx(entry2hsh($entry),$label);
}
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/boxmuller view on Meta::CPAN
sub lognormal ( $$ ) {
return exp boxmuller $_[0], $_[1] ;
}
}
sub SecondInfo( ) { # å¦çãããã¨ã«ã¤ãã¦ã®äºæ¬¡æ
å ±ãåºå
return if $o{1} ;
use FindBin qw [ $Script ] ;
my $cmd = "$Script -m $mu -d $sd" ;
$cmd .= ' -L' if $o{L} ;
print STDERR
view all matches for this distribution
view release on metacpan or search on metacpan
else { & LinePreserve } ;
exit 0 ;
# 1æåãå¶å¾¡æåã«ã¤ãã¦ã¯ã¨ã¹ã±ã¼ãæåãä»ããæ§ãªå½¢ã«ãããããç¨®ã®æåã®æ£è¦åããã
sub norChar($){
state $x = \{ 0,'\0',7,'\a',8,'\b',9,'\t',10,'\n',11,'\v',12,'\f',13,'\r',27,'\e'} ;
return $$x->{ ord $_[0] } // $_[0] ;
}
sub LinePreserve {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/More.pm view on Meta::CPAN
return $tb->unlike(@_);
}
#line 471
sub cmp_ok($$$;$) {
my $tb = Test::More->builder;
return $tb->cmp_ok(@_);
}
inc/Test/More.pm view on Meta::CPAN
return $obj;
}
#line 736
sub subtest($&) {
my ($name, $subtests) = @_;
my $tb = Test::More->builder;
return $tb->subtest(@_);
}
view all matches for this distribution
view release on metacpan or search on metacpan
maint/mk_fatlib.pl view on Meta::CPAN
}
my ($last) =
[ sort { $b->stat->mtime <=> $a->stat->mtime } @buildcandidates ]->[0];
print "Making fatlib using $last\n";
sub withlib(&) {
my ($code) = @_;
my $oldopts = $ENV{PERL5OPT} || '';
my @oldlib = split /:/, $ENV{PERL5LIB} || '';
# local $ENV{PERL5OPT} = "$oldopts -I${last}/lib";
maint/mk_fatlib.pl view on Meta::CPAN
#STDERR->print("\e[31mPERL5OPT=$ENV{PERL5OPT}\e[0m\n");
return $code->();
}
sub inbuild(&) {
my ($code) = @_;
chdir $last;
$code->();
chdir $cwd;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/More.pm view on Meta::CPAN
return $tb->unlike(@_);
}
#line 476
sub cmp_ok($$$;$) {
my $tb = Test::More->builder;
return $tb->cmp_ok(@_);
}
view all matches for this distribution
view release on metacpan or search on metacpan
script/cpanurl view on Meta::CPAN
($JSON ||= __PACKAGE__->new->utf8)->decode(@_);
}
# Obsoleted
sub to_json($) {
Carp::croak ("App::cpanurl::JSON::PP::to_json has been renamed to encode_json.");
}
sub from_json($) {
Carp::croak ("App::cpanurl::JSON::PP::from_json has been renamed to decode_json.");
}
# Methods
view all matches for this distribution
view release on metacpan or search on metacpan
t/t_Common.pm view on Meta::CPAN
# Common setup stuff, not specifically for test cases.
# This file is intended to be identical in all my module distributions.
package t_Common;
sub hash2str($) { my $h=shift; join("",map{" ${_}=>".($h->{$_}//"u")} sort keys %$h) }
my ($default_warnbits, $default_pragmas);
BEGIN {
$default_warnbits = ${^WARNING_BITS}//"u";
$default_pragmas = ($^H//"u").":".hash2str(\%^H);
}
t/t_Common.pm view on Meta::CPAN
our @EXPORT_OK = qw/oops btw btwN/;
use Import::Into;
use Carp;
sub oops(@) {
my $pkg = caller;
my $pfx = "\noops";
$pfx .= " in pkg '$pkg'" unless $pkg eq 'main';
$pfx .= ":\n";
if (defined(&Spreadsheet::Edit::logmsg)) {
t/t_Common.pm view on Meta::CPAN
push @_,"\n" unless $_[-1] =~ /\R\z/;
goto &Carp::confess
}
# "By The Way" messages showing file:linenum of the call
sub btw(@) { unshift @_,0; goto &btwN }
sub btwN($@) {
my $N=shift;
my ($fn, $lno) = (caller($N))[1,2];
$fn =~ s/.*[\\\/]//;
$fn =~ s/(.)\.[a-z]+$/$1/a;
local $_ = join("",@_);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/More.pm view on Meta::CPAN
return $tb->unlike(@_);
}
#line 476
sub cmp_ok($$$;$) {
my $tb = Test::More->builder;
return $tb->cmp_ok(@_);
}
view all matches for this distribution