[Zope-Perl] Getting wierd problem with self in perl script.

Alan Young alany@idiglobal.com
Wed, 20 Jun 2001 15:09:29 -0600


(Ahhh ... appropriate sig!)

I'm trying to get a perl script up and going and running into serious 
understanding issues.

Script (Perl)
id: test
Arguments: self
Code: return $self->objectValues;

DTML Method
id: testtest
Content:
<dtml-var standard_html_header>
<dtml-var "test()">
<dtml-var standard_html_footer>

I go to http://zope/users/alany/test and get the following:

[<DTMLDocument instance at 8d6df90>, <DTMLMethod instance at 8ddff28>, 
<DTMLMethod instance at 89e5ec8>, <DTMLMethod instance at 8be5d50>, 
<PerlMethod instance at 8d6ee88>]

which is to be expected.

I go to http://zope/users/alany/test/test and get the following:

Error Type: PerlError
Error Value: Can't call method "objectValues" on an undefined value at test 
line 1.

Change <dtml-var "test()"> to <dtml-var "test(self)"> and I get

Error Type: NameError
Error Value: self

Change <dtml-var "test()"> to <dtml-var "test(_)"> and I get

Error Type: PerlError
Error Value: Usage: Python::PyObject_GetAttr(o, attrname) at 
/home/zope/lib/perl/Zope.pm line 118.

All of these are errors are the same if I add a my $self = shift; line at the 
top of the method.

Help!

Basically, what I want to do is something like the following:

<dtml-in "sortObjects('size', 'reverse', 'Folder, File, Image')">
<tr class="<dtml-var currentcolor>">
 <td class="ShowFilesType"><img src="<dtml-var 
"_.getitem('sequence-item',0).meta_type">.gif" alt=""></td>
      <td class="ShowFilesName"><a href="&dtml-absolute_url;"><dtml-var 
title_or_id></a></td>
      <td class="ShowFilesModTime"><dtml-var bobobase_modification_time 
fmt="ISO"></td>
      <td class="ShowFilesSize">&nbsp;</td>
</tr>
</dtml-in>

Any ideas or suggestions?
-- 
I think my career is ruined!