Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

in linea

Domestico Codici sorgente E-Libri Trasferimenti dal sistema centrale verso i satelliti Metterseli in contatto con Circa noi

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting


Maneggiamento della lima del Perl

Previous Next





In Perl le lime sono date un nome, anche denominato maniglia. Tutti gli input ed uscita della lima è realizzato filehandling le funzioni. Filehandles è inoltre mezzi per comunicare da un programma ad un altro programma.


Come assegnare le maniglie

Un filehandle è niente di ma nome dati per le lime che intendete usare in vostri programmi e scritti del Perl. Una maniglia è un nome che temporarly è assegnato ad una lima. L'esempio sotto le esposizioni come utilizzare una maniglia della lima nel vostro programma del Perl.

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header
$FilePath = "home/html/myhtml.html"
sysopen(HANDLE, $FilePath, O_RDWR);
printf HANDLE "Welcome to Tizag!";
close (HANDLE);


Lime con la funzione del dado

La funzione del dado inoltre esiste in parecchi altri linguaggi di programmazione. È usata per uccidere i vostri scritti ed inoltre contribuisce a segnare where/if con esattezza che il vostro codice sta venendo a mancare. Usiamo questa funzione come come indicato sotto.

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header

$filepath = "htmlpage.html";

sysopen (HTML, '$filepath', O_RDWR|O_EXCL|O_CREAT, 0755) or die "$filepath cannot be opened.";
printf HTML "<html>\n";
printf HTML "<head>\n";
printf HTML "vtitle>My Home Page</title>";
printf HTML "</head>\n";
printf HTML "<body>\n";
printf HTML "<p align='center'>Here we have an HTML
page with a paragraph.</p>";
printf HTML "v/body>\n";
printf HTML "</html>\n";
close (HTML);

Se dovuto un certo Perl di problema non può aprirsi o generare la nostra lima, saremo informed. È buona pratica usare la funzione del dado e la useremo come andiamo più profondi nel maneggiamento della lima.


Come aprire la lima

Le lime possono essere aperte usando uno di aperto e sysopen la funzione. per della funzione può passare fino a 4 discussioni, la prima discussione è sempre la maniglia della lima, allora il nome di archivio anche conosciuto come un URL o del filepath, bandierine ed infine affatto dei permessi che devono essere assegnati alla lima. Il seguente programma apre un documento precedentemente conservato del HTML.

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header

$FH = "filehandle";
$FilePath = "htmlpage.html";

open(FH, $FilePath, permissions);
or
sysopen(FH, $FileName, permission);

Lime che stanno avendo nomi insoliti della lima o i caratteri speciali sono tutti il più bene aperti dichiarando il URL in primo luogo, come variabile. Questo metodo rimuove la confusione che potrebbe accadere quando il Perl prova ad interpretare il programma. Tuttavia, i nomi di schedario richiedono un punto per una breve sostituzione del carattere prima di cui possono essere disposti nelle dichiarazione aperte.


Vari permessi della lima

I permessi della lima sono cruciali alla funzione ed alla sicurezza della lima. Per esempio, per funzionare, una lima del Perl (.pl) deve avere permessi della lima eseguibile per funzionare sul vostro web server. Inoltre, non potete desiderare tutte le vostre lime del HTML essere regolato per permettere che altri scrivano loro o sopra loro. Qui è un elenco di che cosa da passare alla funzione aperta quando funzionare con la lima maneggia.

Shorthand Flags:

Entities Definition
< or r Read Only Access
> or w Creates, Writes, and Truncates
>>or a Writes, Appends, and Creates
+< or r+ Reads and Writes
+> or w+ Reads, Writes, Creates, and Truncates
+>> or a+ Reads, Writes, Appends, and Creates

O_ Flags:

Value Definition
O_RDWR Read and Write
O_RDONLY Read Only
O_WRONLY Write Only
O_CREAT Create the file
O_APPEND Append the file
O_TRUNC Truncate the file
O_EXCL Stops if file already exists
O_NONBLOCK Non-Blocking usability

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header
use Fcntl; #The Module

sysopen (HTML, '/home/html/htmlpage.html', O_RDWR|O_EXCL|O_CREAT, 0755);
sysopen (HTML, >htmlpage.html');


Archiviare la creazione

Le lime sono aperte e generato usando la stessa funzione “sysopen„. La nostra sintassi aperta (FILEHANDLE, “$filename„, permessi, CHMOD); o sysopen (FILEHANDLE, $filename, permessi, CHMOD);

#!/usr/bin/perl
use Fcntl; #The Module

print "content-type: text/html \n\n"; #The header
sysopen (HTML, 'myhtml.html', O_RDWR|O_EXCL|O_CREAT, 0755);
printf HTML "<html>\n";
printf HTML "<head>\n";
printf HTML "<title>My Home Page";
printf HTML "</head>\n";
printf HTML "<bodyv\n";
printf HTML "<p align='center'>Here we have an HTML
page with a paragraph.</p>";
printf HTML "</body>\n";
printf HTML "</html>\n";
close (HTML);

Con sysopen voi può anche regolare i priviledges esadecimali; Valori di CHMOD. Sysopen ha bisogno della dichiarazione di nuovo modulo per il Perl. Ora utilizzeremo il modulo di Fcntl.


Leggendo da una lima

È facile da leggere le linee dalle lime ed allora da immetterle che usando il <> dell'operatore dell'input. Disponendo l'alimentatore della lima all'interno dell'operatore dell'input, allora il vostro scritto immetterà quella linea della lima.

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header
$HTML = "htmlpage.html";
open (HTML) or die "Can't open the file!";
print <HTML>;
close (HTML);

Qui abbiamo un piccolo scritto del Perl per visualizzare parecchie linee del codice del HTML. Ogni linea è immagazzinata in un allineamento ed è stampata automaticamente al browser nella disposizione del HTML usando il <> dell'operatore dell'input.


Copy una lima

Usando la funzione della copia possiamo duplicare la lima. Il copy prende due discussioni, il URL della lima che necessità di essere copiato ed il URL di nuovi lima/indice a cui la lima deve essere copiata. Se lo stesso nome di archivio è usato o lo stesso URL, riscrittura del Perl sopra la lima se i permessi è permesso.

#!/usr/bin/perl
use File::Copy;

print "content-type: text/html \n\n"; #The header
$filetobecopied = "htmlpage.html.";
$newfile = "html/htmlpage.html.";
copy($filetobecopied, $newfile) or die "File cannot be copied.";

Qui, abbiamo duplicato semplicemente la lima “di htmlpage.html„ e la useremo negli esempi futuri. Mentre usando il Perl sul fotoricettore, è meglio usare il URL completo del Internet. Abbiamo usato un senso di shorthand nell'esempio, ma è migliore a hardcode il URL pieno come: http://www.vyom.co.in/htmlpage.html.


Spostamento delle lime

Lo spostamento della lima richiede l'uso della funzione “di movimento„. Questa funzione funziona similmente alla funzione della copia da suddetto e trasmettiamo lo stesso modulo al Perl. La differenza è qui è, anziché copiando noi appena “tagliati„ la lima e la trasmette ad una nuova posizione. Ciò che funziona è stessa del testo di incollatura e di taglio dal documento dell'ufficio ad un altro.

#!/usr/bin/perl
use File::Copy;

print "content-type: text/html \n\n"; #The header
$oldlocation = "htmlpage.html";
$newlocation = "html/htmlpage.html";
move($oldlocation, $newlocation);

La nostra lima ora completly è stata rimossa dalla relativa posizione attuale alla nuova posizione.


Cancellazione delle lime

Per cancellare le lime specifiche dal vostro web server usare “sconnettono„ la funzione. Il senso migliore è spesso regolare un nome variabile uguale al URL della lima che desiderate cancellare.

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header
$file = "newtext.txt";
if (unlink($file) == 0) {
print "File deleted successfully.";
} else {
print "File was not deleted.";
}


Rimuovendo le lime multiple immediatamente

Per rimuovere le lime multiple immediatamente, dovremmo in primo luogo generare un allineamento delle lime che deve essere cancellato ed allora collegare con ogni. Ci sono molti altri sensi andare circa questo processo.

#!/usr/bin/perl

print "content-type: text/html \n\n"; #The header
@files = ("newtext.txt","moretext.txt","yetmoretext.txt");
foreach $file (@files) {
unlink($file);
}





Previous Next

Keywords:perl tutorial, perl scripts, perl programming, active perl, perl download, blackberry perl, perl regular expressions, perl split, perl array, perl script page


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizes
Oracle Quiz
MySQL Quiz
Operating System Quizes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizes
Testing Quiz
Firewalls Quiz
SAP Module Quizes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizes
Corba Quiz
Networking Quiz
Microsoft Office Quizes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizes
Financial Accounting Quiz
Managerial Accounting Quiz

Privacy Policy
Copyright © 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.