Module Testing Question

E

Eddie

Hi,

I wanted to test all the subroutines in my module from a script,
but I have a problem. Some subroutines are called from only
inside the module and some are not. Therefore I have code
like:

1 my ($pkg, @args) = @_
and
2 my @args = @_

in other places. Unfortunately if i test my sub routine that has #2 above,
I get an error because the package name is passed into the sub and the code
isnt
expecting that. Is there a way that a script can call a method in a module
and not
pass the package name?

Thanks,

Eddie
 
E

Eddie

Thanks so much. Unfortunately, I dont know the inner workings of Perl as
much as I should. I guess everyday is a learning day for me.

Ed
 
A

Anno Siegel

Eddie said:
Hi,

I wanted to test all the subroutines in my module from a script,
but I have a problem. Some subroutines are called from only
inside the module and some are not. Therefore I have code
like:

1 my ($pkg, @args) = @_
and
2 my @args = @_

in other places. Unfortunately if i test my sub routine that has #2 above,
I get an error because the package name is passed into the sub and the code
isnt
expecting that. Is there a way that a script can call a method in a module
and not
pass the package name?

Just a terminological nitpick here. If it doesn't expect the package
(or an object) as the first parameter, it isn't a method but a plain
subroutine. As Christian Winter has suggested in another reply, don't
call the non-methods as methods and you're set.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top