Soitron+HP@YAPC 2007
Emo + Jozef + Porucik

YAPC 2007
- YAPC - Yeat Another Perl Conference
- Wien
- 3 days
- 348 "users"
- 64 speakers
- 66h of talks
- about databases, web, techniques and social thinks
1st day
9:00 Vienna University of Economics and Business Administration

Larry Wall

Larry Wall

Operator overloading
Posibilities

- Arithmetic operations (+, /, x, *, +=, ., etc)
- Comparison operations (<, >, le, <=>, etc)
- Bit operations (&, ^, |, neg, !, ~)
- Increment and decrement (++, --)
- Transcendental functions (atan2, cos, sin, exp, abs, log, sqrt, int)
- Boolean, string and numeric conversion (bool, "$var", '0+')
- Iteration (<>)
- Dereferencing (${}, @{}, %{}, &{}, *{})
- special (nomethod, fallback, =)
Operator overloading
When to use it?
- In mathematical libraries (BigInt, Matrices, Imaginary numbers, Dates)
- Otherwise never, it's too confusing!
-
$x = $y + $z;
print @devices - %in_outage, "\n";
- Except for basic operators like: string
-
See overload
MySQL hacking
Rewrite MySQL in Perl by linking with the MySQL library

- Server-side implementation of the MySQL protocol
- parse SQL statements by calling MySQL's own parser
- Pure perl SQL parser derived from MySQL's grammar and lexer
- Federated database engine (link two MyQSL servers as one)
- Any Perl script can become a valid MySQL server: wrap LDAP as an SQL server
See DBIx::MyServer,
DBIx::MyParse,
and DBIx::MyServerPP
Selenium

- test tool for web applications
- one of the most portable testing frameworks
- 2 parts - IDE, RC
- IDE - browser extension for recording
- RC - server for HTTP
- can test javascript
- See Wikipedia Selenium
Techniques for Remote System-Monitoring

- YAML vs CSV = Enhanced CSV
key=123;key2=321;...
- nmon performance
A free tool to analyze AIX and Linux performance
- .ssh/authorized_keys
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="/usr/bin/SOMEPROG" ssh-rsa ...
- $pid = open3(\*CHLD_IN, \*CHLD_OUT, \*CHLD_ERR, 'some cmd and args', 'optarg', ...);
- RRD round robin data, graphs
OpenThought AJAX Library
Features

- Based on hashes
- Simple API
- Can send JavaScript variables to Perl and vice versa
- Server can control the web browser
- HTML elements behave according to their type:
-
- Form elements have their data updated.
- Text elements (h1, div, etc) can include HTML
- Images can be changed
- HTML elements are found based on their id or name
See OpenThought
Memcached

- Cache::Memcached
- memcached is a high-performance, distributed memory object caching system,
generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load
- using RAM from N servers to cache
- expiration time
- decent cleanup
Web scraping
Overview

Extract information or interact with existing web sites.
- Download information (ex: stock markets)
- Interact with existing HTML forms (ex: vitalnet)
- Unit testing, watchdogs and monitoring
Web scraping
Tools
Existing tools that make our live easier.
- Perl user agents: LWP, WWW::Mechanize, Mozilla::Mechanize, Win32::IE::Mechanize
- Perl modules: LibXML, HTML::Tree, DOM, SAX
- Tools: Mozilla DOM Inspector, Firefox extenstion Firebug
- Queries: XPath, CSS
See LWP,
WWW::Mechanize,
Mozilla::Mechanize,
Win32::IE::Mechanize,
HTML::Tree,
XML::LibXML,
HTML::Tree,
DOM Inspector
Firebug
Net::Proxy
Overview

- TCP/IP proxy written in perl
- Fully customizable
- Can tunnel SSL connections
- Hack: tunnel different protocols in the same port (HTTPS and SSH)
See Net::Proxy
Rest...
- MQ - Message Queue
"Industry" standard
Net::Stomp
- Catalyst - used a lot. Plenty of other "frameworks" out there...
- Ajax Perl syntax highlighting link
And in the evening...
- we had some beer ...
- .. and we went to sleep!

2nd day

damian Conway

- Antisocial Perl
- but...
- Larry doesn't age
- Rod Logic
- Postironic::Variables
- backwards in time...
POE hackathon

- event driven programming
- can fork and work in parallel
- lot of components/servers/clients
- example for DNS, HTTP, SMTP, ...
- pluggable achitecture
Introduction to Moose

- Moose is a complete modern object system for Perl 5
based on the Perl 6 object system.
- check object variables
- better object inheritance
- easy serialization MooseX::Storage
- production ready
- http://search.cpan.org/perldoc?Moose
Attendees Dinner

- shopzilla bus :)
- free food :)
- we run out of beer :(
But we found some!
- we had some discussion about "Oktober Fest" ...
- .. and we went to sleep!

3th day

Lightning Talks

- every one for max 5 minutes
- utf8::upgrade - force utf8 on scalar (more in the next slide)
- Win32::GuiTest
Unicode (UTF-8)
How it's handled in Perl
- There are 2 types of strings: text and binary
- Strings at in latin1 (ISO-8859-1) as long as possible
- Text strings are in UNICODE, not UTF-8
- DO NOT mix binary and text strings wihtout conversion
See perluniintro
and perlunicode
Perl 5.10 Regular Expressions

- \h horizontal whitespace
- \v vertical whitespace
- \R new line (\r,\n,\r\n)
- when benchmarking regexp test agains failed match
- \K replace all to the right of it
- (?<name>pattern) named capture buffers
- (?|pat(te)r|pa(tt)ern) or capture buffers
- (?1 ) recursive patterns
Phrasebooks
Design pattern

- Handles dictionaries of phrases (SQL, output mesasges, SNMP queries)
- Phrases can have place holders
- Mutiple dictionaries can be used for a same phrase (databases, languages, devices)
- Multiple backends can be used to store the phrasebooks: XML, database
See Class::Phrasebook
and DBIx::PhraseBook
Building Scalable Data Collection
- MogileFS - enables horizontal scaling of storage across any number of machines.
designed for high volume applications, such as high traffic websites
- JSON - JavaScript Object Notation, object serialization
- Gearman - gearman distributed job system
server/clients
- TheSchwartz - is a reliable job queue system.
database job storage
Data::Domain

- validating data trees
- lot of condition - min, max, isa, can, range, regexp, ...
- can have error message per condition
Pod::POM::Web
- Web application for browsing the documentation of Perl components installed on your local machine
- a tree view for browsing through installed modules
- search, fulltext search
Rest...
- frontend/backend server setup
frontend serving from the cache passing uncached requests to the backend server
- Perl Programming Interview Questions, Answers, and Explanations: Perl Programming Certification Review (Paperback)
ISBN 1933804483
Perl?

- alive thanks to it's community - CPAN, Mongers groups
- Bratislava.pm - http://bratislava.pm.org
- doesn't work still :(
- Mailing list works! :)
- http://mail.pm.org/mailman/listinfo/bratislava-pm
- Why local PM group?
- We will discuss in local language :) - Slovak!