Re: Library: EasyXS

2022-04-06 Thread Shlomi Fish
Hi Felipe!

On Tue, 5 Apr 2022 11:22:07 -0400
Felipe Gasper  wrote:

> Hi all,
> 
>   I’ve cobbled together a bunch of tools I often need in XS modules
> here:
> 
> https://github.com/FGasper/easyxs
> 
>   This includes, for example:
> 
> - the standard XS #include directives
> - ppport.h
> - a fix for the deluge of warnings from new clangs
> - simple interfaces to call Perl from C
> 
> … and more.
> 
>   See what you think.
> 

Looks nifty, starred and bookmarked. I suggest having tests and CI though:

https://github.com/shlomif/Freenode-programming-channel-FAQ/blob/master/FAQ_with_ToC__generated.md#what-are-some-best-practices-in-programming-that-i-should-adopt

> cheers,
> -Felipe



-- 

Shlomi Fish   https://www.shlomifish.org/
Selina Mandrake - The Slayer (Buffy parody) - https://shlom.in/selina

Monologue: one person talking to himself.
Dialogue: two persons talking to themselves.
— Shaike Ophir: https://www.youtube.com/watch?v=2bpVrKm9QCc

Please reply to list if it's a mailing list post - https://shlom.in/reply .


Help needed getting the eperl reduced testcase to pass on appveyor/win64/cygwin64/cmake

2018-09-21 Thread Shlomi Fish
Hi all!

Help needed getting the ePerl reduced testcase to pass on
appveyor/win64/cygwin64/cmake .

See:

* https://github.com/thewml/website-meta-language/tree/reduce-appveyor-error
(note the branch)

* https://ci.appveyor.com/project/shlomif/website-meta-language

I reduced it as much as I could and still get 

<<<
";
--end--
Perl parsing error (interpreter rc=9) error=
#   Failed test 'generic system wml'
#   at t/03-p3_eperl.t line 12.
#   Failed test 'generic cmp'
#   at t/03-p3_eperl.t line 29.
#  got: ''
# expected: 'foo
# '
# Looks like 
>>>

any insights will be appreciated.

Code is under https://en.wikipedia.org/wiki/GNU_General_Public_License v2+.


Help needed getting the eperl reduced testcase to pass on appveyor/win64/cygwin64/cmake

2018-09-21 Thread Shlomi Fish
Hi all!

Help needed getting the ePerl reduced testcase to pass on
appveyor/win64/cygwin64/cmake .

See:

* https://github.com/thewml/website-meta-language/tree/reduce-appveyor-error
(note the branch)

* https://ci.appveyor.com/project/shlomif/website-meta-language

I reduced it as much as I could and still get 

<<<
";
--end--
Perl parsing error (interpreter rc=9) error=
#   Failed test 'generic system wml'
#   at t/03-p3_eperl.t line 12.
#   Failed test 'generic cmp'
#   at t/03-p3_eperl.t line 29.
#  got: ''
# expected: 'foo
# '
# Looks like 
>>>

any insights will be appreciated.

Code is https://en.wikipedia.org/wiki/GNU_General_Public_License v2+.

-- 
---------
Shlomi Fish   http://www.shlomifish.org/
https://is.gd/MQHVF3 - The Atom Text Editor edits a 2,000,001B file

Summer Glau can give you the Hug of Death, but you’ll die happy.
— http://www.shlomifish.org/humour/bits/facts/Summer-Glau/

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: Seeking more help figuring out test failures

2016-04-25 Thread Shlomi Fish
Hi David,

On Sun, 24 Apr 2016 18:57:25 -0400
David Mertens <dcmertens.p...@gmail.com> wrote:

> Hello everyone,
> 
> My work with Alien::TinyCCx gives errors on appveyor (
> https://ci.appveyor.com/project/run4flat/alien-tinyccx/build/1.0.7). I
> cannot reproduce these errors on my own setup. If you have a Windows
> machine, I would appreciate if you could try to run the test suite for
> Alien::TinyCCx. (I just pushed v0.08 to CPAN, but you can also get it from
> github at https://github.com/run4flat/Alien-TinyCCx). If you can reproduce
> the errors seen on appveyor, I'd like to know about your setup.
> 

I am getting these test failures on a Windows 7 x86-64 Professional
VirtualBox VM with strawberry perl 5.22.1.3:

http://www.shlomifish.org/Files/files/images/alien-tinyccx.png

Getting to the point where I was able to run this was time consuming because it
involved installing many updates (VBox guest additions, Windows Update,
Strawberry Perl, etc.). I hate Windows.

Regards,

Shlomi Fish

> Thanks!
> David
> 



-- 
-----
Shlomi Fish   http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf

   Botje: “you can’t kill Botje” isn’t Newton’s first law.
   It’s not even the 5th.
—  http://www.shlomifish.org/humour/fortunes/sharp-perl.html

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: How to have perl allocate pointers predictably.

2012-08-24 Thread Shlomi Fish
Hi Liz,
On Thu, 23 Aug 2012 20:54:13 +0200
Elizabeth Mattijsen l...@dijkmat.nl wrote:

 I can't help but think this may be caused by hash randomization.
 Have you tried running this with PERL_HASH_SEED=0 ?
 
 See https://metacpan.org/module/perlrun#PERL_HASH_SEED .
 

Here goes:


shlomif[XML-LibXML]:$trunk$ cat TEST.pl
# Feeding XML::LibXML with an invalid file, triggering memory leaks

use strict;
use warnings;

use Devel::Leak;

binmode STDOUT, ':encoding(UTF-8)';

check_libxml_memory();

sub check_libxml_memory {
print running\n;
my $handle;
my $leaveCount = 0;
my $enterCount = Devel::Leak::NoteSV($handle);
print STDERR \nENTER: $enterCount SVs\n;
{
make_trouble(); # Trace how loading a bad doc affects memory
}
$leaveCount = Devel::Leak::CheckSV($handle);
print STDERR \nLEAVE: $leaveCount SVs\n;
}

sub make_trouble {
my $x;

$x = \$x;

return;
}

1;
shlomif[XML-LibXML]:$trunk$ PERL_HASH_SEED=0 perl TEST.pl 
running

ENTER: 9318 SVs
new 0x13a14e8 : 

LEAVE: 9319 SVs
shlomif[XML-LibXML]:$trunk$ PERL_HASH_SEED=0 perl TEST.pl 
running

ENTER: 9318 SVs
new 0xf074e8 : 

LEAVE: 9319 SVs
shlomif[XML-LibXML]:$trunk$ which perl
/bin/perl
shlomif[XML-LibXML]:$trunk$ 


So it did not appear to have helped.

Regards,

Shlomi Fish


 
 Liz
 
 On Aug 23, 2012, at 7:33 PM, Shlomi Fish wrote:
  with the included script below, Devel::Leak keeps outputting
  different pointers each time for the leaked SVs. This makes
  debugging harder. Can I have perl somehow allocate the same
  pointers each time when an allocation is being requested? I don't
  mind rebuilding a dedicated perl for that using perlbrew or
  whatever. Note that this also happens if make_trouble() is as
  simple as my $x; $x = \$x;.
  
  Regards,
  
  -- Shlomi Fish
  
  # Feeding XML::LibXML with an invalid file, triggering memory leaks
  
  use strict;
  use warnings;
  
  use Devel::Leak;
  
  use Encode;
  use XML::LibXML;
  
  use Carp;
  
  binmode STDOUT, ':encoding(UTF-8)';
  
  check_libxml_memory();
  
  sub check_libxml_memory {
 print running\n;
 my $handle;
 my $leaveCount = 0;
 my $enterCount = Devel::Leak::NoteSV($handle);
 print STDERR \nENTER: $enterCount SVs\n;
 {
 make_trouble(); # Trace how loading a bad doc affects memory
 }
 $leaveCount = Devel::Leak::CheckSV($handle);
 print STDERR \nLEAVE: $leaveCount SVs\n;
  }
  
  sub make_trouble {
 # Tries to load a bad XML file into XML::LibXML
 my $filenameIn = 'libxml-trouble-sample.html';
 local $/; #Read whole file
 open(my $FILEIN,'', $filenameIn)
 or die Can't read file '$filenameIn' [$!]\n;
 my $str = $FILEIN;
 close ($FILEIN);
  
 # Feeds the bad file to XML::LibXML.
 my $parser = XML::LibXML-new;
 my $success=1;
 # if recover is set to 0 or 1, the problem ceases to exist
 my $doc = $parser-parse_html_string($str,
 {recover = 2, encoding = 'UTF-8'}
 );
  
 return;
  }
  
  1;
  
  -- 
  -
  Shlomi Fish   http://www.shlomifish.org/
  Funny Anti-Terrorism Story - http://shlom.in/enemy
  
  What is is. Perceive It. Integrate it. Act on it. Idealize it.
 — Leonard Peikoff
  
  Please reply to list if it's a mailing list post -
  http://shlom.in/reply .
 



-- 
-
Shlomi Fish   http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

Xena the warrior princess can meet King David for breakfast and Julius Caesar
for lunch. Without time travel.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: How to have perl allocate pointers predictably.

2012-08-24 Thread Shlomi Fish
Hi bulk 88,

thanks for your message. See below for my response.

On Thu, 23 Aug 2012 17:31:05 -0400
bulk 88 bul...@hotmail.com wrote:

 
 
 
 
  Date: Thu, 23 Aug 2012 20:33:53 +0300
  From: shlo...@shlomifish.org
  To: perl-xs@perl.org
  Subject: How to have perl allocate pointers predictably.
 
  Hi all,
 
  with the included script below, Devel::Leak keeps outputting
  different pointers each time for the leaked SVs. This makes
  debugging harder. Can I have perl somehow allocate the same
  pointers each time when an allocation is being requested? I don't
  mind rebuilding a dedicated perl for that using perlbrew or
  whatever. Note that this also happens if make_trouble() is as
  simple as my $x; $x = \$x;.
 On Windows XP I always get the same SV *s assuming all inputs to the
 process are the same on each run.
  C:\Documents and
 Settings\Owner\Desktopperl -e print \\\perl\ SCALAR(0x8fe04c)
 C:\Documents and Settings\Owner\Desktopperl -e print \\\perl\
 SCALAR(0x8fe04c)
 C:\Documents and Settings\Owner\Desktopperl -e print \\\perl\
 SCALAR(0x8fe04c)
 C:\Documents and Settings\Owner\Desktopperl -e print \\\perl\
 SCALAR(0x8fe04c)
 C:\Documents and Settings\Owner\Desktopperl -e print \\\perl\
 SCALAR(0x8fe04c)
 C:\Documents and Settings\Owner\Desktopperl -e print \\\perl\
 SCALAR(0x8fe04c)
 C:\Documents and Settings\Owner\Desktop
 
 C:\Documents and Settings\Owner\Desktopperl -e print unpack('J',
 pack('p', \p erl\))
 9468532
 C:\Documents and Settings\Owner\Desktopperl -e print unpack('J',
 pack('p', \p erl\))
 9468532
 C:\Documents and Settings\Owner\Desktopperl -e print unpack('J',
 pack('p', \p erl\))
 9468532
 C:\Documents and Settings\Owner\Desktopperl -e print unpack('J',
 pack('p', \p erl\))
 9468532
 C:\Documents and Settings\Owner\Desktopperl -e print unpack('J',
 pack('p', \p erl\))
 9468532
 C:\Documents and Settings\Owner\Desktop
 
 Hash number randomization is irrelevant since the width of the hash
 array is determined by the number of keys/HEKs usually, not the hash
 number. So the memory allocation sizes and order of them to malloc
 are the same. Its it quite popular in modern OSes to randomize
 heaps/dlls/stacks/etc per boot or per process nowadays. That is
 probably what is happening in your case. 

Thanks for the lead. This seems to have been the case. After searching in
vein for perl heap randomization and stuff like that, I searched for
linux heap randomization and got to this page:

http://stackoverflow.com/questions/1455904/how-to-disable-address-space-randomization-for-a-binary-on-linux

This referred me to the setarch -R command and doing this:

$ ( PERL_HASH_SEED=0 setarch x86_64 -R perl libxml2.pl ) 21

now gives me consistent results on each run. It may be enabled by default in 
gdb, though.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Free (Creative Commons) Music Downloads, Reviews and more - http://jamendo.com/

No self‐respecting tomboy would use Mandriva.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


How to have perl allocate pointers predictably.

2012-08-23 Thread Shlomi Fish
Hi all,

with the included script below, Devel::Leak keeps outputting different pointers 
each time for
the leaked SVs. This makes debugging harder. Can I have perl somehow allocate 
the same pointers
each time when an allocation is being requested? I don't mind rebuilding a 
dedicated perl for that
using perlbrew or whatever. Note that this also happens if make_trouble() is as 
simple as
my $x; $x = \$x;.

Regards,

-- Shlomi Fish

# Feeding XML::LibXML with an invalid file, triggering memory leaks

use strict;
use warnings;

use Devel::Leak;

use Encode;
use XML::LibXML;

use Carp;

binmode STDOUT, ':encoding(UTF-8)';

check_libxml_memory();

sub check_libxml_memory {
print running\n;
my $handle;
my $leaveCount = 0;
my $enterCount = Devel::Leak::NoteSV($handle);
print STDERR \nENTER: $enterCount SVs\n;
{
make_trouble(); # Trace how loading a bad doc affects memory
}
$leaveCount = Devel::Leak::CheckSV($handle);
print STDERR \nLEAVE: $leaveCount SVs\n;
}

sub make_trouble {
# Tries to load a bad XML file into XML::LibXML
my $filenameIn = 'libxml-trouble-sample.html';
local $/; #Read whole file
open(my $FILEIN,'', $filenameIn)
or die Can't read file '$filenameIn' [$!]\n;
my $str = $FILEIN;
close ($FILEIN);

# Feeds the bad file to XML::LibXML.
my $parser = XML::LibXML-new;
my $success=1;
# if recover is set to 0 or 1, the problem ceases to exist
my $doc = $parser-parse_html_string($str,
{recover = 2, encoding = 'UTF-8'}
);

return;
}

1;

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

What is is. Perceive It. Integrate it. Act on it. Idealize it.
— Leonard Peikoff

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: XS for C++

2011-12-30 Thread Shlomi Fish
Hi Alberto,

On Thu, 29 Dec 2011 22:13:37 +
Alberto Simões al...@alfarrabio.di.uminho.pt wrote:

 Hello,
 
 I am used to write XS code (well, simple code) for C libraries.
 I never did anything for C++ (and I do not know much about C++), but 
 I'll need to write a simple interface.
 
 Mostly, I need to call a method inside a namespace, and that should be 
 enough.
 
 Can you suggest any module that interfaces with a C++ library where I 
 can peek for ideas?
 

off the top of my head:

* http://search.cpan.org/dist/Wx/

* http://en.wikipedia.org/wiki/Kdebindings

However, since these are GUI libraries, the bindings might be generated using
scripts.

Regards,

Shlomi Fish
 
 Thank you
 Alberto



-- 
-
Shlomi Fish   http://www.shlomifish.org/
Best Introductory Programming Language - http://shlom.in/intro-lang

I invented the term Object‐Oriented, and I can tell you I did not have C++ in
mind.  — Alan Kay (Attributed)

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: embedding?

2011-12-22 Thread Shlomi Fish
Hi Ben,

On Thu, 22 Dec 2011 22:13:28 -0700
ben b...@appliedplastic.com wrote:

 I'm trying to embed perl in a pam module and have a few questions. Is
 this a good place to ask? If not where is?
 

I think here would be a good place.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
What Makes Software Apps High Quality -  http://shlom.in/sw-quality

Deletionists delete Wikipedia articles that they consider lame.

Chuck Norris deletes Deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Re: How to export functions from C++ to embedded perl.

2009-02-10 Thread Shlomi Fish
On Tuesday 10 February 2009 06:23:47 Thomas Rowe wrote:
 I'm trying to embed perl in a C++ application and have some perl modules
 call back into the C++.  I cannot figure out how to make the bootstrap
 work on my callback module.  When I eval use Callback; I get Can't
 locate loadable object for module Callback in @INC even though the
 Callback stuff is linked in.  It shouldn't be looking for a .so file.
 The DynaLoader stuff works fine for other modules.

 Here's what I got:

 Makefile:
   OBJS = main.o perlxsi.o callbackxs.o
   ...
   main : $(OBJS) # my callbackxs.o should link in here fine, right?
   $(CC) -o $@ $^ $(PERLLD)

   callbackxs.o : callback.xs
   xsubpp callback.xs  callbackxs.cpp
   $(CC) -c callbackxs.cpp $(PERLCXX)  # compiles fine.
   ...

 perlxsi.c:
   EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
   EXTERN_C void boot_Callback (pTHX_ CV* cv);

   EXTERN_C void
   xs_init(pTHX)
   {
   char *file = const_castchar*( __FILE__ );
   dXSUB_SYS;
   newXS(DynaLoader::boot_DynaLoader, boot_DynaLoader, file);
   newXS(Callback::boot_Callback, boot_Callback, file);
   }

 main.cpp:
   perl_parse(my_perl, xs_init, arg_count, const_castchar**(args), 
 NULL); #
 dynaloader works fine

 I can see XS(boot_Callback) defined just fine in the code spat out by
 xsubpp on my xs file.

 What gives?  What's the missing step to tell perl about linked in module
 code?

Have you tried putting something into %INC? See its entry in perldoc perlvar:

http://perldoc.perl.org/perlvar.html

%INC is very useful for mocking modules even in pure-Perl scenarios.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://xrl.us/bjn8s

maukeI'm not interested in what you're doing; what are you trying to 
   achieve?
PerlJam  mauke: I'm trying to achieve world peace and this regex is
   the last thing standing in my way! ;)



Wrong refcount for Array ref contents (work with pure-Perl code)

2008-12-23 Thread Shlomi Fish
Hi all!

In:

http://opensvn.csie.org/shlomif/documents/perl/trunk/perl5/ext-embed-internals/docbook/examples/incremental-examples-1/XSTest/

I have written the following XS function:


AV *
concat_two_array_refs(array1, array2)
AV * array1
AV * array2

INIT:
/* Initialize RETVAL to NULL, so we'll know something is wrong
 * if this indeed the case*/
RETVAL = NULL;

CODE:
{
AV * ret;
AV * current;
I32 max_index;
I32 i;
I32 array_idx;
SV * * elem;

/* av_make() accepts a size and a list of SV's. So this
 * call creates a new array*/
ret = av_make(0, NULL);

if (ret == NULL)
{
goto myerror;
}

for(array_idx=0;array_idx2;array_idx++)
{
current = (array_idx == 0) ? array1 : array2;

max_index = av_len(current);
for(i=0;i=max_index;i++)
{
elem = av_fetch(current, i, 0);
if (elem == NULL)
{
av_push(ret, PL_sv_undef);
}
else
{
/* Increment the reference count because we now
 * reference it in another place and av_push
 * does not do it for us.
 * 
 * SvREFCNT_inc_void_NN is a variation of SvREFCNT_inc 
 * which has some limitations that don't matter here.
 * 
 * From the documentation (perldoc perlapi):
 *
 * SvREFCNT_inc_void_NN
   Same as SvREFCNT_inc, but can only be used if 
   you don't need the return value, and you know
   that sv is not NULL.  The macro doesn't need to
   return a meaningful value, or check for
   NULLness, so it's smaller and faster.

 * av_fetch cannot return a non-NULL SV** that points
 * to a NULL SV*.
 * */

SvREFCNT_inc_void_NN(*elem);
av_push(ret, *elem);
}
}
}

myerror:
RETVAL = ret;
}
OUTPUT:
RETVAL
}}}

Now, I wrote the following test case (in t/10-array-from-scratch.t to check 
that the values were indeed destroyed):


{{
package MyTestDestroyed;

use vars (qw(@log));

sub new
{
my $class = shift;
my $self = {};

bless $self, $class;

$self-{'id'} = shift;

return $self;
}

sub DESTROY
{
my $self = shift;

push @log, $self-{id} was Destroyed;
}

package main;

{
{
my $combined;

{
my @array1 = (One, MyTestDestroyed-new(CamelCase));
my @array2 = (20,30,40);

$combined = XSTest::concat_two_array_refs(\...@array1, \...@array2);
# $combined = [...@array1, @array2];
}

# TEST
is ($combined-[0], One, 
concat_two_arrays - Garbage Collection - elem 0
);

# TEST
is ($combined-[1]-{'id'}, CamelCase, 
concat_two_arrays - Garbage Collection - elem 1/id
);
}

# TEST
is_deeply(
\...@mytestdestroyed::log,
[CamelCase was Destroyed],
concat_two_arrays - Garbage Collection - object was destroyed.,
);

@MyTestDestroyed::log = ();
}
}}

The test fails.

If I replace the lines:

{{{
$combined = XSTest::concat_two_array_refs(\...@array1, \...@array2);
# $combined = [...@array1, @array2];
}}}

Everything works as expected.

What am I doing wrong? I asked on #p5p on irc.perl.org.il, and no one could 
tell me what is wrong.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
What Makes Software Apps High Quality -  http://xrl.us/bkeuk

Shlomi, so what are you working on? Working on a new wiki about unit testing 
fortunes in freecell? -- Ran Eilam


Problems with the new constructor in a GD-derived module

2006-07-24 Thread Shlomi Fish
Hi all!

This is my first message to this list. To cut to the chase, I'm trying to 
write a derived class from the GD distribution in CPAN ( 
http://search.cpan.org/dist/GD/ ). The code I have now is here:

http://eskimo.shlomifish.org/Files/files/code/perl/gd-phpfilter/

(Note that I wrote it for work, so it may be considered an in-house code of 
sorts, and not really open-source yet. But it's perfectly OK to look at it.)

Now my problem is that I'm getting the following on ./Build test:


t/01-object...ok 1/10Can't locate auto/GD/new.al in @INC (@INC 
contains: /home/shlomi/progs/perl/cpan/GD-PHPFilter-0.01/blib/lib 
/home/shlomi/progs/perl/cpan/GD-PHPFilter-0.01/blib/arch 
/home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8/i386-linux 
/home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8/i386-linux 
/home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8


I inherit from GD and also have my own new() function (which I think is 
unnecessary), so I don't know what I'm doing wrong.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.


Re: Problems with the new constructor in a GD-derived module

2006-07-24 Thread Shlomi Fish
Hi!

Thanks for your help. See below for my comments.

I forgot to note that I'm using Mandriva Cooker (about to become Mandriva 
2007) with perl-5.8.8-6mdk and gcc-4.1.1-2mdk on a P4-2.4GHz machine.

On Monday 24 July 2006 15:07, Sisyphus wrote:
 - Original Message -
 From: Shlomi Fish [EMAIL PROTECTED]
 To: perl-xs@perl.org
 Sent: Monday, July 24, 2006 9:02 PM
 Subject: Problems with the new constructor in a GD-derived module

  Hi all!
 
  This is my first message to this list. To cut to the chase, I'm trying to
  write a derived class from the GD distribution in CPAN (
  http://search.cpan.org/dist/GD/ ). The code I have now is here:
 
  http://eskimo.shlomifish.org/Files/files/code/perl/gd-phpfilter/
 
  (Note that I wrote it for work, so it may be considered an in-house code

 of

  sorts, and not really open-source yet. But it's perfectly OK to look at

 it.)

  Now my problem is that I'm getting the following on ./Build test:
 
  
  t/01-object...ok 1/10Can't locate auto/GD/new.al in @INC (@INC
  contains: /home/shlomi/progs/perl/cpan/GD-PHPFilter-0.01/blib/lib
  /home/shlomi/progs/perl/cpan/GD-PHPFilter-0.01/blib/arch
  /home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8/i386-linux
  /home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8/i386-linux
  /home/shlomi/apps/perl/modules/lib/perl5/site_perl/5.8.8
 
 
  I inherit from GD and also have my own new() function (which I think is
  unnecessary), so I don't know what I'm doing wrong.

 I don't use Module::Build (though I have it), so I wrote a Makefile.PL,
 relocated lib/PHPFilter.xs and typemap to the top level, and tried to build
 the ol' fashioned way. First problem was that I needed to remove your TODO
 ... comments from the XS file. I thought the same would be necessary if
 you were using Module::Build. 

Indeed, I believe I fixed them in the copy on the web.

 And then I couldn't see any reference to the 
 GD header or library in Build.pl, though I expected that would need to be
 specified, too. 

That's the case indeed. I started from what Module::Starter::XSimple gave me, 
(which so far only supports building module templates using M::B) and since I 
was able to build everything so far, that's what I used. But I do need to add 
it somehow.

 Did 'PHPFilter.so' actually get built for you ? 

It was:


shlomi:~/progs/perl/cpan/GD-PHPFilter-0.01$ 
ls -l ./blib/arch/auto/GD/PHPFilter/PHPFilter.so
-rwxr-xr-x  1 shlomi shlomi 8962 Jul 24 
15:49 ./blib/arch/auto/GD/PHPFilter/PHPFilter.so


Like I said - I'm still a newbie at this, and it's the first time I'm trying 
to use Module::Build (which I only happily used for pure Perl modules so far) 
for PerlXS stuff.

 It didn't  
 for me, though I think I gave it every chance of succeeding. Sticking point
 for me was that `gdImageGrayScale' could not be resolved - so the build
 process failed at the 'make' stage. Where is that symbol defined ? it's not
 in my version (2.0.33) of GD.

Hmmm... Maybe it's a function that the PHP guys coded in C. I'll have to 
check.


 When I tried to build using your source straight out of the box with
 Module::Build, the shared object did not get built for the very same
 reason. It strikes me as a bug in Module::Build that the 'test' phase could
 then be run  but, like I said, I don't use Module::Build ... and I know
 little about it (or its quirks and limitations :-)

OK.


shlomi:~/Docs/homepage/homepage/trunk$ perl -MModule::Build -le 'print 
$Module::Build::VERSION'
0.2801


But maybe I should switch to ExtUtils::MakeMaker.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.