Hey, Kenny.

I offer to stop wasting your time on that cool by marginal solution.

Please use old good tools for inter program communication.

$ perl test.pm | python test.py

as example where output from test.pm come to sys.stdin in python test.py

use json, xml, text ... with easy.

--
DmitriKo

On Wed, Mar 31, 2010 at 4:01 PM, Kenny <zhaowenliangpo...@gmail.com> wrote:
> Dear all,
>
> I have a question about pyperl.
>
> there is a perl module test.pm:
> #! /usr/bin/perl
> package tset
> sub Cal {
> my ($v1,$v2)=...@_;
> my $result=$v1+$v2;
> }
> print "this is a test \n";
> 1;
>
> And there is a python file that calls the module above,
> import perl
> perl.require("test");
> #perl.call("Usage","test1.pl")
> #perl.call("test::Usage", "1")
> b=perl.call("test::Cal", 1, 1)
> print b
>
> when run, I got a error message shown below: (can anyone tell me the reason?
> many thanks)
> ##################################error message####################
> ke...@kenny-laptop:~/Desktop$ python test.py
> it is a test
> 2
> *** glibc detected *** python: free(): invalid pointer: 0xb7d7b1a0 ***
> ======= Backtrace: =========
> /lib/tls/i686/cmov/libc.so.6[0xb7e02a85]
> /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7e064f0]
> /usr/lib/python2.5/site-packages/perl2.so[0xb7cc772d]
> python[0x80855a9]
> python(PyDict_SetItem+0x6e)[0x8086f8e]
> python(_PyModule_Clear+0x158)[0x8088bf8]
> python(PyImport_Cleanup+0x152)[0x80de3d2]
> python(Py_Finalize+0xbf)[0x80ea41f]
> python(Py_Main+0x468)[0x8058d68]
> python(main+0x22)[0x80587f2]
> /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7dad450]
> python[0x8058761]
> ======= Memory map: ========
> 08048000-08140000 r-xp 00000000 08:05 2613978    /usr/bin/python2.5
> 08140000-08165000 rw-p 000f7000 08:05 2613978    /usr/bin/python2.5
> 08165000-08284000 rw-p 08165000 00:00 0          [heap]
> b7900000-b7921000 rw-p b7900000 00:00 0
> b7921000-b7a00000 ---p b7921000 00:00 0
> b7a44000-b7a4e000 r-xp 00000000 08:05 1409036    /lib/libgcc_s.so.1
> b7a4e000-b7a4f000 rw-p 0000a000 08:05 1409036    /lib/libgcc_s.so.1
> b7a5b000-b7a68000 r-xp 00000000 08:05 3008570
> /usr/local/lib/perl/5.8.8/auto/Python/Object/Object.so
> b7a68000-b7a69000 rw-p 0000c000 08:05 3008570
> /usr/local/lib/perl/5.8.8/auto/Python/Object/Object.so
> b7a69000-b7a8a000 rw-p b7a69000 00:00 0
> b7a8a000-b7b6b000 r--p 00000000 08:05 2638705
> /usr/lib/locale/en_US.utf8/LC_COLLATE
> b7b6b000-b7b74000 r-xp 00000000 08:05 1426495
> /lib/tls/i686/cmov/libcrypt-2.7.so
> b7b74000-b7b76000 rw-p 00008000 08:05 1426495
> /lib/tls/i686/cmov/libcrypt-2.7.so
> b7b76000-b7b9d000 rw-p b7b76000 00:00 0
> b7b9d000-b7cb8000 r-xp 00000000 08:05 2613267    /usr/lib/libperl.so.5.8.8
> b7cb8000-b7cbd000 rw-p 0011a000 08:05 2613267    /usr/lib/libperl.so.5.8.8
> b7cbd000-b7cbf000 rw-p b7cbd000 00:00 0
> b7cbf000-b7ccb000 r-xp 00000000 08:05 705539
> /usr/lib/python2.5/site-packages/perl2.so
> b7ccb000-b7ccc000 rw-p 0000b000 08:05 705539
> /usr/lib/python2.5/site-packages/perl2.so
> b7ccc000-b7ccd000 r-xp 00000000 08:05 705537
> /usr/lib/python2.5/site-packages/perl.so
> b7ccd000-b7cce000 rw-p 00000000 08:05 705537
> /usr/lib/python2.5/site-packages/perl.so
> b7cce000-b7cd5000 r--s 00000000 08:05 2622378
> /usr/lib/gconv/gconv-modules.cache
> b7cd5000-b7d14000 r--p 00000000 08:05 2638706
> /usr/lib/locale/en_US.utf8/LC_CTYPE
> b7d14000-b7d97000 rw-p b7d14000 00:00 0
> b7d97000-b7ee0000 r-xp 00000000 08:05 1426493
> /lib/tls/i686/cmov/libc-2.7.so
> b7ee0000-b7ee1000 r--p 00149000 08:05 1426493
> /lib/tls/i686/cmov/libc-2.7.so
> b7ee1000-b7ee3000 rw-p 0014a000 08:05 1426493
> /lib/tls/i686/cmov/libc-2.7.so
> b7ee3000-b7ee6000 rw-p b7ee3000 00:00 0
> b7ee6000-b7f09000 r-xp 00000000 08:05 1426497
> /lib/tls/i686/cmov/libm-2.7.so
> b7f09000-b7f0b000 rw-p 00023000 08:05 1426497
> /lib/tls/i686/cmov/libm-2.7.so
> b7f0b000-b7f0d000 r-xp 00000000 08:05 1426512
> /lib/tls/i686/cmov/libutil-2.7.so
> b7f0d000-b7f0f000 rw-p 00001000 08:05 1426512
> /lib/tls/i686/cmov/libutil-2.7.so
> b7f0f000-b7f10000 rw-p b7f0f000 00:00 0
> b7f10000-b7f12000 r-xp 00000000 08:05 1426496
> /lib/tls/i686/cmov/libdl-2.7.so
> b7f12000-b7f14000 rw-p 00001000 08:05 1426496
> /lib/tls/i686/cmov/libdl-2.7.so
> b7f14000-b7f28000 r-xp 00000000 08:05 1426507
> /lib/tls/i686/cmov/libpthread-2.7.so
> b7f28000-b7f2a000 rw-p 00013000 08:05 1426507
> /lib/tls/i686/cmov/libpthread-2.7.so
> b7f2a000-b7f2c000 rw-p b7f2a000 00:00 0
> b7f2d000-b7f2e000 rw-p b7f2d000 00:00 0
> b7f2e000-b7f2f000 r--p 00000000 08:05 2638723
> /usr/lib/locale/en_US.utf8/LC_NUMERIC
> b7f2f000-b7f30000 r--p 00000000 08:05 2637982
> /usr/lib/locale/en_US.utf8/LC_TIME
> b7f30000-b7f31000 r--p 00000000 08:05 2637983
> /usr/lib/locale/en_US.utf8/LC_MONETARY
> b7f31000-b7f32000 r--p 00000000 08:05 2646018
> /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
> b7f32000-b7f33000 r--p 00000000 08:05 2638724
> /usr/lib/locale/en_US.utf8/LC_PAPER
> b7f33000-b7f34000 r--p 00000000 08:05 2638722
> /usr/lib/locale/en_US.utf8/LC_NAME
> b7f34000-b7f35000 r--p 00000000 08:05 2637984
> /usr/lib/locale/en_US.utf8/LC_ADDRESS
> b7f35000-b7f36000 r--p 00000000 08:05 2637985
> /usr/lib/locale/en_US.utf8/LC_TELEPHONE
> b7f36000-b7f37000 r--p 00000000 08:05 2637986
> /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
> b7f37000-b7f38000 r--p 00000000 08:05 2637987
> /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
> b7f38000-b7f3a000 rw-p b7f38000 00:00 0
> b7f3a000-b7f3b000 r-xp b7f3a000 00:00 0          [vdso]
> b7f3b000-b7f55000 r-xp 00000000 08:05 1409643    /lib/ld-2.7.so
> b7f55000-b7f57000 rw-p 00019000 08:05 1409643    /lib/ld-2.7.so
> bfb9e000-bfbb3000 rw-p bffeb000 00:00 0          [stack]
> Aborted
>
> --
> Best regards,
>
> Kenny
>
> _______________________________________________
> Zope-perl maillist  -  zope-p...@zope.org
> https://mail.zope.org/mailman/listinfo/zope-perl
>
>
_______________________________________________
Zope-perl maillist  -  Zope-perl@zope.org
https://mail.zope.org/mailman/listinfo/zope-perl

Reply via email to