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

Re: CLI Args and Config Files: Best Practices?

by temporal (Pilgrim)
on Feb 01, 2013 at 10:21 UTC ( #1016502=note: print w/replies, xml ) Need Help??

in reply to CLI Args and Config Files: Best Practices?

Thanks for the reply perl514. Config::Tiny is fine for half of my problem. I was already using Config::Simple, which is about the same sort of thing just a little more feature-rich. I really wanted to bring all my argument handling under one roof - which AppConfig does really well

Anonymous Monk - yup, I just went ahead and did the AppConfig swicheroo specced out in my OP which works just fine for now, scribbled down a note about it just in case I need to change things. Excellent documentation! =)

It's also worth noting that most daemon(izer|ing|esque) modules don't play nice on Windows (as in, do not have ported incarnations compiled and waiting in the Perl Package Manager). Of course you had no way of knowing that I am shackled to a Windows machine. Oh, how I miss the days in sunny Linux pastures; frolicking with the tame, OS-supported fork implementations.

So to summarize my current solution: before initializing AppConfig I save @ARGV to more permanent place and just reparse all those arguments immediately after refreshing from the config file. This way I get to keep my CLI args just like I want but I can change other arguments 'on the fly' through the config file.

Now I'll just have to dream up a way to override that behavior, if necessary...

Strange things are afoot at the Circle-K.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016502]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2019-12-12 23:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found