Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: PerlMonks Editor

by parv (Parson)
on Nov 30, 2006 at 05:58 UTC ( [id://586876]=note: print w/replies, xml ) Need Help??


in reply to Re: PerlMonks Editor
in thread PerlMonks Editor

Running it w/ Tk 804.027 (x11-toolkits/p5-Tk port) & perl 5.8.8 on FreeBSD 6.x, spews (nothing else happens) ...

Unhandled flag 'F' used Unhandled flag 'F' used Unhandled flag 'P' used Unhandled flag 'B' used Unhandled flag 'F' used Unhandled flag 'U' used Unhandled flag 'B' used Unhandled flag 'F' used Unhandled flag 'B' used Unhandled flag 'B' used Unhandled flag 'F' used Unhandled flag 'B' used Unhandled flag 'B' used Unhandled flag 'B' used Unhandled flag 'B' used Unhandled flag 'B' used Unhandled flag 'B' used Unhandled flag 'F' used Unhandled flag 'F' used Unhandled flag 'I' used Unhandled flag 'B' used Unhandled flag 'P' used Unhandled flag 'B' used Unhandled flag 'R' used Unhandled flag 'F' used Unhandled flag 'B' used Unhandled flag 'F' used Unhandled flag 'F' used Unhandled flag 'F' used Unhandled flag 'F' used Unhandled flag 'F' used Unhandled flag 'B' used Unhandled flag 'F' used Unhandled flag 'L' usedline (32): Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'L' used Unhandled flag 'R' used Unhandled flag 'B' used Unhandled flag 'L' used Use of uninitialized value in string at PMEdit-001.000201-1.pl line 11 +46, <DATA> line 82. bad event type or keysym "_" at PMEdit-001.000201-1.pl line 268, <DATA +> line 82.

A few minutes later: Ok, the "uninitialized value" goes away if I delete the blank line at the end of __DATA__.

Replies are listed 'Best First'.
Re^3: PerlMonks Editor
by GrandFather (Saint) on Nov 30, 2006 at 09:18 UTC

    The line with whitespace on it (an empty line doesn't do it for me) is fairly trivial - but silly not to have found. Thanks for finding it for me!

    The other issue I should have fixed before uploading, but I sort of forgot about it. On investigation it could be more important than I'd thought and has now been fixed in my current version. It probably doesn't affect current functionality, but my test suite runs against a module version of the code so I've not run the combined version against the test suite to check.

    I'll upload an updated version to CPAN soon.

    Thanks for the help!

    Update: an updated version has been uploaded as http://cpan.perl.org/authors/id/G/GR/GRANDPA/PMEdit/PMEdit-001.000202-1.pl and should appear soonish at a mirror near you. ;)


    DWIM is Perl's answer to Gödel

      Hey, happy to help. But my helping you is not done yet. ;}

      Program stops after printing "bad event type" message .. .

      bad event type or keysym "_" at PMEdit-001.000202-1.pl line 269, <DATA +> line 81.
      ... but that goes away (and a Tk window emerges) if I change _ to one of [a-zA-Z0-9] but not [-+].

      Other minor problems ... (1) chomp fails to clear ^M in __DATA__ ...

      1057 sub LoadConfig { 1058 my $ok = 1; 1059 1060 while (<DATA>) { 1061 # Load the default configuration stuff 1062 chomp; 1063 next if ! length; ... 1067 my ($tag, $htmlTag, $name, $flagsField, @options) = split + /\s*,\s*/; 1068 1069 if (! defined $flagsField) { 1070 print "Missing entries in tag line ($.): $_"; ...
      ... which causes above print() to act; line numbers reported are 32 & 58.

      (2) Later in LoadConfig(), chomp() is rendered useless by use of s/\s+$//; ...

      1136 while (<DATA>) { 1137 # Load key binding information 1138 next if /^#/; 1139 1140 chomp; 1141 s/^\s+//; 1142 s/\s+$//;
      In both cases, I suggest just use s/\s+$// & chop the chomp().

      (3) There seems to spurious tab characters on lines 228, 769, 771-772, 774-775.

      diff -u output follows ...

        Again thank you! The first issue is related to different key binding support due either to OS differences or Tk version differences. I've now wrapped the troublesome code in an eval to trap the error and handle it in a rather friendlier manner.

        The ^M issue is a Windows/*nix line end issue I presume and I have used the fix you suggest - the two chomps are gone.

        I'm not sure where the tab characters came from, but they have now been removed.

        I'll sit on these changes for a day or two in case anything else comes to light. ;)


        DWIM is Perl's answer to Gödel

        Program stops after printing "bad event type" message .. .

        bad event type or keysym "_" at PMEdit-001.000202-1.pl line 269, <DATA> line 81.

        ... but that goes away (and a Tk window emerges) if I change _ to one of [a-zA-Z0-9] but not [-+].

        So after source diving, I found that the key symbol is being retrieved, in Tk-804.027/pTk/mTk/generic/tkBind.c:TkKeysymToString(), via XStringToKeysym(3X11) which uses X11/keysymdef.h which does not have any X_[-+_] entry but does have X_(underscore|plus|minus). Needless to say, after changing '_' in the underline key binding to 'underscore', Ctrl-_ worked as expected.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://586876]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-28 21:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found