view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
view all matches for this distribution
view release on metacpan or search on metacpan
Like L<between> but instead of assuming numbers it checks all three input args
and does alphanumerical comparisons (with Perl operators C<lt>, C<ge> and C<le>) if any of the
three input args don't look like a number or look like a number but with
one or more leading zeros.
btw(1,1,10) #true numeric order since all three looks like number according to =~$Re_isnum
btw(1,'02',13) #true leading zero in '02' leads to alphabetical order
btw(10, 012,10) #true leading zero here means oct number, 012 = 10 (8*1+2), so 10 is btw 10 and 10
btw('003', '02', '09') #false because '003' lt '02'
btw('a', 'b', 'c') #false because 'a' lt 'b'
btw('a', 'B', 'c') #true because upper case letters comes before lower case ones in the "ascii alphabet"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/UNIVERSAL/new.pm view on Meta::CPAN
There are a few other functions:
=head2 C<get_class( $symbol_table, $name_prefix )>
Returns a random class name, after finding everything that looks like a class
beneath the given C<$symbol_table> reference named C<$name_prefix>. If you
pass neither argument, this starts in the main symbol table.
=head2 C<get_ref()>
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-basic.t view on Meta::CPAN
use Scalar::Util ();
use Acme::Version::Hex;
cmp_ok($Acme::Version::Hex::VERSION, '>', 0.0009, '$VERSION is similar to 0.001');
ok(Scalar::Util::looks_like_number($Acme::Version::Hex::VERSION), '$VERSION looks like a number');
ok(Scalar::Util::looks_like_number(Acme::Version::Hex->VERSION), 'VERSION() looks like a number');
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Win32/PEPM.pm view on Meta::CPAN
"packager", the .pm text is stored uncompressed in the .dll, and there is no
sane reason to keep .pm text memory mapped into a process since after
parsing/compiling .pm, the .pm text is never referenced again, yet with this
"packager", if the XS DLL is loaded, so is the .pm text, into the process.
The resulting .pm that is built can not be edited even though it mostly looks
like plain text. If it is edited, the DLL will be corrupt. The resulting .pm,
although superficially looking like pure perl can not be moved between perl
installations/versions except for maint versions, since the XS DLL inside the
.pm, like all XS DLLs/SOs is bound to a particular perl installation and version
number.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/YAPC/Okinawa/ppport.h view on Meta::CPAN
listkids|||
list|||
load_module_nocontext|||vn
load_module|5.006000||pv
localize|||
looks_like_bool|||
looks_like_number|||
lop|||
mPUSHi|5.009002||p
mPUSHn|5.009002||p
mPUSHp|5.009002||p
mPUSHs|5.010001||p
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/emcA.pm view on Meta::CPAN
=head1 DESCRIPTION
The first time you run a program under C<use Acme::emcA>, the module takes
your source file and makes an mirror image of it at both row- and column-
level. The code continues to work exactly as it did before, but now it looks
like this:
;use Acme::emcA esu;
;"!dlroW ,olleH" tnirpprint "Hello, World!";
view all matches for this distribution
view release on metacpan or search on metacpan
unshift @INC, "$base/lib";
}
=head1 USAGE
When you're working within C<a-script.pl> when your project looks like this:
project-root/
âââ bin/
â âââ utils/
â âââ a-script.pl
view all matches for this distribution
view release on metacpan or search on metacpan
Acme/landmine version 1.00
==========================
It looks like a scalar/array/hash but if you try to evaluate
it an exception is thrown, with "confess" stacktrace. For
help debugging data structure problems. References to it
are safe though.
INSTALLATION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/require/case.pm view on Meta::CPAN
sub require_casely {
my ($filename) = @_;
my ( $realfilename, $result, $valid, $actual );
# Are we checking a version number?
if ( _looks_like_version($filename) ) {
my $v = eval { version->new($filename) };
croak $@ if $@;
croak "Perl @{[$v->normal]} required--this is only $^V, stopped"
if $v > $^V;
return 1;
lib/Acme/require/case.pm view on Meta::CPAN
}
# Valid case or invalid?
if ($valid) {
$INC{$filename} = $realfilename;
# uplevel so calling package looks right
my $caller = caller(0);
# deletes $realfilename from %INC after loading it since that's
# just a proxy for $filename, which is already set above
my $code = qq{
package $caller; sub { local %^H; my \$r = do \$_[0]; delete \$INC{\$_[0]}; \$r }
lib/Acme/require/case.pm view on Meta::CPAN
}
}
return ( $valid, $search->relative($prefix) );
}
sub _looks_like_version {
my ($v) = @_;
return 1 if isvstring($v);
return B::svref_2object( \$v )->FLAGS & ( B::SVp_NOK | B::SVp_IOK );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/this.pm view on Meta::CPAN
In the face of ambiguity, do what I mean.
There's more than one way to do it.
Although that might not be obvious unless you're a Monk.
At your discretion is better than not at all.
Although your discretion should be used judiciously.
Just because the code looks clean doesn't mean it is good.
Just because the code looks messy doesn't mean it is bad.
Reuse via CPAN is one honking great idea -- let's do more of that!
EOF
}
1;
lib/Acme/this.pm view on Meta::CPAN
In the face of ambiguity, do what I mean.
There's more than one way to do it.
Although that might not be obvious unless you're a Monk.
At your discretion is better than not at all.
Although your discretion should be used judiciously.
Just because the code looks clean doesn't mean it is good.
Just because the code looks messy doesn't mean it is bad.
Reuse via CPAN is one honking great idea -- let's do more of that!
=head1 DESCRIPTION
Print the Zen of Perl when used.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Activator/Config.pm view on Meta::CPAN
cookbook.pl lookup beans
=head2 Simple Development
Use Case: developer is working on C<cookbook.pl>. Project directory
looks like:
$HOME/src/Cookbook/lib/Cookbook.pm
$HOME/src/Cookbook/bin/cookbook.pl
$HOME/src/Cookbook/etc/cookbook.d/org.yml
$HOME/src/Cookbook/.cookbook.d/$USER.yml
view all matches for this distribution
view release on metacpan or search on metacpan
t/10-relations.t view on Meta::CPAN
is $achievement->id, 4;
ok $Bill->achievements($achievement)->save, 'trying to bind achievement to the customer';
ok my $cnt = $Bill->achievements({ title => 'Bill Achievement' })->count(), 'trying to count customers achievements';
is $cnt, 1, 'looks good';
ok $Bill->achievements({ title => 'Bill Achievement' })->exists;
ok !$Bill->achievements({ title => 'Not Existing Achievement' })->exists;
ok my @bills_orders = $Bill->purchases->fetch, 'got Bill\'s orders';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AddressBook/Config.pm view on Meta::CPAN
their respective backend database equivalents, attribute metadata, and backend
database attributes.
$config = AddressBook::Config->new(config_file=>$filename);
AddressBook::Config looks for a configuration file in /etc/AddressBook.conf if
no config_file parameter is present.
=head1 DESCRIPTION
Configuration is read from an XML configuration file which follows this DTD:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ado/Manual/Intro.pod view on Meta::CPAN
extended with L<plugins|Ado::Manual::Plugins> and L<commands|Ado::Command> or
as a L<CMF|http://en.wikipedia.org/wiki/List_of_content_management_frameworks>
on which to build many different specific applications.
Here is the directory structure. It does not contain the files for brevity. It
looks much the same as a full Mojolicious application would look and as
described in L<Mojolicious::Guides::Growing/Differences>. One noticeable
difference is that Ado has it's starter script in C<bin> instead of in
C<script> and this is only to ease the deployment. Another one is the
L<Ado::Control> namespace instead of Ado::Controlller. We did this for
brevity. The third difference is C<site_templates>, used for putting Ado
lib/Ado/Manual/Intro.pod view on Meta::CPAN
âââ layouts
âââ partials
âââ test
And here is how Ado looks as building blocks:
=for HTML <img src="https://raw.githubusercontent.com/kberov/Ado/master/public/img/Ado-Building-Blocks.png" />
To learn more about Ado plugins, please look at L<Ado::Manual::Plugins>.
Now that you know what additional features Ado provides, you can proceed to
view all matches for this distribution
view release on metacpan or search on metacpan
F<\%read_opts> is an optional hash reference that controls the default parsing
of the config file as it's being read into memory. Feel free to leave as
B<undef> if you're satisfied with this module's default behaviour.
F<\%get_opts> is an optional hash reference that defines the default behaviour
when this module looks something up in the config file. Feel free to leave as
B<undef> if you're satisfied with this module's default behaviour.
F<\%date_opts> is an optional hash reference that defines the default formatting
of the special date variables. Feel free to leave as B<undef> if you're
satisfied with the default formatting rules.
=over
=item $value = $cfg->get_value ( $tag[, %override_get_opts] );
This function looks up the requested B<tag>'s value and returns it.
See common details above.
=cut
sub get_value
#######################################
=item $value = $cfg->get_integer ( $tag[, $rt_flag[, %override_get_opts]] );
This function looks up the requested B<tag>'s value and returns it if its an
integer. If the B<tag>'s value is a floating point number (ex 3.6), then the
value is either truncated or rounded up based on the setting of the I<rt_flag>.
If I<rt_flag> is set, it will perform truncation, so 3.6 becomes B<3>. If the
flag is B<undef> or zero, it does rounding, so 3.6 becomes B<4>. Meaning the
#######################################
=item $value = $cfg->get_numeric ( $tag[, %override_get_opts] );
This function looks up the requested B<tag>'s value and returns it if its
value is numeric. Which means any valid integer or floating point number!
If the B<tag> doesn't exist or its value is not numeric it will return B<undef>
unless it's been marked as I<required>. In that case B<die> may be called
instead.
#######################################
=item $date = $cfg->get_date ( $tag[, $language[, %override_get_opts]] );
This function looks up the requested B<tag>'s value and returns it if its
value contains a valid date. The returned value will always be in I<YYYY-MM-DD>
format no matter what format or language was actually used in the config file
for the date.
If the B<tag> doesn't exist or its value is not a date it will return B<undef>
=over
=item $array_ref = $cfg->get_list_values ( $tag[, $pattern[, $sort[, %override_get_opts ]]] );
This function looks up the requested B<tag>'s value and then splits it up into
an array and returns a reference to it.
If I<sort> is 1 it does an ascending sort. If I<sort> is -1, it will do a
descending sort instead. By default it will do no sort.
Creates a new section called I<$name> within the current Advanced::Config object
I<$cfg>. It returns the I<Advanced::Config> object that it created. If a
section of that same name already exists it will return B<undef>.
There is no such thing as sub-sections, so if I<$cfg> is already points to a
section, then it looks up the parent object and associates the new section with
the parent object instead.
=cut
sub create_section
the curent section. Otherwise it does a case insensitive comparison of the
pattern against each tag to see if it should be returned or not.
If I<override_inherit> is provided it overrides the current I<inherit> option's
setting. If B<undef> it uses the current I<inherit> setting. If I<inherit>
evaluates to true, it looks in the current section I<and> the main section for
a match. Otherwise it just looks in the current section.
The returned list of tags will be sorted in alphabetical order.
=cut
the curent section. Otherwise it does a case insensitive comparison of the
pattern against each tag's value to see if it should be returned or not.
If I<override_inherit> is provided it overrides the current I<inherit> option's
setting. If B<undef> it uses the current I<inherit> setting. If I<inherit>
evaluates to true, it looks in the current section I<and> the main section for
a match. Otherwise it just looks in the current section.
The returned list of tags will be sorted in alphabetical order.
=cut
#######################################
=item $sensitive = $cfg->chk_if_sensitive ( $tag[, $override_inherit] );
This function looks up the requested tag in the current section of the config
file and returns if this module thinks the existing value is senitive (B<1>)
or not (B<0>).
If the tag doesn't exist, it will always return that it isn't sensitive. (B<0>)
3) The config file marked it as being encrypted.
4) It referenced a variable that was marked as sensitive.
If I<override_inherit> is provided it overrides the current I<inherit> option's
setting. If B<undef> it uses the current I<inherit> setting. If I<inherit>
evaluates to true, it looks in the current section I<and> the main section for
a match. Otherwise it just looks in the current section for the tag.
=cut
sub chk_if_sensitive
{
#######################################
=item $encrypted = $cfg->chk_if_still_encrypted ( $tag[, $override_inherit] );
This function looks up the requested tag in the current section of the config
file and returns if this module thinks the existing value is still encrypted
(B<1>) or not (B<0>).
If the tag doesn't exist, it will always return B<0>!
B<disable_decryption> was used. In that case this method was added to detect
which tags still needed their values decrypted before they were used.
If I<override_inherit> is provided it overrides the current I<inherit> option's
setting. If B<undef> it uses the current I<inherit> setting. If I<inherit>
evaluates to true, it looks in the current section I<and> the main section for
a match. Otherwise it just looks in the current section for the tag.
=cut
sub chk_if_still_encrypted
{
#######################################
=item $bool = $cfg->chk_if_still_uses_variables ( $tag[, $override_inherit] );
This function looks up the requested tag in the current section of the config
file and returns if the tag's value contained variables that failed to expand
when the config file was parsed. (B<1> - has variable, B<0> - none.)
If the tag doesn't exist, or you called C<set_value> to create it, this function
will always return B<0> for that tag!
used the B<disable_decryption> option and you had a variable that referenced
a tag that is still encrypted. But use of those two options should be rare.
If I<override_inherit> is provided it overrides the current I<inherit> option's
setting. If B<undef> it uses the current I<inherit> setting. If I<inherit>
evaluates to true, it looks in the current section I<and> the main section for
a match. Otherwise it just looks in the current section for the tag.
=cut
sub chk_if_still_uses_variables
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Affix.pm view on Meta::CPAN
use Affix;
sub some_argless_function :Native('something');
some_argless_function();
The first line imports various code attributes and types. The next line looks
like a relatively ordinary Perl sub declaration--with a twist. We use the
C<:Native> attribute in order to specify that the sub is actually defined in a
native library. The platform-specific extension (e.g., .so or .dll), as well as
any customary prefixes (e.g., lib) will be added for you.
lib/Affix.pm view on Meta::CPAN
A struct consists of a sequence of members with storage allocated in an ordered
sequence (as opposed to C<Union>, which is a type consisting of a sequence of
members where storage overlaps).
A C struct that looks like this:
struct {
char *make;
char *model;
int year;
lib/Affix.pm view on Meta::CPAN
The value of at most one of the members can be stored in a union at any one
time and the union is only as big as necessary to hold its largest member
(additional unnamed trailing padding may also be added). The other members are
allocated in the same bytes as part of that largest member.
A C union that looks like this:
union {
char c[5];
float f;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Agent/TCLI/Package/Base.pm view on Meta::CPAN
use strict;
use Carp;
use Object::InsideOut qw(Agent::TCLI::Base);
use POE;
use Scalar::Util qw(blessed looks_like_number);
use Getopt::Lucid;
use YAML::Syck;
use XML::Simple;
use File::ShareDir;
#use FormValidator::Simple;
lib/Agent/TCLI/Package/Base.pm view on Meta::CPAN
sub NotPosInt {
my ($self,$value,$name,$set) = @_;
$name = "Parameter" unless defined($name);
return ('') unless (defined ($value) && $value ne '');
return($name." is not a number: got '$value' \n") unless (Scalar::Util::looks_like_number($value) );
return($name." is not an integer: got '$value' \n") unless(int($value) == $value);
return($name." is not positive: got '$value' \n") unless ( $value >= 0);
if (defined($set))
{
$self->$name($value) if ($set eq 'set');
lib/Agent/TCLI/Package/Base.pm view on Meta::CPAN
sub NotNumeric {
my ($self,$value,$name,$set) = @_;
$name = "Parameter" unless defined($name);
return ('') unless (defined ($value) && $value ne '');
return($name." is not a number: got '$value' \n") unless (Scalar::Util::looks_like_number($value) );
$self->$name($value) if ($set);
return ('');
}
sub NotScalar {
view all matches for this distribution
view release on metacpan or search on metacpan
Down the road...
----------------
If this release of Agent looks promising, I hope to include support for
PGP encryption & signatures, the KQML/KIF communication standards
(underway!), and more.
Links
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Fs.pm view on Meta::CPAN
sub mkpath (;$) {
my ($path) = @_ == 0? $_: @_;
my $permission;
($path, $permission) = @$path if ref $path;
$permission = DIR_DEFAULT_PERMISSION unless Scalar::Util::looks_like_number $permission;
local $!;
if(isUNIX) {
while($path =~ m!/!g) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Type.pm view on Meta::CPAN
package Aion::Type;
# ÐазовÑй клаÑÑ Ð´Ð»Ñ Ñипов и пÑеобÑазоваÑелей
use common::sense;
use Scalar::Util qw/looks_like_number/;
require DDP;
use overload
"fallback" => 1,
"&{}" => sub {
lib/Aion/Type.pm view on Meta::CPAN
# СимволÑное пÑедÑÑавление знаÑениÑ
sub val_to_str {
my ($self, $v) = @_;
!defined($v) ? "undef":
looks_like_number($v) ? $v:
ref($v) ? DDP::np($v, max_depth => 2, array_max => 13, hash_max => 13, string_max => 255):
do {
$v =~ s/[\\']/\\$&/g;
$v =~ s/^/'/;
$v =~ s/\z/'/;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Album/Tutorial.pm view on Meta::CPAN
Again, 'album' only does the work needed, re-using the work already
done.
=head2 Adding image descriptions
As can be seen from the example runs, 'album' looks for a file
'info.dat'. This file can be used to:
=over 4
=item *
view all matches for this distribution
view release on metacpan or search on metacpan
* touched: 0
*
* (note: the entries in data[] are added in decreasing order)
*
*
* If, on the other hand, if supralist[lattice[d]] looks like
*
* data: 2 0 x y
* count: 8
* next: 11
* touched: 1
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
view all matches for this distribution
view release on metacpan or search on metacpan
listkids|||
list|||
load_module_nocontext|||vn
load_module|5.006000||pv
localize|||
looks_like_bool|||
looks_like_number|||
lop|||
mPUSHi|5.009002||p
mPUSHn|5.009002||p
mPUSHp|5.009002||p
mPUSHs|5.010001||p
view all matches for this distribution
view release on metacpan or search on metacpan
listkids|||
list|||
load_module_nocontext|||vn
load_module|5.006000||pv
localize|||
looks_like_bool|||
looks_like_number|||
lop|||
mPUSHi|5.009002||p
mPUSHn|5.009002||p
mPUSHp|5.009002||p
mPUSHs|5.010001||p
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/BestChoice.pm view on Meta::CPAN
use Algorithm::BestChoice::Matcher;
use Algorithm::BestChoice::Ranker;
use Algorithm::BestChoice::Result;
use Algorithm::BestChoice::Option;
use Scalar::Util qw/looks_like_number/;
has options => qw/is ro required 1 isa ArrayRef/, default => sub { [] };
sub add {
my $self = shift;
lib/Algorithm/BestChoice.pm view on Meta::CPAN
if (my $match = $option->match( $key )) {
my $rank;
if (ref $match eq 'HASH') {
$rank = $match->{rank};
die "Got an undefined rank from a match" unless defined $rank;
die "Got a non-numeric rank ($rank) from a match" unless looks_like_number $rank;
}
else {
$rank = $option->rank( $key );
die "Got an undefined rank from a ranker" unless defined $rank;
die "Got a non-numeric rank ($rank) from a ranker" unless looks_like_number $rank;
}
push @tally, Algorithm::BestChoice::Result->new( rank => $rank, value => $option->value );
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
listkids|||
list|||
load_module_nocontext|||vn
load_module|5.006000||pv
localize|||
looks_like_bool|||
looks_like_number|||
lop|||
mPUSHi|5.009002||p
mPUSHn|5.009002||p
mPUSHp|5.009002||p
mPUSHs|5.010001||p
view all matches for this distribution