Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

How do I pass command line args to test module?

by Anonymous Monk
on Oct 06, 2001 at 19:46 UTC ( #117208=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm writing a module and would like to test it with tests in t/. I need to pass each test the same command line argument. Is there an entry I can make in Makefile.PL that will pass the arg or do I need to write a mother test script that evals the other test scripts? TIA. TG

Comment on How do I pass command line args to test module?
Re: How do I pass command line args to test module?
by thraxil (Prior) on Oct 06, 2001 at 20:36 UTC
Re: How do I pass command line args to test module?
by Anonymous Monk on Oct 06, 2001 at 20:46 UTC
    I appreciate your input but...
    
    I did look at Test::Harness and found:
    
      The global variable $Test::Harness::switches is exportable and can be used
      to set perl command line options used for running the test script(s). The
      default value is `-w'.
    
    which I don't think is going to do what I want it to do.  My
    understanding is that $Test::Harness::switches = "-w blah" would
    result in
    
      perl -w blah t/test.t
    
    not
    
      perl -w t/test.t blah  < this is what I want
    
    Also, I want to set a variable in Makefile.PL that will set
    a variable in Makefile to be used by make test. 
    
Re: How do I pass command line args to test module?
by Anonymous Monk on Oct 06, 2001 at 22:38 UTC
    I figured it out!!!
    
    In the script prior to testing for command line args, I set them
    via the following:
    
    @ARGV = qw(blah);
    
    It seems to work as I wish it to.
    
    TG
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://117208]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-07-04 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls