Greetings. If any one need meeting summary, below is.
Thanks *@saifi* for driving this.
@all Pardon me if anything is missing/change needed. Please add as reply
*Topic heading *PERL data structures, modules
*Session highlights*
1. We got our first(probably) strikr coding guideline :)
2. We discussed on Perl data structures, useful language keywords,
modules
3. We looked at how to find documentation for perl constructs
4. We did hands-on on few visually interesting programs
5. We discussed on few language default properties and override
mechanisms
*Summary*
*Language property*
- By default, the program continues in case a warning or error happens
in a line.
- *use strict *overrides this default behaviour (enforce stop),
- Default behavior is useful in case your code is calling some
resource which is not available. In this case you like to continue doing
other stuffs
- Perl is multi paradigm program with DWIM capability
*Perl datatypes*
- A single variable is scaler. For example, string and number both are
of same *scaler* type
- 0, “0” and “” are false
- Perl has *UNDEF* datatype which is used for declaring a resource (For
example, file handle)
- *\* prefix to variable -> Gives reference. It can be used for function
reference as well. Example of references are
- Database connection
- File handle
- Socket connection
*Perl special variables*
- <> -> stdin
- @INC-> Include
- @ARGV ->All arguments
- %SIG -> Signal
*Useful perl data types*
1. $ -> For scaler
2. & -> For function
3. @ -> For array
4. % -> hash map
scalar $ \$ ${ $ref }
array @ \@ @{ $ref }[] $ref->[]
hash % \% %{ $ref }{} $ref->{}
function & \& &{ $ref }() $ref->()
0 type
1 sigil
2 ref(erence)
3 using ref(erence)
4 using ref(erence) with '->'
*Perl Keywords*
- *eval* -> Its last error value will be stored at $@
- *Die* -> to exit
- * Ref* -> to get property of a reference
- * Package* -> to create package
- *Sub* -> To create function
*Perl module*
Perl -v 5.8.8 | more -> lists modules in v5.8.8. Below are few useful
modules
- *Errno* -> Error number
- *ExtUtils* -> Module to Set *installpath* for example
- *Net* -> Networking related module
- *IO* -> I/O layer module
*Perldoc*
It is used for referencing perl data/module
- Perldoc -q signal
- Perl handles ctrl+c signal(software interrupt) as space and q as exit
- Perldoc perlvar
- Give description about all vars for example $@
- Perldoc perldata
- Gives detail on datatypes
- perldoc perlref
- For knowing about perl reference
*Strikr coding guideline*
- Comma should be prefix, not the trailing. -> Its for avoiding any code
break in case of commenting a line. Below is the example
my %stcap = (
"a" => "test"
, "b" => "test2"
);
*Hands-on*
- We Wrote a module with *OO* encapsulation and abstraction concepts.
This module does addition, subtraction
- We wrote *an auto flush(*no IO buffering*)* featured code. To do
this, we have implemented slowcat (cat equivalent at slow speed)
*Book recommendation*
Modern perl by chromatic
*Reference*
Cpan.org <http://cpan.org/> -> The Comprehensive Perl Archive Network
(CPAN)