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
$_REPL->load_plugin($_) for qw( | |
History Colors | |
FancyPrompt Refresh | |
Interrupt OutputCache | |
DDC Nopaste | |
CompletionDriver::Keywords | |
CompletionDriver::LexEnv | |
CompletionDriver::Methods | |
CompletionDriver::INC |
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 Mojolicious::Plugin::DBIC; | |
use Mojo::Base 'Mojolicious::Plugin'; | |
our $VERSION = '0.01'; | |
my $schemas = {}; | |
sub register { | |
my ($self, $app, $cfg) = @_; |
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 5.12.0; | |
use Mojo::UserAgent; | |
use Compress::Zlib; | |
my $ua = Mojo::UserAgent->new; | |
$ua->on( start => sub { | |
my ( $ua, $tx ) = @_; |
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
$_REPL->load_plugin($_) for qw( | |
History Colors | |
FancyPrompt Refresh | |
Interrupt OutputCache | |
DDC Nopaste | |
CompletionDriver::Keywords | |
CompletionDriver::LexEnv | |
CompletionDriver::Methods | |
CompletionDriver::INC |
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
=attr ua | |
User agent configured with logger and timing. | |
=cut | |
has ua => sub { | |
my $self = shift; | |
my $log = $self->log; | |
$log->debug( "Building user agent" ); | |
my $ua = Mojo::UserAgent->new; |
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 Mojolicious::Lite; | |
get '/' => sub { | |
my $self = shift; | |
$self->render( text => '{"json":"ok"}', status => 201, format => 'json'); | |
}; | |
app->start; |
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
class MercadoPago | |
require 'rubygems' | |
require 'json/add/core' | |
require 'uri' | |
require 'net/https' | |
attr_accessor :client, :secret, :currency | |
def initialize(options={}) | |
@client = options[:client_id] |
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
$self->helper( | |
url_with => sub { | |
my $this = shift; | |
my $url = $this->req->url->clone; | |
return $url unless @_; | |
my $query = ref $_[-1] eq 'HASH' | |
|| ( ref $_[-1] eq 'ARRAY' and not @{$_[-1]} % 2 ) | |
? pop : []; |
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 set_config { | |
my $self = shift; | |
my $config = My::Config->new; | |
$self->app->log->debug( $config->test ); #yay | |
$self->helper( config => sub { $config } ); | |
$self->log->debug( $self->config->test ); # Can't call method "test" on unblessed reference | |
} |
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 Mojolicious::Lite; | |
use Mojo::IOLoop; | |
my $clients = []; | |
my $timer_id; | |
set_next_requests(); | |
get '/' => sub { shift->render( text => "I'm alive!" ) }; |
OlderNewer