Skip to content

Instantly share code, notes, and snippets.

View zostay's full-sized avatar

Sterling Hanenkamp zostay

View GitHub Profile
@zostay
zostay / bad.psgi
Created August 1, 2012 13:23
OWASP Top Ten - A1 Injection - Good/Bad - In Perl
use v5.16;
use Plack::Request;
my $app = sub {
# Plack::Request makes getting parameters easier
my $req = Plack::Request->new(shift);
# Load the name
my $name = $req->parameters->{name};
@zostay
zostay / gist:1358515
Created November 11, 2011 16:53
Best, quickest, safe way I know to pull out the " at x.pm line 1." is:
my $x = reverse $@;
$x =~ s/^.*? \ ta \ //xms;
$x = reverse $x;
@zostay
zostay / gist:1167283
Created August 24, 2011 04:05
For my own sanity, what order do the around's get applied in an object that applies a role that applies a role?
package RoleBar;
use v5.10;
use Moose::Role;
around thing => sub {
my $next = shift;
my $self = shift;
say "RoleBar thing start";
$self->$next();
@zostay
zostay / stacktrace.txt
Created September 20, 2015 16:17
tracking down a syntax error
[11:10] sterling@Weasley Smack#master% perl6 -Ilib --ll-exception t/sent.t
# Unhandled exception: Cannot unbox a type object
# at <unknown>:1 (/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:print_exception:4294967295)
# from gen/moar/m-CORE.setting:17236 (/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:<anon>:40)
# from gen/moar/stage2/NQPHLL.nqp:1425 (/Users/sterling/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:command_eval:380)
# from src/Perl6/Compiler.nqp:59 (/Users/sterling/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval:93)
# from gen/moar/stage2/NQPHLL.nqp:1365 (/Users/sterling/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:command_line:114)
# from gen/moar/m-main.nqp:39 (/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm:MAIN:18)
# from gen/moar/m-main.nqp:35 (/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moar
@zostay
zostay / desc.txt
Last active September 12, 2015 03:50
Weird Iteration/Switch Bug
Okay, so I am at a loss so far as to what is happening here, but something
broke.
In Template::Anti, the node-set.t test is failing:
t/node-set.t ...........
ok 1 - text works
ok 2 - attrib one works
ok 3 - attrib two works
ok 4 - attrib three works
@zostay
zostay / explanation.txt
Last active August 29, 2015 14:26
P6SGI: Use Supply and/or Channel for streaming?
So after publishing 0.1.Draft of P6SGI, the most prominent feedback I have
received is whether or not Channels are the best option for streaming data. The
main alternative put forward is to use a Supply rather than a Channel. After
carefully weighing the options, I am not sure there is a clear winner in this.
The short answer is, Channel is simpler for app and middleware devs, but may not
scale as well or as easily as a Supply-based solution. On the other hand, there
is no obvious best solution when using a Supply and using a Supply can lead to
lost data if the app and middleware developers are not careful.