On Mon, Aug 17, 2015 at 11:56:51AM +0100, Gavin Smith wrote:
> On 17 August 2015 at 11:33, Patrice Dumas <pertu...@free.fr> wrote:
> 
> I think I've seen something like this error before, due to the version
> being "6.0dev" instead of "6.0".

Ok, this was it.

> We don't need to worry about that test failure - it hasn't been used
> for a long time, since I was trying to get XS to work in the first
> place.

Ok.  Here is an updated patch with a new simple test for XSParagraph.
It doesn't work, it cannot find XSParagraph::new.  I tried to show the
methods, but none showed up...

> > Is this a possibility to build a standalone module worth more investigation?
> 
> I'll have a look at the patch you posted. I have to say I don't care
> if building a standalone XS module works. I only care that it can be
> used from texi2any, which is difficult enough as it is. I've no
> interest in maintaining two build systems in parallel: just one of
> them causes enough problems. A standalone pure Perl module is more
> plausible.

Ok.  Since there are fallbacks on the pure perl module, I guess this
would be best to always fall back on pure perl if in the standalone perl
module, and not try to use the XS version in that case.  however, if you
don't want to maintain the standalone perl module, then maybe it could
simply be removed.

-- 
Pat
Index: t/XSParagraph.t
===================================================================
--- t/XSParagraph.t     (révision 6530)
+++ t/XSParagraph.t     (copie de travail)
@@ -16,13 +16,16 @@
 # Insert your test code below, the Test::More module is use()ed here so read
 # its man page ( perldoc Test::More ) for help writing this test script.
 
-my $paragraph;
-$paragraph = {'word' => 'hello world', 'end_sentence' => 0};
+use XSParagraph;
 
-print STDERR "Perl: here 1\n";
-XSParagraph::set_state ($paragraph);
-print STDERR "Perl: here 2\n";
-XSParagraph::get_state ($paragraph);
-print STDERR "In Perl: word set is ", $paragraph->{'word'}, "\n";
-print STDERR "In Perl: end_sentence is ", $paragraph->{'end_sentence'}, "\n";
+#no strict 'refs';
+#my @methods = grep { defined &{$_} } keys %XSParagraph::;
+#use strict 'refs';
+#print STDERR "METHODS: @methods\n"; 
 
+my $paragraph = XSParagraph::new();
+
+my $text = $paragraph->add_text("Some text.");
+$text .=  $paragraph->end();
+
+print STDERR "$text";
Index: XSParagraph.pm
===================================================================
--- XSParagraph.pm      (révision 6530)
+++ XSParagraph.pm      (copie de travail)
@@ -105,6 +105,14 @@
   goto FALLBACK;
 }
 
+my $dlname = undef;
+if ($TEXINFO_XS eq 'module') {
+  $dlname = "XSParagraph.so";
+  push @DynaLoader::dl_library_path, "./blib/arch/auto/XSParagraph/";
+  $TEXINFO_XS = 'debug';
+  goto LOAD;
+}
+
 my ($libtool_dir, $libtool_archive) = _find_file("XSParagraph.la");
 if (!$libtool_archive) {
   _fatal "XSParagraph: couldn't find Libtool archive file";
@@ -119,7 +127,6 @@
 }
 
 # Look for the line in XSParagraph.la giving the name of the loadable object.
-my $dlname = undef;
 while (my $line = <$fh>) {
   if ($line =~ /^\s*dlname\s*=\s*'([^']+)'\s$/) {
     $dlname = $1;
@@ -135,6 +142,8 @@
 push @DynaLoader::dl_library_path, $libtool_dir;
 push @DynaLoader::dl_library_path, "$libtool_dir/.libs";
 
+LOAD:
+
 my $dlpath = DynaLoader::dl_findfile($dlname);
 if (!$dlpath) {
   _fatal "XSParagraph: couldn't find $dlname";
Index: Makefile.PL
===================================================================
--- Makefile.PL (révision 6530)
+++ Makefile.PL (copie de travail)
@@ -4,17 +4,16 @@
 # the contents of the Makefile that is written.
 WriteMakefile(
     NAME              => 'XSParagraph',
-    VERSION_FROM      => 'lib/XSParagraph.pm', # finds $VERSION
+    VERSION_FROM      => 'XSParagraph.pm', # finds $VERSION
     PREREQ_PM         => {}, # e.g., Module::Name => 1.1
     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
-      (ABSTRACT_FROM  => 'lib/XSParagraph.pm', # retrieve abstract from module
-       AUTHOR         => 'A. U. Thor <g...@slackware.lan>') : ()),
+      (AUTHOR         => 'Gavin Smith  <gavinsmith0...@gmail.com>') : ()),
     LIBS              => [''], # e.g., '-lm'
     DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
     INC               => '-I.', # e.g., '-I. -I/usr/include/other'
        # Un-comment this if you add C files to link with later:
-    # OBJECT            => '$(O_FILES)', # link all the C files too
-    'MYEXTLIB' => 'mylib/libxspara.a',
+    OBJECT            => '$(O_FILES)', # link all the C files too
+    #'MYEXTLIB' => 'mylib/libxspara.a',
 );
 
 sub MY::postable {

Reply via email to