background preloader

Perl

Facebook Twitter

WWW::Mechanize. WWW::Mechanize - Handy web browsing in a Perl object Version 1.70 WWW::Mechanize, or Mech for short, is a Perl module for stateful programmatic web browsing, used for automating interaction with websites. Features include: All HTTP methods High-level hyperlink and HTML form support, without having to parse HTML yourself SSL support Automatic cookies Custom HTTP headers Automatic handling of redirections Proxies HTTP authentication Mech supports performing a sequence of page fetches including following links and submitting forms.

Use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get( $url ); $mech->follow_link( n => 3 ); $mech->follow_link( text_regex => qr/download this/i ); $mech->follow_link( url => ' ); $mech->submit_form( form_number => 3, fields => { username => 'mungo', password => 'lost-and-alone', } ); $mech->submit_form( form_name => 'search', fields => { query => 'pot of gold', }, button => 'Search Now' ); $mech->back(); new() $mech->get( $uri ) RemOcular - your eyes in the cloud. Demo | README | Download | GIT Hub remOcular provides a AJAX web interface to Unix command line tools like traceroute, top, mpstat, ... The tools are integrated via a plug-in interface. remOcular comes with plugins for top - process listmpstat - processors related statisticstraceroute - packets trace to network hostdf - disk free ... and many more. remOcular can be easily enhanced to support additional tools.

Open Source Software by OETIKER+PARTNER AG. Perl-Scripts : Übersicht | Die Community für Perl PHP CGI Apache MySQL und Web-Programmierung. Rosetta Code. Perl Regular Expressions. Troubleshooters.Com and Code Corner Present Copyright (C) 1998-2001 by Steve Litt Without regular expressions, Perl would be a fast development environment. Probably a little faster than VB for console apps. With the addition of regular expressions, Perl exceeds other RAD environments five to twenty-fold in the hands of an experienced practitioner, on console apps whose problem domains include parsing (and that's a heck of a lot of them). Regular expressions is a HUGE area of knowledge, bordering on an art. Rather than regurgitate the contents of the Perl documentation or the plethora of Perl books at your local bookstore, this page will attempt to give you the 10% of regular expressions you'll use 90% of the time. Note that for this reason we assume all strings to be single-line strings containing no newline chars.

Simple String Comparisons The most basic string comparison is $string =~ m/sought_text/; $string =~ m/^sought_text/; Similarly, the $ operator indicates "end of string". . . Ississ. Datei Ein/Ausgabe Verzeichnis open read write STDOUT STDIN print sysopen sysread syswrite. 13.1. Datei Ein/Ausgabe Was bringt einem die beste Programmiersprache, wenn man keine Daten Speichern oder wieder Laden kann. Bevor Sie nun aus einer Datei lesen oder schreiben, müssen Sie diese erst mal öffnen. Hierzu verwenden man das in C schon bekannte Schlüsselwort open. Hier ist der Syntax von open ... open(HANDLE, "modus $DATEINAME"); Hiermit öffnen Sie eine Datei Namens $DATEINAME mit dem Modus modus. Open(HANDLE, "datei"); Datei zum Lesen öffnen open(HANDLE, "< datei"); Datei zum Lesen öffnen, existiert diese nicht scheitert die Funkion open(HANDLE, "+< datei"); Datei zum Lesen und Schreiben öffnen open(HANDLE, "> datei"); Datei zum Schreiben öffnen, falls nicht vorhanden wird diese erzeugt open(HANDLE, ">> datei"); Datei öffnen zum Anhängen, falls nicht vorhanden wird diese erzeugt open(HANDLE, "< $file") or die "\nKonnte Datei $file nicht zum Lesen öffnen\n"; Mit dem folgendem Skript können Sie aus einer Datei lesen ... #!

#! Print STDOUT $variable; printf STDOUT "$variable"; #! #! Arrays. Arrays are a special type of variable that store list style data types. Each object of the list is termed an element and elements can either be a string, a number, or any type of scalar data including another variable. Place an array into a PERL script, using the at symbol (@). perlarrays.pl: #!

/usr/bin/perl print "content-type: text/html \n\n"; #HTTP HEADER # DEFINE AN ARRAY @coins = ("Quarter","Dime","Nickel"); # PRINT THE ARRAY print "@coins"; print "<br />"; print @coins; Check the syntax here. Each element of the array can be indexed using a scalar version of the same array. Arrayindexing.pl: #! Quarter Dime Nickel Quarter Dime Nickel Elements can also be indexed backwards using negative integers instead of positive numbers. arrayindexing2.pl: #! Quarter Dime Nickel Quarter Nickel Dime Quotations can be a hassle, especially if the array you wish to build has more than 5 elements. PERL Code: #! Display: Quarter Dime Nickel PERL offers a shortcut for sequential numbers and letters. . #! #! #! #! #! #! #! The CPAN Search Site. Perl programming documentation. Perl Regex Interactive Tutorial. CGI Programming 101: Chapter 1: Getting Started.

Our programming language of choice for this book is Perl. Perl is a simple, easy to learn language, yet powerful enough to accomplish very difficult and complex tasks. It is widely available, and is probably already installed on your Unix server. You don't need to compile your Perl programs; you simply write your code, save the file, and run it (or have the web server run it). The program itself is a simple text file; the Perl interpreter does all the work. The advantage to this is you can move your program with little or no changes to any machine with a Perl interpreter.

The disadvantage is you won't discover any bugs in your program until you run it. You can write and edit your CGI programs (which are often called scripts) either on your local machine or in the Unix shell. You can also use a text editor on your local machine and upload the finished programs to the web server. If you use a text editor, be sure to turn off special characters such as "smartquotes. " chmod 755 filename #!

#!