Re: [Zope-Perl] call subroutine by pyperl
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-0814 r-xp 08:05 2613978 /usr/bin/python2.5 0814-08165000 rw-p 000f7000 08:05 2613978 /usr/bin/python2.5 08165000-08284000 rw-p 08165000 00:00 0 [heap] b790-b7921000 rw-p b790 00:00 0 b7921000-b7a0 ---p b7921000 00:00 0 b7a44000-b7a4e000 r-xp 08:05 1409036 /lib/libgcc_s.so.1 b7a4e000-b7a4f000 rw-p a000 08:05 1409036 /lib/libgcc_s.so.1 b7a5b000-b7a68000 r-xp 08:05 3008570 /usr/local/lib/perl/5.8.8/auto/Python/Object/Object.so b7a68000-b7a69000 rw-p c000 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 08:05 2638705 /usr/lib/locale/en_US.utf8/LC_COLLATE b7b6b000-b7b74000 r-xp 08:05 1426495 /lib/tls/i686/cmov/libcrypt-2.7.so b7b74000-b7b76000 rw-p 8000 08:05 1426495 /lib/tls/i686/cmov/libcrypt-2.7.so b7b76000-b7b9d000 rw-p b7b76000 00:00 0 b7b9d000-b7cb8000 r-xp 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 08:05 705539 /usr/lib/python2.5/site-packages/perl2.so b7ccb000-b7ccc000 rw-p b000 08:05 705539 /usr/lib/python2.5/site-packages/perl2.so b7ccc000-b7ccd000 r-xp 08:05 705537 /usr/lib/python2.5/site-packages/perl.so b7ccd000-b7cce000 rw-p 08:05 705537 /usr/lib/python2.5/site-packages/perl.so b7cce000-b7cd5000 r--s 08:05 2622378 /usr/lib/gconv/gconv-modules.cache b7cd5000-b7d14000 r--p 08:05 2638706 /usr/lib/locale/en_US.utf8/LC_CTYPE b7d14000-b7d97000 rw-p b7d14000 00:00 0 b7d97000-b7ee r-xp 08:05 1426493 /lib/tls/i686/cmov/libc-2.7.so b7ee-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 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 08:05 1426512 /lib/tls/i686/cmov/libutil-2.7.so b7f0d000-b7f0f000 rw-p 1000 08:05 1426512 /lib/tls/i686/cmov/libutil-2.7.so b7f0f000-b7f1 rw-p b7f0f000 00:00 0 b7f1-b7f12000 r-xp 08:05 1426496 /lib/tls/i686/cmov/libdl-2.7.so b7f12000-b7f14000 rw-p 1000 08:05 1426496 /lib/tls/i686/cmov/libdl-2.7.so b7f14000-b7f28000 r-xp 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 08:05 2638723 /usr/lib/locale/en_US.utf8/LC_NUMERIC b7f2f000-b7f3 r--p 08:05 2637982 /usr/lib/locale/en_US.utf8/LC_TIME b7f3-b7f31000 r--p 08:05 2637983 /usr/lib/locale/en_US.utf8/LC_MONETARY b7f31000-b7f32000 r--p 08:05 2646018 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES b7f32000-b7f33000 r--p 08:05 2638724 /usr/lib/locale/en_US.utf8/LC_PAPER b7f33000-b7f34000 r--p 08:05 2638722 /usr/lib/locale/en_US.utf8/LC_NAME b7f34000-b7f35000 r--p 08:05 2637984 /usr/lib/locale/en_US.utf8/LC_ADDRESS b7f35000-b7f36000 r--p
Re: [Zope-Perl] call subroutine by pyperl
I look at it some time ago, and had some problems with pointer errors. I decided to use an JSON gw instead. If any interrest Ill be happy to share! kr Tommy On Wed, Mar 31, 2010 at 3:23 PM, DmitriKo dmitrikozhe...@gmail.com wrote: 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-0814 r-xp 08:05 2613978/usr/bin/python2.5 0814-08165000 rw-p 000f7000 08:05 2613978/usr/bin/python2.5 08165000-08284000 rw-p 08165000 00:00 0 [heap] b790-b7921000 rw-p b790 00:00 0 b7921000-b7a0 ---p b7921000 00:00 0 b7a44000-b7a4e000 r-xp 08:05 1409036/lib/libgcc_s.so.1 b7a4e000-b7a4f000 rw-p a000 08:05 1409036/lib/libgcc_s.so.1 b7a5b000-b7a68000 r-xp 08:05 3008570 /usr/local/lib/perl/5.8.8/auto/Python/Object/Object.so b7a68000-b7a69000 rw-p c000 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 08:05 2638705 /usr/lib/locale/en_US.utf8/LC_COLLATE b7b6b000-b7b74000 r-xp 08:05 1426495 /lib/tls/i686/cmov/libcrypt-2.7.so b7b74000-b7b76000 rw-p 8000 08:05 1426495 /lib/tls/i686/cmov/libcrypt-2.7.so b7b76000-b7b9d000 rw-p b7b76000 00:00 0 b7b9d000-b7cb8000 r-xp 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 08:05 705539 /usr/lib/python2.5/site-packages/perl2.so b7ccb000-b7ccc000 rw-p b000 08:05 705539 /usr/lib/python2.5/site-packages/perl2.so b7ccc000-b7ccd000 r-xp 08:05 705537 /usr/lib/python2.5/site-packages/perl.so b7ccd000-b7cce000 rw-p 08:05 705537 /usr/lib/python2.5/site-packages/perl.so b7cce000-b7cd5000 r--s 08:05 2622378 /usr/lib/gconv/gconv-modules.cache b7cd5000-b7d14000 r--p 08:05 2638706 /usr/lib/locale/en_US.utf8/LC_CTYPE b7d14000-b7d97000 rw-p b7d14000 00:00 0 b7d97000-b7ee r-xp 08:05 1426493 /lib/tls/i686/cmov/libc-2.7.so b7ee-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 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 08:05 1426512 /lib/tls/i686/cmov/libutil-2.7.so b7f0d000-b7f0f000 rw-p 1000 08:05 1426512 /lib/tls/i686/cmov/libutil-2.7.so b7f0f000-b7f1 rw-p b7f0f000 00:00 0 b7f1-b7f12000 r-xp 08:05 1426496 /lib/tls/i686/cmov/libdl-2.7.so b7f12000-b7f14000 rw-p 1000 08:05 1426496 /lib/tls/i686/cmov/libdl-2.7.so b7f14000-b7f28000 r-xp 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 08:05 2638723 /usr/lib/locale/en_US.utf8/LC_NUMERIC b7f2f000-b7f3 r--p 08:05 2637982 /usr/lib/locale/en_US.utf8/LC_TIME b7f3-b7f31000 r--p 08:05 2637983 /usr/lib/locale/en_US.utf8/LC_MONETARY b7f31000-b7f32000 r--p