|
|
| Perl: the Markov chain saw | |
| PerlMonks |
Concatenate strings before Test::More::okby gctaylor1 (Hermit) |
| on Apr 19, 2009 at 19:52 UTC ( [id://758610]=perlquestion: print w/replies, xml ) | Need Help?? |
|
gctaylor1 has asked for the wisdom of the Perl Monks concerning the following question:
I've created a module with three exported subroutines and around 25 private subroutines. I'm now trying to write tests for both the exported and private subs. I can test for the exported subroutines just fine. I can test the private subroutines as long as I correctly use the fully qualified name. The problem is that I have to explicitly qualify the full module package and subroutine. What I want to do is put the package name(only) in a variable and then test the fully qualified package name using the variable followed by ::subroutine.
I think it's a simple concatenation problem, but I can't get it right.
In the tests below, 1, 2, 3, and 4 give the expected behavior.
The results: Here's my test file:
My module:
I'm frequently asked "what are you trying to do, what is your overall goal?" The primary objective is to learn Perl and attempt to help out somehow, someplace so I can contribute back. The snippet of the module is just an example. The real module let's me take one of three exported subroutines and a)fetches an RPM file via FTP from a server to install on a remote machine and then installs it, or b)just fetches it for manual installation, or c) lists various things(help on the script, current RPM version installed, RPM packages already fetched and on the machine, OS name, etc. about the remote machine). I'm just getting started on the testing phase. Right now, it's easier just to run the module/script to test the functionality but I want to understand how to test. Any and all feedback welcome. Thank-you.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||