Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

on-line

Haupt Quellenprogramme E-Bücher Downloads Mit uns in Verbindung treten Über uns

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


PERL File Behandlung


Previous Next





In Perl werden Files einen Namen gegeben, auch genannt Handgriff. Aller Eingang und Ausgang der File wird erzielt, indem man Funktionen filehandling. Filehandles sind auch Mittel, von einem Programm zu einem anderen Programm in Verbindung zu stehen.


Wie man Handgriffe zuweist

Ein filehandle ist nichts aber Name, die für die Files gegeben werden, die du beabsichtigst, in deinen den Perl Programmen und Indexen zu benutzen. Ein Handgriff ist ein Name, der temporarly einer File zugeordnet wird. Das Beispiel unterhalb der Erscheinen, wie man einen File Handgriff in deinem Perl Programm benutzt.

#!/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);


Files mit der Würfel Funktion

Die Würfelfunktion besteht auch in einigen anderen Programmiersprachen. Sie wird verwendet, um deine Indexe zu töten und hilft auch, where/if festzulegen, das dein Code verläßt. Wir verwenden diese Funktion als wie gezeigt unten.

#!/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);

Wenn wegen irgendeines Problem Perl, ist nicht imstande sich zu öffnen, oder, unsere File herzustellen, sind wir informiert. Es ist gutes üblich, die Würfelfunktion zu gebrauchen und wir werden sie verwenden, wie wir in die File Behandlung tiefer gehen.


Wie man die File öffnet

Files können mit irgendeinem von geöffnetem geöffnet werden und sysopen Funktion. entweder für von der Funktion bis zu 4 Argumenten überschreiten, kann das erste Argument ist immer der File Handgriff, dann der Dateiname alias ein URL oder vom filepath, Markierungsfahnen und schließlich irgendwelche der Erlaubnis, die der File bewilligt werden sollen. Das folgende Programm erschließen ein vorher gespeichertes HTML Dokument.

#!/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);

Files, die ungewöhnliche File Namen haben, oder Sonderzeichen alle sind gut, die durch das URL zuerst erklären geöffnet sind, als Variable. Diese Methode entfernt das Durcheinander, das auftreten konnte, wenn Perl versucht, das Programm zu deuten. Jedoch erfordern Dateinamen einen Schritt für einen kurzen Buchstabe Ersatz, vor dem sie in die Dateieröffnungsanweisungen gesetzt werden können.


Verschiedene File Erlaubnis

File Erlaubnis ist zur File Funktion und der Sicherheit entscheidend. Zum Beispiel um zu arbeiten, muß eine Perl File (.pl) vollziehbare File Erlaubnis haben, zwecks auf deinem web server zu arbeiten. Auch du kannst nicht alle deine HTML Files eingestellt werden wünschen, um andere oder über sie schreiben ihnen zu lassen. Ist hier eine Auflistung von was, zur geöffneten Funktion, wenn das Arbeiten zu überschreiten mit File anfaßt.

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');


File Creation

Files are opened and created using the same function "sysopen". Our syntax open(FILEHANDLE, '$filename', permissions, CHMOD); or sysopen(FILEHANDLE, $filename, permissions, 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);

Mit dich sysopen kann hexadezimale priviledges auch einstellen; CHMOD Werte. Sysopen benötigt die Erklärung eines neuen Moduls für Perl. Wir werden jetzt das Fcntl Modul benutzen.


Ablesen von einer File

Es ist einfach, Linien von den Files zu lesen und sie dann einzugeben das Eingang Operator <> verwendend. Indem er die File Zufuhr innerhalb des Eingang Operators, dann setzt, gibt dein Index diese Linie der File. ein.

#!/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);

Hier haben wir einen kleinen Perl Index, zum einiger Linien des HTML Codes anzuzeigen. Jede Linie wird in eine Reihe gespeichert und sie wird automatisch zur Datenbanksuchroutine im HTML Format mit dem Eingang Operator <> gedruckt.


Copy eine File

Mit der Kopie Funktion können wir die File kopieren. Copy nimmt zwei Argumente, das URL der File, die Notwendigkeiten kopiert zu werden und das URL der neuen File/des Verzeichnisses, zu denen die File kopiert werden soll. Wenn der gleiche Dateiname oder das gleiche URL verwendet wird, Perl Neufassung über der File, wenn Erlaubnis erlaubt wird.

#!/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.";

Hier haben wir einfach die „htmlpage.html“ File kopiert und werden sie in den zukünftigen Beispielen benutzen. Beim Verwenden von Perl auf dem Netz, ist sie am besten, das komplette Internet URL zu benutzen. Wir haben eine Stenographieweise im Beispiel verwendet, aber es ist zum hardcode das volle URL wie besser: http://www.vyom.co.in/htmlpage.html.


Verschieben der Files

Das Verschieben der File erfordert den Gebrauch von der „Bewegung“ Funktion. Diese Funktion arbeitet ähnlich zur Kopie Funktion von oben genanntem und wir schicken das gleiche Modul zu Perl. Der Unterschied ist hier ist, anstelle von kopierend uns „gerade geschnitten“ der File und schickt sie zu einer neuen Position. Arbeitendes dieses ist selbe wie Ausschnitt und klebender Text vom Bürodokument zu anderen.

#!/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);

Unsere File ist jetzt completly von seiner anwesenden Position zur neuen Position entfernt worden.


Löschen der Files

Um spezifische Files aus deinem web server zu löschen verwenden „lösen“ Funktion. Die beste Weise ist häufig, einen variablen Namen gleich einzustellen URL der File, die du löschen möchtest.

#!/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.";
}


Mehrfache Files sofort entfernen

Um mehrfache Files sofort zu entfernen, sollten wir eine Reihe Files zuerst herstellen die gelöscht werden und durch jede dann sich schlingen muß. Es gibt viele andere Weisen, über diesen Prozeß zu gehen.

#!/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.