ert weerr am Montag, 9. Oktober 2006 09:24:
> Guys,
Hello
> I'd like to write a perl-based tool that helps me to
> do my regular system monitoring tasks.
> It would be running in console mode but using
> 'windows' to list the command outputs.
>
> Curses::UI::TextEditor would be one of the elements
> that I use to present the output in a nice formatted
> way.
>
> It appears to me that its -text option is not
> accepting strings from a function but only static
> texts.
>
> Is there anyone here who already had to struggle with
> this module before?
>
> Sorry if it's an off-topic email here, I really don't
> know where to ask my question.
>
> Thanks in advance!
>
> Regards,
>
> John
>
> Here's an example:
>
> $w{202}->add(
> undef, 'TextEditor',
> -title => 'Disk space',
> -y => 0, -padright => 0, -border => 1,
> -padbottom => 0,
> -readonly => 1,
> -vscrollbar => 1,
> -hscrollbar => 1,
> -text => $text,
> );
>
> The variable $text has only a simple string value
> something like "This is a test...", but when I run the
> code the TextEditor only present '1'.
>
> If I try to use the function like this
>
> -text => \&fs_check,
>
> The the result is 'CODE(0x972e3c4)'
You assigned a reference to a subroutine, and it's address is correctly shown,
since the value of this attribute is not called by the code but displayed
literally.
You probably want to assign the result string of a call of the subroutine:
-text => fs_check(),
Does this help?
Dani
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>