[Zope-Perl] Calling a perl method called del()
Alexandre Gattiker
gattiker@isb-sib.ch
Fri, 26 Oct 2001 09:58:51 +0200
I have tried pyperl as a way to use existing perl modules in python
programs. Unfortunately, a method in my perl class is called del(),
which is a python reserved word. This is reproduced in the example
below. Replacing del() with another name works. Is there a way to
circumvent the problems without changing the perl module ?
bug.pm :
package bug;
sub new {
my $ref = shift;
my $class = ref($ref) || $ref;
my $self = {};
bless($self, $class);
return $self;
}
sub del {
print "del called\n";
}
1;
bug.py :
from perlmod import PerlClass
bug = PerlClass("bug")()
bug.del()
python bug.py
File "bug.py", line 4
bug.del()
^
SyntaxError: invalid syntax
--
Alexandre Gattiker
SWISS-PROT Group Swiss Institute of Bioinformatics
CMU, 1 rue Michel Servet CH - 1211 Geneva 4 Switzerland
gattiker@isb-sib.ch http://www.expasy.org
It takes an uncommon mind to think of these things.
--- Calvin