[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Paragraph about exit codes in scripts-perl/xchatdox2.html



Current paragraph about exit codes in
scripts-perl/xchatdox2.html:
----------------------------------------
Exit Codes
These are very important.  Every time you set up a handler, it
takes precedent over the built-in functions and commands of
X-Chat.  That is, whatever thing which triggered your subroutine
will go to your code before it goes to X-Chat to be dealt with.
In this way you can replace almost every built-in function that
the client has with your own routines.  The thing to remember is
that if your code exits by hitting the end of your subroutine, or
by a plain 'return' statement, processing of the event will go on
to whatever other things have set up hooks for the event, and
then (provided nothing else exits with a return value of 1) to
X-Chat itself.  There is only one problem with this, (which is
solved by the brokering handler that I'll explain that later) and
that is that you cannot really control what order the custom
routines get called.  Normally they will execute in order of
which ones were installed first,but a single script has no real
way of knowing this.  Beware.
----------------------------------------


This should be changed to something like this:
----------------------------------------
Exit Codes
You handlers will be called before built-in functions and
commands of X-Chat. If the exit code is 0 then all following
registered handlers will be called. X-Chat's built-in functions
and commands are called, when non of the registered handlers
returns an exit code different from 0.
Beware of unwanted exit codes! "The return value of the
subroutine is the value of the last expression evaluated.
Alternatively, a return statement may be used to exit the
subroutine, optionally specifying the returned value, ..."
(perldoc perlsub)
You can't control the order of execution of your registered
handlers.

        Summary:
                exit code 0     ==> following handling allowed
                exit code not 0 ==> your handler is the last
                                    routine which handles the
                                    registered event
                You can't control order of execution.
                Return value is last expression of handler.
                Better use return.
----------------------------------------

English isn't my native language. Feel free to correct me.




***Stefan

-- 
## Stefan Scholl <stesch@linux.de> ## SS10115-RIPE ##
-
XChat-discuss: mailing list for XChat users
Archive:       http://mail.nl.linux.org/xchat-discuss/
Posted By:     Stefan Scholl <stefan.scholl@web.de>