I have some problem(s) with my curses::widgets script. I have maked a textfield and that was pritty easy but I want to read the value from that textfield. I don't know if I'm to locked up in the problem to see the solution, therefor I seek other knowledge to help me out. According to the manual I should get that value with "getField('VALUE')" but I'm maybe out of line, because it still isnt working and I've tried other methods too.

This is how I thought it should be:

use Curses; use Curses::Widgets; use Curses::Widgets::TextField; # Initialise the environment $mwh = new Curses; noecho(); halfdelay(5); $mwh->keypad(0); curs_set(0); $tf = Curses::Widgets::TextField->new({ CAPTION => 'login', CAPTIONCOL => 'yellow', COLUMNS => 10, MAXLENGTH => 255, #MASK => undef, VALUE => '', INPUTFUNC => \&scankey, FOREGROUND => 'black', BACKGROUND => 'green', BORDER => 1, BORDERCOL => 'red', FOCUSSWITCH => "\t\n", CURSORPOS => 0, TEXTSTART => 0, PASSWORD => 0, X => 1, Y => 1, READONLY => 0, }); $tf->draw($mwh, 0); $tf->execute($mwh); $login = $tf->getField('VALUE'); { END { endwin(); } exit 0; sub login { if ($login = ~ /test\b/) { # Do something } }


Any sugestions would be very helpfull because I'm stuck and as you can see I'm quite new into perl programming.
Thank you for your time reading it.

edited by ybiC: Replace <pre> tags with <code>, as per Monastery convention

Title edit by tye


In reply to curses::widgets problem by Warfy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.