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
BEGIN { | |
$ENV{BAIL_ON_FAIL} ||= 1; | |
} | |
use Modern::Perl qw|2013|; | |
use Data::Printer (use_prototypes => 0); | |
use Test::Most; | |
use Mojo::DOM; | |
my $rss = "<channel> |
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 RT::Plugin::Redis; | |
use Mojo::Base qw|Mojolicious::Plugin|; | |
use Modern::Perl qw|2013|; | |
use Data::Printer (use_prototypes => 0); | |
use Mojo::Redis; | |
sub register { | |
my ($self, $app) = @_; | |
my $config = $app->config; |
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 Data::Printer (use_prototypes => 0); | |
use Modern::Perl qw|2013|; | |
use Mojolicious::Lite; | |
use Mojo::Redis; | |
app->attr('salt' => 'passw0rd'); | |
app->helper( | |
'redis_db' => 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
$app->helper( | |
'check_authentication' => sub { | |
my $c = shift; | |
my $cb = pop; | |
my $session_id = shift; | |
die 'no session id' unless defined $session_id && $session_id; | |
my $redis = $c->redis_session; | |
my $log = $c->app->log; |
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 RTRu::Admin::Auth; | |
use Modern::Perl qw|2013|; | |
use Mojo::Base qw|Mojolicious::Controller|; | |
use Data::Printer (use_prototypes => 0); | |
use Hash::Merge::Simple qw|merge|; | |
sub login { | |
my $c = shift; | |
# return $c->redirect_to($c->url_for('page_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
sub load { | |
my ($self, $sid) = @_; | |
my $redis = $self->redis(); | |
my $prefix = $self->redis_prefix; | |
my $session; | |
my $delay = Mojo::IOLoop->delay( | |
sub { | |
my ($d, $res) = @_; | |
$res->{'data'} = $res->{'data'} ? decode_json($res->{'data'}) : undef ; |
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 utf8::all; | |
use Modern::Perl qw|2013|; | |
use Data::Printer (use_prototypes => 0); | |
use Mojolicious::Lite; | |
use Test::Most; | |
use Test::More; | |
use Test::Mojo; | |
use RT::Admin; |
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 Test::Most; | |
use Mojolicious::Lite; | |
use Data::Printer (use_prototypes => 0); | |
use Test::Mojo; | |
use InoTV::DatePaginator; | |
my $now = DateTime->now; | |
under '/:year/:month/:day' => { year => $now->year, month => $now->month, day => undef } => 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
#!/usr/bin/env perl | |
use Modern::Perl qw|2013|; | |
use Data::Printer (use_prototypes => 0, colored => 1); | |
use ZMQ::Constants qw|:all|; | |
use ZMQ; | |
my $ctx = ZMQ::Context->new(1); | |
my $frontend = $ctx->socket(ZMQ_XSUB); |
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 WebSocket::Simple::Example; | |
use Mojo::Base 'Mojolicious::Controller'; | |
use ZMQ; | |
use ZMQ::Constants qw|ZMQ_NOBLOCK|; | |
use Mojo::JSON qw|j|; | |
use Mojo::ByteStream qw|b|; | |
use Data::Printer ( | |
use_prototypes => 0, | |
colored => 1 | |
); |
NewerOlder