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/perl | |
use strict; | |
use lib qw(../lib ../mojo/lib); | |
BEGIN { | |
$ENV{MOJO_MODE}++; | |
$ENV{MOJO_TMPDIR} = 'tmp/upload'; | |
$ENV{MOJO_MAX_MESSAGE_SIZE} = 2 * 1024 * 1024 * 1024; # 2 GB | |
}; |
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::Controller; | |
... | |
sub redirect_accel { | |
my $self = shift; | |
my $url = shift || return; | |
my $type = shift || ''; | |
$self->render_data(''); |
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
# Copyright (C) 2008-2010, Sebastian Riedel. | |
package Mojolicious::Plugin::I18nAll; | |
use strict; | |
use warnings; | |
use base 'Mojolicious::Plugin'; | |
use I18N::LangTags; |
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/perl | |
use common::sense; | |
use lib qw(/tk/lib /tk/mojo/lib); | |
use Mojo::Client; | |
use Data::Dumper; | |
die "Usage: $0 moskva|piter stations|onair" | |
unless @ARGV && $ARGV[0] ~~ ['moskva', 'piter'] && $ARGV[1] ~~ ['stations', 'onair']; |
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/perl | |
use common::sense; | |
use lib qw(../../lib /tk/lib /tk/mojo/lib); | |
use Mojo::IOLoop; | |
use Mojo::Message::Request; | |
use Data::Dumper; | |
my $url = Mojo::URL->new('http://frod.io:8000/station-aac'); | |
my $loop = Mojo::IOLoop->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
package Score; | |
use common::sense; | |
use base 'Mojo::Base'; | |
use constant DEBUG => $ENV{SCORE_DEBUG} // 0; | |
__PACKAGE__->attr('db'); | |
... |
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 App::Foo; | |
use App::Bar; | |
for (ref app) { | |
$_->attr(db => sub { ... }); | |
$_->attr(conf => sub { ... }); | |
} |
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:Foo; | |
use common::sense; | |
use App::User::Info; | |
use base 'App::Controller'; | |
__PACKAGE__->attr(user => sub { App::User::Info->new(%{ +shift }) }); | |
sub bar { | |
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
# mojo code | |
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
get '/' => sub { | |
shift->render(t => join '', 1..50_000); | |
} => 'index'; |
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 ojo; | |
die "Usage: $0 <podcast url>" unless @ARGV; | |
b(g( shift )->dom->find("enclosure[url]")->each(sub { | |
local $_ = shift->attrs->{url}; | |
say if /\.mp3$/; | |
})); |