view release on metacpan or search on metacpan
lib/Acme/Pointer.pm view on Meta::CPAN
my $a = {
a => 20,
b => [1,2]
};
my $b = "$a";
say $b;
print Dumper deref($b);
say "-" x 10;
if ($b =~ /[A-Z]+\((.*)\)/) {
print Dumper pointer($1);
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/greeting.pl view on Meta::CPAN
# The output of ponifying it can be seen in greeting.gif.
#!/usr/bin/perl
use 5.010;
say 'Hello World';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Pony.pm view on Meta::CPAN
$maxy = $y}
}
my @ascii;
# Can you say "generic polygon scanline fill"?
foreach my $y ($miny .. $maxy) {
my($ind1, $ind2, $y1, $y2, $x1, $x2, @polyints);
foreach my $i (0 .. $n-1) {
if (!$i) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/PrettyCure/CureDream.pm view on Meta::CPAN
for my $buddy (@buddies) {
$buddy->transform;
}
$self->say("叿ã®åã¨ãæªæ¥ã®å
");
$self->say("è¯éºã«ç¾½ã°ããäºã¤ã®å¿!");
$self->say("Yes! ããªãã¥ã¢5!");
};
no Any::Moose;
__PACKAGE__->meta->make_immutable;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/PriPara/MainMembers.pm view on Meta::CPAN
}
# alias to voiced_by
*voiced_by = \&cv;
sub say {
my ($self) = @_;
return $self->{say};
}
sub color {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Pythonic/Functions.pm view on Meta::CPAN
=over 12
=item C<pyprint>
Python adds a (system-dependent) newline-character by default to strings to be printed.
This is rather convenient and can be found in the say()-function of Perl 5.10 and above too. I wasn't happy with the way, say() prints lists though. You can have that with something like 'say for @a;', but I like the way, Python prints lists better. ...
If you have to print more complex data-structures, use Data::Dumper.
=back
=head2 String-Functions
view all matches for this distribution
view release on metacpan or search on metacpan
for routing IP over SFSS, you can use the scripts in the example
directory (note that you need Net::Pcap for them):
# ipsfss_receive.pl <interface> [filter]
Receives packets from an interface and shows you what to signal. So
say you want to signal all packets to 10.23.23.23 arriving on en0, just
use
# ipsfss_receive.pl en0 "ip and dst 10.23.23.23"
# ipsfss_send.pl <interface> <source MAC> <destination MAC>
If you receive signals from someone, you can use ipsfss_send.pl to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Rando.pm view on Meta::CPAN
=head1 SYNOPSIS
use Acme::Rando;
say rando();
=head1 DESCRIPTION
Exports a function rando() which returns a random star wars quote. This joke
probably only makes sense to my coworkers.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Resume.pm view on Meta::CPAN
=head1 USAGE
One way to read a résumé (apart from reading the source) is with one-liners:
$ perl -MAcme::Resume::For::ExAmple -E 'say Acme::Resume::For::ExAmple->new->get_job(-1)->started->year'
The L<Acme::Resume::Output::ToPlain> role (used by default) adds a C<to_plain> method:
$ perl -MAcme::Resume::For::Tester -E 'say Acme::Resume::For::Tester->new->to_plain'
=head1 TODO
More documentation and a complete example.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/ReturnValue.pm view on Meta::CPAN
}
my $interesting=$self->interesting;
if (@$interesting > 0) {
foreach my $cool (@$interesting) {
say $cool->{package} .': '.$cool->{value};
}
}
else {
say "boring!";
}
}
sub waste_some_cycles {
lib/Acme/ReturnValue.pm view on Meta::CPAN
$archive->extract($dir);
$self->in_dir($dir,$dist->distvname);
};
if ($@) {
say $@;
}
rmtree($dir);
}
# remove old data files
lib/Acme/ReturnValue.pm view on Meta::CPAN
sub in_dir {
my ($self,$dir,$dumpname)=@_;
$dumpname ||= $dir;
$dumpname=~s/\//_/g;
say $dumpname unless $self->quiet;
$self->interesting([]);
$self->bad([]);
my @pms;
find(sub {
lib/Acme/ReturnValue.pm view on Meta::CPAN
use Acme::ReturnValue;
my $rvs = Acme::ReturnValue->new;
$rvs->in_INC;
foreach (@{$rvs->interesting}) {
say $_->{package} . ' returns ' . $_->{value};
}
=head1 DESCRIPTION
C<Acme::ReturnValue> will list 'interesting' return values of modules.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Robd/Boring.pm view on Meta::CPAN
use strict;
use feature 'say';
...
use Acme::Robd::Boring;
my $arb = Acme::Robd::Boring->new;
say $arb->name;
Acme::Robd::Boring # bore-ing!
=head1 METHODS
=head2 new
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Roman.pm view on Meta::CPAN
=head1 DESCRIPTION
The Roman Empire ruled over a large part of the ocidental world
for a long time, probably too long for the conquested people.
They were finally won and there are some who say it was because
they could not do mathematics. Such liars!
This module redeems Perl with the ungratefully forgotten
Roman numbers, which now can find their glory again.
view all matches for this distribution
view release on metacpan or search on metacpan
use lib 't';
use t::UnsafeSourceFilter;
use Acme::SafetyGoggles;
use Test::More tests => length("xx"); # Can't say tests=>2 because of source filter!
my $foo = 42;
ok( Acme::SafetyGoggles->state eq 'unsafe',
'Acme::SafetyGoggles on altered module marked unsafe' );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Schlong.pm view on Meta::CPAN
# has number_of_modules => ( is => 'ro', isa => Int, lazy_build => 1, documentation => q{} );
method _build_useraccounts { scalar grep { !/Shared/ } grep { -d $_ } glob ( dir( $self->home_directory => '..') . '/*'); } #TODO Make safer for WIN
method _build_username_length { length $self->username }
method _build_shell { $_ = $ENV{SHELL}; s/.*\/(.*?)$/$1/; $_ } # /r
method _build_harddrive_size { $_=`df -l | grep '\\/\$' | awk '{print \$2}'`; chomp; $_ } # -E 'use IPC::Run qw<run timeout>; my $out; my @cmd = (q<du>, q<-s>, q</>); run \@cmd, "", \undef, \$out, timeout( 100 ) echo `uptime|grep days|sed...
method _build_harddrive_used { $_=`df -l | grep '\\/\$' | awk '{print \$3}'`; chomp; $_ } # -E 'use IPC::Run qw<run timeout>; my $out; my @cmd = (q<du>, q<-s>, q</>); run \@cmd, "", \undef, \$out, timeout( 100 ) echo `uptime|grep days|sed...
method _build_uptime { 100 }
method _build_users { 5 }
method _build_cores { App::OS::Detect::MachineCores->new->cores }
method _build_using_multiplex { $self->using_byobu or $self->using_tmux or $self->using_screen ? true : false }
method _build_using_byobu { exists $ENV{BYOBU_BACKEND} ? 1 : 0 }
lib/Acme/Schlong.pm view on Meta::CPAN
# using_zsh
# using_ksh
# using_tcsh
# using_csh
# say for glob (dir($self->home_directory) . '/' . '.*');
$self->add_size(10) if $self->using_zsh;
$self->add_size(100) if $self->using_multiplex;
$self->add_size( 100 * $self->cores );
lib/Acme/Schlong.pm view on Meta::CPAN
$self->abs_size
}
method testdrive {
say "Your Acme Schlong size is: ", $self->size;
say "Your username is: ", $self->username;
say "Your home directory is: ", $self->home_directory;
say "The number of useraccounts is ", $self->useraccounts;
say "Your TERM is ", $self->term;
say "Your shell is ", $self->shell;
say "You are using byobu ", $self->using_byobu;
say "Your username length is ", $self->username_length;
say "You harddrive_size is ", $self->harddrive_size;
say "The number of cores is ", $self->cores;
say "Your perl version is ", $self->perl_version;
# say "Your perl version is a dev_release: ", $self->perl_version_is_dev;
say "You have this many dirs in PATH: ", $self->directories_in_path;
say "You are using a multiplexer: ", $self->using_multiplex;
say "You are using perlbrew: ", $self->using_perlbrew;
say "You are using zsh: ", $self->using_zsh;
say "You are using bash: ", $self->using_bash;
say "You are using cpanm: ", $self->using_cpanm;
say "You are using cpanm customized: ", $self->using_cpanm_customized;
say "You are using Dist::Zilla: ", $self->using_dzil;
say "You have this many perls installed ", $self->perls_installed;
say "Your PAUSE name is ", $self->pause_name;
say "Your number of known hosts is ", $self->known_hosts;
# say "Your number of modules released to the cpan is ", $self->cpan_modules;
}
}
lib/Acme/Schlong.pm view on Meta::CPAN
Build Task:: Distribution so that everybody can keep his own stuff?
=item *
Versioning so that you can say "By metric XYZ your schlong size is XYZ" ?
=item *
More robust OS-specific stuff.
view all matches for this distribution
view release on metacpan or search on metacpan
Scripticide.pm view on Meta::CPAN
Beleive it or not this is handy if you have a one time job to execute:
# $script uses Acme::Scripticide
system $script if -e $script;
or say to create static files from a database:
# in flowers.pl (copy this to whatever names you want and execute:)
use Acme::Scripticide qw(good_bye_cruel_world);
good_bye_cruel_world('.html', get_html($0));
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Builder.pm view on Meta::CPAN
sub _is_qr {
my $regex = shift;
# is_regexp() checks for regexes in a robust manner, say if they're
# blessed.
return re::is_regexp($regex) if defined &re::is_regexp;
return ref $regex eq 'Regexp';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Signature/Arity.pm view on Meta::CPAN
Given a coderef, returns a coderef (either the original or wrapped)
which won't complain if you try to pass more parameters than it was expecting.
This is intended for library authors in situations like this:
$useful_library->each(sub ($item) { say "item here: $item" });
where you later want to add optional new parameters, and don't trust your users
to include the mandatory C<< , @ >> signature definition that indicates excess
parameters can be dropped.
Usage - let's say your first library version looked like this:
sub each ($self, $callback) {
my $code = $callback;
for my $item ($self->{items}->@*) {
$code->($item);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Sneeze.pm view on Meta::CPAN
print ref($object); # will print "Others"
=head1 DESCRIPTION
When you sneeze in America (or other English speaking countries),
you'll be blessed. But the problem is that they say "Bless you"
without the 2nd parameter: the package name.
So with Acme::Sneeze, your object will have I<sneeze> method, and when
you sneeze you'll be automatically blessed to the current package.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Songmu.pm view on Meta::CPAN
my $self = shift;
sprintf '%s %s', $self->first_name, $self->last_name;
}
sub gmu {
say encode_utf8 'ããã¼';
}
1;
__END__
lib/Acme/Songmu.pm view on Meta::CPAN
=head1 SYNOPSIS
use Acme::Songmu;
my $songmu = Acme::Songmu->instance;
say $songmu->name; # => 'Masayuki Matsuki'
say $songmu->age; # => 37
$songmu->gmu; # => 'ããã¼'
=head1 DESCRIPTION
Acme::Songmu is Songmu's sample CPAN module for sandboxing.
view all matches for this distribution
view release on metacpan or search on metacpan
local/lib/perl5/Future.pm view on Meta::CPAN
$future->done( @_ );
}
);
$future->on_ready( sub {
say "The operation is complete";
} );
=head1 DESCRIPTION
A C<Future> object represents an operation that is currently in progress, or
local/lib/perl5/Future.pm view on Meta::CPAN
my $f = foperation( foo => "something" );
$f->on_ready( sub {
my $f = shift;
say "The operation returned: ", $f->get;
} );
=head2 Indicating Success or Failure
Because the stored exception value of a failed future may not be false, the
local/lib/perl5/Future.pm view on Meta::CPAN
my $f = foperation( foo => "something" );
$f->on_ready( sub {
my $f = shift;
if( not my $e = $f->failure ) {
say "The operation succeeded with: ", $f->get;
}
else {
say "The operation failed with: ", $e;
}
} );
By using C<not> in the condition, the order of the C<if> blocks can be
arranged to put the successful case first, similar to a C<try>/C<catch> block.
local/lib/perl5/Future.pm view on Meta::CPAN
use Try::Tiny;
$f->on_ready( sub {
my $f = shift;
try {
say "The operation succeeded with: ", $f->get;
}
catch {
say "The operation failed with: ", $_;
};
} );
Even neater still may be the separate use of the C<on_done> and C<on_fail>
methods.
$f->on_done( sub {
my @result = @_;
say "The operation succeeded with: ", @result;
} );
$f->on_fail( sub {
my ( $failure ) = @_;
say "The operation failed with: $failure";
} );
=head2 Immediate Futures
Because the C<done> method returns the future object itself, it can be used to
local/lib/perl5/Future.pm view on Meta::CPAN
my $f2 = foperation( bar => "something else" );
my $f = Future->wait_all( $f1, $f2 );
$f->on_ready( sub {
say "Operations are ready:";
say " foo: ", $f1->get;
say " bar: ", $f2->get;
} );
This provides an ability somewhat similar to C<CPS::kpar()> or
L<Async::MergePoint>.
view all matches for this distribution
view release on metacpan or search on metacpan
StringFormat.pm view on Meta::CPAN
use Acme::StringFormat;
# enable 'sprintf' operator in the scope
say '[%s][%s]' % 'foo' % 'bar'; # => [foo][bar]
=head1 DESCRIPTION
I had a desire for a "format operator" of other languages.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/SuperCollider/Programming.pm view on Meta::CPAN
Clearly, this is not a realistic ranking of the SuperCollider Programming
profession.
To those who would undervalue the hard-working members of the SuperCollider
Programming collective, we say NO! NO MORE!
By leveraging the 3-4,000 pages that will be created for this distribution,
mentioning B<Acme::SuperCollider::Programming>,
or C<Acme-SuperCollider-Programming>, all of which can be happily found with
a search for C<+"SuperCollider Programming">, this distribution will help to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Teddy.pm view on Meta::CPAN
=head2 import()
This is a cut-down copy of L<Exporter::Heavy>::heavy_export()
(the same routine that B<Exporter> uses normally to export stuff on request).
There are two reasons we don't say C<@ISA = qw(Exporter);>. We don't want to
introduce any dependencies whatsoever; and we offer caller the freedom to
export anything at all. Almost no checking is done of arguments passed
to C<import()> (normally, on the C<use()> line).
=head2 new()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Test/Buffy.pm view on Meta::CPAN
package Acme::Test::Buffy;
# turn on strict. If this was perl 5.6.0 I'd turn on warnings too, but
# testing scripts normally work on perls all the way back to 5.004
# so I can't say that.
use strict;
#use warnings;
# declare the global vars for exporter and isa and stuff. If this
lib/Acme/Test/Buffy.pm view on Meta::CPAN
{
# We failed. We want to test Test::Builder to print something
# like:
# Failed test at line <line number>
# Expected 'Buffy' but got '<what we got>' instead
# that is to say we print failure first, _then_ the extra diag
# stuff that will help people debug the code better.
# print not okay with the right text ("not ok <number> - <text>")
$Tester->ok(0,$text);
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Acme-Testing
0.002 22/Jun/2012
Added some excuses to so it doesn't constantly say 'Finalizing test...' every time. Hoepfully your bosses will fall for it. Good luck!
0.001 Yesterday
First version, released on an unsuspecting world.
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More;
use Acme::Text::Shorten::ForTwitter;
# Some basics, also texting happens before contractions
my $shortener = Acme::Text::Shorten::ForTwitter->new;
my $short = $shortener->shorten("I will not, do not, say you are, why?");
is($short, "I won't, don't, say ur, y?", 'shortened correctly');
Acme::Text::Shorten::ForTwitter->import('-texting');
$shortener = Acme::Text::Shorten::ForTwitter->new;
$short = $shortener->shorten("I will not, do not, say you are, why?");
is($short, "I won't, don't, say you're, why?", 'shortened correctly with -texting');
Acme::Text::Shorten::ForTwitter->import('+texting');
$shortener = Acme::Text::Shorten::ForTwitter->new;
$short = $shortener->shorten("I will not, do not, say you are, why?");
is($short, "I will not, do not, say ur, y?", 'shortened correctly with +texting');
# Make sure longer contractions are used first
Acme::Text::Shorten::ForTwitter->import('+contractions');
$shortener = Acme::Text::Shorten::ForTwitter->new;
$short = $shortener->shorten("I would have");
view all matches for this distribution
view release on metacpan or search on metacpan
---------------------
Version 1.04 is the result of a patch from Kate Pugh, of London.pm,
demonstrating that there are other people in the world that are just as
silly as me. So there. Now this module speaks British English as well as
American English. You say tomato, I say tomato.
---------------------
Version 1.10 is a major rearrangement. The desire was to be able to
create clock modules for any arbitrary clock without working very hard
view all matches for this distribution
view release on metacpan or search on metacpan
However, there is two methods of interpolation:
Example, we have only three numbers: 5, 6 and 7.
Method 1: The most common is to say that 5 and 7 lays on the 25- and
75-percentile. This method is used in Acme::Tools.
Method 2: In Oracle databases the least and greatest numbers
always lay on the 0- and 100-percentile.
...will print the same as:
print for map join("",@$_), permutations(1..3);
...but the first of those two uses less RAM if 3 has been say 9.
Changing 3 with 10, and many computers hasn't enough memory
for the latter.
The examples prints:
213
231
312
321
If you just want to say calculate something on each permutation,
but is not interested in the list of them, you just don't
take the return. That is:
my $ant;
permutations(sub{$ant++ if $_[-1]>=$_[0]*2},1..9);
view all matches for this distribution
view release on metacpan or search on metacpan
my $mapper = Acme::UPnP->new( );
# Discovery
if ( $mapper->discover_device( ) ) {
say 'Found router: ' . $mapper->upnp_device->getfriendlyname( );
# Map a port
$mapper->map_port( 8080, 8080, 'TCP', 'My Silly App' );
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/simple.pl view on Meta::CPAN
use 5.010;
use JSON qw(decode_json);
use Acme::URL;
# print the json
say http://twitter.com/statuses/show/6592721580.json;
# => "He nose the truth."
say decode_json( http://twitter.com/statuses/show/6592721580.json )->{text};
view all matches for this distribution