Perl verständniss beim Perl

Tron36

Ensign
Registriert
Jan. 2011
Beiträge
212
Hallo Leute,
ich bin gerade dabei ein perl-Skript nachzuvollziehen:
URL zum Perl-Skript

Auf Zeile 80 steht,
Code:
my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];

Was macht es?
Ich hoffe ihr könnt mir weiter helfen.

Viele Grüße
Tron36
 
http://www.perl.com/pub/2001/01/poe.html

The Kernel
POE's kernel is much like an operating system's kernel: it keeps track of all your processes and data behind the scenes, and schedules when each piece of your code gets to run. You can use the kernel to set alarms for your POE processes, queue up states that you want to run, and perform various other low-level services, but most of the time you don't interact with it directly.
Sessions
Sessions are the POE equivalent to processes in a real operating system. A session is just a POE program which switches from state to state as it runs. It can create ``child'' sessions, send POE events to other sessions, and so on. Each session can store session-specific data in a hash called the heap, which is accessible from every state in that session.

POE has a very simple cooperative multitasking model; every session executes in the same OS process without threads or forking. For this reason, you should beware of using blocking system calls in POE programs.

Those are the basic pieces of the Perl Object Environment, although there are a few slightly more advanced parts that we ought to explain before we go on to the actual code:

So was kann man ganz leicht selbst googlen. ;)
 
@_ ist das Array der Funktionsparameter der aktuellen Funktion. KERNEL, HEAP, SESSION sind irgendwo definierte Konstanten mit Indexwerten, wahrscheinlich: 0, 1, 2. Es werden drei lokale Variablen $kernel, $heap und $session definiert und Werte aus @_ zugewiesen.
 
Tron36 schrieb:
Auf Zeile 80 steht,
Code:
my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];

*würg*, nichts gegen Perl (ich arbeite häufig mit der Sprache und komme eigentlich auch gut mit ihr zurecht), aber solche Sachen bringen mich jedes Mal zum Kotzen. Die Sprache kommt mir häufig wie ein Wetteifern nach der verworrensten und dämlichst-möglichen Syntax vor.
 
Zurück
Oben