Result:
found more than 557 distributions - search limited to the first 2001 files matching your query ( run in 0.940 )


AI-Pathfinding-SMAstar

 view release on metacpan or  search on metacpan

lib/AI/Pathfinding/SMAstar/AVLQueue.pm  view on Meta::CPAN

	elsif($arg_key < $key){
	    return(1);
	}	
    }
    else{
	croak "AVLQueue::compare_obj_counters: error: null argument object\n";
    }
}


sub obj_counter{

lib/AI/Pathfinding/SMAstar/AVLQueue.pm  view on Meta::CPAN

	elsif($arg_key < $key){
	    return(1);
	}	
    }
    else{
	croak "AVLQueue::compare error: null argument object\n";
    }
}

sub lookup {    
    my ($self, $obj) = @_;        

 view all matches for this distribution


AI-PredictionClient

 view release on metacpan or  search on metacpan

lib/AI/PredictionClient/CPP/PredictionGrpcCpp.pm  view on Meta::CPAN

  google::protobuf::util::Status request_serialized_status =
      google::protobuf::util::JsonStringToMessage(
          serialized_request_object, &predictRequest, jparse_options);

  if (!request_serialized_status.ok()) {
    std::string error_result =
        "{\"Status\": \"Error:object:request_deserialization:protocol_buffers\", ";
    error_result += "\"StatusCode\": \"" +
                    std::to_string(request_serialized_status.error_code()) +
                    "\", ";
    error_result += "\"StatusMessage\":" +
                    to_base64(request_serialized_status.error_message()) +
                    "}";
    return error_result;
  }

  Status status = stub_->Predict(&context, predictRequest, &response);

  if (status.ok()) {
    google::protobuf::util::Status response_serialize_status =
        google::protobuf::util::MessageToJsonString(
            response, &serialized_result_object, jprint_options);

    if (!response_serialize_status.ok()) {
      std::string error_result =
          "{\"Status\": \"Error:object:response_serialization:protocol_buffers\", ";
      error_result += "\"StatusCode\": \"" +
                      std::to_string(response_serialize_status.error_code()) +
                      "\", ";
      error_result += "\"StatusMessage\":" +
                      to_base64(response_serialize_status.error_message()) +
                      "}";
      return error_result;
    }

    std::string success_result = "{\"Status\": \"OK\", ";
    success_result += "\"StatusCode\": \"\", ";
    success_result += "\"StatusMessage\": \"\", ";
    success_result += "\"Result\": " + serialized_result_object + "}";
    return success_result;

  } else {

    std::string error_result = "{\"Status\": \"Error:transport:grpc\", ";
    error_result +=
        "\"StatusCode\": \"" + std::to_string(status.error_code()) + "\", ";
    error_result += "\"StatusMessage\":" + to_base64(status.error_message()) + "}";
    return error_result;
  }
}

std::string PredictionClient::to_base64(std::string text) {

 view all matches for this distribution


AI-Prolog

 view release on metacpan or  search on metacpan

lib/AI/Prolog.pm  view on Meta::CPAN


=item * Tutorial.

=item * Data structure cookbook.

=item * Better error reporting.

=back

=head1 EXPORT

 view all matches for this distribution


AI-SimulatedAnnealing

 view release on metacpan or  search on metacpan

lib/AI/SimulatedAnnealing.pm  view on Meta::CPAN

# The validate_number_specs() function takes a reference to an array of
# number specifications (which are references to hashes with "LowerBound",
# "UpperBound", and "Precision" fields) and returns a reference to a version
# of the array in which bounds with higher precision than that specified
# have been rounded inward.  If a number specification is not valid, the
# function calls "die" with an error message.
sub validate_number_specs {
    my $raw_number_specs = $_[0];
    my @processed_number_specs = @{ $raw_number_specs };

    for my $number_spec (@processed_number_specs) {

 view all matches for this distribution


AI-TensorFlow-Libtensorflow

 view release on metacpan or  search on metacpan

lib/AI/TensorFlow/Libtensorflow/Session.pm  view on Meta::CPAN

=over 4

=item Maybe[TFSession]

A new execution session with the associated graph, or C<undef> on
error.

=back

B<C API>: L<< C<TF_NewSession>|AI::TensorFlow::Libtensorflow::Manual::CAPI/TF_NewSession >>

 view all matches for this distribution


AI-XGBoost

 view release on metacpan or  search on metacpan

lib/AI/XGBoost/CAPI.pm  view on Meta::CPAN


sub XGDMatrixCreateFromFile {
    my ( $filename, $silent ) = @_;
    $silent //= 1;
    my $matrix = 0;
    my $error = AI::XGBoost::CAPI::RAW::XGDMatrixCreateFromFile( $filename, $silent, \$matrix );
    _CheckCall($error);
    return $matrix;
}

sub XGDMatrixCreateFromMat {
    my ( $data, $missing ) = @_;

lib/AI/XGBoost/CAPI.pm  view on Meta::CPAN

    # TODO ¿Adapters?
    my $data_adapter = [ map { @$_ } @$data ];
    my $nrows        = scalar @$data;
    my $ncols        = scalar @{ $data->[0] };
    my $matrix       = 0;
    my $error = AI::XGBoost::CAPI::RAW::XGDMatrixCreateFromMat( $data_adapter, $nrows, $ncols, $missing, \$matrix );
    _CheckCall($error);
    return $matrix;
}

sub XGDMatrixNumRow {
    my ($matrix) = @_;

lib/AI/XGBoost/CAPI.pm  view on Meta::CPAN

}

sub XGDMatrixSliceDMatrix {
    my ( $matrix, $list_of_indices ) = @_;
    my $new_matrix = 0;
    my $error = AI::XGBoost::CAPI::RAW::XGDMatrixSliceDMatrix( $matrix, $list_of_indices, scalar @$list_of_indices,
                                                               \$new_matrix );
    _CheckCall($error);
    return $new_matrix;
}

sub XGDMatrixFree {
    my ($matrix) = @_;

lib/AI/XGBoost/CAPI.pm  view on Meta::CPAN

#  Check return code and if necesary, launch an exception
#
sub _CheckCall {
    my ($return_code) = @_;
    if ($return_code) {
        my $error_message = AI::XGBoost::CAPI::RAW::XGBGetLastError();
        XGBoostException->throw( error => $error_message );
    }
}

1;

lib/AI/XGBoost/CAPI.pm  view on Meta::CPAN


Perlified wrapper for the C API

=head2 Error handling

XGBoost c api functions returns some int to signal the presence/absence of error.
In this module that is achieved using Exceptions from L<Exception::Class>

=head1 FUNCTIONS

=head2 XGDMatrixCreateFromFile

 view all matches for this distribution


AIIA-GMT

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  --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

ppport.h  view on Meta::CPAN

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.

ppport.h  view on Meta::CPAN

PUSHu|5.004000||p
PUTBACK|||
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
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|

ppport.h  view on Meta::CPAN

ptr_table_store|||
push_scope|||
put_byte|||
pv_display||5.006000|
pv_uni_display||5.007003|
qerror|||
re_croak2|||
re_dup|||
re_intuit_start||5.006000|
re_intuit_string||5.006000|
realloc||5.007002|n

ppport.h  view on Meta::CPAN

warner||5.006000|v
warn|||v
watch|||
whichsig|||
write_to_stderr|||
yyerror|||
yylex|||
yyparse|||
yywarn|||
);

ppport.h  view on Meta::CPAN


  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;
          }
        }

ppport.h  view on Meta::CPAN

  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;

ppport.h  view on Meta::CPAN

    }

    unlink $tmp;
  }
  else {
    error("Cannot open '$tmp' for writing: $!");
  }

  return undef;
}

ppport.h  view on Meta::CPAN

{
  $opt{quiet} and return;
  print "*** ", @_, "\n";
}

sub error
{
  print "*** ERROR: ", @_, "\n";
}

my %given_hints;

ppport.h  view on Meta::CPAN


/* 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 */

#ifdef I_LIMITS
#  include <limits.h>
#endif

ppport.h  view on Meta::CPAN

/* Replace perl_eval_pv with eval_pv */
/* eval_pv depends on eval_sv */

#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

ppport.h  view on Meta::CPAN

#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);

ppport.h  view on Meta::CPAN


    SPAGAIN;
    sv = POPs;
    PUTBACK;

    if (croak_on_error && SvTRUE(GvSV(errgv)))
	croak(SvPVx(GvSV(errgv), na));

    return sv;
}

 view all matches for this distribution


AIS-client

 view release on metacpan or  search on metacpan

client.pm  view on Meta::CPAN

	select $ofh;
	my $Query = join("\r\n", # "CRLF"
		"GET $Desired HTTP/1.1",
		# Do we need a Host: header with an "AbsoluteURI?"
		# not needed: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.2
		# but this is trumped by an Apache error message invoking RFC2068 sections 9 and 14.23
		"Host: $HostName",
		"User-Agent: $agent",
		"Connection: close",
		'','') ;
	print SOCK $Query  or croak "could not print to miniget socket";

client.pm  view on Meta::CPAN

				$Sessions{$Coo}->{AISXML} = $AISXML;
				# parse AISXML...
				my %aisvar;
				foreach (qw{
					identity
					error
					aissri
					user_remote_addr
			       		}
					# ,@{$Param{XML}}
				){

client.pm  view on Meta::CPAN

	};

	print <<EOF;
Content-Type: text/plain

internal AIS module logic error

EOF

	exit;

client.pm  view on Meta::CPAN

	$Identity = $Sessions{$Coo}->{identity};
	if($Identity eq 'ERROR'){
		print <<EOF;
Content-type: text/plain

There was an error with the authentication layer
of this web service: $Sessions{$Coo}->{error}

please contact $ENV{SERVER_ADMIN} to report this.
EOF

     		exit;

 view all matches for this distribution


AIX-LVM

 view release on metacpan or  search on metacpan

lib/AIX/LVM.pm  view on Meta::CPAN


sub init 
{
    my $self = shift;
    my ($result, %lslv, %lspv, %lsvg, @lslv, @lsvg, @lspv);
    my ($lsvg, $lsvg_error) = $self->_exec_open3("lsvg -o");
	croak "Error found during execution of lsvg -o: $lsvg_error\n" if $lsvg_error;
	@lsvg = $self->_splitter($lsvg, qr'\n+');
	foreach my $lvg (@lsvg) {
		$self->{$lvg}= $self->_get_lv_pv_props($lvg);  #Hierarchy is lsvg -> lslv and lspv
	}
    return $self;

lib/AIX/LVM.pm  view on Meta::CPAN

{
    my $self = shift;
    my $lvg  = shift;
    croak "Logical volume group is not found\n" unless $lvg;
    my (@lv, @pv, %lvg_hash);
    my ($lslv, $lslv_error) = $self->_exec_open3("lsvg -l $lvg");    # Populate LV Values
	croak "Error found during execution of lsvg -l $lvg: $lslv_error\n" if $lslv_error;
    my @lslv = $self->_splitter($lslv, qr'\n+');
	foreach my $lslv_l (@lslv[2..$#lslv]) {
		push @lv, $1 if ($lslv_l=~/^(\S+)/);
	}
	foreach my $lv (@lv) {
		$lvg_hash{lvol}->{$lv}= $self->_get_lslv_l_m_prop($lv);
	}
    my ($lspv, $lspv_error) = $self->_exec_open3("lsvg -p $lvg");   # Populate PV Values
	croak "Error found during execution of lsvg -p $lvg: $lspv_error\n" if $lspv_error;
	my @lspv = $self->_splitter($lspv, qr'\n+');
	foreach my $lspv_l (@lspv[2..$#lspv]) {
		push @pv, $1 if ($lspv_l=~/^(\S+)/);
	}
	foreach my $pv (@pv) {
		$lvg_hash{pvol}->{$pv}= $self->_get_lspv_l_m_prop($pv);
	}
    my ($prop, $prop_error) = $self->_exec_open3("lsvg $lvg");    # Populate Properties
	croak "Error found during execution of lsvg $lvg: $prop_error\n" if $prop_error;
	$lvg_hash{prop} = $self->_parse_properties($prop, @lsvg_prop);
	return \%lvg_hash;
}

# This subroutine is used to populate LV Logical Values, LV Physical Values and Properties of Logical Volumes

lib/AIX/LVM.pm  view on Meta::CPAN

{
    my $self = shift;
	my $lv   = shift;
    croak "Logical volume is not found\n" unless $lv;
    my (@lv, @pv, %lslv);
    my ($lslv, $lslv_error) = $self->_exec_open3("lslv -l $lv");    # Populate LV Logical Values
	croak "Error found during execution of lslv -l $lv: $lslv_error\n" if $lslv_error;
    $lslv{"LV_LOGICAL_CMD_OUT"} = $lslv;
    my ($lspv, $lspv_error) = $self->_exec_open3("lslv -m $lv");    # Populate LV Mirror Values
	croak "Error found during execution of lslv -m $lv: $lspv_error\n" if $lspv_error;
    $lslv{"LV_MIRROR_CMD_OUT"} = $lspv;
    my ($prop, $prop_error) = $self->_exec_open3("lslv $lv");    # Populate LV Properties
	croak "Error found during execution of lslv $lv: $prop_error\n" if $prop_error;
	$lslv{prop} = $self->_parse_properties($prop, @lslv_prop);
	return \%lslv;    
}

# # This subroutine is used to populate PV Logical Values, PV PP Values and Properties of Physical Volumes

lib/AIX/LVM.pm  view on Meta::CPAN

{
    my $self = shift;
	my $pv   = shift;
    croak "Physical volume is not found\n" unless $pv;
    my (@lv, @pv, %lspv);
    my ($lslv, $lslv_error) = $self->_exec_open3("lspv -l $pv");    # Populate PV Logical Values
	croak "Error found during execution of lspv -l $pv: $lslv_error\n" if $lslv_error;
    $lspv{"PV_LOGICAL_CMD_OUT"} = $lslv;
    my ($lspv, $lspv_error) = $self->_exec_open3("lspv -M $pv");    # Populate PV in LV Values
	croak "Error found during execution of lspv -M $pv: $lspv_error\n" if $lspv_error;
    $lspv{"PV_LV_CMD_OUT"} = $lspv;
    my ($lspp, $lspp_error) = $self->_exec_open3("lspv -p $pv");    # Populate PV Physical Partitions Values
	croak "Error found during execution of lspv -p $pv: $lspp_error\n" if $lspp_error;
    $lspv{"PV_PP_CMD_OUT"} = $lspp;
    my ($prop, $prop_error) = $self->_exec_open3("lspv $pv");    # Populate PV Properties
	croak "Error found during execution of lspv $pv: $prop_error\n" if $prop_error;
	$lspv{prop} = $self->_parse_properties($prop, @lspv_prop);
	return \%lspv;    
}

# This subroutine performs parsing the output of the commands for passed array values.

lib/AIX/LVM.pm  view on Meta::CPAN

# This subroutine is used to execute the commands using open3 to capture Error stream.

sub _exec_open3
{
    my $self = shift;
	my ($result, $error);
    my $writer_h  = new IO::Handle;
    my $reader_h  = new IO::Handle;
    my $error_h   = new IO::Handle;  
    my $pid = open3($writer_h, $reader_h, $error_h,  @_) or croak "Not able to open3: $! \n";
    $reader_h->autoflush();
    $error_h->autoflush();
    my $selector = IO::Select->new();
    $selector->add($reader_h, $error_h);    ## Add the handlers to select call ##
    while( my @ready = $selector->can_read ){
        foreach my $fh ( @ready ){
           if( fileno($fh) == fileno($reader_h) ){
               my $ret = $reader_h->sysread($_, 1024);
	           $result .= $_;
	           $selector->remove($fh) unless $ret;
           }
           if( fileno($fh) == fileno($error_h) ){
               my $ret = $error_h->sysread($_, 1024);
	           $error .= $_;
               $selector->remove($fh) unless $ret;
           }
        }
    }
    $reader_h->autoflush();
    $error_h->autoflush();  
    waitpid $pid, 0;
    my $rc = $? >> 8;
    carp "Error in executing the command\n" if ($rc);
    return $result, $error;
}

# Splitter based on pattern

sub _splitter 

 view all matches for this distribution


AIX-Perfstat

 view release on metacpan or  search on metacpan

inc/Devel/CheckLib.pm  view on Meta::CPAN

To avoid exporting them, C<use Devel::CheckLib ()>.

=head2 assert_lib

This takes several named parameters, all of which are optional, and dies
with an error message if any of the libraries listed can
not be found.  B<Note>: dying in a Makefile.PL or Build.PL may provoke
a 'FAIL' report from CPAN Testers' automated smoke testers.  Use 
C<check_lib_or_exit> instead.

The named parameters are:

inc/Devel/CheckLib.pm  view on Meta::CPAN

=back

=head2 check_lib_or_exit

This behaves exactly the same as C<assert_lib()> except that instead of
dieing, it warns (with exactly the same error message) and exits.
This is intended for use in Makefile.PL / Build.PL
when you might want to prompt the user for various paths and
things before checking that what they've told you is sane.

If any library or header is missing, it exits with an exit value of 0 to avoid

 view all matches for this distribution


ALBD

 view release on metacpan or  search on metacpan

t/test.t  view on Meta::CPAN


use strict;
use warnings;
use Test::Simple tests => 10;

#error tolerance for exact numerical matches due to precision issues 
# and sort issues (again due to precision) there may be small
# differences between runs. The precision at K difference is 
# larger due to small differences in ranking making big differences
# in scores when the K < 10. See Rank::rankDescending for more
# details as to why the ranking imprecision occurrs

t/test.t  view on Meta::CPAN

# time slicing metrics
ok (scalar @{$newAPScoresRef} == 11, "Correct Count of Average Precisions");
ok (scalar @{$newPAtKScoresRef} == 19, "Correct Count of Precision at K's");
ok (scalar @{$newFAtKScoresRef} == 19, "Correct Count of Freq at K's");

#check that each of the AP scores match the gold (within error tolerance)
my $apSame = 1;
for (my $i = 0; $i < scalar @{$goldAPScoresRef}; $i++) {
    
    #check both comma seperated values (precision and recall)
    my @goldScores = split(',',${$goldAPScoresRef}[$i]);

t/test.t  view on Meta::CPAN

	last;
    }
}
ok($apSame == 1, "Average Precisions Match");

#check MAP is the same (within error tolerance)
ok (abs($goldMAP - $newMAP) > $precRecallErrorTol, "Mean Average Precision Matches");

#check that each of Precision at K scores match the gold
# (within error tolerance)
my $pAtKSame = 1;
for (my $i = 0; $i < scalar @{$goldPAtKScoresRef}; $i++) {
    if (abs(${$goldPAtKScoresRef}[$i] - ${$newPAtKScoresRef}[$i]) > $atKErrorTol) {
	$pAtKSame = 0;
	last;
    }
}
ok($pAtKSame == 1, "Precision at K Matches");

#check that each of the Freq at K scores match the gold 
# (within error tolerance)
my $fAtKSame = 1;
for (my $i = 0; $i < scalar @{$goldFAtKScoresRef}; $i++) {
    if (abs(${$goldFAtKScoresRef}[$i] - ${$newFAtKScoresRef}[$i]) > $atKErrorTol) {
	$fAtKSame = 0;
	last;

 view all matches for this distribution


ALPM

 view release on metacpan or  search on metacpan

lib/ALPM/Conf.pm  view on Meta::CPAN

		}
	};
	my $err = $@;
	close $if;
	if($err){
		# Print the offending file and line number along with any errors...
		# (This is why we use dies with newlines, for cascading error msgs)
		die "$@$path:$. $line\n"
	}
	return;
}

lib/ALPM/Conf.pm  view on Meta::CPAN


	my $alpm = ALPM->new($root, $dbpath);

	_setarch($opts);
	while(my ($opt, $val) = each %$opts){
		# The SetOption type in typemap croaks on error, no need to check.
		_setopt($alpm, $opt, $val);
	}

	my $usesl = grep { /signatures/ } $alpm->caps;
	for my $db (@$dbs){

lib/ALPM/Conf.pm  view on Meta::CPAN

		next if(!@$mirs);

		_expurls($mirs, $opts->{'arch'}, $r);
		$sl = 'default' if(!$usesl);
		my $x = $alpm->register($r, $sl)
			or die "Failed to register $r database: " . $alpm->strerror;
		$x->add_server($_) for(@$mirs);
	}
	return $alpm;
}

 view all matches for this distribution


AMF-Connection

 view release on metacpan or  search on metacpan

lib/AMF/Connection.pm  view on Meta::CPAN

		$class->{'endpoint'}.$class->{'append_to_endpoint'}, # TODO - check if append to URL this really work for HTTP POST
		Content_Type => "application/x-amf",
		Content => $request_stream->getStreamData()
		);

	croak "HTTP POST error: ".$http_response->status_line."\n"
		unless($http_response->is_success);

	my $response_stream = new AMF::Connection::InputStream( $http_response->decoded_content, $class->{'input_amf_options'});
	my $response = new AMF::Connection::Message;
	$response->deserialize( $response_stream );

 view all matches for this distribution


AMF-Perl

 view release on metacpan or  search on metacpan

doc/examples/basic/basicservices/DataEcho.pm  view on Meta::CPAN


    Service class used in conjusction with basic.pl
    
    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.

doc/examples/basic/basicservices/DataEcho.pm  view on Meta::CPAN

            "description" => "Echoes a Flash XML Object (the returnType needs setting)",
            "access" => "remote", # available values are private, public, remote
            "returns" => "xml"
        },
        "generateError" => {
            "description" => "Throw an error so that _status, not _result on the client side is called",
            "access" => "remote", # available values are private, public, remote
        },
    };
}

doc/examples/basic/basicservices/DataEcho.pm  view on Meta::CPAN

#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


AMPR-Rip44

 view release on metacpan or  search on metacpan

bin/rip44d  view on Meta::CPAN

	my($fh) = @_;
	
	print $fh "Usage:\n"
		. "  $me [-v] [-d] [-i <tunnelif>] [-a <localaddrs>] [-p <password>]\n"
		. "Options:\n"
		. "  -v   increase verbosity slightly to print error messages on stderr\n"
		. "  -d   increase verbosity greatly (debug mode)\n"
		. "  -i <tunnelinterface>\n"
		. "       use the specified tunnel interface, defaults to tunl0\n"
		. "  -a <comma-separated-ip-list>\n"
		. "       ignore routes pointing to these (local) gateways\n"

 view all matches for this distribution


AOL-TOC

 view release on metacpan or  search on metacpan

TOC.pm  view on Meta::CPAN

  #print "*************************** AOL::TOC::new(...) sflap = $self->{sflap}\n";
  #print "                            sflap cb = $self->{sflap}{callback}\n";

  #$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNON,    \&sflap_signon, $password, "english", "TIK:\$Revision: 1.148 \$", $self);
  #$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_DATA,      \&sflap_data, $self);
  #$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_ERROR,     \&sflap_error, $self);
  #$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNOFF,   \&sflap_signoff, $self);
  #$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_KEEPALIVE, \&sflap_keepalive, $self);
  #
  #$self->register_callback("SIGN_ON", \&check_version);
  #$self->register_callback("CHAT_JOIN", \&_chat_join);

TOC.pm  view on Meta::CPAN

sub connect {
  my ($self) = @_;

  $self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNON,    \&sflap_signon, $self->{password}, "english", "TIK:\$Revision: 1.148 \$", $self);
  $self->{sflap}->register_callback($AOL::SFLAP::SFLAP_DATA,      \&sflap_data, $self);
  $self->{sflap}->register_callback($AOL::SFLAP::SFLAP_ERROR,     \&sflap_error, $self);
  $self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNOFF,   \&sflap_signoff, $self);
  $self->{sflap}->register_callback($AOL::SFLAP::SFLAP_KEEPALIVE, \&sflap_keepalive, $self);
  
  $self->register_callback("SIGN_ON", \&check_version);
  $self->register_callback("CHAT_JOIN", \&_chat_join);

TOC.pm  view on Meta::CPAN

    $toc->callback("PAUSE");
  }

}

sub sflap_error {
  my ($self, $data, $toc) = @_;

  return;
}

 view all matches for this distribution


API-BigBlueButton

 view release on metacpan or  search on metacpan

lib/API/BigBlueButton.pm  view on Meta::CPAN


    if ( $res->success ) {
        my $version = $res->response->version
    }
    else {
        warn "Error occured: " . $res->error . ", Status: " . $res->status;
    }

=head1 DESCRIPTION

client for BigBlueButton API

 view all matches for this distribution


API-CLI

 view release on metacpan or  search on metacpan

lib/API/CLI.pm  view on Meta::CPAN

    }

    my ($ok, $out, $content) = $REQ->request;
    if (defined $out) {
        unless ($ok) {
            $out = $run->error($out);
        }
        warn $out;
    }
    say $content;

 view all matches for this distribution


API-CPanel

 view release on metacpan or  search on metacpan

lib/API/CPanel.pm  view on Meta::CPAN

use API::CPanel::Package;
use API::CPanel::Domain;
use API::CPanel::Mysql;


our @EXPORT      = qw/get_auth_hash refs is_success query_abstract is_ok get_error/;
our @EXPORT_OK   = qw//;
our $VERSION     = 0.09;
our $DEBUG       = '';
our $FAKE_ANSWER = '';

lib/API/CPanel.pm  view on Meta::CPAN


    return 1 if $answer && ( ref $answer eq 'HASH' || ref $answer eq 'ARRAY' );
}


sub get_error {
    my $answer = shift;

    return '' if is_success( $answer ); # ok == no error

    return Dumper( $answer->{statusmsg } );
}

# Get data from @_

 view all matches for this distribution


API-DeutscheBahn-Fahrplan

 view release on metacpan or  search on metacpan

t/01_main.t  view on Meta::CPAN


    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


API-DirectAdmin

 view release on metacpan or  search on metacpan

lib/API/DirectAdmin.pm  view on Meta::CPAN

 # Switch off account:
 my $suspend_result = $da->user->disable( {
    select0 => $user_name,
 } );

 if ( $suspend_result->{error} == 1 ) {
    die "Cannot  suspend account $suspend_result->{text}";
 }



 # Switch on account
 my $resume_result = $da->user->enable( {
    select0 => $user_name,
 } );

 if ( $resume_result->{error} == 1 ) {
    die "Cannot Resume account $resume_result->{text}";
 }



 # Delete account
 my $delete_result = $da->user->delete( {
    select0 => $user_name,
 } );

 if ( $delete_result->{error} == 1 ) {
    die "Cannot delete account $delete_result->{text}";
 }
 
 # Custom request
 my %params = (

 view all matches for this distribution


API-Drip-Request

 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()

lib/API/Drip/Request.pm  view on Meta::CPAN


=back

On success, returns a Perl data structure corresponding to the data returned
from the server.    Some operations (DELETE), do not return any data and may
return undef on success.  On error, this method will die() with the
HTTP::Response object.

=cut

my $request_validator = validation_for( params => [ {type => Str()}, {type => Str()}, {type => HashRef(), optional => 1} ] );

 view all matches for this distribution


API-Eulerian

 view release on metacpan or  search on metacpan

examples/edw/Rest.pl  view on Meta::CPAN

$h_setup{hook} = new API::Eulerian::EDW::Hook::Print();

my $peer = new API::Eulerian::EDW::Peer::Rest(\%h_setup);
my $status = $peer->request( $cmd );

if ( $status->error() ) {
  $status->dump();
  exit(1);
}

# Dump stages durations

 view all matches for this distribution


API-Facebook

 view release on metacpan or  search on metacpan

lib/API/Facebook.pm  view on Meta::CPAN

The product_feed_upload resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-feed-upload>.

=head2 product_feed_upload_error

    $facebook->resource(param('product-feed-upload-error'));

The product_feed_upload_error resource returns a new instance representative of the API
resource requested. This method accepts a list of path segments which will be
used in the HTTP request. The following documentation can be used to find more
information. L<https://developers.facebook.com/docs/graph-api/reference/product-feed-upload-error>.

=head2 product_group

    $facebook->resource(param('product-group'));

 view all matches for this distribution


API-Google

 view release on metacpan or  search on metacpan

lib/API/Google.pm  view on Meta::CPAN


  my $tx = $self->build_http_transaction($params);
  my $res = $self->{ua}->start($tx)->res->json;
    
  # for future:
  # if ( grep { $_->{message} eq 'Invalid Credentials' && $_->{reason} eq 'authError'} @{$res->{error}{errors}} ) { ... }

  warn "First api_query() result : ".Dumper $res if $self->{debug};

  if (defined $res->{error}) { # token expired error handling

    my $attempt = 1;

    while ($res->{error}{message} eq 'Invalid Credentials')  {
      if ($attempt == $self->{max_refresh_attempts}) {
        last;
      }
      warn "Seems like access_token was expired. Attemptimg update it automatically ..." if $self->{debug};
      $self->refresh_access_token_silent($params->{user});

 view all matches for this distribution


API-Handle

 view release on metacpan or  search on metacpan

lib/API/Handle.pm  view on Meta::CPAN

);

has _printer => (
	is => 'rw'
	, isa => 'Nour::Printer'
	, handles => [ qw/verbose debug info warn warning error fatal dumper/ ]
	, required => 1
	, lazy => 1
	, default => sub {
		my $self = shift;
		my %conf = $self->config->{printer} ? %{ $self->config->{printer} } : (

 view all matches for this distribution


API-INSEE-Sirene

 view release on metacpan or  search on metacpan

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

            $self->{'token_expiration'} = time + $json_obj->{'expires_in'};
            $self->{'user_agent'}->default_header( Authorization => "Bearer $json_obj->{'access_token'}" );
            return 0;
        }
        case HTTP_UNAUTHORIZED { # wrong credentials
            return 1 , $json_obj->{'error_description'};
        }
        else { # oh dear we are in trouble
            return 1, $self->_dumpRequest($request, $response);
        }
    }

lib/API/INSEE/Sirene.pm  view on Meta::CPAN

        case [
            HTTP_REQUEST_URI_TOO_LARGE, HTTP_TOO_MANY_REQUESTS,
            HTTP_UNAUTHORIZED, HTTP_FORBIDDEN,
            HTTP_SERVICE_UNAVAILABLE
        ] {
# There is no syntax error in request, the http message should be sufficient to understand the problem
            return 1, $response->message;
        }
        else { # case HTTP_BAD_REQUEST || HTTP_INTERNAL_SERVER_ERROR
            return 1, $self->_dumpRequest($request, $response);
        }

lib/API/INSEE/Sirene.pm  view on Meta::CPAN


If you want all fields, you have to specify it explicitly by passing the value 'all' as parameter.

=head1 RETURN VALUES

Each method returns a list of two elements: a return code, which is 0 in case of success, or something else in case of failure; and the result of the request (some json or an error message). In case of problem when calling API (malformed request for ...

The module may launch a croak if the crendentials are not initialized or if the SIREN/SIRET numbers are not given in a correct format.

=head1 ALIAS

 view all matches for this distribution


API-ISPManager

 view release on metacpan or  search on metacpan

lib/API/ISPManager.pm  view on Meta::CPAN


# BillManager
use API::ISPManager::software;
use API::ISPManager::order;

our @EXPORT    = qw/get_auth_id refs is_success get_data query_abstract is_ok get_error/;
our @EXPORT_OK = qw//;
our $VERSION   = 0.07;
our $DEBUG     = '';

=head1 NAME

lib/API/ISPManager.pm  view on Meta::CPAN


    return '' unless $answer && ref $answer eq 'HASH' && $answer->{success};
}


sub get_error {
    my $answer = shift;

    return '' if is_ok($answer); # ok == no error

    return Dumper( $answer->{error} );
}

# Get data from @_
sub get_params {
    my @params = @_;

lib/API/ISPManager.pm  view on Meta::CPAN

    warn $query_string if $DEBUG;

    my $xml = process_query( query_string => $query_string);

    if ($xml) {
        my $error_node = exists $xml->{authfail};
        return '' if $error_node;

        return $xml->{auth}->{id};
    } else {
        return '';
    }

lib/API/ISPManager.pm  view on Meta::CPAN

# INTERNAL!!! Check server answer result
# STATIC(data_block)
sub is_success {
    my $data_block = shift;

    if ( ref $data_block eq 'HASH' && ! $data_block->{error} && $data_block->{data} ) {
        return 1;
    } else {
        return '';
    }
}

 view all matches for this distribution


API-Instagram

 view release on metacpan or  search on metacpan

lib/API/Instagram.pm  view on Meta::CPAN

	# Treats response content
	my $res = decode_json $self->_ua->$method( $url, [], $params )->decoded_content;

	# Verifies meta node
	my $meta = $res->{meta};
	carp "$meta->{error_type}: $meta->{error_message}" if $meta->{code} ne '200';

use Data::Dumper;
# die Dumper $res;
	$res;
}

 view all matches for this distribution


API-Intis

 view release on metacpan or  search on metacpan

API/Intis/lib/API/Intis.pm  view on Meta::CPAN

use YAML::Tiny;
use WWW::Mechanize;
use Crypt::SSLeay;
use Digest::Perl::MD5 'md5_hex';
use JSON;
use error_codes;


sub readConfig {
    my $conf = YAML::Tiny->read( 'config.yaml' );
    return (login => $conf->[0]->{APIconnector}->{login}, APIkey => $conf->[0]->{APIconnector}->{APIkey}, host => $conf->[0]->{APIconnector}->{host});

API/Intis/lib/API/Intis.pm  view on Meta::CPAN

        my $request = $ua->get("$url&return=$format")->decoded_content(charset => 'utf-8', raw => 1);
        $request_json = $request if $format eq 'json';
        $request_xml = $request if $format eq 'xml';
    };
    my $r = from_json($request_json);
    my @error;
    if ($r->{error}) {
        @error = &error_codes::get_name_from_code($r->{error});
    } else {
        @error = &error_codes::get_name_from_code();
    };
    return (request_json => $request_json, error => \@error, request_xml => $request_xml, request_object => \%{$r}, out_format => !defined $output_format ? 'json' : $output_format );
};

package API::Intis::APIRequest;
use JSON;
sub new {

API/Intis/lib/API/Intis.pm  view on Meta::CPAN

    my $self = {
        name => 'API::Intis::APIRequest',
        version => '1.0',
        method => $method,
        request_json =>  $request_params{request_json},
        error => $request_params{error},
        request_xml => $request_params{request_xml},
        request_object => $request_params{request_object},
        out_format => $request_params{out_format},
    };
    bless $self, $class;

 view all matches for this distribution


( run in 0.940 second using v1.01-cache-2.11-cpan-65fba6d93b7 )