Skip to content

Instantly share code, notes, and snippets.

View bigpresh's full-sized avatar

David Precious bigpresh

View GitHub Profile
13:15 < bigpresh> For reference for when Gryllida returns, the problem is calling makeashorterlink() without
a package name - it gets caught by an AUTOLOAD:
13:15 < bigpresh> Use of inherited AUTOLOAD for non-method My::Bot::makeashorterlink() is deprecated at
gryllida.pl line 11.
13:15 < bigpresh> The fix is, of course, to call it as WWW::Shorten::TinyURL::makeashorterlink($long_url)
@bigpresh
bigpresh / output.txt
Created February 16, 2012 10:43
Route handler attributes test case
[30129] debug @0.008826> [hit #1]Handler code: CODE(0x97b22a8) in beforecontent.pl l. 22
[30129] debug @0.009605> [hit #1]Handler attributes: greeter in beforecontent.pl l. 23
[30129] debug @0.010169> [hit #1]Handler pattern: /hello/:name in beforecontent.pl l. 24
@bigpresh
bigpresh / dupe-files.pl
Created January 16, 2012 12:31
For Irfan
[davidp@columbia:~]$ cat irfan.pl
#!/usr/bin/perl
use strict;
use File::Find;
my %files;
File::Find::find(sub { $files{$_}++ }, shift);
@bigpresh
bigpresh / dumpparams.pl
Created January 9, 2012 14:28
Dumping params from request
[davidp@supernova:~/tmp/dancertests]$ cat dumpparams.pl
#!/usr/bin/perl
use Dancer;
use Data::Dump;
get '/:foo' => sub {
my $params = params;
"<pre>params:" . Data::Dump::dump($params) . "</pre>";
};
@bigpresh
bigpresh / dancer-utf8.pl
Created November 16, 2011 11:58
Test case to illustrate correct UTF8 handling
#!/usr/bin/env perl
use Dancer;
use utf8;
setting charset => 'utf8';
setting logger => 'console';
get '/' => sub {
debug "Привет, мир!";
"Привет, мир!";
};
@bigpresh
bigpresh / abitcrap.pl
Created October 12, 2011 12:38
Pick holes in.
#!/usr/bin/perl
my $filename = @ARGV[0];
open(FILE, $filename);
my @lines = <FILE>:
for (@lines) {
print if /foo/;
@bigpresh
bigpresh / haltinbefore.pl
Created September 9, 2011 23:15
Test case for halt in before
#!/usr/bin/perl
use Dancer;
before => sub {
status 401;
return halt "Sorry, I can't do that Dave.";
};
get '/' => sub {
Testing out gistp.
https://github.com/miyagawa/gistp
@bigpresh
bigpresh / gist:1131605
Created August 8, 2011 11:25
example for ninjapig.pl
#!/usr/bin/perl
use strict;
my $first_file = ...;
my @files;
push @files, $first_file;
while (my $file = shift @files) {
@bigpresh
bigpresh / gist:1129701
Created August 6, 2011 20:06
Adding enclosure support
diff --git a/lib/Dancer/Plugin/Feed.pm b/lib/Dancer/Plugin/Feed.pm
index 079fb3d..64d9bfa 100644
--- a/lib/Dancer/Plugin/Feed.pm
+++ b/lib/Dancer/Plugin/Feed.pm
@@ -16,6 +16,7 @@ my @feed_properties =
my @entries_properties = qw/
title base link content summary category tags author id issued modified
+ enclosure
/;