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
bin/cpanidx_httpserver view on Meta::CPAN
$ cpanidx_httpserver --config cpanidx.ini
=head1 CONFIGURATION
Configuration is stored in an L<Config::Tiny> style initialisation file. By default
it looks for a C<cpanidx.ini> in the current working directory. This can be amended
by using the C<--config> command line switch.
If no previous configuration is found, the script will default to using L<DBD::SQLite>
based database C<cpanidx.db> in the current working directory.
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/App/CPANtoRPM.pm view on Meta::CPAN
}
return %files;
}
# This looks at the filelist determines which are pod files, which are
# .pm files, which are test files, etc.
#
sub _categorize_files {
my($self,$op,$dir,%files) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CamelPKI/CADB.pm view on Meta::CPAN
ok($Synopsis::cursor->isa("App::CamelPKI::CADB::Cursor"));
is($Synopsis::cert->serialize(), $certificate->serialize());
is($Synopsis::infos{foo}->[0], "bar");
is_deeply([sort @{$Synopsis::infos{baz}}], [qw(bloggs quux)]);
like($Synopsis::revocation_time, qr/^\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}Z$/,
"revocation time looks ok");
is($Synopsis::revocation_reason, "keyCompromise");
is($Synopsis::compromise_time, "20070313104800Z");
};
=end internals
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CatalystStarter/Bloated.pm view on Meta::CPAN
If given a --dsn, runs create model and provides default names
for schema and model classes.
=item *
If using a dbi:Pg dsn, looks in your ~/.pgpass to find usernames
and passwords and even intelligently completes your dsn if you are
missing hostname and or port.
=item *
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Changelog2x.pm view on Meta::CPAN
One special value is recognized: C<unix>. If C<date_format> is called with
this value as a format string, a pre-defined format is used that emulates the
UNIX C<date> command as closely as possible (but see L</CAVEATS> for notes
on B<DateTime> limitations with regards to timezone names and the special
patterns recognized in date format strings to try and work around this). A
string formatted this way looks like this:
Mon Aug 10 09:21:46 -0700 2009
=item xslt_path [DIRS]
view all matches for this distribution
view release on metacpan or search on metacpan
devel/brown72-import.pl view on Meta::CPAN
my $tdate = App::Chart::ymd_to_tdate_floor (1980,1,1);
open my $in, '<', $filename or die;
while (defined (my $line = <$in>)) {
$line =~ s/,//;
Scalar::Util::looks_like_number($line) or next;
push @data, { symbol => $symbol,
date => App::Chart::tdate_to_iso($tdate),
close => $line,
};
$tdate++;
devel/brown72-import.pl view on Meta::CPAN
$tdate++;
open my $in, '<', $filename or die;
while (defined (my $line = <$in>)) {
$line =~ s/,//;
Scalar::Util::looks_like_number($line) or next;
$line -= $mean;
$total += $line;
push @data, { symbol => $symbol,
date => App::Chart::tdate_to_iso($tdate),
close => $total,
view all matches for this distribution
view release on metacpan or search on metacpan
# Update a member of an archive of if a newer file exists
ar -ruv libMy.a 1.o
# Alternate syntax to link to an archive library
-lABC # looks for libABC.so, then for libABC.a
-l:libABC.a # Looks for libABC.a (more explicit, but simplier)
#############################################################
## C,CPP - String
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
# Zen of Perl
According to Larry Wall, there are three great virtues of a programmer; Laziness, Impatience and Hubris
- Laziness:
+ my ($Orig,$Self,%Param) = @_;
+ $Orig->($Self,%Param);
+ return 1;
+ };
# The basic Moose type hierarchy looks like this (perl,OOP):
Any
Item
Bool
Maybe[`a]
Undef
#############################################################
## Perl Modules - Scalar::Util
#############################################################
# perl looks_like_number example.
perl -MScalar::Util=looks_like_number -E 'printf("%s: %s\n", $_, looks_like_number($_)) for qw/ 1 cat bat 1.5 1e10 4.5 fat /'
1: 1
cat:
bat:
1.5: 1
1e10: 1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chronicle/Plugin/PostBuild.pm view on Meta::CPAN
The C<on_generate> method is automatically invoked to generate output
pages. This particular plugin method is invoked I<after> any
C<on_initiate> methods which might be present.
This method merely looks for defined post-build commands, and if any
are encountered they are executed via C<system>.
=cut
sub on_generate
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/App/CmdDispatch.pm view on Meta::CPAN
=back
=head2 run( $cmd, @args )
This method looks up the supplied command and executes it.
=head2 command_hint( $cmd )
This method prints a short hint listing all commands and aliases or just the
hint for the supplied command.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cmdline.pm view on Meta::CPAN
$self->composed_of (
'App::Cmdline::Options::Basic',
);
}
The last example looks a bit inconvenient. And you do not need to do
it that way - because the C<composed_of> method accepts also any
arrayrefs, ignoring them and just passing them to its return
value. That's why you really can call this method only once and not to
be bothered with the hashref at the end. Here is an example how you
can combine class names (predefined sets) with your own option
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Session/Cookie.pm view on Meta::CPAN
Sample Usage:
$ref->_init($args);
The _init() method looks at the cookies in the request
and restores the session state information from the cookies
named "app_sessiondata" (and "app_sessiondata[2..n]").
When the values of these cookies are concatenated, they
form a Base64-encoded, gzipped, frozen multi-level hash of
view all matches for this distribution
view release on metacpan or search on metacpan
my $pid = <PID>;
close( PID );
return undef unless defined $pid;
chomp( $pid );
return undef unless $pid;
die "$pid looks like a funny pid!\n"
unless $pid =~ /^(\d+)$/
;
return $self->{PID} = $1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Critique/Command/tutorial.pm view on Meta::CPAN
=head2 Collect
Next you want to ask F<critique> to find all the files you want to
process. This will basically just traverse the directory tree and
find all the available perl files, and looks like this:
> critique collect -v --root lib/ExampleCompany/
You can also provide different criteria to help create the file list
that you want. You can do this in a few ways, here are some examples.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DBBrowser/Auxil.pm view on Meta::CPAN
use warnings;
use strict;
use 5.016;
use Scalar::Util qw( looks_like_number );
use JSON::MaybeXS qw( decode_json );
use List::MoreUtils qw( none uniq );
use Term::Choose qw();
lib/App/DBBrowser/Auxil.pm view on Meta::CPAN
sub is_char_datatype {
my ( $sf, $sql, $col ) = @_;
my $is_char;
if ( ! defined $sql->{data_types}{$col} ) {
if ( looks_like_number $col ) { ##
$is_char = 0;
}
elsif ( $col =~ /^(?:AVG|COUNT|MAX|MIN|SUM)\(/ ) {
$is_char = 0;
}
lib/App/DBBrowser/Auxil.pm view on Meta::CPAN
}
sub quote_constant {
my ( $sf, $value ) = @_;
if ( looks_like_number $value ) {
return $value;
}
else {
return $sf->{d}{dbh}->quote( $value );
}
view all matches for this distribution
view release on metacpan or search on metacpan
The C<flat> output format is meant to support typical unixish command
line uses. It is not a strong serialization format but works well for
simple values nested max 2 levels.
Output looks like this:
=head3 Plain values
Affe
Tiger
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
string like "SIGINT".
=item status
will print out diagnostics on what the status of the daemon is. Typically,
the output looks like this:
Pid file: ./tt.pid
Pid in file: 15562
Running: yes
Name match: 1
This indicates that the pidfile says that the daemon has PID 15562 and
that a process with this PID is actually running at this moment. Also,
a name grep on the process name in the process table results in 1 match,
according to the output above.
Note that the name match is unreliable, as it just looks for a command line
that looks approximately like the script itself. So if the script is
C<test.pl>, it will match lines like "perl -w test.pl" or
"perl test.pl start", but unfortunately also lines like
"vi test.pl".
If the process is no longer running, the status output might look like
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dapper.pm view on Meta::CPAN
_source/
index.md
_output/
index.html
To see what your website looks like, run the C<dapper serve> command which
will spin up a development webserver and serve the static files located in
the output directory (default: C<_output>) at L<http://localhost:8000>.
Now, let's walk through each file:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dest.pm view on Meta::CPAN
Given our database example, we'd likely want each of the action sub-files to be
pure SQL. In that case, we'll need to write some wrapper program that C<dest>
will run that will then consume and run the SQL files as appropriate.
C<dest> looks for wrapper files up the chain from the location of the action
file. Specifically, it'll assume a file is a wrapper if the filename is
"dest.wrap". If such a file is found, then that file is called, and the name of
the action sub-file is passed as its only argument.
As an example, let's say I created an action set that looked like this
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/dex view on Meta::CPAN
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(
blessed refaddr reftype weaken unweaken isweak
dualvar isdual isvstring looks_like_number openhandle readonly set_prototype
tainted
);
our $VERSION = "1.59";
$VERSION =~ tr/_//d;
scripts/dex view on Meta::CPAN
Scalar::Util - A selection of general-utility scalar subroutines
=head1 SYNOPSIS
use Scalar::Util qw(blessed dualvar isdual readonly refaddr reftype
tainted weaken isweak isvstring looks_like_number
set_prototype);
# and other useful utils appearing below
=head1 DESCRIPTION
scripts/dex view on Meta::CPAN
$vs = v49.46.48;
$fmt = isvstring($vs) ? "%vd" : "%s"; #true
printf($fmt,$vs);
=head2 looks_like_number
my $isnum = looks_like_number( $var );
Returns true if perl thinks C<$var> is a number. See
L<perlapi/looks_like_number>.
=head2 openhandle
my $fh = openhandle( $fh );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DocKnot/Generate.pm view on Meta::CPAN
##############################################################################
# Word-wrap a paragraph of text. This is a helper function for _wrap, mostly
# so that it can be invoked recursively to wrap bulleted paragraphs.
#
# If the paragraph looks like regular text, which means indented by two or
# four spaces and consistently on each line, remove the indentation and then
# add it back in while wrapping the text.
#
# $para - A paragraph of text to wrap
# $options_ref - Options to controll the wrapping
lib/App/DocKnot/Generate.pm view on Meta::CPAN
# since it may be a continuation of a numbered list entry.
if (length($indent) > 5 && !$options_ref->{ignore_indent}) {
return $para;
}
# If this looks like thread commands or URLs, leave it alone.
if ($para =~ m{ \A \s* (?: \\ | \[\d+\] ) }xms) {
return $para;
}
# If this starts with a bullet, strip the bullet off, wrap the paragraph,
lib/App/DocKnot/Generate.pm view on Meta::CPAN
$para = $self->_wrap_paragraph($para, { ignore_indent => 1 });
substr($para, $offset, length($number), $number);
return $para;
}
# If this looks like a Markdown block quote, strip trailing whitespace,
# remove the leading indentation marks, wrap the paragraph, and then put
# them back.
## no critic (RegularExpressions::ProhibitCaptureWithoutTest)
if ($para =~ m{ \A (\s*) > \s }xms) {
$para =~ s{ [ ]+ \n }{\n}xmsg;
lib/App/DocKnot/Generate.pm view on Meta::CPAN
$para =~ s{ ^ (\s{$offset}) \s }{$1>}xmsg;
return $para;
}
## use critic
# If this looks like a bunch of short lines, leave it alone.
if ($para =~ m{ \A (?: \Q$indent\E [^\n]{1,45} \n ){3,} }xms) {
return $para;
}
# If this paragraph is not consistently indented, leave it alone.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/CLI/Guide.pm view on Meta::CPAN
If the SID or SCODE of a schedule is known, it can be looked up like so:
SID=12 SHOW
SCODE=SAMPLE SHOW
The first example looks up the schedule with SID 12, and the second looks
up the schedule with SCODE "SAMPLE".
=head3 Define a new schedule
The following commands can be used to "create" a schedule, i.e. define it and
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/REST/Guide.pm view on Meta::CPAN
ALTER ROLE
At this point, we exit C<psql> and, still as the user C<postgres>, we
edit C<pg_hba.conf>. In SUSE distributions, this file is located in
C<data/> under the C<postgres> home directory. Using our favorite editor,
we change the METHOD entry for C<local> so it looks like this:
# TYPE DATABASE USER ADDRESS METHOD
local all all password
For the audit triggers to work (and the application will not run otherwise), we
lib/App/Dochazka/REST/Guide.pm view on Meta::CPAN
=over
=item * B<Allowed methods test>
One of the first things the server looks at, when it receives a request, is
the method. Only certain HTTP methods, such as 'GET' and 'POST', are accepted.
If this test fails, a "405 Method Not Allowed" response is sent.
=item * B<Internal and external authentication, session management>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dochazka/WWW/Dispatch.pm view on Meta::CPAN
In derived-distro mode, this structure is expected to be translated into a
"real" HTTP request, to be forwarded via the LWP::UserAgent object stored in
the session data. The status object received in the response is then passed
back to the JavaScript side.
There is one special case: the POST request from the login dialog looks like this:
{ method: "LOGIN", path: "login", body: { nam: "foo", pwd: "bar" } }
Login requests receive special handling.
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/App/Dothe.pm view on Meta::CPAN
=head1 DOTHE SYNTAX
The configuration file is in YAML. It follows, by and large, the
format used by Task.
By default, `dothe` looks for the file `Dothe.yml`.
Where entries can be templates, they are evaluated via L<Text::Template>.
Basically, that means that in a template all that is surrounded by double curley braces
is evaluated as Perl code. Those code snippets are evaluated within the
C<App::Dothe::Sandbox> namespace, and have all the C<vars> variables
view all matches for this distribution