view release on metacpan or search on metacpan
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).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AC/ISOTime.pm view on Meta::CPAN
sub timeiso {
my $iso = shift;
return unless $iso;
$iso =~ s/^\s+//g; # Ensure no leading spaces can throw off the split
my($date, $time) = split /T|\s/, $iso, 2;
$time =~ s/\s//g;
$time ||= '00:00:00Z';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AC/Yenta/Store/Map.pm view on Meta::CPAN
return 1 if @versions < $cf->{history};
# I can make room for it?
return 1 if $v gt $versions[-1];
# I'll just throw it away.
return;
}
sub put {
my $me = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
}
is( ACME::THEDANIEL::Utils::sum( 1, 2, 3, 4 ), 10, "multiple numbers sum" );
is( ACME::THEDANIEL::Utils::sum( 1 ), 1, "single number sum" );
throws_ok( sub { ACME::THEDANIEL::Utils::sum( 1, 2, "Three" ) }, qr/Invalid input: Three/, "One bad arg out of many");
throws_ok( sub { ACME::THEDANIEL::Utils::sum( "Three" ) }, qr/Invalid input: Three/, "invalid single input");
is( ACME::THEDANIEL::Utils::sum(), undef, "empty input" );
view all matches for this distribution
view release on metacpan or search on metacpan
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).
view all matches for this distribution
view release on metacpan or search on metacpan
t/10-basic.t view on Meta::CPAN
use Test::More tests => 9;
use Test::Exception;
use AE::AdHoc;
throws_ok {
ae_recv { ; } 0.01;
} qr(Timeout), "empty body => reach timeout => die";
lives_and {
is ((ae_recv { ae_send->(137); } 0.01), 137 );
} "plain ae_send is fine";
throws_ok {
ae_send;
} qr(outside), "outside = no go";
throws_ok {
ae_begin;
} qr(outside), "outside = no go";
my $timer;
throws_ok {
ae_recv {
$timer = AnyEvent->timer( after => 0.1, cb => ae_send );
note "timer ref = $timer";
} 0.01;
} qr(Timeout), "Start rotten timer test";
# check that later-on callback generates a warning
{
my @warn;
local $SIG{__WARN__} = sub { push @warn, @_ };
throws_ok {
ae_recv { ; } 0.2;
} qr(Timeout), "Rotten timer didn't spoil later tests:";
is (scalar @warn, 1, " - 1 warning issued");
like ($warn[0], qr(Leftover), " - It was about 'Leftover': $warn[0]");
ok (ref $timer, " - Rotten timer still alive at this point (but harmless): $timer");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AFS/PAG.pm view on Meta::CPAN
=item setpag()
Creates a new, empty PAG and put the current process in it. This should
normally be called before obtaining new AFS tokens to isolate those tokens
from other processes on the system. Returns true on success and throws
an exception on failure.
=item unlog()
Deletes all AFS tokens in the current PAG, similar to the action of
B<kdestroy> on a Kerberos ticket cache. Returns true on success and
throws an exception on failure.
=back
=head1 DIAGNOSTICS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Categorizer/Learner.pm view on Meta::CPAN
a statistical summary of the results.
=item knowledge_set()
Gets/sets the internal C<knowledge_set> member. Note that since the
knowledge set may be enormous, some Learners may throw away their
knowledge set after training or after restoring state from a file.
=item $learner-E<gt>save_state($path)
Saves the Learner for later use. This method is inherited from
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/DecisionTree.pm view on Meta::CPAN
C<train()> method when "noisy" data is encountered. Here "noisy"
means that two or more training instances contradict each other, such
that they have identical attributes but different results.
If C<noise_mode> is set to C<fatal> (the default), the C<train()>
method will throw an exception (die). If C<noise_mode> is set to
C<pick_best>, the most frequent result at each noisy node will be
selected.
=item prune
view all matches for this distribution
view release on metacpan or search on metacpan
t/10migration.t view on Meta::CPAN
BEGIN { $num_tests = 0; };
plan tests => $num_tests;
# constructor
throws_ok(sub { AI::Evolve::Befunge::Migrator->new() }, qr/'Local' parameter/, 'dies without Local');
BEGIN { $num_tests += 1 };
my $quit1 = "q";
my $scorer1 = "[ @]02M^]20M^]11M^" . (' 'x605);
view all matches for this distribution
view release on metacpan or search on metacpan
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).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/FuzzyEngine.pm view on Meta::CPAN
my $val = $var_a->defuzzify(); # $var_a returns a 1dim piddle with two elements
So do the fuzzy operations as provided by the fuzzy engine C<$fe> itself.
Any operation on more then one piddle expands those to common
dimensions, if possible, or throws a PDL error otherwise.
The way expansion is done is best explained by code
(see C<< AI::FuzzyEngine->_cat_array_of_piddles(@pdls) >>).
Assuming all piddles are in C<@pdls>,
calculation goes as follows:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MXNet/Executor.pm view on Meta::CPAN
aux_params : Maybe[HashRef[AI::MXNet::NDArray]], optional
Parameters, hash ref of name to NDArray of auxiliary states.
allow_extra_params : boolean, optional
Whether to allow extra parameters that are not needed by symbol
If this is True, no error will be thrown when arg_params or aux_params
contain extra parameters that is not needed by the executor.
=cut
method copy_params_from(
HashRef[AI::MXNet::NDArray] $arg_params,
view all matches for this distribution
view release on metacpan or search on metacpan
t/10nn_simple.t view on Meta::CPAN
use_ok($CLASS) || die;
};
can_ok($CLASS, 'new');
throws_ok {$CLASS->new}
qr/^\QYou must supply three positive integers to new()\E/,
'... and calling it without arguments should die';
throws_ok {$CLASS->new(qw/foo bar 2/)}
qr/^\QArguments to new() must be positive integers\E/,
'... and supplying new() with bad arguments should also die';
my $net = $CLASS->new(2,1,2);
ok($net, 'Calling new with good arguments should succeed');
isa_ok($net, $CLASS => '...and the object it returns');
can_ok($net, 'learn_rate');
throws_ok {$net->learn_rate(2)}
qr/^\QLearn rate must be between 0 and 1, exclusive\E/,
'... and setting it outside of legal boundaries should die';
is(sprintf("%.1f", $net->learn_rate), "0.2", '... and it should have the correct learn rate');
isa_ok($net->learn_rate(.3), $CLASS => '... and setting it should return the object');
is(sprintf("%.1f", $net->learn_rate), "0.3", '... and should set it correctly');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
while ( $num_solved_in_iter == 0 )
{
my $q_more = $self->_get_next_quota();
if ( !defined($q_more) )
{
AI::Pathfinding::OptimizeMultiple::Error::OutOfQuotas->throw(
error => "No q_more", );
}
$iters_quota += $q_more;
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
while ( $num_solved_in_iter == 0 )
{
my $q_more = $self->_get_next_quota();
if ( !defined($q_more) )
{
AI::Pathfinding::OptimizeMultiple::Error::OutOfQuotas->throw(
error => "No q_more", );
}
$iters_quota += $q_more;
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
while ( $num_solved_in_iter == 0 )
{
my $q_more = $self->_get_next_quota();
if ( !defined($q_more) )
{
AI::Pathfinding::OptimizeMultiple::Error::OutOfQuotas->throw(
error => "No q_more" );
}
$iters_quota += $q_more;
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
$self->_total_boards_solved(0);
$self->_total_iters(0);
$self->_status("iterating");
# $self->_inspect_quota() throws ::Error::OutOfQuotas if
# it does not have any available quotas.
eval {
while ( $self->_status() eq "iterating" )
{
$self->_inspect_quota();
lib/AI/Pathfinding/OptimizeMultiple.pm view on Meta::CPAN
else
{
$err = Exception::Class->caught();
if ($err)
{
if ( not( blessed $err && $err->can('rethrow') ) )
{
die $err;
}
$err->rethrow;
}
}
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/TensorFlow/Libtensorflow/Tensor.pm view on Meta::CPAN
$data,
$deallocator_ptr, $deallocator_arg,
);
# Return early if no TF_Tensor created
# TODO should this throw an exception instead?
return unless $obj;
$obj->{_deallocator_closure} = $deallocator_closure;
$obj;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/XGBoost/CAPI.pm view on Meta::CPAN
#
sub _CheckCall {
my ($return_code) = @_;
if ($return_code) {
my $error_message = AI::XGBoost::CAPI::RAW::XGBGetLastError();
XGBoostException->throw( error => $error_message );
}
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ALPM.pod view on Meta::CPAN
$alpm->set_defsiglvl({ 'pkg' => 'optional', 'db' => 'required trustall' });
$alpm->set_defsiglvl({ 'pkg' => 'required', 'db' => 'optional' });
=head1 ERRORS
In previous version of this module, errors were thrown automatically. Since then,
errors are no longer stored in a global variable (like UNIX's errno) but are instead
stored inside of the libalpm handle structure. In order to preserve the old functionality
I will have to either store a copy of the ALPM object inside every other object or use
the internal C representation which I'm technically not supposed to know.
lib/ALPM.pod view on Meta::CPAN
$db->force_update or die $alpm->strerror;
This is annoying but not unlike most other perl error checking. If you find yourself
calling methods on an undefined value then an error most likely occurred.
But wait there's more! Errors are actually thrown when getting/setting options and
an error condition occurs.
=head1 SEE ALSO
=over
view all matches for this distribution
view release on metacpan or search on metacpan
doc/examples/basic/basicservices/DataEcho.pm view on Meta::CPAN
All AMF::Perl service classes must define the method table, where the user can supply optional description and return type.
If you want to return an error message, handled by functionName_onStatus in the Flash client (as opposed to functionName_onResult, which is normal), include
use AMF::Perl qw/amf_throw/;
and then call amf_throw() with a string or an arbitrary object as a parameter.
==head1 CHANGES
Tue Jul 6 22:06:56 EDT 2004
Added exception throwing via amf_throw().
Sun Apr 6 14:24:00 EST 2003
Created after AMF-PHP.
=cut
use AMF::Perl qw/amf_throw/;
sub new
{
doc/examples/basic/basicservices/DataEcho.pm view on Meta::CPAN
{
my ($self, $data) = @_;
return $data;
}
#This function will NOT return the value, because the call to amf_throw() will interrupt
#the control flow and cause the _Status function on the client to be called.
sub generateError
{
my ($self, $data) = @_;
amf_throw("An error!!!");
return "No error";
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Client.pm view on Meta::CPAN
# no retry necessary
last if $ok;
}
# throw exception if fatal is truthy
if ($req && $res && $self->fatal && !$ok) {
my $code = $res->code;
$self->stash(tx => $tx);
$self->throw([$code, uc "${code}_http_response"]);
}
# return transaction
return $tx;
}
lib/API/Client.pm view on Meta::CPAN
superclass, this module does not map specific HTTP requests to specific
routines, nor does it provide parameter validation, pagination, or other
conventions found in typical API client implementations; Instead, it simply
provides a simple and consistent mechanism for dynamically generating HTTP
requests. Additionally, this module has support for debugging and retrying API
calls as well as throwing exceptions when 4xx and 5xx server response codes are
returned.
=cut
=head1 INTEGRATES
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_main.t view on Meta::CPAN
# Failures
{ #
method => 'location',
params => {},
throws => 1,
throws_regex => qr/Missing path parameter: name/,
},
{ #
method => 'departure_board',
params => { id => '8596008' },
throws => 1,
throws_regex => qr/Missing query parameter: date/,
}
);
for (@uri_tests) {
my ( $method, %params ) = ( $_->{method}, %{ $_->{params} } );
if ( $_->{throws} ) {
throws_ok { $fahrplan_free->_create_uri( $method, %params ) }
$_->{throws_regex}, 'error thrown successfully'
and next;
}
my ( undef, $uri ) = $fahrplan_free->_create_uri( $method, %params );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Drip/Request.pm view on Meta::CPAN
=head1 DESCRIPTION
Low-level perl interface to the Drip API as specified at https://www.getdrip.com/docs/rest-api
All of the methods in this module will throw exceptions on error.
=head1 SUBROUTINES/METHODS
=head2 new()
view all matches for this distribution
view release on metacpan or search on metacpan
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).
view all matches for this distribution
view release on metacpan or search on metacpan
t/04_errors.t view on Meta::CPAN
},
);
foreach $test (@tests) {
$test->{ error } = '.+' if (not defined $test->{ error });
throws_ok(
sub { ARGV::Struct->new(argv => $test->{ argv })->parse },
qr/$test->{ error }/,
"Conformance of " . join ' ', @{ $test->{ argv } }
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
html/manual/OO/form.html view on Meta::CPAN
@vals = $f->getEnumValues(-field => scalar string);
</PRE>
This function returns a list of enumeration values (labels)
for a given field. If the field is not an enumeration field,
an exception is thrown (type=ERROR, num=81006).
<P>
<DT><A NAME="getFieldType"><B>getFieldType()</B></A>
<PRE>
$type = $f->getFieldType(-name => scalar string,
view all matches for this distribution
view release on metacpan or search on metacpan
applications/tools/resources/CalendarPopup-combined.js view on Meta::CPAN
for (var i=0; i<this.monthAbbreviations.length; i++) {
window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthAbbreviations[i];
}
}
}
// Temporary default functions to be called when items clicked, so no error is thrown
function CP_tmpReturnFunction(y,m,d) {
if (window.CP_targetInput!=null) {
var dt = new Date(y,m-1,d,0,0,0);
if (window.CP_calendarObject!=null) { window.CP_calendarObject.copyMonthNamesToWindow(); }
window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ASP4/FileUpload.pm view on Meta::CPAN
=head1 PUBLIC METHODS
=head2 SaveAs( $path )
Writes the contents of the uploaded file to C<$path>. Will throw an exception if
something goes wrong.
=head1 BUGS
It's possible that some bugs have found their way into this release.
view all matches for this distribution
view release on metacpan or search on metacpan
t/bin/mock-aws view on Meta::CPAN
open my $fh, "<", $counter_file or die "Cannot open $counter_file for read: $!";
my $counter = <$fh>;
close $fh;
# This logic is the opposite of usual retries: we throw an error for the counter
# number of times and then proceed normally after.
if ($counter-- > 0) {
open $fh, ">", $counter_file or die "Cannot open $counter_file for write: $!";
print $fh $counter;
close $fh;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AWS/Lambda/Quick/Upload.pm view on Meta::CPAN
);
$self->debug('function congifuration updated');
return $result->{FunctionArn};
}
# just like $self->aws->$method but throws exception on error
sub aws_do {
my $self = shift;
my $method = shift;
my $aws = $self->aws;
my $result = $aws->$method(@_);
return $result if defined $result;
# uh oh, something went wrong, throw exception
## no critic (ProhibitPackageVars)
my $code = $AWS::CLIWrapper::Error->{Code};
my $message = $AWS::CLIWrapper::Error->{Message};
view all matches for this distribution