use warnings;
use strict;
package Obj;
use Exporter qw(import);
our @EXPORT_OK = qw(foo);
sub new {
return bless {}, shift;
}
sub foo {
my $self;
if ($_[0] eq __PACKAGE__ || ref $_[0] eq __PACKAGE__){
$self = shift;
}
my ($x, $y) = @_;
return $x * $y;
}
####
use warnings;
use strict;
use feature 'say';
use lib '.';
use Obj qw(foo);
my $o = Obj->new;
say $o->foo(2, 2);
say Obj::foo(2, 2);
say foo(2, 2);
####
4
4
4