Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

readline_callback_handler_install(3) [php man page]

READLINE_CALLBACK_HANDLER_INSTALL(3)					 1				      READLINE_CALLBACK_HANDLER_INSTALL(3)

readline_callback_handler_install - Initializes the readline callback interface and terminal, prints the prompt and returns immediately

SYNOPSIS
bool readline_callback_handler_install (string $prompt, callable $callback) DESCRIPTION
Sets up a readline callback interface then prints $prompt and immediately returns. Calling this function twice without removing the previ- ous callback interface will automatically and conveniently overwrite the old interface. The callback feature is useful when combined with stream_select(3) as it allows interleaving of IO and user input, unlike readline(3). PARAMETERS
o $prompt - The prompt message. o $callback - The $callback function takes one parameter; the user input returned. RETURN VALUES
Returns TRUE on success or FALSE on failure. Example #1 Readline Callback Interface Example <?php function rl_callback($ret) { global $c, $prompting; echo "You entered: $ret "; $c++; if ($c > 10) { $prompting = false; readline_callback_handler_remove(); } else { readline_callback_handler_install("[$c] Enter something: ", 'rl_callback'); } } $c = 1; $prompting = true; readline_callback_handler_install("[$c] Enter something: ", 'rl_callback'); while ($prompting) { $w = NULL; $e = NULL; $n = stream_select($r = array(STDIN), $w, $e, null); if ($n && in_array(STDIN, $r)) { // read a character, will call the callback when a newline is entered readline_callback_read_char(); } } echo "Prompting disabled. All done. "; ?> readline_callback_handler_remove(3), readline_callback_read_char(3), stream_select(3). PHP Documentation Group READLINE_CALLBACK_HANDLER_INSTALL(3)

Check Out this Related Man Page

Agent::Tag::Callback(3pm)				User Contributed Perl Documentation				 Agent::Tag::Callback(3pm)

NAME
Log::Agent::Tag::Callback - a dynamic tag string SYNOPSIS
require Log::Agent::Tag::Callback; # Inherits from Log::Agent::Tag. my $tag = Log::Agent::Tag::Callback->make( -name => "session id", -callback => Callback->new($obj, 'method', @args), -postfix => 1, -separator => " -- ", ); DESCRIPTION
This class represents a dynamic tag string, whose value is determined by invoking a pre-determined callback, which is described by a "Callback" object. You need to make your application depend on the "Callback" module from CPAN if you make use of this tagging feature, since "Log::Agent" does not depend on it, on purpose (it does not really use it, it only offers an interface to plug it in). At least version 1.02 must be used. CREATION ROUTINE PARAMETERS
The following parameters are defined, in alphabetical order: "-callback" => "Callback" object The callback to invoke to determine the value of the tag. The call is protected via a busy flag, in case there is an unwanted recursion due to a call to one of the logging routines whilst within the callback. If the callback is busy, the tag emitted is: callback "user" busy assuming "user" is the name you supplied via "-name" for this tag. "-name" => name The name of this tag. Used to flag a callback as busy in case there is an unwanted recursion into the callback routine. "-postfix" => flag Whether tag should be placed after or before the log message. By default, it is prepended to the log message, i.e. this parameter is false. "-separator" => string The separation string between the tag and the log message. A single space by default. AUTHOR
Raphael Manfredi <Raphael_Manfredi@pobox.com> SEE ALSO
Callback(3), Log::Agent::Tag(3), Log::Agent::Message(3). perl v5.10.0 2002-03-09 Agent::Tag::Callback(3pm)
Man Page