Successfully reported this slideshow.
Your SlideShare is downloading. ×
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Moose
Moose
Loading in …3
×

Check these out next

1 of 58 Ad
Advertisement

More Related Content

Similar to Yapc2012 (20)

Recently uploaded (20)

Advertisement

Yapc2012

  1. 1. Teaching Perl For Fun and Advocacy By John Napiorkowski, Sponsored by Shutterstock, LLC Copyright 2012
  2. 2. Images Courtesy of Shutterstock http://www.shutterstock.com/jobs.mhtml
  3. 3. With Thanks To General Assembly http://generalassemb.ly/
  4. 4. http://www.onyxneon.com/books/modern_perl/index.html
  5. 5. What Sucks About Perl?
  6. 6. Line Noise / Write Only Ugly Only good for Scripts There are Better Not Modern Options Fine for Text Processing Perl Is Dead Hard To Learn Terrible Docs CPAN is Busted!
  7. 7. For me, Inspiration is helping someone construct their own version of the idea, which is appropriate to their needs and conceptual context.
  8. 8. my $first_class = Perl->o_fun
  9. 9. One Liner Example $perl -MModern::Perl -ne 'say "Hello ". $_' John Hello John
  10. 10. Step By Step • Command Interpreter • Switches • Code • STDIN/OUT • Implicit Arguments
  11. 11. As A Script #!/usr/bin/env perl use Modern::Perl; say "Hello ". shift;
  12. 12. $ perl myscript.pl John Hello John
  13. 13. A Reusable Object package HelloName; use Moose; has name => (is=> "ro", required=>1); sub hello { my ($self) = @_; return "Hello ".$self->name; } 1;
  14. 14. Using Your Object #!/usr/bin/env perl use Modern::Perl; use HelloName; my $obj = HelloName->new(name=>shift); say $obj->hello;
  15. 15. $ perl myscript2.pl John Hello John
  16. 16. Testing use HelloName; use Test::Most; my $obj = HelloName->new(name=>'John'); is $obj->name, 'John'; is $obj->hello, 'Hello John'; done_testing;
  17. 17. $ prove -v hello-name.t hello-name.t .. ok 1 ok 2 1..2 ok All tests successful. Files=1, Tests=2, 0 wallclock secs Result: PASS
  18. 18. As a Website use Modern::Perl; use HelloName; my $obj = HelloName->new( name => $ENV{HelloName_name} ); my $app = sub { return [ 200 => [ "Content-Type" => "text/plain"], [ $obj->hello ], ]; };
  19. 19. $ HelloName_name=John plackup app.psgi HTTP::Server::PSGI: Accepting connections at http://0:5000/
  20. 20. perldoc plackup
  21. 21. A Running Website!
  22. 22. How To Learn More • Modern Perl book • Task::Kensho • perl.org • Books (Catalyst Book) • IRC and Mailing lists
  23. 23. Classes 2 - 8 • Perl: History, ecosystem, community and installing. • More Perl than I got paid to know at my first job. • Creating your first Perl Application and following community standards. • Perl: Review idioms and common solutions. • Objects: Moose, strategies for reusability. • Working: Building the Guestbook Application • Summary: Review, things to avoid, where to go next.
  24. 24. (Guest Lecture on Task::Kensho)++
  25. 25. APEIRON++
  26. 26. GeneralAssembly::Guestbook https://github.com/jjn1056/GeneralAssembly-Guestbook
  27. 27. “Perl was always designed to be an Evolving Language” - Larry Wall, Original Perl Language Designer
  28. 28. Student Feedback • Liked implicit arguments and return values. • Neutral on syntax and $@%*. • Appreciation for cpanm, local::lib, perlbrew. • Plack is a hit... • ...and so was Moose!
  29. 29. Stumbled a bit on installing Perl and CPAN modules, and a bit of trouble understanding local::lib.
  30. 30. Jury out on documentation and learning tools
  31. 31. The First Class is Great :)
  32. 32. The Second Class should have been focused exclusively on Installing Perl
  33. 33. “More Perl than I got paid to know at my first job.” Maybe next time use an old script as an example?
  34. 34. Make Better Use of Social Media
  35. 35. Guest Lecturer was a good idea
  36. 36. (system Perl)--
  37. 37. Paper Handouts / Take-aways?
  38. 38. http://www.shutterstock.com/jobs.mhtml

Editor's Notes

  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

×