Twib in Yokoahma.pm 2010/3/5

  • 1,473 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,473
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
2
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. •  •  • 
  • 2. • 
  • 3. 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;  } 
  • 4. •  –  –  –  • 
  • 5. •  •  –  • 
  • 6. use Noe; #Plack based WAF  use DBIx::Skinny;  use Imager;  use WWW::Favicon;  use LWP::UserAgent;  use Cache::Memcached::Fast; 
  • 7. •  •  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; 
  • 8. •  •  •  •  • 
  • 9.      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;      } 
  • 10. •  •  • 
  • 11. •  •  •