Takamoto has asked for the wisdom of the Perl Monks concerning the following question:
See UPDATE below:
I've been fighting for the last two days trying to link the (already installed) Tcl.pm module to another Tcl.dll . This is my machine:
Now, no Tcl/Tk is in the permanent Windows Path (and I do not want to have it), no other Tcl/Tk installation is on my machine, only the one above in C:/. I want Tcl.pm to link to this installation, independently to the Tcl installation Tcl.pm was linked to (visible) at the moment of installation. Plus, I do not want to modify permanently my Path. After reading posts everywhere, I was sure the following would work:
use strict; use warnings; BEGIN { print "Starting script on MSWIN\n"; my $pathTCL = "C:/Tcl/bin/tcl86.dll"; print "TCL: " . $pathTCL . "\n"; $ENV{'PERL_TCL_DL_PATH'} = $pathTCL;# showld be the same of: PERL_ +TCL_DLL } use Tcl;
Unfortunately, I get the following, which for me is quite strange...
Starting script on MSWIN TCL: C:/Tcl/bin/tcl86.dll NpLoadLibrary: could not find Tcl library at 'C:/Tcl/bin/tcl86.dll' at + C:/Strawberry/perl/lib/XSLoader.pm line 111. Failed to load Tcl dll! at C:/Strawberry/perl/lib/XSLoader.pm line 111 +. Unable to initialize Tcl at C:/Strawberry/perl/lib/XSLoader.pm line 11 +1. Compilation failed in require at .\wheel.pl line 11. BEGIN failed--compilation aborted at .\wheel.pl line 11.
UPDATE
This is a working solution, but I would like to hear from you if my approach is right. Adding the Tcl bin to $ENV{PATH} seems to make the Tcl installation visible to Tcl.pm. However, I am not a MS Windows man and I am not accustomed to manipulating $ENV in MS Windows, especially within a BEGIN. So, I am wondering if my hack will give me bad surprises (for example Perl is no more in $ENV after the Begin block). Any comment will be very much appreciated.
use warnings; use FindBin qw($Bin); BEGIN { print "Starting script on MSWIN \n"; print "My directory: $Bin\n"; my $pathTclDLL = $Bin . "\\tcltk2\\bin\\tcl86.dll"; my $pathTclBin = $Bin . "\\tcltk2\\bin"; print "TCL DLL: " . $pathTclDLL . "\n"; print "TCL BIN: " . $pathTclBin . "\n"; $ENV{PATH}=$pathTclBin; $ENV{'PERL_TCL_DL_PATH'} = $pathTclDLL; print "Printing ENV\n"; print my $path = $ENV{'PATH'}; } use Tcl;
|
|---|