$ cat myapp.pl
#!/usr/bin/env perl
use Mojolicious::Lite;
my $nn = Mojo::UserAgent->new;
$nn->get('http://zoutrition.missouri.edu/zoutrition');
get '/ShowItemNutritionLabel/:unitOid/:menuOid/:detailOid' => sub {
my $c = shift;
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
$ cat lib/Mojolicious/Plugin/CouchDB.pm | |
package Mojolicious::Plugin::CouchDB; | |
use Mojo::Base 'Mojolicious::Plugin'; | |
use Mojo::Exception; | |
use Mojo::JSON 'j'; | |
our $VERSION = '0.01'; | |
has 'couch' => 'http://127.0.0.1:5984/'; | |
has 'app'; |
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 Mojolicious::Lite; | |
# This route is to emulate a slow web request | |
# This slow web request does not block; while it sleeps, it passes control | |
# back to the dispatcher for further request processing. Once the sleep | |
# completes, it then connects this back to the original request. | |
get '/:sleep' => {sleep => 0} => sub { | |
my $self = shift; |
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 Mojolicious::Lite; | |
use Socket; | |
get '/' => {text => 'Hello, World!'}; | |
get '/connect' => sub { | |
my $self = shift; | |
my ($ip, $protocol, $port, $myhouse, $yourhouse, $log); | |
$ip = '192.168.0.52'; |
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 Mojo::Storage; | |
use Mojo::Base 'Mojo::EventEmitter'; | |
use Carp 'croak'; | |
use DBM::Deep; | |
our $VERSION = '0.01'; | |
has _home => sub { Mojo::Home->new->detect }; | |
has _database => sub { {} }; |
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
# Failed test 'content is similar' | |
# at t/coffee.t line 33. | |
# '(function(){console.log('hello from c coffee');}).call(this); | |
# (function(){console.log('hello from d coffee');}).call(this); | |
# ' | |
# doesn't match '(?^:c coffee.*d coffee)' | |
# Looks like you failed 1 test of 12. | |
t/coffee.t ......................... |
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
t/mojolicious/embedded_lite_app.t .......... 3/? | |
# Failed test 'exact match for content' | |
# at t/mojolicious/embedded_lite_app.t line 186. | |
Wide character in print at /usr/share/perl/5.18/Test/Builder.pm line 1759. | |
# got: 'myapp | |
# works ♥!Insecure!Insecure! | |
# | |
# too!works!!!Mojolicious::Plugin::Config::Sandbox | |
# <a href="/">Test</a> | |
# <form action="/%E2%98%83"> |
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
Needs some error handling. | |
release () | |
{ | |
NAME=$(perl -p -E '$_ = /^\s*NAME\s*/ ? eval("{$_}")->{NAME} : undef' Makefile.PL); | |
VERSION_FROM=$(perl -p -E '$_ = /^\s*VERSION_FROM\s*/ ? eval("{$_}")->{VERSION_FROM} : undef' Makefile.PL); | |
CV=$(perl -E "require '$VERSION_FROM'; say \$$NAME::VERSION"); | |
BV=$(perl -E "require '$VERSION_FROM'; say \$$NAME::VERSION+0.01"); | |
rm -f Mojolicious-Plugin-MimeTypes-*.tar.gz; | |
git tag $CV; |
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 Mojolicious::Lite; | |
use experimental 'signatures'; | |
plugin "OAuth2" => { | |
fix_get_token => 1, | |
facebook => { | |
key => $ENV{OAUTH_KEY}, | |
secret => $ENV{OAUTH_SECRET}, | |
}, | |
}; |
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 Cat; | |
use Mojo::Base -base; | |
has name => 'Nyan'; | |
has ['age', 'weight'] => 4; | |
package Tiger; | |
use Mojo::Base 'Cat'; | |
has friend => sub { Cat->new }; |
OlderNewer