view release on metacpan or search on metacpan
lib/Acme/RedShirt.pm view on Meta::CPAN
my %HOW = (
phaser => 'Got hit by a phaser. ',
mutant_plant => 'I knew those plants looked funny. ',
spear => 'The natives got him. ',
lightning => 'Must be a god-like alien around. ',
insect_bite => "Insects? Sensors didn't pick up any insects. ",
transporter => 'Scotty, you need to fix the transporter. ',
);
sub import
{
lib/Acme/RedShirt.pm view on Meta::CPAN
=head2 DESCRIPTION
Every good captain is surrounded by a bunch of extras wearing red shirts, whose
job it is to put themselves in the line of fire so the regulars can get on with
the show. Now, this level of security is brought to Perl.
It is possible to use this module to specify a method of death for your expendable
program. Currently defined methods are:
phaser
mutant_plant
spear
lightning
insect_bite
transporter
=head1 BUGS
Actually doesn't die(), but instead just exit(0). die() causes an extra error message
view all matches for this distribution
view release on metacpan or search on metacpan
/*
* In order for a Perl extension module to be as portable as possible
* across differing versions of Perl itself, certain steps need to be taken.
* Including this header is the first major one, then using dTHR is all the
* appropriate places and using a PL_ prefix to refer to global Perl
* variables is the second.
*
*/
/* If you use one of a few functions that were not present in earlier
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
and telling the user how to view a copy of this License. (Exception: if the
Program itself is interactive but does not normally print such an announcement,
your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Program, the distribution of the whole must be on
the terms of this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to
work written entirely by you; rather, the intent is to exercise the right to control
the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all the
source code for all modules it contains, plus any associated interface definition
files, plus the scripts used to control compilation and installation of the
not permit royalty-free redistribution of the Program by all those who receive
copies directly or indirectly through you, then the only way you could satisfy
both it and this License would be to refrain entirely from distribution of the
Program.
If any portion of this section is held invalid or unenforceable under any particular
circumstance, the balance of the section is intended to apply and the section as
a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other
property right claims or to contest validity of any such claims; this section has
the sole purpose of protecting the integrity of the free software distribution
system, which is implemented by public license practices. Many people have
made generous contributions to the wide range of software distributed through
that system in reliance on consistent application of that system; it is up to the
author/donor to decide if he or she is willing to distribute software through any
other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries
either by patents or by copyrighted interfaces, the original copyright holder who
places the Program under this License may add an explicit geographical
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $name = shift;
my $features = ( $self->{values}->{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $name = shift;
my $features = ( $self->{values}{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t view on Meta::CPAN
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;
}
for my $phase ( qw(configure build test runtime develop other) ) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/pms/Envolve.pm view on Meta::CPAN
required => 1,
trigger => sub {
my ($self, $value) = @_;
confess 'EnvolveAPI: Invalid API Key' unless $value =~ m/\d+-\w+/;
my @key_parts = split /-/, $self->api_key;
$self->secret($key_parts[1]);
$self->site_id($key_parts[0]);
}
);
has secret => (
is => 'rw',
);
has site_id => (
is => 'rw',
t/pms/Envolve.pm view on Meta::CPAN
return $command_string;
}
sub sign_command_string {
my ($self, $command_string) = @_;
my $hash = hmac_sha1_hex( $command_string, $self->secret);
return $hash . ';' . $command_string;
}
no Any::Moose;
__PACKAGE__->meta->make_immutable;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/RohlfsC.pm view on Meta::CPAN
my $foo = Acme::RohlfsC->new();
...
=head1 EXPORT
A list of functions that can be exported. You can delete this section
if you don't export anything, such as for a purely object-oriented module.
=head1 SUBROUTINES/METHODS
=head2 function1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/RunDoc.pm view on Meta::CPAN
use Acme::RunDoc
$module1 => \@args1,
$module2 => \%args2,
$module3 => undef;
(See the sections on C<use>, C<import> and C<require> in L<perlfunc> if any
of that confuses you.)
=head1 SEE ALSO
L<icrosoft::Word>, L<Text::Extract::Word>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/SDUM/Renew.pm view on Meta::CPAN
Username to SDUM (don't forget to prepend a 'A' in case you are a student like me).
=item password
Your super ultra secret password.
=item email
A valid email address to send the report.
lib/Acme/SDUM/Renew.pm view on Meta::CPAN
croak $Mail::Sender::Error if $Mail::Sender::Error;
}
=head1 AUTHOR
Ruben Fonseca, C<< <root at cpan.org> >>
=head1 BUGS
Please report any bugs or feature requests to
C<bug-acme-sdum-renew at rt.cpan.org>, or through the web interface at
lib/Acme/SDUM/Renew.pm view on Meta::CPAN
=head1 ACKNOWLEDGEMENTS
=head1 COPYRIGHT & LICENSE
Copyright 2007 Ruben Fonseca, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/SList/Utilities.pm view on Meta::CPAN
}
sub sdate {
my ($stamp) = @_;
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = localtime $stamp;
return sprintf("%02d/%02d/%04d %02d:%02d:%02d",
$mday, $mon + 1, $year + 1900, $hour, $min, $sec);
}
sub sduration { # calculate a duration ($_[0]...$_[1])
my ($from, $to) = @_;
my $tsec = $to - $from; my $sec = $tsec % 60;
my $tmin = int($tsec / 60); my $min = $tmin % 60;
my $thour = int($tmin / 60); my $hour = $thour;
my $dur = "$sec sec";
$dur = "$min min ".$dur unless $min == 0;
$dur = "$hour hrs ".$dur unless $hour == 0;
return $dur;
}
view all matches for this distribution
view release on metacpan or search on metacpan
.github/workflows/github_ci_default.yml view on Meta::CPAN
if: ${{ !matrix.coverage }}
run: prove -lv t
- name: Run tests (with coverage)
if: ${{ matrix.coverage }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cpanm -n Devel::Cover::Report::Coveralls
cover -test -report Coveralls
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/SafetyGoggles.pm view on Meta::CPAN
}
more_trustable_code();
=cut
# How would we handle this case? Match a section of $original beginning
# after a "use Some::Filter;" statement and before a "no Some::Filter;"
# statement?
=pod
view all matches for this distribution
view release on metacpan or search on metacpan
CODE_OF_CONDUCT.md view on Meta::CPAN
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://github.com/sanko/Net-uTP.pm/discussions.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
package MY;
sub test {
my($self) = shift;
my $test_sec = $self->SUPER::test(@_);
substr($test_sec,index($test_sec,'TEST_VERBOSE=0'), length('TEST_VERBOSE=0') ,'TEST_VERBOSE=1');
return $test_sec;
}
#b/c of this sub, distdir only runs on Cygwin, perm changes are for Kwalitee
sub distdir {
my($self) = shift;
my $distdir_sec = $self->SUPER::distdir(@_);
#in newer perls we are patching create_distdir, in olders, distdir
#see MM patch "6.25 alphas caused a Makefile to be added to the dist. Fixed. "
my $repstartpos = index($distdir_sec,"\'\$(DIST_CP)\');\"");
die "distdir cant match" if $repstartpos == -1;
substr($distdir_sec
,$repstartpos
,length("\'\$(DIST_CP)\');\"")
,"\'\$(DIST_CP)\');\" \\\n\t&& cd \$(DISTVNAME) && chmod -v -x-x-x Makefile.PL"
);
return $distdir_sec;
}
package main;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/AutoInstall.pm view on Meta::CPAN
$self->makemaker_args( Module::AutoInstall::_make_args() );
my $class = ref($self);
$self->postamble(
"# --- $class section:\n" .
Module::AutoInstall::postamble()
);
}
sub auto_install_now {
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t view on Meta::CPAN
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;
}
for my $phase ( qw(configure build test runtime develop other) ) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
}
$self->version_from($file) unless $self->version;
$self->perl_version_from($file) unless $self->perl_version;
# The remaining probes read from POD sections; if the file
# has an accompanying .pod, use that instead
my $pod = $file;
if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) {
$file = $pod;
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $features = ( $self->{values}{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Sort/Bogosort.pm view on Meta::CPAN
sub is_ordered {
my ( $compare, $listref ) = @_;
ref( $compare ) =~ /CODE/
or croak "is_ordered() expects a coderef as first arg.";
ref( $listref ) =~ /ARRAY/
or croak "is_ordered() expects an arrayref as second arg.";
foreach( 0 .. $#{$listref} - 1 ) {
return 0
if $compare->( $listref->[ $_ ], $listref->[ $_ + 1 ] ) > 0;
}
return 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Sort/Bozo.pm view on Meta::CPAN
sub is_ordered {
my ( $compare, $listref ) = @_;
ref( $compare ) =~ /CODE/
or croak "is_ordered() expects a coderef as first arg.";
ref( $listref ) =~ /ARRAY/
or croak "is_ordered() expects an arrayref as second arg.";
foreach( 0 .. $#{$listref} - 1 ) {
return 0
if $compare->( $listref->[ $_ ], $listref->[ $_ + 1 ] ) > 0;
}
return 1;
lib/Acme/Sort/Bozo.pm view on Meta::CPAN
# are guaranteed to be distinct.
sub swap {
my $listref = shift;
my $elements = @{$listref};
my $first = int( rand( $elements ) );
my $second;
do{ $second = int( rand( $elements ) ); } until $second != $first;
# ( $listref->[$first], $listref->[$second] ) = ( $listref->[$second], $listref->[$first] );
@{$listref}[$first, $second] = @{$listref}[$second, $first];
return $listref;
}
# Default compare() is ascending standard string comparison order.
view all matches for this distribution
view release on metacpan or search on metacpan
local/lib/perl5/Future.pm view on Meta::CPAN
It is intended that library functions that perform asynchronous operations
would use future objects to represent outstanding operations, and allow their
calling programs to control or wait for these operations to complete. The
implementation and the user of such an interface would typically make use of
different methods on the class. The methods below are documented in two
sections; those of interest to each side of the interface.
It should be noted however, that this module does not in any way provide an
actual mechanism for performing this asynchronous activity; it merely provides
a way to create objects that can be used for control and data flow around
those operations. It allows such code to be written in a neater,
local/lib/perl5/Future.pm view on Meta::CPAN
convention of C<Future>-using code is to encode extra semantics in the
arguments given to the C<fail> method, to represent different kinds of
failure.
The convention is that after the initial message string as the first required
argument (intended for display to humans), the second argument is a short
lowercase string that relates in some way to the kind of failure that
occurred. Following this is a list of details about that kind of failure,
whose exact arrangement or structure are determined by the failure category.
For example, L<IO::Async> and L<Net::Async::HTTP> use this convention to
indicate at what stage a given HTTP request has failed:
local/lib/perl5/Future.pm view on Meta::CPAN
regardless. The returned sequence future represents the entire combination of
activity.
In some cases the code should return a future; in some it should return an
immediate result. If a future is returned, the combined future will then wait
for the result of this second one. If the combinined future is cancelled, it
will cancel either the first future or the second, depending whether the first
had completed. If the code block throws an exception instead of returning a
value, the sequence future will fail with that exception as its message and no
further values.
As it is always a mistake to call these sequencing methods in void context and lose the
local/lib/perl5/Future.pm view on Meta::CPAN
I<Since version 0.33.>
Returns a new sequencing C<Future> that behaves like an C<else> call which
dispatches to a choice of several alternative handling functions depending on
the kind of failure that occurred. If C<$f1> fails with a category name (i.e.
the second argument to the C<fail> call) which exactly matches one of the
string names given, then the corresponding code is invoked, being passed the
same arguments as a plain C<else> call would take, and is expected to return a
C<Future> in the same way.
$f2 = $code->( $exception, $name, @other_details )
local/lib/perl5/Future.pm view on Meta::CPAN
=head2 btime
=head2 rtime
[ $sec, $usec ] = $future->btime
[ $sec, $usec ] = $future->rtime
I<Since version 0.28.>
Accessors that return the tracing timestamps from the instance. These give the
time the instance was contructed ("birth" time, C<btime>) and the time the
result was determined (the "ready" time, C<rtime>). Each result is returned as
a two-element ARRAY ref, containing the epoch time in seconds and
microseconds, as given by C<Time::HiRes::gettimeofday>.
In order for these times to be captured, they have to be enabled by setting
C<$Future::TIMES> to a true value. This is initialised true at the time the
module is loaded if either C<PERL_FUTURE_DEBUG> or C<PERL_FUTURE_TIMES> are
set in the environment.
local/lib/perl5/Future.pm view on Meta::CPAN
return $self->{rtime};
}
=head2 elapsed
$sec = $future->elapsed
I<Since version 0.28.>
If both tracing timestamps are defined, returns the number of seconds of
elapsed time between them as a floating-point number. If not, returns
C<undef>.
=cut
local/lib/perl5/Future.pm view on Meta::CPAN
each one executing and returning a C<Future> when the previous operation
succeeds.
my $f = do_first()
->then( sub {
return do_second();
})
->then( sub {
return do_third();
});
local/lib/perl5/Future.pm view on Meta::CPAN
case is more complex, because it may be that the entire operation should still
fail, or it may be that the cancellation of C<$f1> should again be treated
simply as a special kind of failure, and the C<else> logic run as normal.
To be specific; in each case it is unclear what happens if the first future is
cancelled, while the second one is still waiting on it. The semantics for
"normal" top-down cancellation of C<$f2> and how it affects C<$f1> are already
clear and defined.
=head2 Cancellation of Divergent Flow
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Spork.pm view on Meta::CPAN
close $log_fh;
},
) or die qq{Couldn't fork for spork: $!};
print 2;
This prints out "12" immediately and is done running, now if you tail -f spork.log you'll see "I am spork hear me spoon\n" get written to it 4 or 5 seconds later by the spork()ed process :)
spork() returns the PID of the spork()ed process so you can keep track of them and do what you need with it.
If it returns false then fork failed so you can:
view all matches for this distribution
view release on metacpan or search on metacpan
A silly module for generating a "stardate" string based
on the local clock. Stardates are simple numerically and lexically
comparable strings that might be useful as version numbers.
http://en.wikipedia.org/wiki/Stardate documents a bit about the usage of
the term on Star Trek. This module just generates sortable gmt date plus
a decimal fraction of a day precise enough to catch one second changes
INSTALLATION
To install this module, run the following commands:
view all matches for this distribution
view release on metacpan or search on metacpan
@ISA = qw(Class::Accessor);
$VERSION = '0.06';
my @keys = qw(offset data section x y datum_length done filename_generator
suffix);
# What arguments can we accept to the constructor.
# Am I reinventing the wheel here?
my %keys;
Acme::Steganography::Image::Png->mk_accessors(@keys);
# This will get refactored out at some point to support other formats.
sub generate_header {
my ($self) = shift;
my $section = $self->section;
my $header = pack 'w', $section;
if (!$section) {
$header .= pack 'w', length ${$self->data};
}
$header;
}
$datum .= "N" x ($datum_length - length $datum);
$self->done(1);
} elsif (length ${$self->data()} == $self->offset) {
warn length $datum;
}
$self->section($self->section + 1);
$self->make_image($datum);
}
sub new {
'png';
}
sub write_images {
my $self = shift;
$self->section(0);
$self->offset(0);
$self->datum_length($self->calculate_datum_length());
my $type = $self->type;
my $filename_generator
= $self->filename_generator || \&default_filename_generator;
foreach my $file (@_) {
my $img = new Imager;
$img->open(file => $file) or carp "Can't read '$file': " . $img->errstr;
my $payload = $class->extract_payload($img);
my $datum;
my $section;
($section, $datum) = unpack "wa*", $payload;
if ($section == 0) {
# Oops. Strip off the length.
($length, $datum) = unpack "wa*", $datum;
}
$got{$section} = $datum;
}
carp "Did not find first section in files @_" unless defined $length;
my $data = join '', map {$got{$_}} sort {$a <=> $b} keys %got;
substr ($data, $length) = '';
$data;
Acme::Steganography::Image::Png::RGB::556->read_files(@files);
=head1 DESCRIPTION
Acme::Steganography::Image::Png is extremely ineffective at hiding your
secrets inside Png images.
There are 4 implementations
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
docs/SubmittingPatches.pod view on Meta::CPAN
some of the dependent topics graduate to 'master', and rebase your work.
=back
To find the tip of a topic branch, run "git log --first-parent
master..pu" and look for the merge commit. The second parent of this
commit is the tip of the topic branch.
=head2 (1) Make separate commits for logically separate changes.
Unless your patch is really trivial, you should not be sending
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $name = shift;
my $features = ( $self->{values}{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Study/BLACKJ.pm view on Meta::CPAN
my $foo = Acme::Study::BLACKJ->new();
...
=head1 EXPORT
A list of functions that can be exported. You can delete this section
if you don't export anything, such as for a purely object-oriented module.
=head1 SUBROUTINES/METHODS
=head2 function1
view all matches for this distribution
view release on metacpan or search on metacpan
examples/object_use_example.pl view on Meta::CPAN
# Simple generic get/set utility method
# Expects either 1 or 2 parameters.
#
# If passed a single string value, returns the associated instance value
#
# If passed a string and a second parameter, sets the the associated instance value to the value of the
# second parameter.
#
sub _property {
my $self = shift;
my $package = __PACKAGE__;
my $property_id = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $name = shift;
my $features = ( $self->{values}->{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/SvGROW.pm view on Meta::CPAN
techniques shared on perl5-porters mailing list November 4 and 5, 2009
=head1 EXPORT
the C<SvGROW> subroutine is exported. It takes two arguments,
the first the string to extend and the second the length.
=head1 SEE ALSO
L<perlguts>
view all matches for this distribution