Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, Trying to run socket program and have server side going but when trying to run client I get the following:
unknown28cfdaf0e790:desktop James$ perl test.txt Retreiving Config File... unknown option "text" at /Library/Perl/5.12/darwin-thread-multi-2level +/Tk/Widget.pm line 205. at test.txt line 235

Am I missing some tk files....why does it reference /Library/Perl/5.12/darwin-thread-multi-2level/Tk/Widget.pm ...

Thanks, James

Replies are listed 'Best First'.
Re: Simple error
by NetWallah (Canon) on Jun 12, 2012 at 23:58 UTC
    Your files and installation seem fine.

    It is complaining about line 235 in test.txt.

    That line apparently calls a function in Tk::Widget, passing "text".
    The function in Tk::Widget is upset by that, and rejects it.

                 I hope life isn't a big joke, because I don't get it.
                       -SNL

      Could you suggest a fix, greatly appreciated. I am not sure how to adapt versions as my skills are young. Looking forward to critiques after fix:

        Jshelton31:

        It complained about unknown option "text". When I looked at the Tk docs (I've not played with it before), I noticed they frequently prefix hyphen on the options. When I looked your code over, I saw that in most places, there were hyphen prefixes. So I added a few hyphens, and the code brought up a window. There were two "text" options needing a hyphen, and a "width" and "height".

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

        Jshelton31: Welcome to the Monastery.

        The recommended max length for posted code is something on the order of 15-20 lines (with the provisos that

        • The code posted is compilable (passes perl -c script.pl), executable, and produces the same result with which you're dissatisfied
          and
        • When necessary, the posted code may be an adaption of a single small part of a larger program

        TTBOMK, NodeReaper has never thrown a violator into the catacombs... permanently, that is. On the other hand, however, some Monks -- this one specifically included -- will not invest hours to solve a problem presented with some 1278 lines of code. Fifteen or twenty lines, yes; on a good day, maybe even more. But not 1278.

        So, if you can, create a snippet illustrating the problem. And if the problem is so recalcitrant that you can't demonstrate it in 15 or 20 lines, read Markup in the Monastery, with special attention to the <readmore> tag set.

        Explanation of anonymous monk's post:

        grep -n "(text" test-tk2.pl 153: $left_frame->Label(text => "Perl Chat Client v$VERSION") 172: $right_frame->Label(text => 'Buddies')
        This shows two places where you have used "text" instead of "-text".

        Adding the "-" should solve your problem.

        Update: Just noticed that roboticus beat me to the punch.

                     I hope life isn't a big joke, because I don't get it.
                           -SNL