CPAN 模組二三事

4,480 views
4,392 views

Published on

CPAN 模組

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,480
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
22
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

CPAN 模組二三事

  1. 1. CPAN c9s (cornelius) http://github.com/c9s cornelius.howl@gmail.com
  2. 2. CPAN
  3. 3. • DRY ( Dont repeat yourself) • Class Library • 3400+ authors • 12000+ modules • Unit Tests
  4. 4. CPAN
  5. 5. CPAN ?
  6. 6. Release Often
  7. 7. Unit Testing
  8. 8. Module review
  9. 9. Write Once Never Maintain (?) XD
  10. 10. Read-only Module ? Patch Please patch locally.... XD
  11. 11. ( )
  12. 12. XD
  13. 13. .... (blush)
  14. 14. CPAN
  15. 15. CPAN Module
  16. 16. • audreyt (autrijus) CPAN Module • gugod Authors • clkao in Taiwan • clsung Acme::CPANAuthors::Taiwanese • imacat • shelling • BlueT • cornelius (c9s) • etc...
  17. 17. • ADAMK (218+ ) • RJBS (211+ ) • Miyagawa ( 177+ ) • CPAN Leaderboard http://thegestalt.org/simon/perl/wholecpan.html
  18. 18. • $ wget http://path/to/Dist-{version}.tar.gz • $ perl Makefile.PL # Makefile • $ make • $ make install
  19. 19. CPAN • CPAN Shell • CPANPLUS Shell • cpanminus http://github.com/miyagawa/cpanminus
  20. 20. CPAN Shell • Unix-like platform • • : $ cpan [Module Name]
  21. 21. CPANPLUS • CPAN Shell
  22. 22. CPANPLUS • CPAN Shell • CPAN Shell XD
  23. 23. CPANPLUS • CPAN Shell • CPAN Shell XD •
  24. 24. cpanminus • • • • ( )
  25. 25. cpanminus http://github.com/miyagawa/cpanminus
  26. 26. CPANMinus $ cd ~/bin/ $ wget http://xrl.us/cpanm $ chmod +x cpanm
  27. 27. CPANMinus from github $ git clone git://github.com/miyagawa/cpanminus.git $ cd cpanminus $ perl Makefile.PL $ make install
  28. 28. $ cpanm [Module Name]
  29. 29. $ cpanm -n [Module Name] {no test}
  30. 30. $ cpanm -v [Module Name] {verbose}
  31. 31. $ cpanm -f [Module Name] {force}
  32. 32. $ cpanm --help {help}
  33. 33. cpanm CGI cpanm MIYAGAWA/Plack-0.99_05.tar.gz cpanm http://example.org/LDS/CGI.pm-3.20.tar.gz cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz cpanm --interactive Task::Kensho cpanm . cpanm --installdeps .
  34. 34. • Perldoc : $ perldoc Data::Dumper • search.cpan.org • Synopsis • Code use : use Data::Dumper;
  35. 35. Shell • Getopt::Long - Command Line • $ getopt.pl --take=blah --id=10 --verbose -t
  36. 36. Shell • Pod::Usage - my %options = ( debug => 0, ); GetOptions(%options, qw{ help|h! version|V! debug|d! config|c=s }) or pod2usage(0); pod2usage({ -verbose => 2, -exitval => 0, -noperldoc => 1 }) if $options{help};
  37. 37. Process • Proc::Daemon • ForkManager • IPC::Run
  38. 38. Lists • List::Util maxstr min minstr reduce shuffle sum ) ( first max • List::MoreUtils ( any all none notall true false firstidx first_index lastidx last_index insert_after insert_after_string apply after after_incl before before_incl indexes firstval first_value lastval last_value each_array each_arrayref pairwise natatime mesh zip uniq minmax )
  39. 39. Event • AnyEvent::* • POE::*
  40. 40. Serialization • Data::Dumper • Storable • JSON (JSON::PP, JSON::XS ...) • YAML (YAML::XS,YAML::Syck)
  41. 41. Web (server-side) • AnyEvent::HTTPD • Plack • Catalyst , Jifty , Mojo • Template::Declare , Template::Markpl • Mason
  42. 42. Web (client-side) • LWP::UserAgent • LWP::Simple • AnyEvent::HTTP • LWP::Parallel • HTTP::Async
  43. 43. Web (client-side) • Web::Scraper • pQuery • WWW::Mechanize • HTTP::Async
  44. 44. HTML • HTML::Parser • HTTP::TreeBuilder • WebService::Validator::HTML::W3C
  45. 45. Documents • Office • Spreadsheet::WriteExcel, Spreadsheet::ParseExcel ... • OpenOffice::* • PDF::API2
  46. 46. Graphics • GD, Imager • Image::Magick • Gimp • SVG::Graph • Cairo • GraphViz • Image::LibRSVG
  47. 47. Network • Protocols • Net::FTP , Net::SSH, Net::SCP, Net::DNS, • Net::DHCP , Net::Ping .... • Low level • IO::Socket, Net::Packet, Net::Pcap ...
  48. 48. Database • DBI (PostgreSQL, SQLite, Oracle, MySQL ...) • DBI::Proxy, DBD::Gofer • DBIx::Simple
  49. 49. ORM • Class::DBI, DBIx::Class • Jifty::DBI • Prophet • Tangram, Alzabo, SPOPS • Rose::DB::Object, DBIx::DataModel, Fey::ORM
  50. 50. Tests • Test::More, Test::BuilderDevel::CoverTest::Deep, Test::LongStringTest::Exception, Test::NoWarningsTest::MockModule, Test::MockObjectTest::Class, Test::UnitTest::LectroTest
  51. 51. • Module::Starter • App::Ack • Perl::Tidy • Perl::Tags
  52. 52. Debugging • XXX • Devel::SimpleTrace • Devel::Graph • Devel::LeakTrace • Devel::NYTProf
  53. 53. Cache • Cache::CHI • Cache::Memory • Cache::File • Cache::Memcached •
  54. 54. Object-oriented Programming • Class::MOP • Moose • Mouse • autobox
  55. 55. The External World • Languages • Inline: C , Java, Ruby, Python ... • External Library • XS • Devel::PPPort • Swig • etc...
  56. 56. • Git • Github::Import • Gearman • ....
  57. 57. • The Phalanx 100: http://qa.perl.org/ phalanx/100/ • CPAN Search: http://search.cpan.org/ • Perldoc: http://www.perldoc.org • Perl Cookbook
  58. 58. Perlbuzz.com
  59. 59. • Module::Starter $ module-starter --mi --module=Foo::Bar --author=”Your Name” --email=your_email@blah.com • lib/Foo/Bar.pm • t/*.t • Makefile.PL
  60. 60. • Makefile , , : $ perl Makefile.PL $ make test $ make dist • PAUSE ID ( http://pause.perl.org): • (CPAN::Uploader) $ make upload ... or $ cpan-upload Dist-0.01.tar.gz
  61. 61. ...
  62. 62. Live Demo XD
  63. 63. Thanks /c9s/

×