develooper Front page | perl.beginners | Postings from August 2009

function calling and object calling

Thread Next
From:
Jenn G.
Date:
August 10, 2009 23:14
Subject:
function calling and object calling
Message ID:
fbe35f750908102314q624d1b25u156478adb8f22013@mail.gmail.com
Hello,

When I create a package, and call its methods by both object way and
function (exported) way, how to avoid the conflict in arguments
passing?

for exmaple,


package myclass;

require Exporter;
our @ISA = qw/Exporter/;

our @EXPORT = qw/my_method/;


sub new {
    ...
}

sub my_method {

    my $self = shift;
    my @arg = @_;
    ...
}

__END__

But for function calling, "my $self = shift;" shouldn't be used.
So how to make both function calling and object calling work together?

Thanks.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About