Re: Setting up a property on a Perl object causes segfault
[email protected] (David Wheeler) Tue, 2 Aug 2005 11:23:12 -0700
| Newsgroups | perl.php.sandwich.dev |
|---|---|
| Message-ID | <[email protected]> |
On Aug 2, 2005, at 11:18 AM, David Wheeler wrote:
> So, you should *always* use accessor methods:
>
> sub test {
> my $self = shift;
> return $self->{test} unless @_;
> $self->{test} = shift;
> }
>
> Then, your PHP code should:
>
> echo $obj->test();
> echo $obj->test(2);
That said, I would expect it to work if you treated the object as a
hash in PHP:
echo $obj['test'];
echo $obj['test'] = 2;
Hrm, but it doesn't:
Fatal error: Cannot use object of type PerlSV as array in
PHP::Interpreter::eval on line 28
A PHP error occured
Any ideas, George? (I'll fix the misspelling :-)).
Best,
David