summaryrefslogtreecommitdiff
path: root/corso.content.tex
blob: d20938bde992f88b733d6de565bb9173abbb39a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
\usepackage[latin1]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{colortbl}
\usepackage{listings}
\usepackage{tikz}
 
\lstset{numbers=left,numberstyle=\tiny ,numbersep=5pt,language=Perl,printpod=true,showspaces=false,frame=single,framerule=0pt,backgroundcolor=\color{black!20},basicstyle=\small\ttfamily}
 
\mode<presentation>
{
\usetheme[hideothersubsections]{Goettingen}
\usecolortheme{beaver}
\usecolortheme{rose}
}
\mode<article>{\usepackage{fullpage}}
\mode<handout>{\setbeamercolor{background canvas}{bg=black!5}}
 
%% \AtBeginSection[]{
%%   \begin{frame}<beamer>{Argomenti}
%%   \small
%%     \tableofcontents[sectionstyle=show/shaded,subsectionstyle=show/hide/hide]
%%   \end{frame}
%% }
 
%% \AtBeginSubsection[]{
%%   \begin{frame}<beamer>{Argomenti}
%%     \tableofcontents[sectionstyle=show/hide,subsectionstyle=show/shaded/hide]
%%   \end{frame}
%% }
 
\newcommand{\Perl}{\textsf{Perl}}
\newcommand{\perl}{\texttt{perl}}
 
% 'sto coso non va... ed � pure copiato dalla documentazione di beamer!
%% \newenvironment{itemframe}
%% {\begin{frame}\frametitle{gino}\startitemframe}
%% {\stopitemframe\end{frame}}
%
%% \newcommand\startitemframe{\begin{itemize}}
%% \newcommand\stopitemframe{\end{itemize}}
 
\title{\Perl\ --- corso introduttivo}
\author[perl.it]{perl.it \url{http://www.perl.it/}}
\date[IPW2008]{Italian Perl Workshop 2008}
 
\begin{document}
 
\begin{frame}
\titlepage
\end{frame}
 
% shamelessly lifted from Llama3
 
\section{Introduzione}
 
\subsection{Informazioni generali}
 
\begin{frame}\frametitle{Cosa imparerete}
\begin{itemize}
\item a scrivere ed eseguire programmi Perl
\item a leggere molti semplici programmi altrui
\item a trovare ulteriori informazioni
\end{itemize}
\end{frame}
 
\begin{frame}\frametitle{Cosa dovete gi� sapere}
\begin{itemize}
\item usare un editor di testi
\item usare la linea di comando
\item programmare in qualche linguaggio \uncover<2->{(anche se comincia per P)}
\end{itemize}
\end{frame}
 
\subsection{Cos'� Perl?} % ma perch� non va con \textit???
 
\begin{frame}\frametitle{Il nome}
\begin{itemize}[<+->]
\item \Perl\ � il nome del linguaggio
\item \perl\ � il nome del programma
\item PERL � un errore
\end{itemize}
\end{frame}
 
\begin{frame}\frametitle{Il nome}
\begin{itemize}[<+->]
\item \emph{non} � una sigla
\item � un nome
\item se proprio volete...
 \begin{itemize}[<+->]
 \item Practical Extraction and Report Language
 \item Pathologically Eclectic Rubbish Lister
 \item Polymorphic Existential Recursive Lambdas
 \end{itemize}
\end{itemize}
\end{frame}
 
\begin{frame}\frametitle{Interprete o compilatore?}
\addtocounter{beamerpauses}{1}
\begin{description}
\item[Interprete] legge un'istruzione alla volta e la esegue
 \begin{itemize}[<+->]
 \item scova gli errori solo quando ci sbatte
 \item non fa ottimizzazioni serie
 \end{itemize}
\item[Compilatore] trasforma il programma da un linguaggio a un altro
 \begin{itemize}[<+->]
 \item pu� scovare molti errori staticamente
 \item pu� ottimizzare il codice
 \item \emph{non � mai sufficiente}
 \end{itemize}
\end{description}
\end{frame}
 
\begin{frame}\frametitle{Interpreti --- esempi}
\begin{itemize}[<+->]
\item la CPU � un interprete
\item \texttt{bash} � un interprete
\item la JVM � un interprete
\item \perl\ � un interprete
\end{itemize}
\end{frame}
 
\begin{frame}\frametitle{Compilatori --- esempi}
\begin{itemize}[<+->]
\item \texttt{GCC} � un compilatore
\item \texttt{javac} � un compilatore
\item \perl\ � un compilatore
\end{itemize}
\end{frame}
 
\begin{frame}\frametitle{Interprete \textit{e} compilatore}
\perl\ esamina l'intero programma, e se non ci sono errori lo
\emph{compila} in una struttura dati in RAM, la quale viene poi
\emph{interpretata}
\end{frame}
 
\begin{frame}\frametitle{La filosofia}
\begin{itemize}[<+->]
\item simile a un linguaggio naturale
\item TMTOWTDI
\item making easy things easy, and hard things possible
\item \emph{manipulexity} vs. \emph{whipuptitude}
\end{itemize}
\end{frame}
 
\subsection{Dove trovare \perl}
 
\begin{frame}\frametitle{Forse non serve}
\begin{itemize}
\item praticamente tutti i sistemi *NIX lo includono
\item pure il MacOS X
\end{itemize}
\end{frame}
 
\begin{frame}\frametitle{Ma io uso Windows!}
\begin{overprint}
\onslide<1|handout:0>{Mi dispiace per te}
\onslide<2|handout:1>{\begin{itemize}
\item \url{http://win32.perl.org/}
\item \href{http://www.activestate.com/Products/activeperl/index.mhtml}{ActivePerl}, di ActiveState
\item \href{http://win32.perl.org/wiki/index.php?title=Strawberry_Perl}{Starwberry Perl}, se volete qualcosa di pi� ``normale''
\end{itemize}}
\end{overprint}
\end{frame}
 
\subsection{Scrivere ed eseguire programmi}
 
\begin{frame}\frametitle{File di testo}
\uncover<+->{Come la maggior parte dei linguaggi di programmazione,
Perl legge i programmi da semplici file di testo.}
 
\uncover<+->{Per il momento supponiamo di usare soltanto i caratteri
  dell'insieme ASCII (niente accentate)}
 
\uncover<+->{� pi� semplice se usate i fine-linea normali per la
  vostra piattaforma}
\end{frame}
 
\begin{frame}\frametitle{Convenzioni}
\begin{itemize}[<+->]
\item per i programmi potete usare i nomi che volete
\item certe volte si usa \texttt{.pl} come estensione
\item \texttt{\#!/usr/bin/perl} o \texttt{\#!/usr/bin/env perl}
\item i file che definiscono i moduli devono avere nomi particolari
\end{itemize}
\end{frame}
 
\begin{frame}[fragile]\frametitle{Esempio minimo}
\begin{lstlisting}
#!/usr/bin/env perl
use strict;
use warnings;
 
# qui il vostro programma
\end{lstlisting}
\end{frame}
 
\begin{frame}\frametitle{Esecuzione}
\begin{itemize}[<+->]
\item \texttt{perl nomefile}
\item *NIX: \texttt{chmod +x nomefile; ./nomefile}
\item Windows: trucchi con i file \texttt{.BAT}
\end{itemize}
\end{frame}
 
\section{Scalari}
 
\subsection{Numeri}
 
\subsection{Stringhe}
 
\subsection{Input/Output} % print, <>, chomp
 
\subsection{\texttt{if} e \texttt{while}} % else, elsif
 
\subsection{Valori particolari} % undef, true/false, defined
 
\section{Liste e Array}
 
\subsection{Indici}
 
\subsection{Valori}
 
\subsection{Interpolazione}
 
\subsection{\texttt{foreach}}
 
\subsection{Il contesto}
 
\section{Subroutine}
 
\subsection{Definizione}
 
\subsection{Invocazione}
 
\subsection{Argomenti e valore di ritorno}
 
\subsection{Variabili lessicali}
 
\section{Hash}
 
\subsection{Indici}
 
\subsection{Valori}
 
\subsection{Funzioni}
 
\section{Input/Output}
 
\subsection{Qualche dettaglio in pi�}
 
\subsection{Le magie di \texttt{<>}}
 
\subsection{\texttt{printf}}
 
\subsection{Codifiche}
 
\section{Espressioni regolari}
 
\subsection{Cosa sono}
 
\subsection{Casi semplici} % literal, simple charclass, repetition
 
\subsection{Operatori pi� complessi} % anchors, parens, complex charclass (\p)
 
\subsection{Uso generale} % m, s, split, =~, options
 
\section{Controllo del flusso}
 
\subsection{Controlli negati} % unless, until
 
\subsection{Modificatori}
 
\subsection{\texttt{for}}
 
\subsection{Controllo dei cicli}
 
\section{Moduli}
 
\subsection{Cosa sono}
 
\subsection{CPAN}
 
\subsection{Installazione} % CPAN.pm, distribuzioni e local::lib
 
\section{Filehandle}
 
\subsection{Leggere e scrivere file}
 
\subsection{Test sui file}
 
\subsection{Moduli da usare} % File::Spec, Path::Class
 
\section{Directory}
 
\subsection{Le funzioni} % opendir, readdir
 
\subsection{Moduli da usare} % File::Find, File::Find::Rule, File::Find::Next
 
\section{Processi}
 
\subsection{Le funzioni} % system, exec, qx, fork/wait
 
\subsection{Moduli da usare} % IPC::Run
 
\section{Argomenti avanzati}
 
\subsection{Manipolazione di stringhe} % substr, sprintf
 
\subsection{Manipolazione di liste} % sort, grep, map
 
\subsection{Indici multipli} % array & hash slices
 
\end{document}
 
% - 
% Local Variables:
% mode: outline-minor
% outline-regexp: "\\(. -+ \\)\\|\\\\part\\|\\\\section\\|\\\\subsection"
% coding: iso-8859-1
% tex-command: "pdflatex"
% tex-main-file: "corso.slides.tex"
% End: