Sophie

Sophie

distrib > Mandriva > cooker > x86_64 > by-pkgid > 1243822e7df129a639ee31c72aac04d0 > files > 43

php-perl-1.0.0-34.x86_64.rpm

--TEST--
Test 33: calling objects methods with arguments
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$perl = new Perl();
$perl->eval(<<<PERL_END
package Foo;
  sub new {
    my \$this = shift;
    my \$type = ref(\$this) || \$this;
    my \$self = {};
    \$self->{'sum'} = 0;
    bless \$self, \$type;
    return \$self;
  }

  sub sum {
    my \$self = shift;
    foreach my \$x (@_) {
      \$self->{'sum'} += \$x;
    }
    return \$self->{'sum'};
  }

package main;
PERL_END
);
$foo = new Perl('Foo');
var_dump($foo->sum(1,2,3,4,5));
var_dump($foo->sum(1,2,3,4,5));
echo "ok\n";
?>
--EXPECT--
int(15)
int(30)
ok