Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Tk in Strawberry on W10

by gsd4me (Beadle)
on Mar 30, 2024 at 22:55 UTC ( [id://11158596]=perlquestion: print w/replies, xml ) Need Help??

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

My apologies if this seems to be old hat but frustration has now become annoying and an internet search has not come up with an appropriate solution:

I wrote a perl program 2 years ago that worked and did what it was told to/asked to do and it utilised:

use Tk

I am now trying to rerun this program but it fails at trying to 'find' Tk - sure enough the module is not in any of the libraries in the path. Why it is no longer there is for another frustrating investigation by Yours Truly

I have tried re-installing it using ppm, cpan, cpanm (with and without 'forcing') but there is always something that fails

It also seems that Tk is no longer the simple name for this module but it has a version number as part of the build

All I want is my simple TK module back so that my loyal program can fulfil its duties once more.

I am using Strawberry Perl, v5.38.0 on a 64 Windows 10 machine

Any guidance would be most gratefully received

ADB

Replies are listed 'Best First'.
Re: Tk in Strawberry on W10
by eyepopslikeamosquito (Archbishop) on Mar 31, 2024 at 04:12 UTC

    Though I've never used Tk, I stumbled upon a few references you might find useful:

    Update: You shouldn't be using perl v5.38.0 because it contains a security vulnerability, described at THREE new perl releases.

    👁️🍾👍🦟
      see especially this reply from syphilis, which describes a fix to the Tk C code in pTk/mTk/xlib/X11/X.h

      Thanks for locating that eyepopslikeamosquito - I think it's fucking deplorable that we still have to keep digging up this old stuff. (And I don't even use Tk.)
      The github repo (at least) should have been fixed by now, IMFO.
      Unfortunately, it's still broken.

      If I clone the current Tk version from github into Tk-20240331 ($ git clone https://github.com/eserte/perl-tk Tk-20240331), I still have to apply 2 fixes to that source.
      Firstly, I have to apply the patch at https://github.com/chrstphrchvz/perl-tk/commit/0cc1fd7c599fc6b7050fcd7442f10824b032c462.
      Then, in that very same X.h file that I've just patched, I need to replace the one occurrence of typedef unsigned long XID with typedef unsigned long long XID (at line 46).
      I made all of those changes by hand (cut'n'paste) - it's not such a big deal.
      That done, in Strawberry-5.38.2 I can just cd to that Tk-20240331 source directory and run "cpan .". (Ignore the error messages that are generated at the start - they're just in response to the configure probing that's being done.)
      The big deal is having to continually dig up these solutions because no-one can be bothered actually fixing the github source. (Of course, it's actually a new release of Tk that's needed.)

      Update: The above patch that replaces "long" with "long long" works fine on Windows, but the revised X.h would really be better rewritten as:
      $ diff -u X.h X.h_preferred --- X.h 2024-03-31 17:24:19.640385400 +1100 +++ X.h_preferred 2024-03-31 20:33:02.097334700 +1100 @@ -40,10 +40,8 @@ /* Resources */ -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN64) typedef __int64 XID; -#else -typedef unsigned long long XID; #endif
      $ diff -u X.h X.h_preferred --- X.h 2024-03-31 17:24:19.640385400 +1100 +++ X.h_preferred 2024-04-01 10:05:59.718400900 +1100 @@ -40,10 +40,10 @@ /* Resources */ -#if defined(_WIN64) && defined(_MSC_VER) +#if defined(_WIN64) typedef __int64 XID; #else -typedef unsigned long long XID; +typedef unsigned long XID; #endif typedef XID Window;
      Cheers,
      Rob
        https://ci.appveyor.com/project/eserte/perl-tk/builds/48445961, the AppVeyor build on the most recent commit, shows it building OK on Strawberry Perl?

        Is the problem you're describing captured in one of the open issues on there? When I asked Slaven for co-maint and a commit bit in the past (for GraphViz::Makefile), he was very receptive.

Re: Tk in Strawberry on W10
by GrandFather (Saint) on Mar 31, 2024 at 01:19 UTC

    I'm using Strawberry Perl 5.32 64 bit with Tk. It may be that is the highest version I tried while setting this machine up that seemed to work with Tk. Maybe I went with that version because the test matrix lists 5.32 as the highest Perl version with a pass for Tk on Win32.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re: Tk in Strawberry on W10
by gsd4me (Beadle) on Apr 06, 2024 at 18:05 UTC

    As I am not very au fait with the operational details of CPAN (and some of the more geeky details of perl) is there any way that I can access the Tk modules that are/were available but are now seemingly hidden to me? I am attempting to replace the Tk elements with those from PRIMA but I am running into operational problems withe those, but that is for another discussion elsewhere if I am forced down that route, depending upon any replies to this post

    The latest version seems to be Tk-804.036 but I would rather not go through all my written software changing the 'use' statements (is this what I would need to do?). Even the examples on the CPAN site are printed as saying "use Tk".

    Q: Can I download Tk-804.036 and rename the topmost directory to be "Tk" in the library in the path environment? Or is it far more complex than that?

    All I want is a simple life !!

    Again, guidance will be much appreciated

    regards ADB

      All I want is a simple life !! Again, guidance will be much appreciated

      While I strongly sympathize with your current lamentable installation problems, crafting quality GUIs is a complex art, requiring considerable skill and taste! It is not a simple life. A few examples from On Interfaces and APIs:

      • Adopt the user's perspective; provide natural mappings; communicate actions to user; provide feedback; prevent, detect and forgive errors
      • Cater for both novice and expert; for novice: easy-to-learn, discoverable, tips, help; for expert: efficiency, flexibility, shortcuts, customizability
      • Ask forgiveness, not permission; make all actions reversible; be polite, remember what the user entered last time
      • ... and many many more :-)

      In case it's of use to you, or a future monk, I've made a first attempt at cobbling together: GUI References. Suggestions for other useful GUI references welcome.

      👁️🍾👍🦟
      The latest version seems to be Tk-804.036

      Yes, and unfortunately it contains some C code that makes an assumption that is not supported by the C standards.
      That, and an (unlucky) windows-specific symbol clash, need to be fixed in the source before it can be built.
      If you like to tell me the first problem you have when trying to follow the approach I outlined in my previous post, then I'll work you through it.
      (You can ignore the "UPDATE" to that post if that's causing confusion - it's not needed to fix your issue.)
      Then, I'll work you through the next step that's causing difficulty... then the next ... and so on.

      Or is it far more complex than that?</i?

      Yes, it's not that simple - though I regard the workaround as "annoying" rather than "complex".

      Cheers,
      Rob
      > All I want is a simple life !!

      Buy a Mac and only use the applications it provides for you.

      Real life is never simple.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2025-07-12 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.