Upgrade to Pro — share decks privately, control downloads, hide ads and more …

課題をテストで解決する

shibayu36
April 20, 2014

 課題をテストで解決する

shibayu36

April 20, 2014
Tweet

More Decks by shibayu36

Other Decks in Programming

Transcript

  1. ςετ͍ͨ͜͠ͱ [email protected]! 10 5 * * * apache perl /path/to/dir/script/echo.pl!

    30 09 * * * apache perl /path/to/dir/script/sleep.pl ϑΝΠϧऴ୺ʹվߦ͋Δ ࢦఆϑΝΠϧଘࡏ͢Δ ೔෇ࢦఆਖ਼͍͠
  2. ࢦఆϑΝΠϧଘࡏ͢Δ? my @files = $crontab =~ m{/path/to/dir/(.*\.pl)}g;! ! for my

    $file (@files) {! ok -e $file, "$file ͕ଘࡏ";! } QSPKFDU಺ͬΆ͍ϑΝΠϧ୳͢ ͦΕͧΕϑΝΠϧ͋Δ͔
  3. [! {! "blog_url" : "http://shibayu36.hatenablog.com/",! "permission" : "public",! "can_be_edited_by" :

    [! "shiba_yu36"! ]! },! {! "blog_url" : "http://shibayu36-private.hatenablog.com/",! "permission" : "private",! "can_be_edited_by" : [! "shiba_yu36",! "shiba_yu37"! ]! },! {! "blog_url" : "http://blog.example.com/",! "permission" : "public",! "can_be_edited_by" : [! "example-user"! ]! }! ]
  4. [! {! "blog_url" : "http://shibayu36.hatenablog.com/",! "permission" : "public",! "can_be_edited_by" :

    [! "shiba_yu36"! ]! },! {! "blog_url" : "http://shibayu36-private.hatenablog.com/",! "permission" : "private",! "can_be_edited_by" : [! "shiba_yu36",! "shiba_yu37"! ]! },! {! "blog_url" : "http://blog.example.com/",! "permission" : "public",! "can_be_edited_by" : [! "example-user"! ]! }! ] CMPH@VSM͸63-Ͱ͋Δ
  5. [! {! "blog_url" : "http://shibayu36.hatenablog.com/",! "permission" : "public",! "can_be_edited_by" :

    [! "shiba_yu36"! ]! },! {! "blog_url" : "http://shibayu36-private.hatenablog.com/",! "permission" : "private",! "can_be_edited_by" : [! "shiba_yu36",! "shiba_yu37"! ]! },! {! "blog_url" : "http://blog.example.com/",! "permission" : "public",! "can_be_edited_by" : [! "example-user"! ]! }! ] QFSNJTTJPO͸ QVCMJD͔QSJWBUF
  6. [! {! "blog_url" : "http://shibayu36.hatenablog.com/",! "permission" : "public",! "can_be_edited_by" :

    [! "shiba_yu36"! ]! },! {! "blog_url" : "http://shibayu36-private.hatenablog.com/",! "permission" : "private",! "can_be_edited_by" : [! "shiba_yu36",! "shiba_yu37"! ]! },! {! "blog_url" : "http://blog.example.com/",! "permission" : "public",! "can_be_edited_by" : [! "example-user"! ]! }! ] CMPH@VSM͸ શମͰϢχʔΫ
  7. my $blogs_config = decode_json(file('blogs.json')->slurp);! ! for my $config (@$blogs_config) {!

    ! my $blog_url = URI->new($config->{blog_url});! is $blog_url->scheme, 'http', "blog_url͸httpͷURLͰ͋Δ";! ! cmp_deeply $config->{permission}, any('public', 'private'),! 'permission͸public͔privateͰ͋Δ';! }
  8. my $blogs_config = decode_json(file('blogs.json')->slurp);! ! for my $config (@$blogs_config) {!

    ! my $blog_url = URI->new($config->{blog_url});! is $blog_url->scheme, 'http', "blog_url͸httpͷURLͰ͋Δ";! ! cmp_deeply $config->{permission}, any('public', 'private'),! 'permission͸public͔privateͰ͋Δ';! } CMPH@VSM͸63-Ͱ͋Δ QFSNJTTJPO͸ QVCMJD͔QSJWBUF
  9. CMPH@VSM͸ શମͰϢχʔΫ my $blogs_config_uniq = [! uniq_by { $_->{blog_url} }

    @$blogs_config,! ];! ! is scalar @$blogs_config_uniq,! scalar @$blogs_config,! "blog_url͕શମͰϢχʔΫͰ͋Δ";
  10. <html>! <head>! <title>[% loc('blog.manage') %]</title>! </head>! <body>! <p>[% loc('blog.manage.description') %]</p>!

    </body>! </html> <html>! <head>! <title>[% loc('blog.manage') %]</title>! </head>! <body>! <p>ϒϩά؅ཧ͕Ͱ͖·͢</p>! </body>! </html>
  11. my @files = glob('templates/*.html');! ! for my $file (@files) {!

    my $content = file($file)->slurp;! my $has_japanese = $content =~ /[^[:ascii:]]+/;! ok ! $has_japanese, "$file ͸೔ຊޠΛؚ·ͳ͍";! } <html>! <head>! <title>[% loc('blog.manage') %]</title>! </head>! <body>! <p>ϒϩά؅ཧ͕Ͱ͖·͢</p>! </body>! </html>