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);
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 «...»;
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
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