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
my @sources; | |
my $in_section; | |
while (my $line = <$fh>) { | |
$in_section++ if $line =~ /^# You can add/; | |
next unless $in_section; | |
$line =~ /^source (.+)/ and push @sources, $1; | |
} | |
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
23:16 < merlyn> ugh - body must be bytes and should not contain wide characters (UTF-8 | |
strings). at | |
/usr/local/lib/perl5/site_perl/5.10.1/Plack/Middleware/StackTrace.pm | |
line 27 | |
23:16 < merlyn> why does plack care if I'm sending utf8? | |
23:17 < merlyn> looks related to this issue - | |
http://github.com/miyagawa/Plack/issues/issue/115 | |
23:20 < merlyn> might be a bug in Dancer then | |
23:20 < merlyn> it's passing the utf8 string to plack, instead of byte-ing it | |
23:21 < merlyn> this statement is triggering - if (ref $res->[2] eq 'ARRAY' && grep |
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
[davidp@supernova:~]$ cat test.yml | |
plack_middlewares: | |
Static: | |
- path | |
- qr{^/(images|js|css)/} | |
- root | |
- './public/' |
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/perl | |
use common::sense; | |
use Data::Dump; | |
use CGI; | |
my $cgi = CGI->new; | |
print $cgi->header; | |
my @selected = $cgi->param('myfield'); |
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
my $form = HTML::Form->parse($mech->response); | |
my $dropdown = $form->find_input('DropdownName'); | |
my @labels = $dropdown->value_names; | |
my @values = $dropdown->possible_values; | |
# The above works perfectly for fetching a list of values and labels, | |
# but for each entry in the drop-down, I need to know which <optgroup> | |
# it's in. HTML::Form doesn't appear to provide that info... |
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
315 # And a route to list records already in the table: | |
316 get "$args{prefix}" => sub { | |
317 # TODO: handle pagination | |
318 my $sth = $dbh->prepare("select * from $table_name"); | |
319 $sth->execute; | |
320 my $table = HTML::Table::FromDatabase->new( | |
321 -sth => $sth, | |
322 -border => 1, | |
323 ); | |
324 return $table->getTable; |
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
my $matches; | |
while ($html =~ m{ | |
<optgroup \s+ label=" | |
(?<label> .+?) | |
"> | |
(?<options_html> .+?) | |
</optgroup> | |
}gxsi) | |
{ | |
say "Group: [$+{label}]"; |
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
simple_crud( | |
prefix => 'test', | |
db_table => 'test', | |
record_title => 'Test Thing', | |
); |
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/perl | |
use strict; | |
use Dancer; | |
set logger => 'console'; | |
set log => 'debug'; | |
before sub { | |
debug("In before filter"); |