This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Modern::Perl; | |
use File::Temp 'tempfile'; | |
use IO::All; | |
my $libcustom = '.libcustom'; | |
# run the code with perl -c and show STDERR if it fails. Otherwise, rerun it | |
# with perl -c -Mwarnings::unused |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use utf8::all; | |
use Test::More; | |
use Unicode::Collate; | |
my $a1 = "\N{U+212B}"; # Å | |
my $a2 = "\N{U+00C5}"; # Å | |
my $a3 = "\N{U+0041}\N{U+030A}"; # Å |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Devel::Peek; | |
Dump $_ for .96, 0.96; | |
# this is fine | |
eval "use Data::Dumper 0.01 'Dumper'"; | |
my $error = $@ || "none"; | |
print "\nError is: $error\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Carp qw(cluck); | |
use autodie ':all'; | |
use Getopt::Long 2.33 qw(:config auto_help); | |
use File::Find::Rule; | |
use File::Basename 'basename'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execve("/usr/bin/git", ["git", "push", "-v", "origin", "users/ovid"], [/* 66 vars */]) = 0 | |
brk(0) = 0x13f3000 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3804f8f000 | |
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
open("/etc/ld.so.cache", O_RDONLY) = 3 | |
fstat(3, {st_mode=S_IFREG|0644, st_size=80249, ...}) = 0 | |
mmap(NULL, 80249, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3804f7b000 | |
close(3) = 0 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lie to the debugger about what the lines of code are | |
no strict 'refs'; | |
my $line_num = 0; | |
foreach ( @{"::_<$filename"} ) { | |
# uncomment these to blow your f'in mind | |
#if ( not defined ) { | |
# use Devel::Peek; | |
# warn "line number is $line_num"; | |
# Dump($_); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fetch Federal Register daily XML documents | |
# I decided not to include this in my book. | |
# | |
# This script is for daily updates and will be slow. Go to | |
# http://www.gpo.gov/fdsys/bulkdata/FR to download a year | |
# worth of documents at a time in .zip format. This script | |
# can then keep you up to date. | |
use strict; | |
use warnings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Why do people think this stuff is clever? | |
no warnings;my$M=__PACKAGE__.::;*{$M.Object::new}=sub{bless{@_[1..$#_]},$_[0]}; | |
*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.::;shift; | |
eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M}; | |
%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift; | |
my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};$m=$o{$_}->($m,$n,@_)for sort keys%o; | |
*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object}; | |
*{$M.'builder::e'}=sub{my($P,$e,$o)=@_;$o->{builder}=sub{my($m,$n,%a)=@_; | |
my$b=$a{builder}or return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}= | |
$_[0]->$b:$m->(@_)}}};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# in your .vimrc | |
# " quickfix for Perl error formats | |
# set errorformat+=%m\ at\ %f\ line\ %l\. | |
# set errorformat+=%m\ at\ %f\ line\ %l | |
# noremap ,c :!time perlc --critic %<cr> | |
use 5.10.0; | |
use File::Temp 'tempfile'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
throws_ok { $job_rs->add_job } | |
qr/Mandatory parameters.*missing/, | |
'... and it should fail with no arguments'; | |
my %args = ( | |
third_party_key => 'not a valid key', | |
client_id => 1111111111, | |
campaign_id => 2222222222, | |
ad_group_id => 3333333333, | |
); |
OlderNewer