view release on metacpan or search on metacpan
* operating system type and version
* exact text of error message or description of problem
* example model files/data being classified
If we don't have access to a system similar to yours, you may be asked
to insert some debugging lines and report back on the results. The more help
and information you can provide, the better.
5) AUTHOR INFORMATION
---------------------
view all matches for this distribution
view release on metacpan or search on metacpan
push @ARGV,"any";
}
if($kkey =~ /debug/){
my $NORMAL=`tput sgr0`;
my $REVERSE=`tput smso`;
print "$REVERSE $_ $NORMAL " for @ARGV;
print "\n";
}else{
view all matches for this distribution
view release on metacpan or search on metacpan
examples/lesion.pl view on Meta::CPAN
# Create the network
my $network = AI::NNFlex::Backprop->new(randomconnections=>0,
randomweights=>1,
learningrate=>.1,
debug=>[],bias=>1,
momentum=>0.6,
round=>1);
view all matches for this distribution
view release on metacpan or search on metacpan
* \param out used to hold the result of copy
* \return 0 when success, -1 when failure happens
*/
int NNSymbolCopy(SymbolHandle in, SymbolHandle *out);
/*!
* \brief Print the content of symbol, used for debug.
* \param symbol the symbol
* \param out_str pointer to hold the output string of the printing.
* \return 0 when success, -1 when failure happens
*/
int NNSymbolPrint(SymbolHandle in, const char **out);
view all matches for this distribution
view release on metacpan or search on metacpan
BackProp.pm view on Meta::CPAN
my $value = 0;
my $state = 0;
my (@map,@weight);
# We loop through all the syanpses connected to this one and add the weighted
# valyes together, saving in a debugging list.
for (0..$size-1) {
$value += $self->{SYNAPSES}->{LIST}->[$_]->{VALUE};
$self->{SYNAPSES}->{LIST}->[$_]->{FIRED} = 0;
$map[$_]=$self->{SYNAPSES}->{LIST}->[$_]->{VALUE};
BackProp.pm view on Meta::CPAN
}
# Debugging subs
$AI::NeuralNet::BackProp::DEBUG = 0;
sub whowasi { (caller(1))[3] . '()' }
sub debug { shift; $AI::NeuralNet::BackProp::DEBUG = shift || 0; }
sub out1 { print shift() if ($AI::NeuralNet::BackProp::DEBUG eq 1) }
sub out2 { print shift() if (($AI::NeuralNet::BackProp::DEBUG eq 1) || ($AI::NeuralNet::BackProp::DEBUG eq 2)) }
sub out3 { print shift() if ($AI::NeuralNet::BackProp::DEBUG) }
sub out4 { print shift() if ($AI::NeuralNet::BackProp::DEBUG eq 4) }
BackProp.pm view on Meta::CPAN
my $rand = shift;
return $self->{random} if(!(defined $rand));
$self->{random} = $rand;
}
# Sets/gets column width for printing lists in debug modes 1,3, and 4.
sub col_width {
my $self = shift;
my $width = shift;
return $self->{col_width} if(!$width);
$self->{col_width} = $width;
BackProp.pm view on Meta::CPAN
to view the learning stats for every learn call, you can just:
print $net->learn(\@map,\@res);
If you call "$net->debug(4)" with $net being the
refrence returned by the new() constructor, you will get benchmarking
information for the learn function, as well as plenty of other information output.
See notes on debug() in the METHODS section, below.
If you do call $net->debug(1), it is a good
idea to point STDIO of your script to a file, as a lot of information is output. I often
use this command line:
$ perl some_script.pl > .out
BackProp.pm view on Meta::CPAN
=item $net->debug($level)
Toggles debugging off if called with $level = 0 or no arguments. There are four levels
of debugging.
Level 0 ($level = 0) : Default, no debugging information printed. All printing is
left to calling script.
Level 1 ($level = 1) : This causes ALL debugging information for the network to be dumped
as the network runs. In this mode, it is a good idea to pipe your STDIO to a file, especially
for large programs.
Level 2 ($level = 2) : A slightly-less verbose form of debugging, not as many internal
data dumps.
Level 3 ($level = 3) : JUST prints weight mapping as weights change.
Level 4 ($level = 4) : JUST prints the benchmark info for EACH learn loop iteteration, not just
learning as a whole. Also prints the percentage difference for each loop between current network
results and desired results, as well as learning gradient ('incremenet').
Level 4 is useful for seeing if you need to give a smaller learning incrememnt to learn() .
I used level 4 debugging quite often in creating the letters.pl example script and the small_1.pl
example script.
Toggles debuging off when called with no arguments.
=item $net->save($filename);
BackProp.pm view on Meta::CPAN
index of the word if it exists in the crunch list.
=item $net->col_width($width);
This is useful for formating the debugging output of Level 4 if you are learning simple
bitmaps. This will set the debugger to automatically insert a line break after that many
elements in the map output when dumping the currently run map during a learn loop.
It will return the current width when called with a 0 or undef value.
view all matches for this distribution
view release on metacpan or search on metacpan
$AI::NeuralNet::Mesh::Connector = '_c';
# Debugging subs
$AI::NeuralNet::Mesh::DEBUG = 0;
sub whowasi { (caller(1))[3] . '()' }
sub debug { shift; $AI::NeuralNet::Mesh::DEBUG = shift || 0; }
sub d { shift if(substr($_[0],0,4) eq 'AI::'); my ($a,$b,$c)=(shift,shift,$AI::NeuralNet::Mesh::DEBUG); print $a if($c == $b); return $c }
sub verbose {debug @_};
sub verbosity {debug @_};
sub v {debug @_};
# Return version of ::ID string passed or current version of this
# module if no string is passed. Used in load() to detect file versions.
sub version {
my $rand = shift;
return $self->{random} if(!(defined $rand));
$self->{random} = $rand;
}
# Sets/gets column width for printing lists in debug modes 1,3, and 4.
sub col_width {
my $self = shift;
my $width = shift;
return $self->{col_width} if(!$width);
$self->{col_width} = $width;
=item $net->verbosity($level);
=item $net->v($level);
=item $net->debug($level)
Note: verbose(), verbosity(), and v() are all functional aliases for debug().
Toggles debugging off if called with $level = 0 or no arguments. There are several levels
of debugging.
NOTE: Debugging verbosity has been toned down somewhat from AI::NeuralNet::BackProp,
but level 4 still prints the same amount of information as you were used to. The other
levels, however, are mostly for advanced use. Not much explanation in the other
levels, but they are included for those of you that feel daring (or just plain bored.)
Level 0 ($level = 0) : Default, no debugging information printed. All printing is
left to calling script.
Level 1 ($level = 1) : Displays the activity between nodes, prints what values were
received and what they were weighted to.
Level 2 ($level = 2) : Just prints info from the learn() loop, in the form of "got: X, wanted Y"
type of information. This is about the third most useful debugging level, after level 12 and
level 4.
Level 3 ($level = 3) : I don't think I included any level 3 debugs in this version.
Level 4 ($level = 4) : This level is the one I use most. It is only used during learning. It
displays the current error (difference between actual outputs and the target outputs you
asked for), as well as the current loop number and the benchmark time for the last learn cycle.
Also printed are the actual outputs and the target outputs below the benchmark times.
Level 12 ($level = 12) : Level 12 prints a dot (period) [.] after each learning loop is
complete. This is useful for letting the user know that stuff is happening, but without
having to display any of the internal variables. I use this in the ex_aln.pl demo,
as well as the ex_agents.pl demo.
Toggles debuging off when called with no arguments.
=item $net->save($filename);
A function alias for crunched().
=item $net->col_width($width);
This is useful for formating the debugging output of Level 4 if you are learning simple
bitmaps. This will set the debugger to automatically insert a line break after that many
elements in the map output when dumping the currently run map during a learn loop.
It will return the current width when called with a 0 or undef value.
The column width is preserved across load() and save() calls.
=item $AI::NeuralNet::Mesh::DEBUG
This variable controls the verbosity level. It will not hurt anything to set this
directly, yet most people find it easier to set it using the debug() method, or
any of its aliases.
=head1 CUSTOM NETWORK CONNECTORS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/PBDD.pm view on Meta::CPAN
satCount
// printing
printDot
printSet
print
// debugging
printStats
checkPackage
debugPackage
debugBDD
// low-level access
internal_index
internal_refcount
internal_isconst
internal_constvalue
lib/AI/PBDD.pm view on Meta::CPAN
=item B<$ok = checkPackage>
Return 0 if something is wrong.
=item B<debugPackage>
Debug the BDD package.
=item B<$ok = debugBDD($bdd)>
Debug C<$bdd> in the BDD package. Return 0 if something is wrong.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/PSO.pm view on Meta::CPAN
my $themMax = 'null'; # 'social' maximum random weight (this should really be between 0, 1)
my $psoRandomRange = 'null'; # PSO::.86 new variable to support original unmodified algorithm
my $useModifiedAlgorithm = 'null';
#-#-# user/debug parameters #-#-#
my $verbose = 0; # This one defaults for obvious reasons...
#NOTE: $meWeight and $themWeight should really add up to a constant value.
# Swarm Intelligence defines a 'pso random range' constant and then computes two random numbers
# within this range by first getting a random number and then subtracting it from the range.
view all matches for this distribution
view release on metacpan or search on metacpan
6. As an exception to the Sections above, you may also
combine or link a "work that uses the Library" with the
Library to produce a work containing portions of the Library,
and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the
customer's own use and reverse engineering for debugging
such modifications.
You must give prominent notice with each copy of the work
that the Library is used in it and that the Library and its use
are covered by this License. You must supply a copy of this
view all matches for this distribution
view release on metacpan or search on metacpan
6. As an exception to the Sections above, you may also
combine or link a "work that uses the Library" with the
Library to produce a work containing portions of the Library,
and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the
customer's own use and reverse engineering for debugging
such modifications.
You must give prominent notice with each copy of the work
that the Library is used in it and that the Library and its use
are covered by this License. You must supply a copy of this
view all matches for this distribution
view release on metacpan or search on metacpan
debop||5.005000|
debprofdump||5.005000|
debprof|||
debstackptrs||5.007003|
debstack||5.007003|
debug_start_match|||
deb||5.007003|v
del_sv|||
delete_eval_scope|||
delimcpy||5.004000|
deprecate_old|||
get_av|5.006000||p
get_context||5.006000|n
get_cvn_flags||5.009005|
get_cv|5.006000||p
get_db_sub|||
get_debug_opts|||
get_hash_seed|||
get_hv|5.006000||p
get_isa_hash|||
get_mstats|||
get_no_modify|||
incpush_if_exists|||
incpush_use_sep|||
incpush|||
ingroup|||
init_argv_symbols|||
init_debugger|||
init_global_struct|||
init_i18nl10n||5.006000|
init_i18nl14n||5.006000|
init_ids|||
init_interp|||
rsignal_save|||
rsignal_state||5.004000|
rsignal||5.004000|
run_body|||
run_user_filter|||
runops_debug||5.005000|
runops_standard||5.005000|
rvpv_dup|||
rxres_free|||
rxres_restore|||
rxres_save|||
unpackstring||5.008001|
unshare_hek_or_pvn|||
unshare_hek|||
unsharepvn||5.004000|
unwind_handler_stack|||
update_debugger_info|||
upg_version||5.009005|
usage|||
utf16_to_utf8_reversed||5.006001|
utf16_to_utf8||5.006001|
utf8_distance||5.006000|
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Perl extension AI::Pathfinding::AStar.
0.10 Sun Jun 17 16:00:00 2007
- *sighs* A debugging remnant in the test files caused make test
to fail. This appears to fix it.
0.09 Sat Jun 16 19:00:00 2007
- I apologize. Revision number bumped due to distribution snafu.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Pathfinding/SMAstar.pm view on Meta::CPAN
my ($priority_queue,
$goal_p,
$successors_func,
$eval_func,
$backup_func,
$log_function, # debug string func; represent state object as a string.
$str_function,
$prog_function,
$show_prog_func,
$max_states_in_queue,
$max_cost,
view all matches for this distribution
view release on metacpan or search on metacpan
bin/Inception.pl view on Meta::CPAN
required => 0,
format => 's',
default => $default_model_signature,
doc => "API signature for model [Default: $default_model_signature]"
);
option debug_verbose => (is => 'ro', doc => 'Verbose output');
option debug_loopback_interface => (
is => 'ro',
required => 0,
doc => "Test loopback through dummy server"
);
option debug_camel => (
is => 'ro',
required => 0,
doc => "Test using camel image"
);
bin/Inception.pl view on Meta::CPAN
port => $self->port
);
$client->model_name($self->model_name);
$client->model_signature($self->model_signature);
$client->debug_verbose($self->debug_verbose);
$client->loopback($self->debug_loopback_interface);
$client->camel($self->debug_camel);
printf("Sending image %s to server at host:%s port:%s\n",
$self->image_file, $self->host, $self->port);
if ($client->call_inception($image_ref)) {
bin/Inception.pl view on Meta::CPAN
}
sub read_image {
my $self = shift;
return \'' if $self->debug_camel;
my $file_name = shift;
my $max_file_size = 16 * 1000 * 1000; # A large but safe maximum
open(my $fh, '<:raw', $file_name)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Prolog/Parser.pm view on Meta::CPAN
use warnings;
use Carp qw( confess croak );
use Regexp::Common;
use Hash::Util 'lock_keys';
# debugging stuff
use Clone;
use Text::Balanced qw/extract_quotelike extract_delimited/;
use aliased 'AI::Prolog::Engine';
use aliased 'AI::Prolog::KnowledgeBase';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=head2 TF_StartThread
=over 2
Returns a new thread that is running work_func and is identified
(for debugging/performance-analysis) by thread_name.
The given param (which may be null) is passed to work_func when the thread
starts. In this way, data may be passed from the thread back to the caller.
Caller takes ownership of the result and must call TF_JoinThread on it
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=head2 TFE_DeleteTensorDebugInfo
=over 2
Deletes `debug_info`.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern void TFE_DeleteTensorDebugInfo(
TFE_TensorDebugInfo* debug_info);
=head2 TFE_TensorDebugInfoOnDeviceNumDims
=over 2
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern int TFE_TensorDebugInfoOnDeviceNumDims(
TFE_TensorDebugInfo* debug_info);
=head2 TFE_TensorDebugInfoOnDeviceDim
=over 2
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern int64_t TFE_TensorDebugInfoOnDeviceDim(
TFE_TensorDebugInfo* debug_info, int dim_index);
=head2 TFE_NewOp
=over 2
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=head2 TFE_GetExecutedOpNames
=over 2
Get a comma-separated list of op names executed in graph functions dispatched
to `ctx`. This feature is currently only enabled for TFRT debug builds, for
performance and simplicity reasons.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AIIA/GMT.pm view on Meta::CPAN
return &submit($txt);
}
sub submit {
my @args = (shift);
my $client = Frontier::Client->new(url => $SERVER_URL, debug => 0);
my $ret = $client->call('Annotator.getAnnotation', @args);
my @rep;
map {push @rep, $_->{'offset'} . "\t" . $_->{'mention'};} @{$ret->{'mentions'}};
@rep = sort @rep;
return \@rep;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Devel/CheckLib.pm view on Meta::CPAN
@sys_cmd = (@cc, (map { "-I$_" } @incpaths), "-o$exefile", $cfile);
} else { # Unix-ish
# gcc, Sun, AIX (gcc, cc)
@sys_cmd = (@cc, $cfile, (map { "-I$_" } @incpaths), "-o", "$exefile");
}
warn "# @sys_cmd\n" if $args{debug};
my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd);
push @missing, $header if $rv != 0 || ! -x $exefile;
_cleanup_exe($exefile);
unlink $cfile;
}
inc/Devel/CheckLib.pm view on Meta::CPAN
} else { # Unix-ish
# gcc, Sun, AIX (gcc, cc)
my @libpath = map { "-L$_" } @libpaths;
@sys_cmd = (@cc, $cfile, "-o", "$exefile", "-l$lib", @libpath);
}
warn "# @sys_cmd\n" if $args{debug};
my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd);
push @missing, $lib if $rv != 0 || ! -x $exefile;
_cleanup_exe($exefile);
}
unlink $cfile;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ALBD.pm view on Meta::CPAN
my $self = shift;
return $VERSION;
}
##############################################################################
# functions for debugging
##############################################################################
=comment
sub debugLBD {
my $self = shift;
my $startingCuisRef = shift;
print "Starting CUIs = ".(join(',', @{$startingCuisRef}))."\n";
view all matches for this distribution
view release on metacpan or search on metacpan
extern SV *cb_trans_progress_sub;
/* String constants to use for log levels (instead of bitflags) */
extern const char * log_lvl_error;
extern const char * log_lvl_warning;
extern const char * log_lvl_debug;
extern const char * log_lvl_function;
extern const char * log_lvl_unknown;
/* CALLBACKS ****************************************************************/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AMF/Connection.pm view on Meta::CPAN
use AMF::Connection::InputStream;
use LWP::UserAgent;
use HTTP::Cookies;
#use Data::Dumper; #for debug
use Carp;
use strict;
our $VERSION = '0.32';
view all matches for this distribution
view release on metacpan or search on metacpan
doc/examples/petmarket/petmarket.pl view on Meta::CPAN
use strict;
use AMF::Perl;
my $gateway = AMF::Perl->new;
$gateway->setBaseClassPath(".");
$gateway->debugDir("/tmp");
$gateway->service();
view all matches for this distribution
view release on metacpan or search on metacpan
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"
. " (list contains system's local IP addresses by default)\n"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AMQP.pm view on Meta::CPAN
$self->host($+{'hostname'} || 'localhost');
$self->port($+{'port'} || 5672);
$self->vhost($+{'vhost'} || '/');
$self->username($+{'username'} || 'guest');
$self->password($+{'password'} || 'guest');
say "amqp://" . $self->host . ":" . $self->port . $self->vhost if $self->debug;
$self;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
#CORE::close($self->{fd});
return;
}
sub set_debug {
my ($self, $level) = @_;
$self->{debug_level} = $level;
print "slfap debug level $level\n";
}
sub debug {
my ($self, @args) = @_;
if (exists $self->{debug_level} && $self->{debug_level} > 0) {
print @args;
}
}
sub __connect {
$self->callback($SFLAP_SIGNOFF);
return;
}
my ($id, $chan, $seq, $len, $data) = unpack("aCnn", $buffer);
$self->debug("sflap recv ($self->{fd}) $foo chan = $chan seq = $seq len = $len\n");
$foo = CORE::sysread($fd, $data, $len);
$self->debug(" data = $data\n");
$self->callback($chan, $data);
return $buffer;
}
$length, $data, 0);
($id, $ch, $seq, $len, $data, $nuller) = unpack($format, $buffer);
$foo = CORE::syswrite($self->{fd}, $buffer, $length + 6);
$self->debug("sflap send ($self->{fd}) $foo chan = $ch seq = $seq len = $len data = $data\n");
}
sub write {
my ($self, $buffer, $len, $noflap) = @_;
my $fd = $self->{fd};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AOLserver/CtrlPort.pm view on Meta::CPAN
=head1 Debugging
AOLserver::CtrlPort is Log4perl enabled. If your scripts don't do
what you want and you need to find out which messages are being sent
back and forth, you can easily bump up AOLserver::CtrlPort's
internal debugging level by saying something like
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($DEBUG);
in your test script before any AOLserver::CtrlPort commands are called.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Basecamp.pm view on Meta::CPAN
method resource (@segments) {
# build new resource instance
my $instance = __PACKAGE__->new(
debug => $self->debug,
fatal => $self->fatal,
retries => $self->retries,
timeout => $self->timeout,
user_agent => $self->user_agent,
account => $self->account,
lib/API/Basecamp.pm view on Meta::CPAN
password => 'PASSWORD',
identifier => 'APPLICATION NAME',
account => 'ACCOUNT NUMBER',
);
$basecamp->debug(1);
$basecamp->fatal(1);
my $project = $basecamp->projects('605816632');
my $results = $project->fetch;
lib/API/Basecamp.pm view on Meta::CPAN
$basecamp->username;
$basecamp->username('USERNAME');
The username attribute should be set to the account holder's username.
=head2 debug
$basecamp->debug;
$basecamp->debug(1);
The debug attribute if true prints HTTP requests and responses to standard out.
=head2 fatal
$basecamp->fatal;
$basecamp->fatal(1);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/CLI.pm view on Meta::CPAN
sub apicall {
my ($self, $run) = @_;
my ($method, $path) = @{ $run->commands };
my $params = $run->parameters;
my $opt = $run->options;
if ($opt->{debug}) {
warn __PACKAGE__.':'.__LINE__.": apicall($method $path)\n";
warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$params], ['params']);
warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$opt], ['opt']);
}
$path =~ s{(?::(\w+)|\{(\w+)\})}{$params->{ $1 // $2 }}g;
if ($opt->{debug}) {
warn __PACKAGE__.':'.__LINE__.": apicall($method $path)\n";
}
my $REQ = API::CLI::Request->from_openapi(
openapi => $run->spec->openapi,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Client.pm view on Meta::CPAN
our $VERSION = '0.12'; # VERSION
# ATTRIBUTES
has 'debug' => (
is => 'ro',
isa => 'Bool',
def => 0,
);
lib/API/Client.pm view on Meta::CPAN
}
method serialize() {
return {
debug => $self->debug,
fatal => $self->fatal,
name => $self->name,
retries => $self->retries,
timeout => $self->timeout,
url => $self->url->to_string,
lib/API/Client.pm view on Meta::CPAN
# log activity
if ($req && $res) {
my $log = $self->logger;
my $msg = join " ", "attempt", ("#".($i+1)), ": $method", $url->to_string;
$log->debug("req: $msg")->data({
request => $req->to_string =~ s/\s*$/\n\n\n/r
});
$log->debug("res: $msg")->data({
response => $res->to_string =~ s/\s*$/\n\n\n/r
});
# output to the console where applicable
$log->info("res: $msg [@{[$res->code]}]");
$log->output if $self->debug;
}
# no retry necessary
last if $ok;
}
lib/API/Client.pm view on Meta::CPAN
can easily adapt to changes in the API with minimal effort. As a thin-client
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
lib/API/Client.pm view on Meta::CPAN
This package has the following attributes:
=cut
=head2 debug
debug(Bool)
This attribute is read-only, accepts C<(Bool)> values, and is optional.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/DirectAdmin.pm view on Meta::CPAN
my $self = {
auth_user => '',
auth_passwd => '',
host => '',
ip => '',
debug => $DEBUG,
allow_https => 1,
fake_answer => $FAKE_ANSWER,
(@_)
};
lib/API/DirectAdmin.pm view on Meta::CPAN
my $command = delete $params{command};
my $fields = $params{allowed_fields} || '';
my $allowed_fields;
warn 'query_abstract ' . Dumper( \%params ) if $self->{debug};
confess "Empty command" unless $command;
$fields = "host port auth_user auth_passwd method allow_https command $fields";
@$allowed_fields = split /\s+/, $fields;
lib/API/DirectAdmin.pm view on Meta::CPAN
my $query_string = $self->mk_full_query_string( {
command => $command,
%$params,
} );
carp Dumper $query_string if $self->{debug};
my $server_answer = $self->process_query(
method => $params{method} || 'GET',
query_string => $query_string,
params => $params,
);
carp Dumper $server_answer if $self->{debug};
return $server_answer;
}
# Kill slashes at start / end string
lib/API/DirectAdmin.pm view on Meta::CPAN
my $method = $params{method};
confess "Empty query string" unless $query_string;
my $answer = $self->{fake_answer} ? $self->{fake_answer} : $self->mk_query_to_server( $method, $query_string, $params{params} );
carp $answer if $self->{debug};
return $answer;
}
# Make request to server and get answer
lib/API/DirectAdmin.pm view on Meta::CPAN
$request->content_type('application/x-www-form-urlencoded');
my $response = $ua->request($request);
$content = $response->content;
}
warn "Answer: " . $content if $self->{debug};
return $content if $params->{noparse};
return $self->parse_answer($content);
}
view all matches for this distribution