[rt.cpan.org #125472] error with coderefs passes as scalar args

2018-07-02 Thread SJ Luo via RT
https://rt.cpan.org/Ticket/Display.html?id=125472 >

Hi,

I am trying to understand the content of the code disposal patches. So far I 
cannot fully make it out but I think it would be more efficient than the 
previous one. There are something I'd like to discuss:

1) The new version put document of originally internal function 
create_tcl_sub() as a new API. IMHO programmers should always use the form 
"$interp->call(...,WRITABLE=>$sub)" if they want code disposal to be handled 
automatically; otherwise, they could just apply original API CreateCommnd() - 
DeleteCommand() pair to handle code creation and disposal manually. Providing 
another create_tcl_sub() - _code_dispose() pair looks duplicating and 
confusing. Besides, user may find it difficult to provide DESCRNAME arg value.

2) The newest POD in github HEAD mentioned

$interp->call('fileevent','sock9827430','writable');

won't dispose the sub created from

$interp->call('fileevent','sock9827430', 'writable'=>sub{...});

is it still true? Or only 'set' command behaves in this way?

3) The POD mentioned two functions _code_destroy() and destroy_ref() which 
cannot be found in Tcl.pm. I guess you mean _code_dispose() and delete_ref(). 
IMO we just need to have delete_ref() in POD. Disclosing both of them might be 
confusing too.

Thanks,
SJ


[rt.cpan.org #125701] Use stub on FreeBSD

2018-06-28 Thread SJ Luo via RT
https://rt.cpan.org/Ticket/Display.html?id=125701 >

Hi,

   I've noticed changes on Makefile.PL recently.
   The commit 1492e disables usestubs on freebsd. However, the freebsd 
compilation error only occurred on v1.09 while it had no problem on v1.08. It 
should not be a problem of stub. This line 
https://github.com/gisle/tcl.pm/blob/7ef5e393ffaedcc0f12e8038ccf2ca583d11c74d/Makefile.PL#L110
 , where 'defined($arch)' is always true and tcl-core would be applied 
incorrectly on freebsd if usestub. In 1.08 Makefile.PL, 'defined($arch)' is 
false on freebsd.
   My suggested patch is as attached (also fix a warning on undefined 
$tclconfig)



diff --git a/Makefile.PL b/Makefile.PL
index 06262b3..7f518a9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -10,7 +10,7 @@ use Getopt::Long;
 use ExtUtils::MakeMaker;
 use Config;
 
-my $arch = "$^O";
+my $arch;
 my $stub = "tclstub8.4";
 
 # These need updating as more platforms are added to tcl-core/ area
@@ -24,7 +24,7 @@ if ($^O eq "MSWin32") {
 $arch = "$^O-x86" if ($Config{archname} =~ /86/);
 $arch = "$^O-sparc" if ($Config{archname} =~ /sun4/);
 } elsif ($^O eq "aix") {
-# $arch = "$^O";
+$arch = "$^O";
 } elsif ($^O eq "hpux") {
 $arch = "$^O-ia64" if ($Config{archname} =~ /ia64/i);
 $arch = "$^O-parisc" if ($Config{archname} =~ /pa-risc/i);
@@ -44,15 +44,13 @@ sub _die ($) {
 GetOptions(
"tclsh=s", \(my $tclsh='tclsh'),
"tclconfig=s", \ my $tclconfig,
-   "usestubs!",   \(my $usestubs = $^O =~ /^solaris|linux|hpux|darwin|cygwin|aix$/? 1 : 0),
+   "usestubs!",   \(my $usestubs = $^O =~ /^solaris|linux|hpux|darwin|cygwin|aix|freebsd|netbsd$/? 1 : 0),
 	# we prefer usestubs, but on windows default is to not use them, because
 	# stubs lib that come with AS TCL is impossible to link with GCC which 
 	# comes with strawberry perl; Have a ticket for this; (XXX) VKON 27-06-2018
 	#
-	# ... also freebsd, which have problems with stubs currently
-	# http://www.cpantesters.org/cpan/report/0bb213fc-7a55-11e8-8df7-db842dc43508
-	#
-	# ... but also any other $^O which we do not have in 'tcl-core' dir
+	# ... also any other $^O which we do not have in 'tcl-core' dir
+# except freebsd and netbsd
 	#
"library=s",   \ my $libpath,
"include=s",   \ my $incpath,
@@ -113,7 +111,7 @@ if (defined($libpath) && defined($incpath)) {
 $tclconfig = $tclcfg{'tclConfig.sh'};
 }
 
-if (!defined($tclconfig) && defined($arch) && $usestubs) {
+if (!$tclconfig && $arch && $usestubs) {
 	$incpath = "-Itcl-core/include";
 	$libpath = "-Ltcl-core/$arch -l$stub";
 	if ($^O eq 'darwin') {
@@ -178,7 +176,7 @@ if (defined($libpath) && defined($incpath)) {
 print "LIBS   = $libpath\n";
 print "INC= $incpath\n";
 print "DEFINE = $defs\n";
-print "tclConfig.sh = $tclconfig\n";
+print "tclConfig.sh = ", $tclconfig || "", "\n";
 
 if ($^O eq 'darwin') {
 # darwin has a broken ranlib that requires you to run it anytime


[rt.cpan.org #125597] Compilation problem applying Makefile.PL --tclconfig

2018-06-25 Thread SJ Luo via RT
https://rt.cpan.org/Ticket/Display.html?id=125597 >

Hi,

   My patch for Cygwin as well as needed libtclstub8.4.a are attached. It makes 
Cygwin build method much more like Linux: No longer forcing --telconfig and no 
tcl-devel package necessary to compile it.
   Note that the directory structure and names in tclstub84_cyg.tar.gz have to 
be kept.

   Though the stub lib is 8.4, they are well compiled on both 32/64bit Cygwin 
2.10 with tcl-8.6 pre-installed and passed all 'make test' items.

SJ

--- Tcl-1.05-UjbRn3/Makefile.PL	2016-06-29 00:48:16.0 +0800
+++ Tcl-1.05-SJ/Makefile.PL	2018-06-22 22:50:36.943227700 +0800
@@ -45,7 +45,8 @@
 $arch = "$^O-ia64" if ($Config{archname} =~ /ia64/i);
 $arch = "$^O-x86_64" if ($Config{archname} =~ /x86_64/);
 } elsif ($^O eq "cygwin") {
-$tclconfig = '/usr/lib/tclConfig.sh';
+$arch = "$^O-i686" if ($Config{archname} =~ /i\d86/);
+$arch = "$^O-x86_64" if ($Config{archname} =~ /x86_64/);
 }
 
 sub _die ($) {


tclstub84_cyg.tar.gz
Description: application/gzip


[rt.cpan.org #125597] Compilation problem applying Makefile.PL --tclconfig

2018-06-25 Thread SJ Luo via RT
https://rt.cpan.org/Ticket/Display.html?id=125597 >

I've checked the head branch on github. There is no problem compiling on my 
Cygwin with default configuration now. Thanks for the apply.

SJ