NAME
Puppet::Log - Log window used by any puppet class
SYNOPSIS
use Puppet::Any ; use Data::Dumper ;
package myClass ;
@myClass::ISA=('Puppet::Any') ;
DESCRIPTION
This class defined a log facility usable by any class.
This log class will store all text passed to it. When no its display is not opened, the log text will be written on stdout. If a display is opened, the text display will be updated with the log text.
When the display is created it will feature all logs written since the creation of this object or since the clear method was called.
Methods
new(name,['whenNoDisplay' => 'print' | 'warn' ], [ help => ...] )
Creates the log object. 'name' is the log name.
The whenNoDisplay parameter specifies what to do when a log is sent to the object and the display is not opened (either print on STDOUT, warn on STDERR)
log(text,['whenNoDisplay' => 'print' | 'warn' ])
Will log the passed text
The whenNoDisplay parameter will supersede the parameter passed to the constructor.
clear()
Clear the logs
display(toplevel_ref | multi_manager_reference, [hidden] )
Will create the log display. The log display is in fact a Tk::Multi::Text window which can managed by a Tk::Multi::Manager object.
- toplevel_ref is the parent window object.
- multi_manager_reference is the Tk::Multi::Manager reference
- hidden : when hidden is 1, the log will not displayed on start-up. (default
is to show the log window)
If you don't provide a multi_manager reference, Puppet::Log will consider that you want the Log to appear in its own TopLevel window. So Log will create a new Toplevel window and create a menu manager in it. In this case, the menu will feature also a File->close button which will destroy the window. The display method can then be called later to recall the log window.
In any case Log returns the manager reference. You may reuse this reference to add another Log display in the Toplevel window that Log just created. (See the test.pl file if this not clear enough. Curiously enough I have some doubts regarding my explanations)
show()
Will raise the log window. Note that this function is ignored if its called before display().
AUTHOR
Dominique Dumont, Dominique_Dumont@grenoble.hp.com
SEE ALSO
perl(1), Tk(3), Tk::Multi::Text(3), Tk::Multi::Manager(3)