package Protected; sub fetchdata { my $pkg = shift; my $name = shift; my $pass = shift; #check the $name and $pass and process @request # or send an response indicating authentication error }