[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/lib/5.10.0/pod/ -> perlcall.pod (summary)

(no description)

File Size: 1937 lines (55 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

actually:: (3 methods):
  that()
  required()
  with()


Interface: actually  - X-Ref

that(would like is to be able to specify a Perl subroutine that will becalled instead.=item * An Event Driven ProgramThe classic example of where callbacks are used is when writing anevent driven program like for an X windows application. In this caseyou register functions to be called whenever specific events occur,e.g., a mouse button is pressed, the cursor moves into a window or amenu item is selected.=backAlthough the techniques described here are applicable when embeddingPerl in a C program, this is not the primary goal of this document.There are other details that must be considered and are specific toembedding Perl. For details on embedding Perl in C refer toL<perlembed>.Before you launch yourself head first into the rest of this document,it would be a good idea to have read the following two documents -L<perlxs> and L<perlguts>.=head1 THE CALL_ FUNCTIONSAlthough this stuff is easier to explain using examples, you first needbe aware of a few important definitions.Perl has a number of C functions that allow you to call Perlsubroutines. They areI32 call_sv(SV* sv, I32 flags)   X-Ref
No description

required(static voidcall_Adder(a, b)   X-Ref
No description

with(Say for example you want to interface to a library which allows asynchronousfile i/o. In this case you may be able to register a callback whenevera read operation has completed. To be of any use we want to be able tocall separate Perl subroutines for each file that is opened. As itstands, the error handler example above would not be adequate as itallows only a single callback to be defined at any time. What werequire is a means of storing the mapping between the opened file andthe Perl subroutine we want to be called for that file.Say the i/o library has a function C<asynch_read> which associates a Cfunction C<ProcessRead> with a file handle C<fh>--this assumes that ithas also provided some routine to open the file and so obtain the filehandle.asynch_read(fh, ProcessRead)   X-Ref
No description



Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1