in reply to Re: RFC: Test::Sysconfig
in thread RFC: Test::Sysconfig

Thanks for your reply. You're right, my module is documented rather poorly. I'll be fixing that, but to briefly clarify here, the module has little to do with cfengine, aside from the fact that I use it to test my cfengine config on a staging server, before pushing it out to production.

As for check_package and file_contains, they check that a package exists and that a file's contents match a regexp, respectively. They call ok() (as in Test::Builder::Module's ok())

The failed test was a silly oversight on my part. I'd forgotten that some systems don't use dpkg and apt :). I'll have it skip that test on non-dpkg systems.

I've fixed the tests to work correctly on a non-dpkg system and clarified the docs quite a bit (I think :). Here is the fixed version. The Sys:: namespace seems like a good idea; I'm thinking something like Sys::ConfigTest... will ponder that for a bit.

Thanks again for taking the time to review this, and the great advice. ++.

Replies are listed 'Best First'.
Re^3: RFC: Test::Sysconfig
by naikonta (Curate) on Jun 27, 2007 at 16:02 UTC
    I see some improvements on the docs, and I now I understand what your module is trying to do. I just don't have yet a chance to find out if similiar solutions exist on CPAN. Some notes:
    • You may want to reconsider the check_package implementation because it's too centric on one favor of distro. I'm afraid that it's not that simple to verify that a package really exists, or even "usable" on the current system being tested.
    • I see that file_contains is some kind of another grep implementation. You just can't take arbitrary string and treat is a regex. It could blow your module and something happens you don't expect.
    • It's good to put a "SEE ALSO" section at the bottom of the POD and put Test::Builder::Module there, so users know where to find more information you don't need to provide
    Overall, I strongly recommend you to dig more on CPAN to find out 1) the more flexible and generic way to check package availability 2) the safer way to check file content with regex (think eval), there is a number of File:: modules you may find useful (althought you don't have to use them); also you may want to improve it so your module can check more than one pattern in the target file.

    Out of all, I'd still say, go ahead. Please be explicit that it's currently implemented for specific distro of specific operating system. If you find it useful for you, others may find it useful for them as well. And if they use different distro/OS, hopefully they implement that part for you. Good luck, jagh!


    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!