Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I just published version 0.12 of Test::MonitorSites to cpan. The bugs introduced at version 0.06 with its new functionality have at last been squashed (by version 0.09) and by now this module will run quietly and w/o obvious (to me) bugs.

However, I am not yet satisfied with the operation of the test suite. It's been doing the 'ET phone home' thing, because I haven't settled on an elegant way to propogate user input into the test suite, yet. I understand I can grab user input using the prompt() method. Once I have it, though, I need to use that input to rewrite a number of t/testsuite_*.ini files, replacing placeholder values with the user defined ones.

But how do I allow for the possibility that someone might run make test more than once? My current thinking is that the way to go here might be to create a new directory at t/ini/ which would have a set of stock configuration files needed to drive the test suite, each with its placeholders. Then have the Makefile.PL script use those to rewrite the real config files used by the test suite.

Am I making this harder than it needs to be? Is there a more elegant way to handle this without this proliferation of files on the system? My current approach is adding an additional prerequisite with File::Util. Is there a more straight-forward way of approaching this? Is there some platform independent way to avoid my use of File::Utils->list_dir() method and its additional dependency?

My Makefile.PL currently reads:

use strict; use warnings; use ExtUtils::MakeMaker; use File::Util; print "==> These tests generate email output + <==\n"; print "==> Where would you like your test results sent? + <==\n"; print "==> By default test email summaries go to dev-null\ +m <==\n"; print "==> By default test sms summaries go to dev-null\ + <==\n"; my $email = prompt('Send test email summaries to?',' +m'); my $sms = prompt('Send test sms summaries to?',''); my($f) = File::Util->new(); my @config_files = $f->list_dir( 't/ini' , '--pattern=\.ini$' ); foreach my $config_file (@config_files){ print "writing t/$config_file \n"; open ('INI','>',"t/$config_file"); open ('SRC',"t/ini/$config_file"); while(<SRC>){ if(m/^sms_recipients =/){ $_ =~ s/$_/sms_recipients = '$sms'\n/; } if(m/^results_recipients =/){ $_ =~ s/$_/results_recipients = '$em +ail'\n/; } print INI $_; } close SRC; close INI; } WriteMakefile( NAME => 'Test::MonitorSites', AUTHOR => 'Hugh Esco <>', VERSION_FROM => 'lib/Test/', ABSTRACT_FROM => 'lib/Test/', PL_FILES => {}, PREREQ_PM => { 'Cwd' => 0, 'Carp' => 0, 'File::Util' => 0, 'Data::Dumper' => 0, 'Test::More' => 0, 'Test::Pod' => 1.14, 'Test::Pod::Coverage' => 1.04, 'Test::Builder' => 0, 'Mail::Mailer' => 0, 'Config::Simple' => 0, 'WWW::Mechanize' => 0, 'Test::WWW::Mechanize' => 0, 'Test::HTML::Tidy' => 0, 'HTTP::Request::Common' => 0, 'Test::Builder::Tester' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', } +, clean => { FILES => 'Test-MonitorSites-*' }, );

I have now posted to cpan, version 0.13, which incorporates the approach outlined above and busts the ET-phone-home bug which was previously a part of the test suite. It also allows for the clean up of the t/*.ini files with `make clean`, as well. I'm still looking for ways to get this done without the extra dependency. Thanks to diotalevi for the lead about postponing the work until the build itself.

if( $lal && $lol ) { $life++; }

In reply to Propogating user settings w/ ExtUtils::MakeMaker by hesco

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2021-05-13 10:32 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (134 votes). Check out past polls.