SlideShare a Scribd company logo
Author: Mons Anderson (MONS)
search.cpan.org/~mons XML-Declare uni-perl AnyEvent-SMTP accessors-fast ex-lib Test-If AnyEvent-RPC Acme-CPANAuthors-AnyEvent constant-def AnyEvent-Worker Image-JpegTran XML-Hash-LX Socket-AcceptFilter XML-Parser-Style-EasyTree lvalue Catalyst-Action-Serialize-XML-Hash-LX XML-Fast Devel-Leak-Cb lib-abs Crypt-RSA-Yandex AnyEvent-Connection AnyEvent-Memcached Test-More-UTF8 Dash-Leak AnyEvent-Handle-Writer Variable-Eject self-init XML-RPC-Fast Image-LibExif Test-Dist
github.com/Mons AnyEvent::HTTP::Server AnyEvent::UA AnyEvent-XMPP-2 Proc::Vsize Daemond Devel::Rewrite CatalystX-InternalRedirect
use lib ? use lib '../lib'; use lib '/opt/project/lib'; use FindBin; use lib «$FindBin::Bin/../lib»;
09.11.2008 ex::lib (now lib::abs) (thanks to A. Shrub ;)
use lib::abs (ex::lib) use lib::abs '../lib'; use lib::abs '../../*/lib';
use, use, use? use utf8; use strict; use warnings; use Carp; use Data::Dumper; use open qw(:utf8 :std); use mro 'c3'; use feature qw(say state switch);
use warnings? Use of uninitialized value...
common::sense? - No utf8 until v3.0 - No open :utf8 support for v3.0+ - No require perl 5.10+ for features - No Carp - No mro
use uni::perl ':dumper'; use strict; use feature qw(say state switch); no warnings; use warnings qw(FATAL ...); no warnings qw(exec newline); use utf8; use open (:utf8 :std); use mro 'c3'; use autouse 'Carp'; use autouse 'Data::Dumper';
Secret feature ;) (pluggable) use uni::perl ':ru'; say cp1251::encode «...»; say cp1251::decode «...»; say koi8r::encode «...»; say koi8r::decode «...»; say cp866::encode «...»; say cp866::decode «...»;
XML::* XML::RPC::Fast XML::Parser::Style::EasyTree XML::Hash::LX XML::Fast XML::Declare
Test::* Test::Dist kwalitee for cpants.perl.org
Test::* Test::If — tired of eval { use Test::...; 1 } or plan skip_all => «...»; $Test::...::VERSION >= 1.23 or plan skip_all => «...»;
Test::* Test::More::UTF8 against Wide character in print at Test/Builder.pm line 1698.
Fun syntax - lvalue - self::init - accessors-fast - constant-def
lvalue sub mysub : lvalue { get { return 'result for get'; } set { my $set_value = shift;   # ... } }
self::init use self::init \-a => qw(a b), \-b => (), \-c => qw( c c ), ; vs __PACKAGE__->a(qw(a b)); __PACKAGE__->b(); __PACKAGE__->c(qw(c c));
accessors::fast use accessors::fast qw(field1 field2); vs use base 'Class::Accessors::Fast'; __PACKAGE__->mk_accessors( qw(field1 field2) );
constant::def use constant::abs 'My::DEBUG' => 1; use constant::def DEBUG => 0; vs BEGIN { *My::DEBUG = sub () { 1 }; } BEGIN { defined &DEBUG or *DEBUG = sub () { 0 }; }
AnyEvent::* AnyEvent::Connection manage your connection AnyEvent::SMTP send 7k emails/s AnyEvent::Memcached client with rget (for memcachedb) AnyEvent::Worker any blocking work for AE app AnyEvent::Handle::Writer use sendfile() with write queue AnyEvent::HTTP::Server pipeline, websockets, http/1.1 AnyEvent::UA http/1.1 useragent
Image::* Image::JpegTran (binding to jpegtran) Image::LibExif 4000% (40 times) faster than Image::ExifTool
Daemond (github) - Correct daemonization - Detach - redirection of output - keeping the fileno for STD* handles - chroot - change user - Pluggable engine - Built-in CLI (Command-line interface) - Pidfile - Scoreboard - Different packages for child and parent - Child monitoring for parent death - Timers for termination
Simple Daemond  package SampleD; use Daemond -parent; name 'test'; cli;  # Command line control proc;  # Alter $0 children 1; # How many children pid '/var/run/test.pid'; child { $SIG{USR2} = sub { exit; }; while() { do_job(); } };
Daemond CLI Usage: [options] [start|stop|restart|check] Options: -v, --verbose increase verbosity level -f, --nodetach run in nodetach mode -c N, --children N redefine count of children
Devel::Rewrite # @rewrite s/^#\s+//; # use Some::Development::Module; # @rewrite s/some_call/another_call/; $object->some_call; sub something { # @include sub.debug.inc ... } perl -MDevel::Rewrite …
Dash-Leak use Dash::Leak; { leaksz "block label"; # some code, that may leak } leaksz "tests begin"; some_operation($arg); leaksz "some_operation", sub { warn sprintf "We leaked by %+d kilobytes;", shift }; $ DEBUG_MEM=1 perl ...

More Related Content

PPTX
Developing High Performance Application with Aerospike & Go
PPTX
Rapid Application Design in Financial Services
PDF
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
PDF
Golang Performance : microbenchmarks, profilers, and a war story
PDF
RestMQ - HTTP/Redis based Message Queue
KEY
Rails Hardware (no conclusions!)
PDF
Devel::NYTProf 2009-07 (OUTDATED, see 201008)
PDF
PL/Perl - New Features in PostgreSQL 9.0 201012
Developing High Performance Application with Aerospike & Go
Rapid Application Design in Financial Services
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Golang Performance : microbenchmarks, profilers, and a war story
RestMQ - HTTP/Redis based Message Queue
Rails Hardware (no conclusions!)
Devel::NYTProf 2009-07 (OUTDATED, see 201008)
PL/Perl - New Features in PostgreSQL 9.0 201012

What's hot (20)

PDF
Application Logging in the 21st century - 2014.key
PPTX
Binary Studio Academy: Concurrency in C# 5.0
PDF
Xanadu - Java Chapter Meeting
PDF
Go Profiling - John Graham-Cumming
PDF
Redis as a message queue
PDF
Top 10 Perl Performance Tips
PDF
[231] the simplicity of cluster apps with circuit
PDF
CPAN 模組二三事
PDF
Python Load Testing - Pygotham 2012
PDF
Go debugging and troubleshooting tips - from real life lessons at SignalFx
PDF
RabbitMQ for Perl mongers
ODP
Profiling with Devel::NYTProf
PPTX
All you need to know about the JavaScript event loop
PDF
2017 meetup-apache-kafka-nov
PDF
What Have Syscalls Done for you Lately?
PDF
Perl Memory Use 201209
PDF
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
KEY
Streams are Awesome - (Node.js) TimesOpen Sep 2012
PDF
Go memory
PDF
CQL: SQL In Cassandra
Application Logging in the 21st century - 2014.key
Binary Studio Academy: Concurrency in C# 5.0
Xanadu - Java Chapter Meeting
Go Profiling - John Graham-Cumming
Redis as a message queue
Top 10 Perl Performance Tips
[231] the simplicity of cluster apps with circuit
CPAN 模組二三事
Python Load Testing - Pygotham 2012
Go debugging and troubleshooting tips - from real life lessons at SignalFx
RabbitMQ for Perl mongers
Profiling with Devel::NYTProf
All you need to know about the JavaScript event loop
2017 meetup-apache-kafka-nov
What Have Syscalls Done for you Lately?
Perl Memory Use 201209
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Go memory
CQL: SQL In Cassandra
Ad

Viewers also liked (9)

PDF
Guitar Hero, Wikipedia, VK, Perl, Like it!
PDF
PDF
Разработка документации для RESTful API: как убить трёх зайцев одним. Moscow....
ODP
Ae internals
PPTX
Введение в веб-технологии. Лекция.
PDF
Buytaert kris tools
PDF
Развитие интернета в регионах России
PDF
Ленивые итераторы для разбора разнородных данных. Михаил Озеров. Moscow.pm 6 ...
PPT
Communication Online
Guitar Hero, Wikipedia, VK, Perl, Like it!
Разработка документации для RESTful API: как убить трёх зайцев одним. Moscow....
Ae internals
Введение в веб-технологии. Лекция.
Buytaert kris tools
Развитие интернета в регионах России
Ленивые итераторы для разбора разнородных данных. Михаил Озеров. Moscow.pm 6 ...
Communication Online
Ad

Similar to Владимир Перепелица "Модули" (20)

KEY
Good Evils In Perl (Yapc Asia)
PDF
Perl 5.10
ODP
Introduction to Modern Perl
PDF
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
PPT
Cleancode
ODP
Perl - laziness, impatience, hubris, and one liners
PDF
Good Evils In Perl
PPTX
C to perl binding
PDF
System Programming and Administration
ODP
Modern Perl
PDF
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
ODP
30 Minutes To CPAN
PDF
Utility Modules That You Should Know About
ODP
What's new in Perl 5.10?
PDF
Os Wilhelm
ODP
Advanced Perl Techniques
PPTX
Perl basics for Pentesters
PDF
CPANTS: Kwalitative website and its tools
PDF
Barely Legal Xxx Perl Presentation
Good Evils In Perl (Yapc Asia)
Perl 5.10
Introduction to Modern Perl
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Cleancode
Perl - laziness, impatience, hubris, and one liners
Good Evils In Perl
C to perl binding
System Programming and Administration
Modern Perl
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
30 Minutes To CPAN
Utility Modules That You Should Know About
What's new in Perl 5.10?
Os Wilhelm
Advanced Perl Techniques
Perl basics for Pentesters
CPANTS: Kwalitative website and its tools
Barely Legal Xxx Perl Presentation

More from Media Gorod (20)

PDF
Itogi2013
PDF
Moneytree rus 1
PDF
Iidf market watch_2013
PDF
E travel 2013 ufs-f
PPTX
Travel shop 2013
PPT
Kozyakov pay u_e-travel2013
PDF
13909772985295c7a772abc7.11863824
PPT
As e-travel 2013
PDF
Ishounkina internet research-projects
PPTX
E travel13
PPTX
Orlova pay u group_290813_
PDF
Ep presentation (infographic 2013)
PDF
Iway slides e-travel_2013-11_ready
PPTX
Data insight e-travel2013
PDF
Электронное Правительство как Продукт
PPTX
Lean мышление / Специфика Lean Startup
PDF
Глобальный взгляд на мобильный мир (Nielsen)
PDF
Как россияне используют смартфоны (Nielsen)
PDF
Мобильный интернет в России (MailRuGroup)
PDF
Meta Mass Media
Itogi2013
Moneytree rus 1
Iidf market watch_2013
E travel 2013 ufs-f
Travel shop 2013
Kozyakov pay u_e-travel2013
13909772985295c7a772abc7.11863824
As e-travel 2013
Ishounkina internet research-projects
E travel13
Orlova pay u group_290813_
Ep presentation (infographic 2013)
Iway slides e-travel_2013-11_ready
Data insight e-travel2013
Электронное Правительство как Продукт
Lean мышление / Специфика Lean Startup
Глобальный взгляд на мобильный мир (Nielsen)
Как россияне используют смартфоны (Nielsen)
Мобильный интернет в России (MailRuGroup)
Meta Mass Media

Владимир Перепелица "Модули"

  • 2. search.cpan.org/~mons XML-Declare uni-perl AnyEvent-SMTP accessors-fast ex-lib Test-If AnyEvent-RPC Acme-CPANAuthors-AnyEvent constant-def AnyEvent-Worker Image-JpegTran XML-Hash-LX Socket-AcceptFilter XML-Parser-Style-EasyTree lvalue Catalyst-Action-Serialize-XML-Hash-LX XML-Fast Devel-Leak-Cb lib-abs Crypt-RSA-Yandex AnyEvent-Connection AnyEvent-Memcached Test-More-UTF8 Dash-Leak AnyEvent-Handle-Writer Variable-Eject self-init XML-RPC-Fast Image-LibExif Test-Dist
  • 3. github.com/Mons AnyEvent::HTTP::Server AnyEvent::UA AnyEvent-XMPP-2 Proc::Vsize Daemond Devel::Rewrite CatalystX-InternalRedirect
  • 4. use lib ? use lib '../lib'; use lib '/opt/project/lib'; use FindBin; use lib «$FindBin::Bin/../lib»;
  • 5. 09.11.2008 ex::lib (now lib::abs) (thanks to A. Shrub ;)
  • 6. use lib::abs (ex::lib) use lib::abs '../lib'; use lib::abs '../../*/lib';
  • 7. use, use, use? use utf8; use strict; use warnings; use Carp; use Data::Dumper; use open qw(:utf8 :std); use mro 'c3'; use feature qw(say state switch);
  • 8. use warnings? Use of uninitialized value...
  • 9. common::sense? - No utf8 until v3.0 - No open :utf8 support for v3.0+ - No require perl 5.10+ for features - No Carp - No mro
  • 10. use uni::perl ':dumper'; use strict; use feature qw(say state switch); no warnings; use warnings qw(FATAL ...); no warnings qw(exec newline); use utf8; use open (:utf8 :std); use mro 'c3'; use autouse 'Carp'; use autouse 'Data::Dumper';
  • 11. Secret feature ;) (pluggable) use uni::perl ':ru'; say cp1251::encode «...»; say cp1251::decode «...»; say koi8r::encode «...»; say koi8r::decode «...»; say cp866::encode «...»; say cp866::decode «...»;
  • 12. XML::* XML::RPC::Fast XML::Parser::Style::EasyTree XML::Hash::LX XML::Fast XML::Declare
  • 13. Test::* Test::Dist kwalitee for cpants.perl.org
  • 14. Test::* Test::If — tired of eval { use Test::...; 1 } or plan skip_all => «...»; $Test::...::VERSION >= 1.23 or plan skip_all => «...»;
  • 15. Test::* Test::More::UTF8 against Wide character in print at Test/Builder.pm line 1698.
  • 16. Fun syntax - lvalue - self::init - accessors-fast - constant-def
  • 17. lvalue sub mysub : lvalue { get { return 'result for get'; } set { my $set_value = shift; # ... } }
  • 18. self::init use self::init \-a => qw(a b), \-b => (), \-c => qw( c c ), ; vs __PACKAGE__->a(qw(a b)); __PACKAGE__->b(); __PACKAGE__->c(qw(c c));
  • 19. accessors::fast use accessors::fast qw(field1 field2); vs use base 'Class::Accessors::Fast'; __PACKAGE__->mk_accessors( qw(field1 field2) );
  • 20. constant::def use constant::abs 'My::DEBUG' => 1; use constant::def DEBUG => 0; vs BEGIN { *My::DEBUG = sub () { 1 }; } BEGIN { defined &DEBUG or *DEBUG = sub () { 0 }; }
  • 21. AnyEvent::* AnyEvent::Connection manage your connection AnyEvent::SMTP send 7k emails/s AnyEvent::Memcached client with rget (for memcachedb) AnyEvent::Worker any blocking work for AE app AnyEvent::Handle::Writer use sendfile() with write queue AnyEvent::HTTP::Server pipeline, websockets, http/1.1 AnyEvent::UA http/1.1 useragent
  • 22. Image::* Image::JpegTran (binding to jpegtran) Image::LibExif 4000% (40 times) faster than Image::ExifTool
  • 23. Daemond (github) - Correct daemonization - Detach - redirection of output - keeping the fileno for STD* handles - chroot - change user - Pluggable engine - Built-in CLI (Command-line interface) - Pidfile - Scoreboard - Different packages for child and parent - Child monitoring for parent death - Timers for termination
  • 24. Simple Daemond package SampleD; use Daemond -parent; name 'test'; cli; # Command line control proc; # Alter $0 children 1; # How many children pid '/var/run/test.pid'; child { $SIG{USR2} = sub { exit; }; while() { do_job(); } };
  • 25. Daemond CLI Usage: [options] [start|stop|restart|check] Options: -v, --verbose increase verbosity level -f, --nodetach run in nodetach mode -c N, --children N redefine count of children
  • 26. Devel::Rewrite # @rewrite s/^#\s+//; # use Some::Development::Module; # @rewrite s/some_call/another_call/; $object->some_call; sub something { # @include sub.debug.inc ... } perl -MDevel::Rewrite …
  • 27. Dash-Leak use Dash::Leak; { leaksz "block label"; # some code, that may leak } leaksz "tests begin"; some_operation($arg); leaksz "some_operation", sub { warn sprintf "We leaked by %+d kilobytes;", shift }; $ DEBUG_MEM=1 perl ...