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 Dancer; | |
use MyTop::MyMiddle::MeetingAlerts; | |
use Plack::Builder; | |
my $app = sub { | |
my $env = shift; | |
my $request = Dancer::Request->new(env=>$env); | |
Dancer->dance($request); | |
}; |
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
# bin/script2.pl | |
#unnecessary use FindBin; | |
#unnecessary use Cwd qw/realpath/; | |
use Dancer ':script'; | |
=pod | |
Dancer already knows this | |
#tell the Dancer where the app lives |
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; | |
while (<DATA>) { | |
s/[<>]//g; | |
s{\[((/)?(b|i|s))\]}{<$1>}g; | |
print; | |
} | |
__DATA__ |
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; | |
######################################### | |
############# would be in Animal.pm normally | |
######################################### | |
package Animal; | |
sub new { | |
my $package = shift; | |
# this 'bless' call tells that anonymous hash "if someone calls ->foo on you, look in $package for a sub named 'foo', |
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 DBI; | |
use strict; | |
use warnings; | |
my $db_name = shift or die "call as $0 [database_name] [mysql user] [mysql password]"; | |
my $mysql_user = shift || 'root'; | |
my $mysql_password = shift || ''; | |
my $dbh = DBI->connect("dbi:mysql:database=$db_name", $mysql_user, $mysql_password) || die DBI->errstr; |
NewerOlder