I have this PM class file:
nodejs app.js
and I have the main test pl file:
use strict ;
use warnings;
package Math;
sub new{
my $class = shift;
my $self = {};
bless($self, $class);
return $self;
}
sub add{
my $x = shift;
my $y = shift;
return $x + $y;
}
sub substract{
my $x = shift;
my $y = shift;
return $x - $y;
}
sub multiple{
my $x = shift;
my $y = shift;
return $x * $y;
}
sub divide{
my $x = shift;
my $y = shift;
return $x / $y;
}
1;
From some reason I am getting odd results randomly with each run. Probably something easy (?) I did not touch perl for long time, digging an hour to find solution could not find ...Any help will be appreciated.
答案 0 :(得分:2)
When you use OOP in perl the first argument to each method is the thing you blessed
singular_table_name
HTH
答案 1 :(得分:0)
compile 'com.spoledge.aacdecoder:aacdecoder-lib:0.8'
答案 2 :(得分:0)
在Perl6中,以程序子程序调用的方式访问对象方法作为类方法是不可能的。但是现在你可以在没有引用的情况下调用方法抛出一个实例resp。对象,每个人都认为没问题:
赞: print add(2,3)。在您的情况下,当您忘记祝福引用变量的声明和定义时。
干杯。