SlideShare a Scribd company logo
1 of 17
Download to read offline
• 
• 
• 
• 
sub run { 
    my $self = shift; 
    my $cv          = AnyEvent‐>condvar; 
    my $feed_reader = AnyEvent::Feed‐>new( 
        url      => $self‐>url, 
        interval => $self‐>interval, 
        on_fetch => sub { 
            my ( $feed_reader, $entries, $feed, $error ) = @_; 
            if ( defined $error ) { 
                warn "ERROR: $errorn"; 
                $cv‐>send; 
                return; 
            } 
            for (@$entries) { 
                my $entry = Twib::CLI::Feed::Entry‐>new( $_‐>[1] ); 
                if( my $post = $self‐>create_post( $entry ) ){ 
                } 
            } 
        } 
    ); 
    $cv‐>recv; 
} 
• 
     – 
     – 
     – 
• 
• 

• 
     – 




• 
use Noe; #Plack based WAF 
use DBIx::Skinny; 
use Imager; 
use WWW::Favicon; 
use LWP::UserAgent; 
use Cache::Memcached::Fast; 
• 
• 
package MyApp::Controller::Root; 

sub root { 
    my ( $self, $c  ) = @_; 
    $c‐>render('index', { message => $c‐>config‐>{message} } ); 
} 
sub hi { 
    my ( $self, $c ) = @_; 
    my $name = $c‐>req‐>param('name') || 'nanashi'; 
    $c‐>render('hi', { name => $name } ); 
} 
sub redirect { 
    my ($self, $c ) = @_; 
    $c‐>redirect( $c‐>base ); 
} 
1; 
• 

• 
• 
• 
• 
     my $rs = $self‐>schema‐>resultset('Link')‐>search( 
        $args, 
        { 
            order_by => 'tweet_count DESC', 
            page     => $page, 
            rows     => $rows, 
            prefetch => $prefech, 
        } 
    ); 
    if (wantarray) { 
          my $next_page = 
            $self‐>schema‐>resultset('Link') 
            ‐>search( {}, { columns => [qw/me.id/], page => $page + 1, 
   rows => $rows } )‐>next 
            ? $page + 1 
            : 0; 
          return ( $rs, $next_page ); 
    } 
    else { 
        return $rs; 
    } 
• 
• 

• 
• 
• 
• 

More Related Content

What's hot

Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
diego_k
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門
Yusuke Wada
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
Tatsuhiko Miyagawa
 
Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard Interfaces
Thomas Weinert
 

What's hot (20)

Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門
 
20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
 
16.mysql stored procedures in laravel
16.mysql stored procedures in laravel16.mysql stored procedures in laravel
16.mysql stored procedures in laravel
 
Getting out of Callback Hell in PHP
Getting out of Callback Hell in PHPGetting out of Callback Hell in PHP
Getting out of Callback Hell in PHP
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard Interfaces
 
Undercover Pods / WP Functions
Undercover Pods / WP FunctionsUndercover Pods / WP Functions
Undercover Pods / WP Functions
 
Sadi service
Sadi serviceSadi service
Sadi service
 
Example code for the SADI BMI Calculator Web Service
Example code for the SADI BMI Calculator Web ServiceExample code for the SADI BMI Calculator Web Service
Example code for the SADI BMI Calculator Web Service
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON API
 
Laravel the right way
Laravel   the right wayLaravel   the right way
Laravel the right way
 
TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !
 
4. Php MongoDB view_data
4. Php MongoDB view_data4. Php MongoDB view_data
4. Php MongoDB view_data
 

Similar to Twib in Yokoahma.pm 2010/3/5

Intro To Moose
Intro To MooseIntro To Moose
Intro To Moose
cPanel
 
Selenium rc presentation_20110104
Selenium rc presentation_20110104Selenium rc presentation_20110104
Selenium rc presentation_20110104
Michael Salvucci
 
Dirty Secrets of the PHP SOAP Extension
Dirty Secrets of the PHP SOAP ExtensionDirty Secrets of the PHP SOAP Extension
Dirty Secrets of the PHP SOAP Extension
Adam Trachtenberg
 

Similar to Twib in Yokoahma.pm 2010/3/5 (20)

Perl Web Client
Perl Web ClientPerl Web Client
Perl Web Client
 
Intro To Moose
Intro To MooseIntro To Moose
Intro To Moose
 
Any event intro
Any event introAny event intro
Any event intro
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Perl调用微博API实现自动查询应答
Perl调用微博API实现自动查询应答Perl调用微博API实现自动查询应答
Perl调用微博API实现自动查询应答
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
WordPress Kitchen 2014 - Александр Стриха: Кеширование в WordPress
 
DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たち
 
并发模型介绍
并发模型介绍并发模型介绍
并发模型介绍
 
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
Web::Machine - Simpl{e,y} HTTP
Web::Machine - Simpl{e,y} HTTPWeb::Machine - Simpl{e,y} HTTP
Web::Machine - Simpl{e,y} HTTP
 
Selenium rc presentation_20110104
Selenium rc presentation_20110104Selenium rc presentation_20110104
Selenium rc presentation_20110104
 
Selenium RC Presentation 20110104
Selenium RC Presentation 20110104Selenium RC Presentation 20110104
Selenium RC Presentation 20110104
 
Snakes on a Treadmill
Snakes on a TreadmillSnakes on a Treadmill
Snakes on a Treadmill
 
Dirty Secrets of the PHP SOAP Extension
Dirty Secrets of the PHP SOAP ExtensionDirty Secrets of the PHP SOAP Extension
Dirty Secrets of the PHP SOAP Extension
 
以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 

More from Yusuke Wada

僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由
Yusuke Wada
 

More from Yusuke Wada (20)

僕がつくった 70個のうちの48個のWebサービス達
僕がつくった 70個のうちの48個のWebサービス達僕がつくった 70個のうちの48個のWebサービス達
僕がつくった 70個のうちの48個のWebサービス達
 
スッとGoを取り入れる
スッとGoを取り入れるスッとGoを取り入れる
スッとGoを取り入れる
 
東京脱出計画中
東京脱出計画中東京脱出計画中
東京脱出計画中
 
Extreme remote working
Extreme remote workingExtreme remote working
Extreme remote working
 
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPANPodcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
Podcastを支える技術、エンジニアのためのWebメディア、そしてCPAN
 
創造のプロセスを回せ!v0.01
創造のプロセスを回せ!v0.01創造のプロセスを回せ!v0.01
創造のプロセスを回せ!v0.01
 
It's not only about "REMOTE"
It's not only about "REMOTE"It's not only about "REMOTE"
It's not only about "REMOTE"
 
事故からはじまるスケールチャンス
事故からはじまるスケールチャンス事故からはじまるスケールチャンス
事故からはじまるスケールチャンス
 
Google BigQueryを使ってみた!
Google BigQueryを使ってみた!Google BigQueryを使ってみた!
Google BigQueryを使ってみた!
 
Webサービスのコンテンツパターン 或いはデータの活⽤
Webサービスのコンテンツパターン 或いはデータの活⽤Webサービスのコンテンツパターン 或いはデータの活⽤
Webサービスのコンテンツパターン 或いはデータの活⽤
 
とある Perl Monger の働き方
とある Perl Monger の働き方とある Perl Monger の働き方
とある Perl Monger の働き方
 
5 minutes - YAPC::Asia Tokyo 2014
5 minutes - YAPC::Asia Tokyo 20145 minutes - YAPC::Asia Tokyo 2014
5 minutes - YAPC::Asia Tokyo 2014
 
Podcastをカジュアルに 支える技術
Podcastをカジュアルに 支える技術Podcastをカジュアルに 支える技術
Podcastをカジュアルに 支える技術
 
The master plan of scaling a web application
The master plan ofscaling a web applicationThe master plan ofscaling a web application
The master plan of scaling a web application
 
そのWebサービスは本当に「あたりまえ」だったのか?
そのWebサービスは本当に「あたりまえ」だったのか?そのWebサービスは本当に「あたりまえ」だったのか?
そのWebサービスは本当に「あたりまえ」だったのか?
 
Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門Mojoliciousでつくる! Webアプリ入門
Mojoliciousでつくる! Webアプリ入門
 
10 things to learn from Bokete
10 things to learn from Bokete10 things to learn from Bokete
10 things to learn from Bokete
 
僕らの履歴書
僕らの履歴書僕らの履歴書
僕らの履歴書
 
僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由僕らがWebサービスをつくる5つの理由
僕らがWebサービスをつくる5つの理由
 
僕らがつくるための 「5W」について
僕らがつくるための 「5W」について僕らがつくるための 「5W」について
僕らがつくるための 「5W」について
 

Twib in Yokoahma.pm 2010/3/5