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 $square = shift or die "Usage: $0 3 [where 3 is the number you want to find the square root of]"; | |
my $guess; | |
"This is an implementation of Newton's method for finding roots. | |
(Specifically, we're finding square roots here, although Newton's | |
method can be used for many different kinds of functions.) | |
The only goal is for you to see how rapidly it converges, it is | |
otherwise quite useless :D.\n\n\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
perl -ni -e '$cutting = 1 if /#.*start_inflate/; print unless ($cutting or $_=~/\s*1;\s*/); $cutting = 0 if /#.*end_inflate/;' lib/Test/Schema/Result/TestDeflate.pm | |
cat inflate_snippet.pl >> lib/Test/Schema/Result/TestDeflate.pm |
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; | |
my $flips = shift @ARGV // 1000; | |
print "I'm going to flip a coin [$flips] times...\n"; | |
my @thresholds = (5, 10); |
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
package Foodle; | |
use Dancer ':syntax'; | |
use Storable; | |
our $VERSION = '0.1'; | |
get '/' => sub { | |
template 'index'; | |
}; |
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 Template; | |
my $tt = Template->new( START_TAG=>'<%', END_TAG=>'%>' ); | |
$tt->process(\*DATA, {}, \*stdout) ; | |
__DATA__ | |
<% index = 0; last = 0; %> | |
index is now <% index %> |
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
# This is the main configuration file of your Dancer app | |
# env-related settings should go to environments/$env.yml | |
# all the settings in this file will be loaded at Dancer's startup. | |
# Your application's name | |
appname: "Acme::Test::Dancer::Plugin::Database" | |
# The default layout to use for your application (located in | |
# views/layouts/main.tt) | |
layout: "main" |
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 utf8; | |
use v5.10; | |
my $string = "áéíóú"; | |
binmode(STDOUT, ":utf8"); | |
say $string; | |
use Encode qw/encode decode/; | |
my $bob = encode( 'UTF-8', $string); |
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
package Minimal::Reproduce; | |
use Dancer ':syntax'; | |
use Dancer::Plugin::SimpleCRUD; | |
our $VERSION = '0.1'; | |
get '/' => sub { | |
template 'index'; | |
}; |
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
--- a/lib/Dancer/Plugin/SimpleCRUD.pm | |
+++ b/lib/Dancer/Plugin/SimpleCRUD.pm | |
@@ -1176,6 +1193,8 @@ sub _ensure_auth { | |
Dancer::ModuleLoader->load('Dancer::Plugin::Auth::Extensible') | |
or die "Can't use auth settings without" | |
. " Dancer::Plugin::Auth::Extensible!"; | |
+ } else { | |
+ return $handler; | |
} | |
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
perl -e 'for $year (2013..2113) {$cal = qx{cal $year}; $cal =~ s/\d{4}//; if ($year eq "2013") {$comp_cal = $cal} else { die "cal $year\n" if $comp_cal eq $cal} }' | |
cal 2019 |
NewerOlder