Application &Popularity Today

greenbeansneedlesΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 3 χρόνια και 11 μήνες)

75 εμφανίσεις


History


Ease of use


Portability


Standard


Security & Privacy


User support


Application &Popularity Today


Ten Most Popular Programming Languages


COOL


Practical Extraction & Report Language(PERL)


Developed by Larry Wall in 1987



Combined features of C, awk, Sed, Bourne


Efficient use for manipulation of text files.


Efficient use for report processing


Motto: “there is more than one way to do it”


Contains multiple versions




Very easy to use and understand


Designed with syntax similar to human language


Has features that make it easy to program ex:


Automatic memory management


List


Dynamic Typing


Regular Expression allow manipulation of text




Among the most portable programming
languages


Can be compiled over 70 Operating Systems


Can pick up a Perl program and compile it on
another computer


Almost no need to modify the program



Keywords


Instructions Perl recognizes and understand. Ex:


Print, Die, Return


Should not be re


Statements


Print: “hello world/n”


Blocks


Enclosed in braces

{ print “This is”;


print “a block”;


print “of statements”; }



Perl has 3 basic types of variables

1.
Scalar

Holds a single type of value, preceded by a dollar sign

Can be a string, a number, or a reference


$foo = 1;

Types of value that can be assigned to a number :


12345 # integer



-
54321 # negative integer


12345.67 # floating point



6.02E23 # scientific notation


0xffff # hexadecimal



Perl has 3 basic types of variables

2
-

Arrays


holds multiple values, preceded by the @ sign



@color ={ “red”, “blue”, “green”};


Its index start at 0, print the first element of array



print “$color[0]
\
n”;
// to print
red








Perl has 3 basic types of variables

3
-

Hash


Unordered collection of values


Each value can be retrieved by its key


Hash name is preceded by a % sign


Declared by :


Hash Name
-
> Key
-
> Value



% pages =






( "fred", "http://www.cgi101.com/~fred/",





"beth", "http://www.cgi101.com/~beth/",





"john", “http://www.cgi101.com/~john/" );






Perl also contains:


If … else statements


If( expression) {execute this} else {execute this};


More than four different types of loop


While loop


For loop


Foreach loop


Until loop


Perl also contains


Control commands


Last
: terminates the execution of a loop


Next
: makes the loop go to its next iteration


Redo
: makes loop restart without evaluating loop conditions


Modifiers


Allow any statement to loop based on some conditions


Statements
if

expression


Statements
until/unless

expression



Statements
while

expression




Perl also contains


Regular Expressions


They are String literals


Used to find and replace strings by using patterns


s/pattern/replace/
-
>searches $_ by default,
replace


Subroutines


Defined using
keyword sub


sub (name) {block};


$subref=sub{block}; #creates anonymous subroutine





Privacy


Privacy is not enforced in Perl


“Perl does not enforce
private

and
public

part of its
module as …in…C++, Ada, Modula
-
17”



Module is a fundamental unit of code reuse in Perl


Security


Perl has features that make it secure


Can handle insecure data by using Taint mode


Taint mode can be set automatically


Things that come outside your program is tainted


Tainted data are restricted in what they can do



Has a vast community of support that has


User Groups

o
Have mongers in many cities around the world


Workshops

o
Teach Perl during workshops at different level


Hackathons

o
Perl hackers gather to hack on specific projects for days


Two Major Annual Conventions

o
Perl Conference

o
Yet Another Perl Conference (YAPC)



Application


Used to write CGI scripts


Popular for writing web applications


Many large projects are written in Perl

Cpanel, a UNIX web based hosting panel

Bugzilla, web tracker developed by Mozilla

Twiki, Perl based structured wiki application

Amazon, Priceline, Craigslist


Popularity


Perl is the 8
th

top programming language in 2010