view release on metacpan or search on metacpan
lib/Acme/AsciiArt2HtmlTable.pm view on Meta::CPAN
=back
=cut
sub aa2ht {
# default configuration
my %config = _clone_hash( \%default_configuration );
=head3 OPTIONS
lib/Acme/AsciiArt2HtmlTable.pm view on Meta::CPAN
}
# subroutines
sub _random_color {
my $color = '';
for (1 .. 6) {
$color .= qw/1 2 3 4 5 6 7 8 9 0 a b c d e f/[int rand 16];
}
return $color;
}
sub _clone_hash {
my %hash = %{+shift};
my %new_hash;
for (keys %hash) {
lib/Acme/AsciiArt2HtmlTable.pm view on Meta::CPAN
}
return %new_hash;
}
sub _count_in_the_beginning {
my ($cell, @elems) = @_;
my $t = 0;
for (@elems) {
if ($cell eq $_) {
$t++;
lib/Acme/AsciiArt2HtmlTable.pm view on Meta::CPAN
}
}
return $t;
}
sub _min {
my $min = shift;
for (@_) {
if ( $min > $_ ) { $min = $_ }
}
return $min;
}
sub _max {
my $max = shift;
for (@_) {
if ( $max < $_ ) { $max = $_ }
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
Constructor - creates a new Acme:AsciiArtFarts object. This method takes no arguments.
=cut
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
$self->{ua} = LWP::UserAgent->new();
$self->{uri} = 'http://www.asciiartfarts.com';
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
Returns the current strip.
=cut
sub current {
return $_[0]->__request('/today.txt')
}
=head2 random
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
Returns a random strip.
=cut
sub random {
return __parse($_[0]->__request('/random.cgi'));
}
=head2 list_keywords
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
Returns a list of all keywords by which strips are sorted.
=cut
sub list_keywords {
return sort keys %{$_[0]->{keywords}}
}
=head2 list_by_keyword
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
Returns a list of strip numbers for the given keyword.
=cut
sub list_by_keyword {
my ($self,$keyword)= @_;
exists $self->{keywords}->{$keyword} or return 0;
return @{$self->{keywords}{$keyword}{strips}};
}
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
Alternately, given an integer value that is a valid strip number, return the requested strip.
=cut
sub get_by_num {
my ($self,$num) =@_;
$num =~ /^#/ or $num = '#'.$num;
return __parse($self->__request("/$self->{strips}{$num}{page}"))
}
sub __get_keywords {
my $self= shift;
my $itr = 0;
my @html= split /\n/, $self->__request('/keyword.html');
for ($itr=0;$itr<@html;$itr++) {
lib/Acme/AsciiArtFarts.pm view on Meta::CPAN
$self->{strips}{$num}{keyword} = $key;
}
}
}
sub __request {
my($self,$rl) = @_;
$rl |= '';
my $res = $self->{ua}->get($self->{uri}.$rl);
$res->is_success and return $res->content;
$self->{error} = 'Unable to retrieve content: ' . $res->status_line;
return 0
}
sub __parse {
my @html = split /\n/, $_[0];
my $found = 0;
my $res;
foreach (@html) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#############################################################################
#
# run ASCII Artinization on a picture and a code string.
#
sub asciiartinate {
my %opts = @_;
if (@_ == 1 && ref $_[0] eq "HASH") {
%opts = @{$_[0]};
}
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
}
#
# run a file containing Perl code for a Perl compilation check
#
sub compile_check {
my ($file) = @_;
print "\n";
print "- " x 20, "\n";
print "Compile check for $file:\n";
print "- " x 20, "\n";
print `$^X -cw "$file"`;
print "- " x 20, "\n";
return $?;
}
sub tweak_padding {
my ($filler, $tref, $cref) = @_;
# TODO: if there are many consecutive characters of padding
# in the code, we can improve its appearance by
# inserting some quoted text in void context.
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#
# does the current string begin with an "operator keyword"?
# if so, return it
#
sub find_token_keyword {
my ($q) = @_;
foreach my $k (@token_keywords) {
if (substr($q,0,length($k)) eq $k) {
return $k;
}
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
}
#
# find position of a scalar in an array.
#
sub STRPOS {
my ($word, @array) = @_;
my $pos = -1;
for (my $i=0; $i<@array; $i++) {
$pos = $i if $array[$i] =~ /$word/;
}
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#
# what does the "/" token that we just encountered mean?
# this is a hard game to play.
# see http://www.perlmonks.org/index.pl?node_id=44722
#
sub regex_or_divide {
my ($tokenref, $contextref) = @_;
my @tokens = @$tokenref;
my @contexts = @$contextref;
# regex is expected following an operator,
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
return "regex" if $tokens[$c] eq ";" && $tokens[$c-1] ne "SIGIL";
return "divide";
}
sub tokenize_code {
my ($INPUT) = @_;
local $" = '';
my @INPUT = grep { /[^\n]/ } split //, $INPUT;
# tokens are:
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
@asciiartinate::tokens = @tokens;
@tokens;
}
sub asciiindex_code {
my ($X) = @_;
my $endpos = index($X,"\n__END__\n");
if ($endpos >= 0) {
substr($X,$endpos) = "\n";
}
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
&tokenize_code($X);
}
#############################################################################
sub tokenize_art {
my ($INPUT) = @_;
my @INPUT = split //, $INPUT;
my $white = 1;
my $block_size = 0;
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
push @blocks, $block_size;
}
return @blocks;
}
sub asciiindex_art {
my ($X) = @_;
&tokenize_art($X);
}
#
# replace darkspace on the pic with characters from the code
#
sub print_code_to_pic {
my ($pic, @tokens) = @_;
local $" = '';
my $code = "@tokens";
my @code = split //, $code;
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#
# find misalignment between multi-character tokens and blocks
# and report position where additional padding is needed for
# alignment
#
sub padding_needed {
my @tokens = @{$_[0]};
my @contexts = @{$_[1]};
my @blocks = @{$_[2]};
my $ib = 0;
my $tc = 0;
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#
# choose a random number between 0 and n-1,
# with the distribution heavily weighted toward
# the high end of the range
#
sub hi_weighted_rand {
my $n = shift;
my (@p, $r, $p);
for ($r = 1; $r <= $n; $r++) {
push @p, $p += $r * $r * $r;
}
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#
# look for opportunity to insert padding into the
# code at the specified location
#
sub try_to_pad {
my ($pos, $npad, $tref, $cref) = @_;
# padding techniques:
# X SIGIL name ---> SIGIL { name }
# XXX ---> ( XXX )
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
#
# find all misalignments and insert padding into the code
# until all code is aligned or until the padded code is
# too large for the pic.
#
sub pad {
my @tokens = @{$_[0]};
my @contexts = @{$_[1]};
my @blocks = @{$_[2]};
my $nblocks = 0;
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
&I();$N=<>;@o=(map{$z=${U}x($x=1+$N-$_);
' 'x$x.($".$F)x$_.($B.$z.$P.$z.$F).($B.$")x$_.$/}
0..$N);@o=(@o,($U.$F)x++$N.($"x3).($B.$U)x$N.$/);
print@o;
sub I{($B,$F,$P,$U)=qw(\\ / | _);}
while($_=pop@o){y'/\\'\/';@o||y#_# #;$t++||y#_ # _#;print}
What this code does is read one value from standard input
and draws a spider web of the given size:
lib/Acme/AsciiArtinator.pm view on Meta::CPAN
{U }x( $x= 1+
$N- $_) ;' 'x $x. ($".
$F)x$_ .($B.$z.$ P. $z.$F).
($B.$")x$_.$/}0..$N);@
o=(@o,($U.$F)x++$N.($"x3).($B.$U
)x$N.$/);;;;print@o;;;sub I{( $B,
$F, $P,$U)=qw(\\ /
| _);;}while($_=pop @o
){ y'/\\'\/';;;@o||y#_# #;; ;;;
;$ t++ ||y#_ # _#;print }# ##
## ## ################ ## ##
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AsciiEmoji.pm view on Meta::CPAN
=head1 EXPORT
=cut
sub ascii_emoji {
return pack( 'C*', @{ $EMOJI{ $_[0] } } );
}
=head2 innocent
Êâ¿Ê
Innocent face
=cut
sub innocent {
return ascii_emoji('innocent');
}
=head2 disapproval
ಠ_à²
Reddit disapproval face
=cut
sub disapproval {
return ascii_emoji('disapproval');
}
=head2 table_flip
(â¯Â°â¡Â°ï¼â¯ï¸µ â»ââ»
Table Flip / Flipping Table
=cut
sub table_flip {
return ascii_emoji('table_flip');
}
=head2 put_the_table_back
â¬â⬠ã( ã-ãã)
Put the table back
=cut
sub put_the_table_back {
return ascii_emoji('put_the_table_back');
}
=head2 double_flip
â»â⻠︵ã½(`д)ï¾ï¸µ â»ââ»
Double Flip / Double Angry
=cut
sub double_flip {
return ascii_emoji('double_flip');
}
=head2 super_waving
( ï¾âï¾)ï½±ï¾ï¾å
«å
«ï¾ã½ï¾ã½ï¾ã½ï¾ ï¼¼ / ï¼¼/ ï¼¼
Super waving
=cut
sub super_waving {
return ascii_emoji('super_waving');
}
=head2 fistacuffs
á(ï½ã¼Â´á)
Fistacuffs
=cut
sub fistacuffs {
return ascii_emoji('fistacuffs');
}
=head2 cute_bear
Êâ¢á´¥â¢Ê
Cute bear
=cut
sub cute_bear {
return ascii_emoji('cute_bear');
}
=head2 big_eyes
(。ââ¿â。)
Big eyes
=cut
sub big_eyes {
return ascii_emoji('big_eyes');
}
=head2 surprised
ï¼ãï¾Ðï¾ï¼
surprised / loudmouthed
=cut
sub surprised {
return ascii_emoji('surprised');
}
=head2 shrug
¯\_(ã)_/¯
shrug face
=cut
sub shrug {
return ascii_emoji('shrug');
}
=head2 meh
¯\(°_o)/¯
meh
=cut
sub meh {
return ascii_emoji('meh');
}
=head2 feel_perky
(`ï½¥Ï・´)
feel perky
=cut
sub feel_perky {
return ascii_emoji('feel_perky');
}
=head2 angry
(⬠ಠçಠ)
angry face
=cut
sub angry {
return ascii_emoji('angry');
}
=head2 excited
â(ââ½â)â
excited
=cut
sub excited {
return ascii_emoji('excited');
}
=head2 running
ε=ε=ε=â(;*´Ð`)ï¾
running
=cut
sub running {
return ascii_emoji('running');
}
=head2 happy
ã½(´â½`)/
happy face
=cut
sub happy {
return ascii_emoji('happy');
}
=head2 basking_in_glory
ã½(´ã¼ï½)ã
basking in glory
=cut
sub basking_in_glory {
return ascii_emoji('basking_in_glory');
}
=head2 kitty
áµá´¥áµ#
kitty emote
=cut
sub kitty {
return ascii_emoji('kitty');
}
=head2 meow
à¸
^â¢ï»â¢^à¸
meow
=cut
sub meow {
return ascii_emoji('meow');
}
=head2 cheers
ï¼ ^_^ï¼oèªèªoï¼^_^ ï¼
Cheers
=cut
sub cheers {
return ascii_emoji('cheers');
}
=head2 devious
ಠâ¿à²
devious smile
=cut
sub devious {
return ascii_emoji('devious');
}
=head2 chan
( ͡° ÍÊ Í¡Â°)
4chan emoticon
=cut
sub chan {
return ascii_emoji('chan');
}
=head2 disagree
Ù©â̯âÛ¶
disagree
=cut
sub disagree {
return ascii_emoji('disagree');
}
=head2 flexing
á(ââ¸â¼â¶)á
flexing
=cut
sub flexing {
return ascii_emoji('flexing');
}
=head2 do_you_lift_bro
á¦(ò_óË)á¤
do you even lift bro?
=cut
sub do_you_lift_bro {
return ascii_emoji('do_you_lift_bro');
}
=head2 kirby
â(ââ¿â)ã¤
kirby
=cut
sub kirby {
return ascii_emoji('kirby');
}
=head2 tripping_out
q(ââ¿â)p
tripping out
=cut
sub tripping_out {
return ascii_emoji('tripping_out');
}
=head2 discombobulated
âï¹â
discombobulated
=cut
sub discombobulated {
return ascii_emoji('discombobulated');
}
=head2 sad_shrug
¯\_(â︿â)_/¯
sad and confused
=cut
sub sad_shrug {
return ascii_emoji('sad_shrug');
}
=head2 confused
¿â§_â§ï®
confused
=cut
sub confused {
return ascii_emoji('confused');
}
=head2 confused_scratch
(â.â)7
confused scratch
=cut
sub confused_scratch {
return ascii_emoji('confused_scratch');
}
=head2 worried
(´・_・`)
worried
=cut
sub worried {
return ascii_emoji('worried');
}
=head2 dear_god_why
Ñï¼ï¾Ðï¾Ñï¼
dear god why
=cut
sub dear_god_why {
return ascii_emoji('dear_god_why');
}
=head2 staring
Ù©(Í¡à¹_à¹)Û¶
staring
=cut
sub staring {
return ascii_emoji('staring');
}
=head2 strut
á( á )á
strut
=cut
sub strut {
return ascii_emoji('strut');
}
=head2 zoned
(â_â)
zoned
=cut
sub zoned {
return ascii_emoji('zoned');
}
=head2 crazy
ãâï¹âã
crazy
=cut
sub crazy {
return ascii_emoji('crazy');
}
=head2 trolling
༼âµà¼½ ༼â¨à¼½ ༼â¢à¼½ ༼â¤à¼½
trolling
=cut
sub trolling {
return ascii_emoji('trolling');
}
=head2 angry_troll
ã½à¼¼ ಠçಠ༽ï¾
angry troll
=cut
sub angry_troll {
return ascii_emoji('angry_troll');
}
=head2 hugger
(ã¥ï¿£ ³ ̄)ã¥
hugger
=cut
sub hugger {
return ascii_emoji('hugger');
}
=head2 stranger_danger
(ã¥ï½¡ââ¿â¿â。)ã¥
stranger danger
=cut
sub stranger_danger {
return ascii_emoji('stranger_danger');
}
=head2 flip_friend
(ãಠâ©à² )ã彡( \o°o)\
flip friend
=cut
sub flip_friend {
return ascii_emoji('flip_friend');
}
=head2 cry
。ï¾( ï¾à®â¸à®ï¾)ï¾ï½¡
cry face
=cut
sub cry {
return ascii_emoji('cry');
}
=head2 tgif
âã½(´â½ï½)ãâ
TGIF
=cut
sub tgif {
return ascii_emoji('tgif');
}
=head2 dancing
â(ãã¨ã)Ê
dancing
=cut
sub dancing {
return ascii_emoji('dancing');
}
=head2 sleepy
ë_ë
sleepy
=cut
sub sleepy {
return ascii_emoji('sleepy');
}
=head2 fly_away
â½â½à¬( ËáµË )à¬â¾â¾
fly away
=cut
sub fly_away {
return ascii_emoji('fly_away');
}
=head2 careless
â_â
careless
=cut
sub careless {
return ascii_emoji('careless');
}
=head2 love
â¥â¿â¥
love
=cut
sub love {
return ascii_emoji('love');
}
=head2 touch
Ô
(ââ¿âÔ
)
Touchy Feely
=cut
sub touchy {
return ascii_emoji('touchy');
}
=head2 robot
{â¢Ì_â¢Ì}
robot
=cut
sub robot {
return ascii_emoji('robot');
}
=head2 seal
(áµá´¥áµ)
seal
``
=cut
sub seal {
return ascii_emoji('seal');
}
=head2 questionable
(Ծ⸠Ծ)
questionable / dislike
=cut
sub questionable {
return ascii_emoji('questionable');
}
=head2 winning
(â¢Ìá´â¢Ì)Ù ÌÌ
Winning!
=cut
sub winning {
return ascii_emoji('winning');
}
=head2 zombie
[¬º-°]¬
Zombie
=cut
sub zombie {
return ascii_emoji('zombie');
}
=head2 pointing
(âï¾ã®ï¾)â
pointing
=cut
sub pointing {
return ascii_emoji('pointing');
}
=head2 chasing
''â(ಠ۾ಠ)¬'''
chasing / running away
=cut
sub chasing {
return ascii_emoji('chasing');
}
=head2 shy
(à¹â¢Ì â â¢Ìà¹)
shy
=cut
sub shy {
return ascii_emoji('shy');
}
=head2 okay
( â¢_â¢)
okay..
=cut
sub okay {
return ascii_emoji('okay');
}
=head2 put_sunglasses_on
( â¢_â¢)>ââ -â
Put Sunglasses on.
=cut
sub put_sunglasses_on {
return ascii_emoji('put_sunglasses_on');
}
=head2 sunglasses
(ââ _â )
sunglasses
=cut
sub sunglasses {
return ascii_emoji('sunglasses');
}
=head2 giving_up
o(â¥ï¹â¥)o
Giving Up
=cut
sub giving_up {
return ascii_emoji('giving_up');
}
=head2 magical
(ï¾âã®â)ï¾*:ã»ï¾â§
Magical
=cut
sub magical {
return ascii_emoji('magical');
}
=head2 mustach
( Ëà·´Ë )
Mustach
=cut
sub mustach {
return ascii_emoji('mustach');
}
=head2 friends
(ï½ã»_ã»)ãâ(á´_ á´ã)
Friends
=cut
sub friends {
return ascii_emoji('friends');
}
=head2 evil
(å±®ï½â´)å±®
Evil
=cut
sub evil {
return ascii_emoji('evil');
}
=head2 devil
(â£ââ¢)Ï
Devil
=cut
sub devil {
return ascii_emoji('devil');
}
=head2 salute
(ï¿£ã¼ï¿£)ã
Salute
=cut
sub salute {
return ascii_emoji('salute');
}
=head2 inject
â(â ÍÊâ)ã¤â£ââââââ
inject
=cut
sub inject {
return ascii_emoji('inject');
}
=head2 why
ã½(ï½â´ã¡)ã
why
=cut
sub why {
return ascii_emoji('why');
}
=head2 execution
(ââ _â )︻â¦â¤â (â¥ï¹â¥)
execution
=cut
sub execution {
return ascii_emoji('execution');
}
=head2 kicking
ã½( ï½¥âï½¥)ï¾ââΣ(ã `д)ã
kicking
=cut
sub kicking {
return ascii_emoji('kicking');
}
=head2 success
â§*。٩(ËáË*)Ùâ§*。
yay
=cut
sub success {
return ascii_emoji('success');
}
=head2 punch
ââ«*ï½ï½°Â´â£ââââââââââ)ï¾Oï¾).。ï¾
punch
=cut
sub punch {
return ascii_emoji('punch');
}
=head2 fu
áâ ͡ᵠ⸠͡ᵠâå¸
*fu*
=cut
sub fu {
return ascii_emoji('fu');
}
=head2 vision
(-(-(-_-)-)-)
vision
=cut
sub vision {
return ascii_emoji('vision');
}
=head2 eyes
â(ââ âà·´â ââ)â®
eyes
=cut
sub eyes {
return ascii_emoji('eyes');
}
=head2 wall
â´â¬â´â¤ï½¥_ï½¥ââ´â¬â´
wall
=cut
sub wall {
return ascii_emoji('wall');
}
=head2 eastern smile
))
smile
=cut
sub east_smile {
return ascii_emoji('east_smile');
}
=head2 western smile
:)
smile
=cut
sub west_smile {
return ascii_emoji('west_smile');
}
=head2 bat
/|\ ^._.^ /|\
bat
=cut
sub bat {
return ascii_emoji('bat');
}
=head2 dollarbill
[̲Ì
$̲Ì
(̲Ì
ιο̲Ì
Ì
)̲Ì
$̲Ì
]
dollarbill
=cut
sub dollarbill {
return ascii_emoji('dollarbill');
}
=head2 wizard
â°( ͡° ÍÊ Í¡Â° )ã¤âââ*:ã»ï¾
=cut
sub wizard {
return ascii_emoji('wizard');
}
=head2 terrorist
à§à¼¼à² çಠ༽︻â¦â¤â
=cut
sub terrorist {
return ascii_emoji('terrorist');
}
=head2 sword
o()xxxx[{::::::::::::::::::>
=cut
sub sword {
return ascii_emoji('sword');
}
=head2 swag
(Ì¿âÌ¿â¿âÌ¿âÌ¿ Ì¿)
=cut
sub swag {
return ascii_emoji('swag');
}
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AtIncPolice.pm view on Meta::CPAN
BEGIN {
use Tie::Trace qw/watch/;
no warnings 'redefine';
*Tie::Trace::_output_message = sub {
my ($self, $class, $value, $args) = @_;
if (!$value) {
return;
}
lib/Acme/AtIncPolice.pm view on Meta::CPAN
return("${msg}" . (! $self->{options}->{pkg} || @msg ? "" : " => "). "{$args->{key}} => $value$location");
}
};
*Tie::Trace::_carpit = sub {
my ($self, %args) = @_;
return if $Tie::Trace::QUIET;
my $class = (split /::/, ref $self)[2];
my $op = $self->{options} || {};
lib/Acme/AtIncPolice.pm view on Meta::CPAN
croak $watch_msg . $msg . "\n";
}
};
watch @INC, (
debug => sub {
my ($self, $things) = @_;
for my $thing (@$things) {
my $ref = ref($thing);
if ($ref) {
return "Acme::AtIncPolice does not allow contamination of \@INC";
lib/Acme/AtIncPolice.pm view on Meta::CPAN
=head1 SYNOPSIS
use Acme::AtIncPolice;
# be killed by Acme::AtIncPolice
push @INC, sub {
my ($coderef, $filename) = @_;
my $modfile = "lib/$filename";
if (-f $modfile) {
open my $fh, '<', $modfile;
return $fh;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Auggy.pm view on Meta::CPAN
use strict;
use warnings;
package Acme::Auggy;
sub say_auggy {
return "Auggy";
}
sub say_auggy_is {
my ($is) = @_;
return say_auggy . ' is ' . $is;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AutoColor.pm view on Meta::CPAN
our $VERSION = '0.04';
our $Colors;
sub import {
my $class = shift;
# TODO: parse version numbers
$Colors = Graphics::ColorNames->new(@_);
}
lib/Acme/AutoColor.pm view on Meta::CPAN
use Carp qw( croak );
use Graphics::ColorNames qw( hex2tuple );
our $AUTOLOAD;
sub AUTOLOAD {
my $class = shift;
$AUTOLOAD =~ /.*::(\w+)/;
my $cname = $1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AutoLoad.pm view on Meta::CPAN
our $last_fetched = "";
our $lib = "lib";
our $hook = \&inc;
sub ignore {}
sub import {
warn "DEBUG: Congratulations! Acme::AutoLoad has been loaded.\n" if $ENV{AUTOLOAD_DEBUG};
$lib = $ENV{AUTOLOAD_LIB} if $ENV{AUTOLOAD_LIB};
if ($lib =~ m{^[^/]}) {
eval {
require Cwd;
lib/Acme/AutoLoad.pm view on Meta::CPAN
push @INC, $lib, $hook if $hook;
$hook = undef;
return \&ignore;
}
sub mkbase {
my $path = shift;
if ($path =~ s{/+[^/]*$ }{}x) {
return 1 if -d $path;
}
die "$path: Not a directory\n" if lstat $path;
lib/Acme/AutoLoad.pm view on Meta::CPAN
return mkdir $path, 0755;
}
return 0;
}
sub fetch {
my $url = shift;
my $recurse = shift || {};
$url = full($url) unless $url =~ m{^\w+://};
my $contents = get($url);
$last_fetched = $url;
lib/Acme/AutoLoad.pm view on Meta::CPAN
return $contents;
}
# full
# Turn a relative URL into a full URL
sub full {
my $rel = shift;
if ($rel =~ m{http://} || $last_fetched !~ m{^(http://[^/]+)(/?.*)}) {
return $rel;
}
my $h = $1;
lib/Acme/AutoLoad.pm view on Meta::CPAN
return "$h$p$rel";
}
# fly
# Create a stub module to load the real file on-the-fly if needed.
sub fly {
my $inc = shift;
my $url = shift;
my $write = shift;
warn "DEBUG: Creating stub for [$inc] in order to download [$url] later if needed.\n" if $ENV{AUTOLOAD_DEBUG};
my $contents = q{
lib/Acme/AutoLoad.pm view on Meta::CPAN
close $fh;
}
return $contents;
}
sub inc {
my $i = shift;
my $f = shift;
my $cache_file = "$lib/$f";
if (-f $cache_file) {
warn "$cache_file: Broken module. Can't continue.\n";
lib/Acme/AutoLoad.pm view on Meta::CPAN
}
return ();
}
sub get {
local $_ = shift;
s{^http(s|)://}{}i;
s{^([\w\-\.\:]+)$}{$1/};
s{^([\w\-\.]+)/}{$1:80/};
if (m{^([\w\-\.]+:\d+)(/.*)}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AutoloadAll.pm view on Meta::CPAN
use warnings;
our $DEBUG = 0;
BEGIN {
$SIG{__WARN__} = sub {
warn @_ unless $_[0] =~ m/inherited AUTOLOAD/;
};
}
sub find_function {
my $function = shift;
my $package = shift || 'main';
my $seen = shift || {};
# remove last ::
$package =~ s/::$//;
lib/Acme/AutoloadAll.pm view on Meta::CPAN
return undef if (exists($seen->{$package}));
print STDERR "Searching '$function' in '$package'...\n" if ($DEBUG);
# check if the current package has the function
my $sub = $package->can($function);
print STDERR "Found!\n" if ($DEBUG && (ref($sub) eq 'CODE'));
return $sub if (ref($sub) eq 'CODE');
$seen->{$package} = 1;
# check sub packages
my $symbols = do { no strict 'refs'; \%{$package . '::'} };
my @packages = grep { $_ =~ m/::$/ } keys(%$symbols);
foreach my $pkg (@packages) {
$pkg = $package . '::' . $pkg unless ($package eq 'main');
$sub = find_function($function, $pkg, $seen);
return $sub if (ref($sub) eq 'CODE');
}
# not found
return undef;
}
sub UNIVERSAL::AUTOLOAD {
(my $function = $UNIVERSAL::AUTOLOAD) =~ s/.*:://;
my $sub = find_function($function);
print STDERR "Not found!\n" if ($DEBUG && (ref($sub) ne 'CODE'));
goto &$sub if (ref($sub) eq 'CODE');
}
1;
__END__
lib/Acme/AutoloadAll.pm view on Meta::CPAN
This module allows you to call any function ever seen by your perl instance.
As long as you used/required a module in the past you can now call its functions everywhere.
=head1 HOW IT WORKS
The module puts an AUTOLOAD sub into UNIVERSAL so every package has it.
When it is called (i.e. your current package doesn't have the called sub itself)
it traverses all known packages (it examines main:: and from there on everything else).
The first found function will then be executed.
=head1 LIMITATIONS
Obviously calling 'new' in a package that does not have it is kind of not clever as a lot of packages have that sub.
So you cannot really be sure which one is called...
Also calling subs working on a $self only works, if your package has the guts the called sub expects.
Other than that it might collide with other AUTOLOADs, so use with care ;-)
=head2 WARNING
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/AwesomeQuotes.pm view on Meta::CPAN
'notcaron' => qr/[^\P{NonspacingMark}\x{030C}]/,
'puncsep' => qr/[\p{Separator}\p{Punctuation}]/,
);
sub GetAwesome {
(my $string = NFD($_[0])) =~ s/(?:^${chartypes{puncsep}}+|${chartypes{puncsep}}+$)//g;
eval {checkstring($string)} or croak $@;
# For individual characters, use a caron instead of terminal acute/grave accents:
lib/Acme/AwesomeQuotes.pm view on Meta::CPAN
return(NFC($string));
}
sub checkstring {
my $string = $_[0];
if ($string eq '') {
die "String is empty!\n";
}
elsif ((($string =~ /^`\p{Letter}${chartypes{notgrave}}*\x{0300}/) &&
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/BABYMETAL.pm view on Meta::CPAN
our $VERSION = "0.03";
my @members = qw(SU-METAL YUIMETAL MOAMETAL);
sub new {
my $class = shift;
my $self = bless {members => []}, $class;
for my $member (@members) {
$member =~ s|-|_|;
my $module_name = 'Acme::BABYMETAL::' . $member;
lib/Acme/BABYMETAL.pm view on Meta::CPAN
push @{$self->{members}}, $module_name->new;
}
return $self;
}
sub homepage {
my ($self) = @_;
return 'http://www.babymetal.jp/';
}
sub youtube {
my ($self) = @_;
return 'https://www.youtube.com/BABYMETAL';
}
sub facebook {
my ($self) = @_;
return 'https://www.facebook.com/BABYMETAL.jp/';
}
sub instagram {
my ($self) = @_;
return 'https://www.instagram.com/babymetal_official/';
}
sub twitter {
my ($self) = @_;
return 'https://twitter.com/BABYMETAL_JAPAN';
}
sub members {
my ($self, $member) = @_;
return @{$self->{members}} unless $member;
if ( $member =~ /^S/i ) {
@members = $self->{members}[0];
lib/Acme/BABYMETAL.pm view on Meta::CPAN
@members = @{$self->{members}};
}
return @members;
}
sub shout {
my ($self) = @_;
print "We are BABYMETAL DEATH!!\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/BLACKJ/Utils.pm view on Meta::CPAN
=head2 sum
=cut
sub sum {
my $a = shift;
my $b = shift;
return $a + $b;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/BOATES.pm view on Meta::CPAN
Returns the sum of the numbers
=cut
sub sum {
my $sum = 0;
foreach( @_ ) { $sum += $_ }
return $sum;
}
=head2 function2
=cut
sub function2 {
}
=head1 AUTHOR
Brian Oates, C<< <boates at cpan.org> >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/BOPE.pm view on Meta::CPAN
#my $ignoradas = join "|", @ignoradas;
use Filter::Simple;
FILTER_ONLY
all => sub {
my $package = shift;
my %par = @_;
if ( $par{'DEBUG'} ) {
filter($_);
lib/Acme/BOPE.pm view on Meta::CPAN
# if eval "require Perl::Tidy";
# print if $DEBUG;
# exit;
},
code_no_comments => \&filter;
sub filter {
$_ = "\$senhor = \$\$_;$/" . $_;
$_ = "\$| = 1;$/" . $_;
s#pelot[ãa]o, cantar hino#print Acme::BOPE::canta_hino#gi;
s#Capit[ãa]o Nascimento#print Acme::BOPE::fato#gi; # mudar por frase legal
lib/Acme/BOPE.pm view on Meta::CPAN
s#"(\d+)"#"$quotes[$1]"#g;
};
# hinos do bope:
sub canta_hino {
my $self = shift;
my @hinos = (
'O interrogatório é muito fácil de fazer/pega o favelado e dá porrada até doer/O interrogatório é muito fácil de acabar/pega o bandido e dá porrada até matar',
'Esse sangue é muito bom/ já provei não tem perigo/é melhor do que café/é o sangue do inimigo',
'O quintal do inimigo/não se varre com vassoura/se varre com granada/com fuzil, metralhadora',
lib/Acme/BOPE.pm view on Meta::CPAN
$hinos[int(rand(@hinos))];
}
# frases sobre o cap.nascimento
sub fato {
my $self = shift;
my @fatos = (
'Deus disse que iria fazer o mundo em 7 anos. Capitão Nascimento disse bem alto: "O senhor é um fanfarrão, Sr. 01. O senhor tem 7 dias, sr. 01! SETE DIAS!"',
'Quando vivia no paraíso, Capitão Nascimento forçou Eva a comer a maçã, dizendo: "Come a porra da maçã 02! Tá com nojinho, 02? Come tudo, porra!"',
'A farda do Capitão Nascimento é preta porque nenhuma outra cor quis ficar perto dele.',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Backwards.pm view on Meta::CPAN
package Acme::Backwards;
our $VERSION = '1.01';
use Keyword::Declare;
sub import {
keytype OKAY is m{(?:fisle (?&PerlNWS)(?&PerlExpression).*?;|esle (?&PerlNWS).*?;)?+}xms;
keyword rof (/(my\s*\$\w+)?/ $declare, Expr $test, /.+?;$/ $code) {_backwards('for', ($declare ? $declare : ()), $test, $code);};
keyword fi (Expr $test, /.+?;/ $code, OKAY @next) {_backwards('if', $test, $code)._process_backwards(@next);};
keyword sselnu (Expr $test, /.+?;/ $code, OKAY @next) {_backwards('unless', $test, $code)._process_backwards(@next);};
}
sub _process_backwards {join' ',map{$_=~m/(fisle|esle)(.*)$/;return"_$1"->($2)}@_;}
sub _esle {_backwards('else','',shift)}
sub _fisle {shift=~m/\s*((?&PerlExpression))\s*(.*?;) $PPR::GRAMMAR/gxm;_backwards('elsif', $1, $2);}
sub _backwards {scalar@_>3?sprintf"%s %s %s { %s }",@_:sprintf"%s %s { %s }",@_;}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/BadFont.pm view on Meta::CPAN
$VERSION =~ tr/_//d;
use Scalar::Util qw(dualvar looks_like_number);
use overload ();
sub import {
overload::constant(q => sub {
my $string = $_[1];
my $number = $string;
if (looks_like_number($number)) {
return $string;
}
lib/Acme/BadFont.pm view on Meta::CPAN
}
return $string;
});
}
sub unimport {
overload::remove_constant('q');
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/BayaC.pm view on Meta::CPAN
use warnings;
use Carp qw/croak/;
our $VERSION = '0.05';
sub new {
my $class = shift;
my $args = shift || +{};
bless $args, $class;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Be/Modern.pm view on Meta::CPAN
=cut
=head1 WARNING
The source filter (defined in the L<Acme::Be::Modern::filter> sub is
simply a naive search-and-replace. Don't use this in any real code.
=head1 IMPLEMENTATION
The implementation is a slight variation of the example in
lib/Acme/Be/Modern.pm view on Meta::CPAN
calls filter_add() with a blessed reference. Now the filter is
activated.
=cut
sub import {
my ($type) = @_;
my ($ref) = [];
filter_add(bless $ref);
}
lib/Acme/Be/Modern.pm view on Meta::CPAN
filter_read(). Any occurrence (and I mean any) of 'be modern' will be
replace with 'use Modern::Perl'.
=cut
sub filter {
my ($self) = @_;
my ($status);
s/be modern/use Modern::Perl/g if ($status = filter_read()) > 0;
$status;
}
view all matches for this distribution
view release on metacpan or search on metacpan
$VERSION = '0.02';
use LWP::Simple;
sub import
{
shift;
if (!@_) {
my $page = get 'http://search.cpan.org/search?query=cool&mode=all';
push @_, $1 while $page =~ m!<h2.*?<b>(.*?)</b></a></h2>!g;
view all matches for this distribution