This file contains hidden or 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 WWW::FGen; | |
use WWW::Mechanize; | |
# constructor | |
sub new { | |
my $class = shift; | |
return bless { | |
_mechanize => WWW::Mechanize->new( agent => 'Perl of Love' ), | |
_url => 'http://mendel.cs.rhul.ac.uk/mendel.php?topic=fgen-file', |
This file contains hidden or 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 Mojolicious::Lite; | |
use Test::Mojo; | |
use Test::More tests => 2; | |
get '/first' => sub { | |
shift->redirect_to('second'); | |
}; |
This file contains hidden or 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 common::sense; | |
use Mojo::IOLoop; | |
use Mojo::UserAgent; | |
use MongoDB; | |
use Data::Dumper; | |
my $ua = Mojo::UserAgent->new; |
This file contains hidden or 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 | |
package TestApp; | |
use Mojolicious::Lite; | |
get '/one/:foo' => [ foo => [qw/bar barfly/] ] => sub { shift->render_text('hi') }; | |
get '/two/:foo' => [ foo => qr[bar|barfly] ] => sub { shift->render_text('hi') }; | |
package main; | |
use Test::More tests => 8; |
This file contains hidden or 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 App::Index; | |
use App::Base -controller, with => ['App::News', 'App::Book', 'App::Audio']; | |
sub main { | |
my $self = shift; | |
my $limit = $self->conf('limit')->{index}; | |
$self->render('index', | |
news => $self->news->_last(limit => $limit->{news}), | |
book => $self->book->_list, |
This file contains hidden or 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 lib 'lib'; | |
package Mojolicious::Plugin::IncludeHelpers; | |
use strict; | |
use warnings; | |
use base 'Mojolicious::Plugin'; | |
use Data::Dumper; |
This file contains hidden or 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 lib 'lib'; | |
use Mojo::IOLoop; | |
use Mojo::Client; | |
my $loop = Mojo::IOLoop->new; | |
my $client = Mojo::Client->new; $client->ioloop( $loop ); | |
foo(); |
This file contains hidden or 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 Mojolicious::Lite; | |
my $use_auth = 1; # with auth enabled.. | |
my ( $user, $pass ) = qw/user password/; | |
if ($use_auth) { plugin 'basic_auth'; } | |
get '/' => sub { my $self = shift; $self->redirect_to('/upload'); }; | |
get '/upload' => sub { | |
my $self = shift; |
This file contains hidden or 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 MojoX::JSON; | |
use Mojo::JSON; | |
our $SINGLETON; | |
BEGIN { | |
# install JSON::XS if you can! | |
eval 'use JSON();'; | |
eval ( $@ ? 'sub HAS_JSON(){ 0 }' : 'sub HAS_JSON(){ 1 }' ); |
This file contains hidden or 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; | |
use Data::Dumper; | |
use Data::UUID; | |
use DBI; | |
use Time::Piece; | |
use Mojolicious::Lite; |