エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -

on

  • 6,038 views

エロサイト管理者の憂鬱3

エロサイト管理者の憂鬱3
Hokkaido.pm#4 のの発表資料です。

Statistics

Views

Total Views
6,038
Views on SlideShare
4,257
Embed Views
1,781

Actions

Likes
3
Downloads
15
Comments
0

9 Embeds 1,781

http://hokkaido.pm.org 1358
http://yusukebe.com 358
http://kamawada.com 57
http://orhowilearnedtolovetheperl.com 2
http://static.slidesharecdn.com 2
http://paper.li 1
http://www.m3a.org 1
http://twitter.com 1
http://b.hatena.ne.jp 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 - Presentation Transcript

  • 1. ./!"" repo#   !"" Changes#   !"" MANIFEST.SKIP#   !"" Makefile.PL#   !"" README#   !"" lib#   #   %"" SampleApp.pm#   !"" t#   #   %"" 00_compile.t#   %"" xt#   !"" 01_podspell.t#   !"" 02_perlcritic.t#   !"" 03_pod.t#   %"" perlcriticrc%"" sandbox
  • 2. ./lib!"" SampleApp#   !"" CLI#   #   %"" Crawler.pm#   !"" Role.pm use Mouse::Role;#   %"" Web#   !"" API.pm use Mouse; with “SampleApp::Role”;#   %"" Controller#   %"" Root.pm $c->model(“API”)->get_entries();%"" SampleApp.pm
  • 3. use LWP::UserAgent;use Email::Sender::Simple qw(sendmail);use Email::MIME;use Try::Tiny;use YAML qw(LoadFile);use Path::Class qw( file );my $file = $ARGV[0] || "config.yaml";die "Cant open $file" unless ( -f file($file)->stringify );my $config = LoadFile( file($file) );my $ua = LWP::UserAgent->new( agent => Monita/0.01, timeout => 30 );for my $url ( @{ $config->{url} } ) { my $res = $ua->get($url); send_report( $res ) unless $res->is_success;}sub send_report { my $res = shift; my $email = Email::MIME->create( header => [ From => $config->{from}, To => $config->{to}, Subject => $res->request->uri . : . $res->code, ], attributes => { content_type => text/plain, }, body => $res->status_line, ); try { sendmail($email) } catch { my $error = $_; warn $error->message };}