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:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/ExceptionEater.pm view on Meta::CPAN
=back
=head1 DIAGNOSTICS
None. Acme::ExceptionEater produces fewer than zero error messages.
=head1 CONFIGURATION AND ENVIRONMENT
Acme::ExceptionEater requires no configuration files or environment variables.
view all matches for this distribution
view release on metacpan or search on metacpan
Calculator.xs view on Meta::CPAN
* Acme::ExtUtils::XSOne::Test::Calculator::Basic - Basic arithmetic operations
*/
/* C helper functions for Basic package */
static double basic_safe_divide(double a, double b, int *error) {
if (b == 0.0) {
*error = 1;
return 0.0;
}
*error = 0;
return a / b;
}
static double basic_clamp(double value, double min_val, double max_val) {
if (value < min_val) return min_val;
Calculator.xs view on Meta::CPAN
* Acme::ExtUtils::XSOne::Test::Calculator::Scientific - Scientific/advanced operations
*/
/* C helper functions for Scientific package */
static double sci_safe_log(double a, int *error) {
if (a <= 0.0) {
*error = 1;
return 0.0;
}
*error = 0;
return log(a);
}
static double sci_safe_sqrt(double a, int *error) {
if (a < 0.0) {
*error = 1;
return 0.0;
}
*error = 0;
return sqrt(a);
}
static double sci_ipow(double base, int exp) {
/* Integer power - faster than pow() for integer exponents */
Calculator.xs view on Meta::CPAN
double
safe_divide(a, b)
double a
double b
CODE:
int error;
RETVAL = basic_safe_divide(a, b, &error);
if (error) {
RETVAL = 0.0; /* Return 0 instead of croak */
}
add_to_history('/', a, b, RETVAL);
OUTPUT:
RETVAL
Calculator.xs view on Meta::CPAN
double
safe_sqrt(a)
double a
CODE:
int error;
RETVAL = sci_safe_sqrt(a, &error);
if (!error) {
add_to_history('r', a, 0.5, RETVAL);
}
OUTPUT:
RETVAL
double
safe_log(a)
double a
CODE:
int error;
RETVAL = sci_safe_log(a, &error);
if (!error) {
add_to_history('l', a, M_E, RETVAL);
}
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/EyeDrops.pm view on Meta::CPAN
'['&'~';$\=','^'|'
=head2 Error Handling
The C<sightly> function returns a properly shaped program string;
there is no error return. If something is badly wrong, C<die> is called.
So if you are calling C<sightly> in an environment where it's
unacceptable to die, be sure to wrap the C<sightly> call in
an C<eval> block. For example:
eval {
lib/Acme/EyeDrops.pm view on Meta::CPAN
=item sightly HASHREF
Given a hash reference, HASHREF, describing various attributes,
returns a properly shaped program string.
There is no error return; if something is badly wrong, C<die> is
called -- so wrap the call to C<sightly> in an eval block if you
can't afford to die.
The attributes that HASHREF may contain are:
lib/Acme/EyeDrops.pm view on Meta::CPAN
To convert complex programs, you must use Regex => 0, which
emits a leading unsightly double C<eval>.
The code generated by non-zero Regex requires Perl 5.005 or higher
in order to run; when run on earlier versions, you will likely
see the error message: C<Sequence (?{...) not recognized>.
If using Perl 5.18+, the generated file needs a leading
"use re 'eval'" when a postive value for Regex is used.
The converted program runs inside an C<eval> which may cause
view all matches for this distribution
view release on metacpan or search on metacpan
build_e7BB/Build_iu8t.pm view on Meta::CPAN
$agxDOs eq q|buildq85v| or die qq|!utOr! wrong target ($agxDOs)\n|;
# WORKAROUND:202502091853:whynot: Hard to imagine B<P::T> being missing, but that's one way to avoid to list it in I<%build_requires> (because C<buildq85v> isn't a target outside of development.
require Pod::Text or die qq|!wmvU! [require](Pod::Text) failed\n|;
# NOTE:202502091918:whynot: v3.17
my $qrSl5y = Pod::Text->new(
alt => !0, errors => q|stderr|, sentence => !0 );
my @lmGCWI;
while( my( $hprHQ0, $hqVg4r ) = each %{ $qrXNrk->buildq85v_files } ) {
my $hkTrsQ = ( stat $hprHQ0 )[9];
defined $hkTrsQ or die qq|!0lnO! [stat]($hprHQ0): $!\n|;
my $hkVGdJ = -e $hqVg4r ? ( stat $hqVg4r )[9] : 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/FishFarm/Feeder.pm view on Meta::CPAN
=head2 set_feeding_volume ( $volume )
Sets the fish food feeding volume.
C<$volume> must be a positive number. No error checking is done for this yet.
=cut
sub set_feeding_volume {
ref (my $self = shift) or croak "Please use this the OO way";
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
t/00-report-prereqs.t view on Meta::CPAN
else {
$source = 'static metadata';
}
my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
# Add static includes into a fake section
for my $mod (@include) {
$req_hash->{other}{modules}{$mod} = 0;
t/00-report-prereqs.t view on Meta::CPAN
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
if ( $have !~ /\A$lax_version_re\z/ ) {
push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
}
elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
push @dep_errors, "$mod version '$have' is not in required range '$want'";
}
}
}
else {
push @reports, [$mod, $want, "missing"];
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
t/00-report-prereqs.t view on Meta::CPAN
if ( @full_reports ) {
diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
}
if ( @dep_errors ) {
diag join("\n",
"\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n",
"The following REQUIRED prerequisites were not satisfied:\n",
@dep_errors,
"\n"
);
}
pass;
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:
view all matches for this distribution
view release on metacpan or search on metacpan
1.0.0 Mon Sep 9 05:52:56 PM UTC 2024
- maintenance release, updated dist.ini to reflect required
module versions
1.0.1 Sun Mar 9 02:01:55 PM UTC 2025
- attempting to fix testing errors by pinning down perl and
Util::H2O::More versions
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Free/API/Geodata/GeoIP.pm view on Meta::CPAN
# these are copied from CAVACs vast framework. But we don't want hundreds of dependencies in this example code, only a couple of functions
sub _fetchURL($self, $url) {
$self->{agent}->get($url);
if(!$self->{agent}->success()) {
$self->_debuglog("Network error while fetching URL $url");
return;
}
my $response = $self->{agent}->response();
if(!defined($response)) {
view all matches for this distribution
view release on metacpan or search on metacpan
- found via, https://www.freepublicapis.com/
- cleaned up SYNOPSIS and client (don't need Util::H2O::More there)
- update dist.ini with required module versions
1.0.2 Sun Mar 09 05:13:30 PM UTC 2025
- fixing test errors
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Free/Advice/Unsolicited.pm view on Meta::CPAN
$res->{success} ? decode_json( $res->{content} ) : ();
}
#
sub advice ( $advice_id //= () ) {
my $res = _http( 'https://kk-advice.koyeb.app/api/advice' . ( $advice_id ? '/' . $advice_id : '' ) );
defined $res->{error} ? () : bless $res, __PACKAGE__;
}
sub all () {
my $res = _http('https://kk-advice.koyeb.app/api/advice/all');
map { bless $_, __PACKAGE__ } @{ $res // [] };
view all matches for this distribution
view release on metacpan or search on metacpan
to include Dispatch::Fu needed for the "fletch" client
(included).
0.9.10 Sun Mar 9 05:39:16 PM UTC 2025
- pinning prereq and dendencies to specific versions in an
attempt to fix unexpected testing errors
view all matches for this distribution
view release on metacpan or search on metacpan
- minor POD update, code clean up
- maintenance release (dist.ini)
0.9.10 Sun Mar 9 05:39:16 PM UTC 2025
- pinning prereq and dendencies to specific versions in an
attempt to fix unexpected testing errors
view all matches for this distribution
view release on metacpan or search on metacpan
CONTRIBUTING view on Meta::CPAN
* Translation
Translations of documentation would be welcome.
For translations of error messages and other strings embedded in the
code, check with me first. Sometimes the English strings may not in
a stable state, so it would be a waste of time translating them.
Coding Style
I tend to write using something approximating the Allman style, using
view all matches for this distribution
view release on metacpan or search on metacpan
module-starter --module=Acme::GLOINBG::Utils
cd ~/goroExt/sandbox/Perl/trunk/books/IntermediatePerl/Acme-GLOINBG-Utils
# add t/sum.t to test the sum function; then update the manifest, either manually or with this command:
./Build manifest
To introduce namespace overlap error:
module-starter --module=Tie::Cycle --dist=.
./Build manifest
To install this module, run the following commands:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Ghost.pm view on Meta::CPAN
Main routine for just daemonize.
This routine will check on the pid file, safely fork, create the pid file (storing the pid in the file),
become another user and group, close STDIN, STDOUT and STDERR, separate from the process group (become session leader),
and install $SIG{INT} to remove the pid file. In otherwords - daemonize.
All errors result in a die
=head2 filepid
my $filepid = $g->filepid;
lib/Acme/Ghost.pm view on Meta::CPAN
$g = $g->set_gid('1000 10001 10002');
$g = $g->set_gid(1000);
$g = $g->set_gid('nogroup');
$g = $g->set_gid;
Become another group. Arguments are groups (or group ids or space delimited list of group ids). All errors die
=head2 set_uid
$g = $g->set_uid(1000);
$g = $g->set_uid('nobody');
$g = $g->set_uid;
Become another user. Argument is user (or userid). All errors die
=head1 CONTROL METHODS
List of LSB Daemon Control Methods
view all matches for this distribution
view release on metacpan or search on metacpan
t/12_reimport.t view on Meta::CPAN
use Acme::Globule qw( Range );
package main;
ok("We imported Acme::Globule::Range twice without error");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Globus.pm view on Meta::CPAN
$user . $host,
key_path => $key_path,
async => 0,
) ;
$ssh->error
and die "Couldn't establish SSH connection: " . $ssh->error ;
my $debug = 0 ;
say STDERR "\t" . '=' x 20 if $debug ;
say STDERR "\t" . $command if $debug ;
say STDERR "\t" . '-' x 20 if $debug ;
my $response = $ssh->capture($command)
or carp "remote command failed: " . $ssh->error ;
return $response ;
}
1 ;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Glue.pm view on Meta::CPAN
vec($_,@#,@#) = @<< == @######### @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$off, $width, $bits, $val, $res
.
__END__
=head2 LEEJO (example from "How Perl Saved the Human Genome Project" complete with syntax error)
use Boulder::Stream;
$stream = new Boulder::Stream;
while ($record=$stream->read_record('NAME','SEQUENCE')) {
$name = $record->get('NAME');
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t view on Meta::CPAN
else {
$source = 'static metadata';
}
my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
# Add static includes into a fake section
for my $mod (@include) {
$req_hash->{other}{modules}{$mod} = 0;
t/00-report-prereqs.t view on Meta::CPAN
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
if ( $have !~ /\A$lax_version_re\z/ ) {
push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
}
elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
push @dep_errors, "$mod version '$have' is not in required range '$want'";
}
}
}
else {
push @reports, [$mod, $want, "missing"];
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
t/00-report-prereqs.t view on Meta::CPAN
if ( @full_reports ) {
diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
}
if ( @dep_errors ) {
diag join("\n",
"\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n",
"The following REQUIRED prerequisites were not satisfied:\n",
@dep_errors,
"\n"
);
}
pass;
view all matches for this distribution
view release on metacpan or search on metacpan
/* 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 ERRSV
# define ERRSV perl_get_sv("@",FALSE)
#endif
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
5. Added the CPAN distribution metadata to Makefile.PL and
Build.PL.
2013-05-10 version 0.04
1. lib/Acme/GuessNumber.pm: Applied the patch from Mark A. Smith
<jprogrammer082@gmail.com>, in order to fix the English errors
in the POD. Thank you, Mark, although I will not share my
jackpot with you. You have to win your own. ^_^
2. lib/Acme/GuessNumber.pm: Fixed several other English mistakes
in the POD.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/HTTP.pm view on Meta::CPAN
}
elsif ($net_http eq 'Net::HTTPS::NB') {
require Net::HTTPS::NB;
}
else {
$@ = 'Acme::HTTP - Internal error net_http = \''.$net_http.'\'';
return;
}
$hdl = $net_http->new(Host => $host) or do {
$@ = 'Acme::HTTP - Can\'t Net::HTTP(S)->new(Host =>...)';
lib/Acme/HTTP.pm view on Meta::CPAN
$url = $Response{'Location'};
}
unless (defined $hdl) {
$@ = 'Acme::HTTP - Internal error, hdl is undefined';
return;
}
bless { hdl => $hdl };
}
view all matches for this distribution
view release on metacpan or search on metacpan
CONTRIBUTING view on Meta::CPAN
* Translation
Translations of documentation would be welcome.
For translations of error messages and other strings embedded in the
code, check with me first. Sometimes the English strings may not in
a stable state, so it would be a waste of time translating them.
Coding Style
I tend to write using something approximating the Allman style, using
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
Can't we use C<UNIVERSAL::isa()>? Yes, and no. If you already have an object,
then C<isa()> will let you know if it inherits from a given class. But what do
we do if we know nothing of the inheritance tree of the object's class? Also,
if we don't have an object, just a normal reference, then attempting to call
C<isa()> through it will result in a run-time error.
B<holy()> is a quick, single test to determine if a given scalar represents
an object (i.e. a blessed reference).
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