There are three major objects in Embperl: application, request and component.
Each of these objects can be used to get information about the processing and
control the execution. Each of these objects has a config sub-object, which makes
the configuration accessible and, where possible, changeable at runtime. The config
method of these three objects returns a reference to the configuration object. The methods
of these configurations objects are described in the section Configuration.
The request and the component object have addtionaly a parameter sub-object, which holds
parameters passed to the current request/component. The param method of these two
objects returns the parameter sub-object. The methods of these parameter objects
can be found in the section Parameters.
Addtionaly each of the three major objects has a set of own methods, which are described
here.
| Method: | | $application -> thread [read only] | | | Since: | | 2.0b6 | |
Returns a reference to a object which hold per threads information. There is only one
such object per thread.
| Method: | | $application -> curr_req [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the current request object i.e. the object of the
request currently running.
| Method: | | $application -> config [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the configuration object of the application. See section Configuration.
| Method: | | $application -> user_session [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the user session object.
| Method: | | $application -> state_session [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the state session object.
| Method: | | $application -> app_session [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the application session object.
| Method: | | $application -> udat [read only] | | | Since: | | 2.0b6 | |
Returns a reference to a hash which contains the data of the user session.
This has can be used to access and modify user session data. It's the same
as accessing the global %udat.
| Method: | | $application -> sdat [read only] | | | Since: | | 2.0b6 | |
Returns a reference to a hash which contains the data of the state session.
This has can be used to access and modify state session data. It's the same
as accessing the global %sdat.
| Method: | | $application -> mdat [read only] | | | Since: | | 2.0b6 | |
Returns a reference to a hash which contains the data of the application session.
This has can be used to access and modify application session data. It's the same
as accessing the global %mdat.
| Method: | | $application -> errors_count | | | Since: | | 2.0b6 | |
Contains the number of errors since last time send per mail. See also mail_errors_to.
| Method: | | $application -> errors_last_time | | | Since: | | 2.0b6 | |
Time when the last error has occurred. See also mail_errors_to.
| Method: | | $application -> errors_last_send_time | | | Since: | | 2.0b6 | |
Time when the last mail with error messages was sent. See also mail_errors_to.
| Method: | | $request -> apache_req [read only] | | | Since: | | 2.0b6 | |
Returns a reference to mod_perls Apache request object. In mod_perl 1 this is of
type Apache:: in mod_perl 2 it's a Apache2::RequestRec .
| Method: | | $request -> config [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the configuration object of the request. See section Configuration.
| Method: | | $request -> param [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the parameter object of the request. See section Parameters.
| Method: | | $request -> component [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the object of component currently running. See component methods below.
| Method: | | $request -> app [read only] | | | Since: | | 2.0b6 | |
Returns a reference to the object of application to which the current request belongs.
See application methods above.
| Method: | | $request -> thread [read only] | | | Since: | | 2.0b6 | |
Returns a reference to a object which hold per threads information. There is only one
such object per thread.
| Method: | | $request -> request_count [read only] | | | Since: | | 2.0b6 | |
Returns the number of request handled so far by this child process.
| Method: | | $request -> request_time [read only] | | | Since: | | 2.0b6 | |
Start time of the current request.
| Method: | | $request -> session_mgnt [read only] | | | Since: | | 2.0b6 | |
Set to true if session management is available.
| Method: | | $request -> session_id [read only] | | | Since: | | 2.0b6 | |
Combined id of current user and state session.
| Method: | | $request -> session_state_id [read only] | | | Since: | | 2.0b6 | |
Id of the current state session as received by the browser, this
means this method returns undef for a new session.
| Method: | | $request -> session_user_id [read only] | | | Since: | | 2.0b6 | |
Id of the current user session as received by the browser, this
means this method returns undef for a new session.
| Method: | | $request -> cookie_expires | | | Since: | | 2.1.1 | |
Can be used to retrieve the actual expiration date that Embperl uses for the cookie with the session id.
| Method: | | $request -> had_exit [read only] | | | Since: | | 2.0b6 | |
True if exit was called in one of the components processed so far.
| Method: | | $request -> log_file_start_pos [read only] | | | Since: | | 2.0b6 | |
File possition of the log file at the time when the request has started.
| Method: | | $request -> error | | | Since: | | 2.0b6 | |
True if there were any error during the request.
| Method: | | $request -> errors | | | Since: | | 2.0b6 | |
Reference to an array which holds all error messages occurred so far.
| Method: | | $request -> errdat1 | | | Since: | | 2.0b6 | |
Additional information passed to the error handler when an error is reported.
| Method: | | $request -> errdat2 | | | Since: | | 2.0b6 | |
Additional information passed to the error handler when an error is reported.
| Method: | | $request -> lastwarn | | | Since: | | 2.0b6 | |
Last warning message.
| Method: | | $request -> errobj | | | Since: | | 2.0rc3 | |
The object passed to the last die, if any.
This is useful when you pass an object to die inside an Execute. After the Execute you
can check $epreq -> errobj, to get the object. The object is also push to the array
passed to the errors parameter of Execute.
| Method: | | $request -> cleanup_vars | | | Since: | | 2.0b6 | |
Reference to an array which is filled with references to variables that should be
cleaned up after the request. You can add your own variables that needs cleanup here,
but you should never remove any variables from this array.
| Method: | | $request -> cleanup_packages | | | Since: | | 2.0b6 | |
Reference to a hash which contains all packages that must be cleaned up after the request.
| Method: | | $request -> initial_cwd [read only] | | | Since: | | 2.0b6 | |
Working directory when the request started.
| Method: | | $request -> messages | | | Since: | | 2.0b6 | |
Reference to an array of hashs of messages. This is used by Embperl to translate
message into different languages. When a [= =] block is processed or
$request -> gettext is called, Embperl searches this array. It starts from the first
element in the array (each element in the array must be a hashref) and tries to
lookup the text for the given symbol in hash. When it fails it goes to the
next array element. This way you can setup multiple translation tables that are search
for the symbol. Example: %messages =
(
'de' =>
{
'addsel1' => 'Klicken Sie auf die Kategorie zu der Sie etwas hinzufügen möchten:',
'addsel2' => 'oder fügen Sie eine neue Kategorie hinzu. Bitte geben Sie die Beschreibung in so vielen Sprachen wie Ihnen möglich ein.',
'addsel3' => 'Falls Sie die Übersetzung nicht wissen, lassen Sie das entsprechende Eingabefeld leer.',
'addsel4' => 'Kategorie hinzufügen',
},
'en' =>
{
'addsel1' => 'Click on the category for which you want to add a new item:',
'addsel2' => 'or add new category. Please enter the description in as much languages as possible.',
'addsel3' => 'If you don\'t know the translation leave the corresponding input field empty.',
'addsel4' => 'Add category',
}
) ; $lang = $request -> param -> language ;
push @{$request -> messages}, $messages{$lang} ;
push @{$request -> default_messages}, $messages{'en'} if ($lang ne 'en') ; $request - param -> language> retrieves the language as given by the browser
language-accept header (or set before in your program). Then it pushes the german
or english messages hash onto the message array. Addtionaly it pushes the english
messages on the default_messages array. Messages will be taken from this array
if nothing can be found in the messages array.
| Method: | | $request -> default_messages | | | Since: | | 2.0b6 | |
Reference to an array with default messages. Messages will be taken from this array
if nothing can be found in the messages array.
| Method: | | $component -> config [read only] | | | Since: | | 2.0b6 | |
Returns an reference to the configuration object of the component.
| Method: | | $component -> param [read only] | | | Since: | | 2.0b6 | |
Returns an reference to the parameter object of the component.
| Method: | | $component -> req_running [read only] | | | Since: | | 2.0b6 | |
True if Embperl is inside of the execution of the request.
| Method: | | $component -> sub_req [read only] | | | Since: | | 2.0b6 | |
True is this is not the outermost Embperl component, i.e. this component is
called from within another component.
| Method: | | $component -> inside_sub [read only] | | | Since: | | 2.0b6 | |
True is we are inside a Embperl subroutine ([$ sub $] ... [$ endsub $])
| Method: | | $component -> had_exit [read only] | | | Since: | | 2.0b6 | |
True if the exit was called during the excution of the component.
| Method: | | $component -> path_ndx [read only] | | | Since: | | 2.0b6 | |
Tells Embperl how much parts of the path should be ignored when searching
through the path.
| Method: | | $component -> cwd [read only] | | | Since: | | 2.0b6 | |
Directory of the source file of the component.
| Method: | | $component -> sourcefile [read only] | | | Since: | | 2.0b6 | |
Source file of the component.
| Method: | | $component -> syntax | | | Since: | | 2.0b6 | |
Syntax of the component
| Method: | | $component -> prev [read only] | | | Since: | | 2.0b6 | |
Previous component, e.g. the component which called this component.
| Method: | | $component -> import_stash [read only] | | | Since: | | 2.0b6 | |
While importing a component this is set to the stash to which symbols are imported.
undef during normal execution.
| Method: | | $component -> exports | | | Since: | | 2.0b6 | |
Symbols that should be exported by this component.
| Method: | | $component -> curr_package [read only] | | | Since: | | 2.0b6 | |
Name of the package the component is executed in.
| Method: | | $component -> code | | | Since: | | 2.0b6 | |
Only valid during compile phase. Can used to retrieve and modify the code
Embperl is generating. See Embperl::Syntax for more details and Embperl::Syntax::RTF
for an example.
|