view release on metacpan or search on metacpan
lib/Agents/Platform.pm view on Meta::CPAN
=head1 DIAGNOSTICS
=for author to fill in:
List every single error and warning message that the module can
generate (even the ones that will "never happen"), with a full
explanation of each problem, one or more likely causes, and any
suggested remedies.
=over
=item C<< Error message here, perhaps with %s placeholders >>
[Description of error here]
=item C<< Another error message here >>
[Description of error here]
[Et cetera, et cetera]
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Format.pm view on Meta::CPAN
sub accesslog(@) {
print "[", POSIX::strftime("%F %T", localtime), "] ", coloring @_;
}
# ÐÐ»Ñ ÐºÑона: ÐиÑÐµÑ Ð² STDIN
sub errorlog(@) {
print STDERR "[", POSIX::strftime("%F %T", localtime), "] ", coloring @_;
}
#@category ÐÑеобÑазованиÑ
lib/Aion/Format.pm view on Meta::CPAN
Writes to STDOUT using the C<coloring> function for formatting and adds a date-time prefix.
trappout { accesslog "#{green}ACCESS#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[32mACCESS\e\[0m 6\n
=head2 errorlog ($format, @params)
Writes to B<STDERR> using the C<coloring> function for formatting and adds a date-time prefix.
trapperr { errorlog "#{red}ERROR#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[31mERROR\e\[0m 6\n
=head2 p ($target; %properties)
C<p> from Data::Printer with preset settings.
lib/Aion/Format.pm view on Meta::CPAN
=head2 trapperr (&block)
Trap for B<STDERR>.
If there is an error in the block, C<STDOUT> is restored, but the output in the block is lost.
trapperr { print STDERR "Stars: â¨" } # => Stars: â¨
See also C<IO::Capture::Stderr>.
=head2 trappout (&block)
Trap for B<STDOUT>.
If there is an error in the block, C<STDOUT> is restored, but the output in the block is lost.
trappout { print "Stars: â¨" } # => Stars: â¨
trappout { print "Stars: â¨"; die "error" } # @=> error
See also C<IO::Capture::Stdout>.
=head2 TiB ()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Fs.pm view on Meta::CPAN
($path) = @$path if ref $path;
$path = $fs->{before_split}->($path) if exists $fs->{before_split};
+{
$path =~ $fs->{regexp}? (map { $_ ne "ext" && $+{$_} eq ""? (): ($_ => $+{$_}) } keys %+): (error => 1),
path => $path,
}
}
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ÑоÑмаÑа одной ÐС в дÑÑгÑÑ
lib/Aion/Fs.pm view on Meta::CPAN
# ÐайÑи ÑайлÑ
sub find(;@) {
my $files = @_? shift: $_;
$files = [$files] unless ref $files;
my @noenters; my $errorenter = sub {};
my $ex = @_ && ref($_[$#_]) eq 'Aion::Fs::Find'
? pop
: undef;
if($ex) {
bless $ex, 'Aion::Fs';
if(Scalar::Util::reftype $ex eq 'CODE') {
$errorenter = $ex;
} else {
$errorenter = bless pop @$ex, undef if Scalar::Util::reftype($ex->[$#$ex]) eq "CODE";
push @noenters, _filters @$ex;
}
}
my @filters = _filters @_;
my $iter = Aion::Fs::Find->new(
noenters => \@noenters,
errorenter => $errorenter,
filters => \@filters,
files => $files,
);
defined(wantarray)
lib/Aion/Fs.pm view on Meta::CPAN
sub noenter(@) {
bless [@_], "Aion::Fs::Find"
}
# ÐÑзÑваеÑÑÑ Ð´Ð»Ñ Ð²ÑеÑ
оÑибок ввода-вÑвода
sub errorenter(&) {
bless shift, "Aion::Fs::Find"
}
# ÐÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ find бÑдÑÑи вÑзван Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ из его ÑилÑÑÑов, errorenter или noenter
sub find_stop() {
die bless \(my $stop = 1), "Aion::Fs::Find"
}
# ÐÑÐ¾Ð¸Ð·Ð²Ð¾Ð´Ð¸Ñ Ð·Ð°Ð¼ÐµÐ½Ñ Ð²Ð¾ вÑеÑ
ÑказаннÑÑ
ÑайлаÑ
. ÐозвÑаÑÐ°ÐµÑ ÑÐ°Ð¹Ð»Ñ Ð² коÑоÑÑÑ
замен не бÑло
lib/Aion/Fs.pm view on Meta::CPAN
[map cat, grep -f, find ["hello/big", "hello/small"]]; # --> [qw/ hellow! noenter /]
my @noreplaced = replace { s/h/$a $b H/ }
find "hello", "-f", "*.txt", qr/\.txt$/, sub { /\.txt$/ },
noenter "*small*",
errorenter { warn "find $_: $!" };
\@noreplaced; # --> ["hello/moon.txt"]
cat "hello/world.txt"; # => hello/world.txt :utf8 Hi!
cat "hello/moon.txt"; # => noreplace
lib/Aion/Fs.pm view on Meta::CPAN
If the -X filter is not a perl file function, an exception is thrown:
eval { find "example", "-h" }; $@ # ~> Undefined subroutine &Aion::Fs::h called
In this example, C<find> cannot enter the subdirectory and passes an error to the C<errorenter> function (see below) with the C<$_> and C<$!> variables set (to the directory path and the OS error message).
B<Attention!> If C<errorenter> is not specified, then all errors are B<ignored>!
mkpath ["example/", 0];
[find "example"] # --> ["example"]
[find "example", noenter "-d"] # --> ["example"]
eval { find "example", errorenter { die "find $_: $!" } }; $@ # ~> find example: Permission denied
mkpath for qw!ex/1/11 ex/1/12 ex/2/21 ex/2/22!;
my $count = 0;
find "ex", sub { find_stop if ++$count == 3; 1};
lib/Aion/Fs.pm view on Meta::CPAN
=head2 noenter (@filters)
Tells C<find> not to enter directories matching the filters behind it.
=head2 errorenter (&block)
Calls C<&block> for every error that occurs when a directory cannot be entered.
=head2 find_stop ()
Stops C<find> being called in one of its filters, C<errorenter> or C<noenter>.
my $count = 0;
find "ex", sub { find_stop if ++$count == 3; 1};
$count # -> 3
=head2 erase (@paths)
Removes files and empty directories. Returns C<@paths>. If there is an I/O error, it throws an exception.
eval { erase "/" }; $@ # ~> erase dir /: Device or resource busy
eval { erase "/dev/null" }; $@ # ~> erase file /dev/null: Permission denied
=head3 See also
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Run/Runner.pm view on Meta::CPAN
my($self) = @_;
my %run;
open my $f, '<:utf8', INI or die "Can't open ${\INI}: $!";
while (<$f>) {
chomp;
warn("Annotation error. Use #\@run <rubric>:<name> <remark>\n$_\n at ${\INI} line $."), next unless /^([\w:]+)#(\w*),(\d+)=(\S+?):(\S+)[ \t]+(.+)/am;
$run{$5} = {
rubric => $4,
name => $5,
remark => $6,
pkg => $1,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Type.pm view on Meta::CPAN
$Int->coerce(undef) # => 0
$Int->coerce("abc") # => abc
=head2 detail ($element, $feature)
Generates an error message.
my $Int = Aion::Type->new(name => "Int");
$Int->detail(-5, "Feature car") # => Feature car must have the type Int. The it is -5!
lib/Aion/Type.pm view on Meta::CPAN
eval { Aion::Type->new(name=>"Rim", init => sub {...})->make(__PACKAGE__) }; $@ # ~> init_where won't work in Rim
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make }; $@ # ~> syntax error
=head2 make_arg ($pkg)
Creates a subroutine with arguments that returns a type.
lib/Aion/Type.pm view on Meta::CPAN
"IX" ~~ Len[2,2] # => 1
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make_arg }; $@ # ~> syntax error
=head2 make_maybe_arg ($pkg)
Creates a subroutine with arguments that returns a type.
lib/Aion/Type.pm view on Meta::CPAN
3 ~~ Enum123[4,5,6] # -> ""
5 ~~ Enum123[4,5,6] # -> 1
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make_maybe_arg }; $@ # ~> syntax error
=head2 equal ($type)
Types are equal if they have the same name, the same number of arguments, the parent element, and the arguments are equal.
lib/Aion/Type.pm view on Meta::CPAN
Parent type.
=head2 message (;&message)
Message accessor. Uses C<&message> to generate an error message.
=head2 title (;$title)
Header accessor (used to create the B<swagger> schema).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Akado/Account.pm view on Meta::CPAN
sub _check_response {
my ($self, $response) = @_;
my $url = scalar $response->request->uri->canonical;
if ($response->is_error) {
croak "Can't get url '$url'. Got error "
. $response->status_line;
}
return '';
}
lib/Akado/Account.pm view on Meta::CPAN
info from that site.
Unfortunately Akdado account site has no API, so this module acts as a browser
to get needed info.
Every module method dies in case of error.
=head1 DESCRIPTION
Akado::Account version numbers uses Semantic Versioning standart.
Please visit L<http://semver.org/> to find out all about this great thing.
lib/Akado/Account.pm view on Meta::CPAN
B<Get:> 1) $self 2) $cookies - HTTP::Response object
B<Return:> -
The method checks that there was no error in accessing some page. If there was
error, the die is performed.
=end comment
=head1 TODO
view all matches for this distribution
view release on metacpan or search on metacpan
t/0002-debug.t view on Meta::CPAN
# functional tests
is($debug, $clone, 'test for a singleton object');
ok($debug->logger->debug('foo'), 'print a message of priority DEBUG');
ok($debug->logger->info('foo'), 'print a message of priority INFO');
ok($debug->logger->warn('foo'), 'print a message of priority WARN');
ok($debug->logger->error('foo'), 'print a message of priority ERROR');
ok($debug->logger->fatal('foo'), 'print a message of priority FATAL');
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
has 'tools_uri' => (is => 'ro', default => TOOLS_URI);
has 'dig_uri' => (is => 'ro', default => DIG_URI);
has 'mtr_uri' => (is => 'ro', default => MTR_URI);
has 'loc_uri' => (is => 'ro', default => LOC_URI);
has 'baseurl' => (is => 'rw', trigger => \&Akamai::Open::Debug::debugger);
has 'last_error'=> (is => 'rw');
sub validate_base_url {
my $self = shift;
my $base = $self->baseurl();
$self->debug->logger->debug('validating baseurl');
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
my $data;
$self->debug->logger->debug('dig() was called');
unless(ref($param)) {
$self->last_error('parameter of dig() has to be a hashref');
$self->debug->logger->error($self->last_error());
return(undef);
}
unless(defined($param->{'hostname'}) && defined($param->{'queryType'})) {
$self->last_error('hostname and queryType are mandatory options for dig()');
$self->debug->logger->error($self->last_error());
return(undef);
}
unless($param->{'queryType'} =~ m/$valid_types_re/) {
$self->last_error('queryType has to be one of A, AAAA, PTR, SOA, MX or CNAME');
$self->debug->logger->error($self->last_error());
return(undef);
}
unless(defined($param->{'location'}) || defined($param->{'sourceIp'})) {
$self->last_error('either location or sourceIp has to be set');
$self->debug->logger->error($self->last_error());
return(undef);
}
$self->request->uri->query_form($param);
$self->sign_request();
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
$self->debug->logger->info(sprintf('HTTP response code for dig() call is %s', $self->response->code()));
$data = decode_json($self->response->content());
given($self->response->code()) {
when($_ == 200) {
if(defined($data->{'dig'}->{'errorString'})) {
$self->last_error($data->{'dig'}->{'errorString'});
$self->debug->logger->error($self->last_error());
return(undef);
} else {
return($data->{'dig'});
}
}
when($_ =~m/^5\d\d/) {
$self->last_error('the server returned a 50x error');
$self->debug->logger->error($self->last_error());
return(undef);
}
}
$self->last_error(sprintf('%s %s %s', $data->{'httpStatus'} ,$data->{'title'} ,$data->{'problemInstance'}));
$self->debug->logger->error($self->last_error());
return(undef);
}
sub mtr {
my $self = shift;
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
my $data;
$self->debug->logger->debug('mtr() was called');
unless(ref($param)) {
$self->last_error('parameter of mtr() has to be a hashref');
$self->debug->logger->error($self->last_error());
return(undef);
}
unless(defined($param->{'destinationDomain'})) {
$self->last_error('destinationDomain is a mandatory options for mtr()');
$self->debug->logger->error($self->last_error());
return(undef);
}
unless(defined($param->{'location'}) || defined($param->{'sourceIp'})) {
$self->last_error('either location or sourceIp has to be set');
$self->debug->logger->error($self->last_error());
return(undef);
}
$self->request->uri->query_form($param);
$self->sign_request();
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
$self->debug->logger->info(sprintf('HTTP response code for mtr() call is %s', $self->response->code()));
$data = decode_json($self->response->content());
given($self->response->code()) {
when($_ == 200) {
if(defined($data->{'mtr'}->{'errorString'})) {
$self->last_error($data->{'mtr'}->{'errorString'});
$self->debug->logger->error($self->last_error());
return(undef);
} else {
return($data->{'mtr'});
}
}
when($_ =~m/^5\d\d/) {
$self->last_error('the server returned a 50x error');
$self->debug->logger->error($self->last_error());
return(undef);
}
}
$self->last_error(sprintf('%s %s %s', $data->{'httpStatus'} ,$data->{'title'} ,$data->{'problemInstance'}));
$self->debug->logger->error($self->last_error());
return(undef);
}
sub locations {
my $self = shift;
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
$self->response($self->user_agent->request($self->request()));
$self->debug->logger->info(sprintf('HTTP response code for locations() call is %s', $self->response->code()));
$data = decode_json($self->response->content());
given($self->response->code()) {
when($_ == 200) {
if(defined($data->{'errorString'})) {
$self->last_error($data->{'errorString'});
$self->debug->logger->error($self->last_error());
return(undef);
} else {
return($data->{'locations'});
}
}
when($_ =~m/^5\d\d/) {
$self->last_error('the server returned a 50x error');
$self->debug->logger->error($self->last_error());
return(undef);
}
}
$self->last_error(sprintf('%s %s %s', $data->{'httpStatus'} ,$data->{'title'} ,$data->{'problemInstance'}));
$self->debug->logger->error($self->last_error());
return(undef);
}
1;
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
To initiate diagnostinc actions inside the Akamai network, you'll
need the information about the locations from which diagnostic
actions are available.
I<locations()> provides the informations. On success it returns a
Perl-style array reference. On error it returns I<undef> and sets
the I<last_error()> appropriate.
=head2 $diag->mtr($hash_ref)
I<mtr()> returns a network trace like the well know I<mtr> Unix command.
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
A Akamai Server IP you want to run mtr from. This paramter is optional.
Either location or sourceIp has to be passed to I<mtr()>
=back
On success it returns a Perl-style hash reference. On error it returns
I<undef> and sets the I<last_error()> appropriate.
The hash reference has the following format:
{
'source' => ...,
'packetLoss' => '...',
'destination' => '...',
'errorString' => ...,
'analysis' => '...',
'host' => '...',
'avgLatency' => '...',
'hops' => [
{
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
A Akamai Server IP you want to run dig from. This paramter is optional.
Either location or sourceIp has to be passed to I<dig()>
=back
On success it returns a Perl-style hash reference. On error it returns
I<undef> and sets the I<last_error()> appropriate.
The hash reference has the following format:
{
'authoritySection' => [
lib/Akamai/Open/DiagnosticTools.pm view on Meta::CPAN
'ttl' => '...',
'preferenceValues' => ...,
'recordClass' => '...'
}
],
'errorString' => ...,
'queryType' => '...',
'hostname' => '...',
'result' => '...'
}
=head2 $diag->last_error()
Just returns the last occured error.
=head1 AUTHOR
Martin Probst <internet+cpan@megamaddin.org>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Akamai/PropertyFetcher.pm view on Meta::CPAN
$pm->finish;
}
} elsif ($properties_resp->code == 403 || $properties_resp->code == 404) {
warn "Error retrieving property list (Contract ID: $contract_id, Group ID: $group_id): " . $properties_resp->status_line . " - Skipping\n";
} else {
die "Unexpected error (Contract ID: $contract_id, Group ID: $group_id): " . $properties_resp->status_line;
}
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
helper/shellrun.c view on Meta::CPAN
// Launch the file specified on the command-line.
result = ShellExecute(NULL, "open", lpCmdLine, NULL, NULL, SW_SHOWMAXIMIZED);
if ((int)result <= 32) {
// An error was encountered launching, probably because the
// computer doesn't have IE5 or greater.
// Open windows explorer, showing the CD contents.
ShellExecute(NULL, "explore", "", NULL, NULL, SW_SHOWNORMAL);
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/analogize.pl view on Meta::CPAN
sub _validate_args {
my %args = @_;
if($args{help}){
pod2usage(1);
}
my $errors = '';
if(!$args{exemplars} and !$args{project}){
$errors .= "Error: need either --exemplars or --project parameters\n";
}elsif(($args{exemplars} or $args{test}) and $args{project}){
$errors .= "Error: --project parameter cannot be used with --exempalrs or --test\n";
}
if(!defined $args{format}){
$errors .= "Error: missing --format parameter\n";
}elsif($args{format} !~ m/^(?:no)?commas$/){
$errors .=
"Error: --format parameter must be either 'commas' or 'nocommas'\n";
}
if($args{print}){
my %allowed =
map {$_ => 1} qw(
bin/analogize.pl view on Meta::CPAN
gang_summary
gang_detailed
);
for my $param (split ',', $args{print}){
if(!exists $allowed{$param}){
$errors .= "Error: unknown print parameter '$param'\n";
}
}
}
if($errors){
$errors .= 'use "analogize --help" for detailed usage information';
chomp $errors;
pod2usage($errors);
}
}
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Accounting.pm view on Meta::CPAN
my $obj;
eval qq{
require $class;
\$obj = $class->new;
};
die"report() error\n" if $@;
$obj->process(
$self->occurrence_hash,
$self->field_groups,
$self->group_occurrence
);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
inc/Module/Install.pm view on Meta::CPAN
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future ($s > $t).
inc/Module/Install.pm view on Meta::CPAN
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.
If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).
If you're a user of a module, please contact the author.
EOT
view all matches for this distribution
view release on metacpan or search on metacpan
--diff=program use diff program and options
--compat-version=version provide compatibility with Perl version
--cplusplus accept C++ comments
--quiet don't output anything except fatal errors
--nodiag don't show diagnostics
--nohints don't show hints
--nochanges don't suggest changes
--nofilter don't filter input files
Using this option instructs F<ppport.h> to leave C++
comments untouched.
=head2 --quiet
Be quiet. Don't print anything except fatal errors.
=head2 --nodiag
Don't output any diagnostic messages. Only portability
alerts will be printed.
PL_defgv|5.004050||p
PL_diehook|5.004050||p
PL_dirty|5.004050||p
PL_dowarn|||pn
PL_errgv|5.004050||p
PL_error_count|5.024000||p
PL_expect|5.024000||p
PL_hexdigit|5.005000||p
PL_hints|5.005000||p
PL_in_my_stash|5.024000||p
PL_in_my|5.024000||p
PadnamelistREFCNT||5.024000|
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
PerlIO_context_layers||5.009004|
PerlIO_eof||5.007003|
PerlIO_error||5.007003|
PerlIO_fileno||5.007003|
PerlIO_fill||5.007003|
PerlIO_flush||5.007003|
PerlIO_get_base||5.007003|
PerlIO_get_bufsiz||5.007003|
my_snprintf|5.009004||pvn
my_socketpair||5.007003|n
my_sprintf|5.009003||pvn
my_stat_flags|||
my_stat||5.024000|
my_strerror||5.021001|
my_strftime||5.007002|
my_strlcat|5.009004||pn
my_strlcpy|5.009004||pn
my_unexec|||
my_vsnprintf||5.009004|n
put_range|||
pv_display|5.006000||p
pv_escape|5.009004||p
pv_pretty|5.009004||p
pv_uni_display||5.007003|
qerror|||
qsortsvu|||
quadmath_format_needed|||n
quadmath_format_single|||n
re_compile||5.009005|
re_croak2|||
whichsig_pvn||5.015004|
whichsig_pv||5.015004|
whichsig_sv||5.015004|
whichsig|||
win32_croak_not_implemented|||n
with_queued_errors|||
wrap_op_checker||5.015008|
write_to_stderr|||
xs_boot_epilog|||
xs_handshake|||vn
xs_version_bootcheck|||
yyerror_pvn|||
yyerror_pv|||
yyerror|||
yylex|||
yyparse|||
yyunlex|||
yywarn|||
);
if ($file{changes}) {
if (exists $opt{copy}) {
my $newfile = "$filename$opt{copy}";
if (-e $newfile) {
error("'$newfile' already exists, refusing to write copy of '$filename'");
}
else {
local *F;
if (open F, ">$newfile") {
info("Writing copy of '$filename' with changes to '$newfile'");
print F $c;
close F;
}
else {
error("Cannot open '$newfile' for writing: $!");
}
}
}
elsif (exists $opt{patch} || $opt{changes}) {
if (exists $opt{patch}) {
unless ($patch_opened) {
if (open PATCH, ">$opt{patch}") {
$patch_opened = 1;
}
else {
error("Cannot open '$opt{patch}' for writing: $!");
delete $opt{patch};
$opt{changes} = 1;
goto fallback;
}
}
if (!defined $diff) {
$diff = run_diff('diff', $file, $str);
}
if (!defined $diff) {
error("Cannot generate a diff. Please install Text::Diff or use --copy.");
return;
}
print F $diff;
}
}
unlink $tmp;
}
else {
error("Cannot open '$tmp' for writing: $!");
}
return undef;
}
{
$opt{quiet} and return;
print "*** ", @_, "\n";
}
sub error
{
print "*** ERROR: ", @_, "\n";
}
my %given_hints;
/* It is very unlikely that anyone will try to use this with Perl 6
(or greater), but who knows.
*/
#if PERL_REVISION != 5
# error ppport.h only works with Perl version 5
#endif /* PERL_REVISION != 5 */
#ifndef dTHR
# define dTHR dNOOP
#endif
#ifndef dTHX
# define PL_defgv defgv
# define PL_diehook diehook
# define PL_dirty dirty
# define PL_dowarn dowarn
# define PL_errgv errgv
# define PL_error_count error_count
# define PL_expect expect
# define PL_hexdigit hexdigit
# define PL_hints hints
# define PL_in_my in_my
# define PL_laststatval laststatval
# define PL_lex_state D_PPP_my_PL_parser_var(lex_state)
# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff)
# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf)
# define PL_in_my D_PPP_my_PL_parser_var(in_my)
# define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash)
# define PL_error_count D_PPP_my_PL_parser_var(error_count)
#else
/* ensure that PL_parser != NULL and cannot be dereferenced */
/* Replace perl_eval_pv with eval_pv */
#ifndef eval_pv
#if defined(NEED_eval_pv)
static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
static
#else
extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
#endif
#ifdef eval_pv
# undef eval_pv
#endif
#define Perl_eval_pv DPPP_(my_eval_pv)
#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
SV*
DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
{
dSP;
SV* sv = newSVpv(p, 0);
PUSHMARK(sp);
SPAGAIN;
sv = POPs;
PUTBACK;
if (croak_on_error && SvTRUE(GvSV(errgv)))
croak(SvPVx(GvSV(errgv), na));
return sv;
}
# define UVuf "u"
# define UVof "o"
# define UVxf "x"
# define UVXf "X"
# else
# error "cannot define IV/UV formats"
# endif
#endif
#ifndef NVef
# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Perl extension Algorithm::BIT::XS.
0.003 2017-06-17T22:04+03:00
- Fix segmentation fault
- Fix lack of destructors
- Fix off-by-one errors in argument validation
- Improve test suite
- Make XS slightly shorter
0.002 2017-06-10T21:33+01:00
- Add support for 2D binary indexed trees
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
#pod problem.
#pod
#pod =item *
#pod
#pod B<Adjustable timeouts> - Providing an adjustable timeout after each request solves the
#pod opposite problem of exponential backoffs: slower, unresponsive errors that gobble up all
#pod of the max duration time in one go. Each new timeout is a certain percentage of the time
#pod left.
#pod
#pod =back
#pod
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
problem.
=item *
B<Adjustable timeouts> - Providing an adjustable timeout after each request solves the
opposite problem of exponential backoffs: slower, unresponsive errors that gobble up all
of the max duration time in one go. Each new timeout is a certain percentage of the time
left.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
return
unless system( 'sudo', $^X, $0, "--config=$config",
"--installdeps=$missing" );
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
view all matches for this distribution
view release on metacpan or search on metacpan
META.json
META.yml
README
t/00_compile.t
t/01_basic.t
t/02_error.t
xt/01_podspell.t
xt/02_perlcritic.t
xt/03_pod.t
xt/04_minimum_version.t
xt/05_cpan_meta.t
view all matches for this distribution
view release on metacpan or search on metacpan
##======================================================================
## Exports
##======================================================================
no warnings 'portable'; ##-- avoid "Bit vector size > 32 non-portable" errors for native quads
our $HAVE_QUAD = ($Config::Config{use64bitint} ##-- avoid errors with xs U64TYPE but no perl-side 64bit ints (e.g. freebsd w/o -use64bitint perl config option)
&&
($HAVE_XS ? Algorithm::BinarySearch::Vec::XS::HAVE_QUAD() : $Config::Config{d_quad})
);
our $KEY_NOT_FOUND = $HAVE_XS ? Algorithm::BinarySearch::Vec::XS::KEY_NOT_FOUND() : 0xffffffff;
#our $KEY_NOT_FOUND = $HAVE_XS ? Algorithm::BinarySearch::Vec::XS::KEY_NOT_FOUND() : ($HAVE_QUAD ? 0xffffffffffffffff : 0xffffffff);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/BitVector.pm view on Meta::CPAN
sub set_bit {
my $self = shift;
my $posn = shift;
my $val = shift;
croak "incorrect value for a bit" unless $val =~ /\d/ && ($val == 0 or $val == 1);
die "index range error" if ($posn >= $self->{size}) or ($posn < - $self->{size});
$posn = $self->{size} + $posn if $posn < 0;
my $block_index = int($posn / 16);
my $shift = $posn & 0xF;
my $cv = $self->{_vector}->[$block_index];
if ( ( ( $cv >> $shift ) & 1 ) != $val) {
lib/Algorithm/BitVector.pm view on Meta::CPAN
## get_slice() method.
sub get_bit {
my $self = shift;
my $pos = shift;
unless (ref($pos) eq "ARRAY") {
die "index range error" if ($pos >= $self->{size}) or ($pos < - $self->{size});
$pos = $self->{size} + $pos if $pos < 0;
return ( $self->{_vector}->[int($pos/16)] >> ($pos&15) ) & 1;
}
# my @slice = map $self->get_bit($_), (@$pos)[0..@$pos-1];
my @slice = map $self->get_bit($_), (@$pos)[0..@$pos-2];
lib/Algorithm/BitVector.pm view on Meta::CPAN
my $self = shift;
die "Abort: The read_bits_from_file() method invoked on an object that is " .
"not of type Algorithm::BitVector"
unless UNIVERSAL::isa( $self, 'Algorithm::BitVector');
my $blocksize = shift;
my $error_str = "You need to first construct a BitVector object with a filename as argument";
die "$error_str" unless $self->{filename};
die "block size must be a multiple of 8" if $blocksize % 8;
my $bitstr = _readblock( $blocksize, $self );
if (length $bitstr == 0) {
return Algorithm::BitVector->new( size => 0 );
print "file has no bits\n";
lib/Algorithm/BitVector.pm view on Meta::CPAN
Version 1.21 fixes a bug in the code for the Miller-Rabin primality test function
C<test_for_primality()>. This version also places a hard limit on the size of the
integers that are allowed to be tested for primality.
Version 1.2 fixes an important bug in creating bitvectors from the contents of a disk
file. This version also includes corrections for some of the documentation errors
discovered.
Version 1.1 incorporates additional type checking on the operands for the overloaded
operators. Also fixed some minor documentation formatting issues.
lib/Algorithm/BitVector.pm view on Meta::CPAN
reported by Dana Jacobsen in a bug report filed at C<rt.cpan.org>. Thanks Dana!
The restriction on the Perl version was removed on Slaven Rezic's recommendation. He
says the module runs fine with Perl 5.8.9. Thanks Slaven!
Austin Nobis reported a documentation error in Version 1.24 which was fixed in Version
1.25. Thanks Austin!
=head1 AUTHOR
The author, Avinash Kak, recently finished a 17-years long "Objects Trilogy Project"
view all matches for this distribution
view release on metacpan or search on metacpan
--diff=program use diff program and options
--compat-version=version provide compatibility with Perl version
--cplusplus accept C++ comments
--quiet don't output anything except fatal errors
--nodiag don't show diagnostics
--nohints don't show hints
--nochanges don't suggest changes
--nofilter don't filter input files
Using this option instructs F<ppport.h> to leave C++
comments untouched.
=head2 --quiet
Be quiet. Don't print anything except fatal errors.
=head2 --nodiag
Don't output any diagnostic messages. Only portability
alerts will be printed.
PL_defgv|5.004050||p
PL_diehook|5.004050||p
PL_dirty|5.004050||p
PL_dowarn|||pn
PL_errgv|5.004050||p
PL_error_count|5.014000||p
PL_expect|5.014000||p
PL_hexdigit|5.005000||p
PL_hints|5.005000||p
PL_in_my_stash|5.014000||p
PL_in_my|5.014000||p
PUTBACK|||
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
PerlIO_context_layers||5.009004|
PerlIO_eof||5.007003|
PerlIO_error||5.007003|
PerlIO_fileno||5.007003|
PerlIO_fill||5.007003|
PerlIO_flush||5.007003|
PerlIO_get_base||5.007003|
PerlIO_get_bufsiz||5.007003|
put_byte|||
pv_display|5.006000||p
pv_escape|5.009004||p
pv_pretty|5.009004||p
pv_uni_display||5.007003|
qerror|||
qsortsvu|||
re_compile||5.009005|
re_croak2|||
re_dup_guts|||
re_intuit_start||5.009005|
warner_nocontext|||vn
warner|5.006000|5.004000|pv
warn|||v
watch|||
whichsig|||
with_queued_errors|||
write_no_mem|||
write_to_stderr|||
xmldump_all_perl|||
xmldump_all|||
xmldump_attr|||
xmldump_sub_perl|||
xmldump_sub|||
xmldump_vindent|||
xs_apiversion_bootcheck|||
xs_version_bootcheck|||
yyerror|||
yylex|||
yyparse|||
yyunlex|||
yywarn|||
);
if ($file{changes}) {
if (exists $opt{copy}) {
my $newfile = "$filename$opt{copy}";
if (-e $newfile) {
error("'$newfile' already exists, refusing to write copy of '$filename'");
}
else {
local *F;
if (open F, ">$newfile") {
info("Writing copy of '$filename' with changes to '$newfile'");
print F $c;
close F;
}
else {
error("Cannot open '$newfile' for writing: $!");
}
}
}
elsif (exists $opt{patch} || $opt{changes}) {
if (exists $opt{patch}) {
unless ($patch_opened) {
if (open PATCH, ">$opt{patch}") {
$patch_opened = 1;
}
else {
error("Cannot open '$opt{patch}' for writing: $!");
delete $opt{patch};
$opt{changes} = 1;
goto fallback;
}
}
if (!defined $diff) {
$diff = run_diff('diff', $file, $str);
}
if (!defined $diff) {
error("Cannot generate a diff. Please install Text::Diff or use --copy.");
return;
}
print F $diff;
}
}
unlink $tmp;
}
else {
error("Cannot open '$tmp' for writing: $!");
}
return undef;
}
{
$opt{quiet} and return;
print "*** ", @_, "\n";
}
sub error
{
print "*** ERROR: ", @_, "\n";
}
my %given_hints;
/* It is very unlikely that anyone will try to use this with Perl 6
(or greater), but who knows.
*/
#if PERL_REVISION != 5
# error ppport.h only works with Perl version 5
#endif /* PERL_REVISION != 5 */
#ifndef dTHR
# define dTHR dNOOP
#endif
#ifndef dTHX
# define PL_defgv defgv
# define PL_diehook diehook
# define PL_dirty dirty
# define PL_dowarn dowarn
# define PL_errgv errgv
# define PL_error_count error_count
# define PL_expect expect
# define PL_hexdigit hexdigit
# define PL_hints hints
# define PL_in_my in_my
# define PL_laststatval laststatval
# define PL_lex_state D_PPP_my_PL_parser_var(lex_state)
# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff)
# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf)
# define PL_in_my D_PPP_my_PL_parser_var(in_my)
# define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash)
# define PL_error_count D_PPP_my_PL_parser_var(error_count)
#else
/* ensure that PL_parser != NULL and cannot be dereferenced */
/* Replace perl_eval_pv with eval_pv */
#ifndef eval_pv
#if defined(NEED_eval_pv)
static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
static
#else
extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
#endif
#ifdef eval_pv
# undef eval_pv
#endif
#define Perl_eval_pv DPPP_(my_eval_pv)
#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
SV*
DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
{
dSP;
SV* sv = newSVpv(p, 0);
PUSHMARK(sp);
SPAGAIN;
sv = POPs;
PUTBACK;
if (croak_on_error && SvTRUE(GvSV(errgv)))
croak(SvPVx(GvSV(errgv), na));
return sv;
}
view all matches for this distribution
view release on metacpan or search on metacpan
BreakOverlappingRectangles.xs view on Meta::CPAN
void
_break_rectangles(rects)
AV *rects;
CODE:
if (SvMAGICAL((SV*)rects))
Perl_croak(aTHX_ "internal error: unacceptable magic AV found");
_break(aTHX_ rects, 0, (AV*)sv_2mortal((SV*)newAV()));
view all matches for this distribution
view release on metacpan or search on metacpan
eg/bucketize view on Meta::CPAN
wienerschnitzel 03.avi wienerschnitzel 05.avi wienerschnitzel 07.avi
./002:
wienerschnitzel 08.avi wienerschnitzel 09.avi
It is an error if a numbered directory already exists, make sure you
start with a clean slate.
=head1 EXAMPLES
$ bucketize *.jpg
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Burg.pm view on Meta::CPAN
=head1 DESCRIPTION
The L<Algorithm::Burg> module uses the Burg method to fit an autoregressive (AR)
model to the input data by minimizing (least squares) the forward and backward
prediction errors while constraining the AR parameters to satisfy the
Levinson-Durbin recursion.
B<DISCLAIMER: This is work in progress! The code is buggy and the interface is subject to change.>
=head1 ATTRIBUTES
view all matches for this distribution
view release on metacpan or search on metacpan
t/005_order_disagreement.t view on Meta::CPAN
Algorithm::C3::merge('Z' => sub {
no strict 'refs';
@{$_[0] . '::ISA'};
})
};
like($@, qr/^Inconsistent hierarchy/, '... got the right error with an inconsistent hierarchy');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $constname;
our $AUTOLOAD;
($constname = $AUTOLOAD) =~ s/.*:://;
croak "&Algorithm::CP::IZ::constant not defined" if $constname eq 'constant';
my ($error, $val) = constant($constname);
if ($error) { croak $error; }
{
no strict 'refs';
# Fixed between 5.005_53 and 5.005_61
#XXX if ($] >= 5.00561) {
#XXX *$AUTOLOAD = sub () { $val };
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
# Autoload methods go after =cut, and are processed by the autosplit program.
my $Instances = 0;
sub _report_error {
my $msg = shift;
croak __PACKAGE__ . ": ". $msg;
}
sub new {
my $class = shift;
if ($Instances > 0) {
_report_error("another instance is working.");
}
Algorithm::CP::IZ::cs_init();
$Instances++;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub restore_context {
my $self = shift;
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("restore_context: bottom of context stack");
}
Algorithm::CP::IZ::cs_restoreContext();
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
validate([$label], ["I"],
"Usage: restore_context_until(int_label)");
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("restore_context_until: invalid label");
}
Algorithm::CP::IZ::cs_restoreContextUntil($label);
}
sub forget_save_context {
my $self = shift;
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("forget_save_context: bottom of context stack");
}
Algorithm::CP::IZ::cs_forgetSaveContext();
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
validate([$label], ["I"],
"Usage: forget_save_context_until(int_label)");
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("forget_save_context_until: invalid label");
}
Algorithm::CP::IZ::cs_forgetSaveContextUntil($label);
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
sub accept_context {
my $self = shift;
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("accept_context: bottom of context stack");
}
Algorithm::CP::IZ::cs_acceptContext();
# pop must be after cs_acceptContext to save cs_backtrack context.
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
validate([$label], ["I"],
"Usage: accept_context_until(int_label)");
my $cxt = $self->{_cxt};
if (@$cxt == 0) {
_report_error("accept_context_until: invalid label");
}
while (@$cxt >= $label) {
Algorithm::CP::IZ::cs_acceptContext();
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
elsif (ref $p1 && ref $p1 eq 'ARRAY') {
$name = shift;
$ptr = $self->_create_int_from_domain($p1);
unless ($ptr) {
my $param_str = join(", ", @$p1);
_report_error("cannot create variable from [$param_str]");
}
}
else {
my $min = $p1;
my $max = shift;
$name = shift;
$ptr = $self->_create_int_from_min_max($min, $max);
unless ($ptr) {
my $param_str = join(", ", $min, $max);
_report_error("cannot create variable from ($param_str)");
}
}
my $ret = Algorithm::CP::IZ::Int->new($ptr);
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
if (exists $checker{$k}) {
my $func = $checker{$k};
&$func($params->{$k});
}
else {
_report_error("search: Unknown Key $k in params");
}
}
return 1;
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
"Usage: search([variables], {key=>value,...}");
my $array = [map { $$_ } @$var_array];
my $max_fail = -1;
my $find_free_var_id = 0;
my $find_free_var_func = sub { die "search: Internal error"; };
my $criteria_func;
my $value_selectors;
my $max_fail_func;
my $ngs;
my $notify;
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
if (exists $checker{$k}) {
my $func = $checker{$k};
&$func($params->{$k});
}
else {
_report_error("find_all: Unknown Key $k in params");
}
}
return 1;
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
"find_all: usage: find_all([vars], &callback_func, {params})");
my $array = [map { $$_ } @$var_array];
my $find_free_var_id = 0;
my $find_free_var_func = sub { die "find_all: Internal error"; };
if ($params->{FindFreeVar}) {
my $ffv = $params->{FindFreeVar};
if (ref $ffv) {
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $self = shift;
my @params = @_;
my $usage_msg = 'usage: Add(v1, v2, ...)';
if (@params < 1) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $self = shift;
my @params = @_;
my $usage_msg = 'usage: Mul(v1, v2, ...)';
if (@params < 1) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $self = shift;
my @params = @_;
my $usage_msg = 'usage: Sub(v1, v2, ...)';
if (@params < 1) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
lib/Algorithm/CP/IZ.pm view on Meta::CPAN
my $self = shift;
my @params = @_;
my $usage_msg = 'usage: Div(v1, v2)';
if (@params != 2) {
_report_error($usage_msg);
}
for my $v (@params) {
validate([$v], ["V"], $usage_msg);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/test.data view on Meta::CPAN
power NN B
, , O
but CC O
a DT B
single JJ I
error NN I
on IN O
his PRP$ B
part NN I
could MD O
cost VB O
t/test.data view on Meta::CPAN
hands NNS I
can MD O
become VB O
vehicles NNS B
of IN O
terror NN B
. . O
An DT B
adept JJ I
bicyclist NN I
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits.pm view on Meta::CPAN
=head2 CheckDigits($method)
Returns an object of an appropriate Algorithm::CheckDigits class for the
given algorithm.
Dies with an error message if called with an unknown algorithm.
See below for the available algorithms. Every object understands the following
methods:
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
return
unless system( 'sudo', $^X, $0, "--config=$config",
"--installdeps=$missing" );
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
view all matches for this distribution
view release on metacpan or search on metacpan
0.01 Thu Apr 11 19:19:59 2013
- original version; created by h2xs 1.23 with options
-X -n Algorithm
0.02 Thu Apr 11 23:58:06 IST 2013
- Removed the POD errors
0.03 Sat Jun 1 20:13:30 2013
- Removed Quick sorting of array before searching in Binary Search
- Improved Subroutine of Binary Search
0.04 Monday May 5 22:12:30 2014
- Corrected Makefile.PL
view all matches for this distribution