use strict; use warnings; my $auth = Mymodules::Auth->new(); $auth->auth('foo', 'bar'); package Mymodules::Auth; sub new { my $class = shift; my $self = {}; return bless $self, $class; } sub auth { my ($self,$user,$pass); ... }