You have an interesting case here. Personally, I don't see anything wrong with the approach you've started with, and I think trying to stuff subroutine refs into the GetOpt::Long usage to handle option dependencies is just going to obfuscate things. You don't need to go there, IMO. (I would especially advise against any approach the requires the options to be given in a specific order; this goes against the nature of option usage as most command-line users understand it.)
Apart from that, I have just a few nit-picks:
- Running the script with no args looks like a no-op; this should be treated the same as using the "-h|--help" option.
- You might consider working on the pod a bit... see if you can indicate some of the option dependencies in the synopsis, and/or re-order the list of options so the dependencies are more salient and make sense on first glance.
- For heaven's sake, provide an appropriate DESCRIPTION that at least gives an idea about what happens when the various settings are activated.
- Your "make_dirs" sub could be using the Perl-internal "mkdir" and "chmod" functions, rather than running a bunch of system calls, and I'm not sure what you gain by using !system "ls ..." or die as opposed to, say, ( -d "..." ) or die
- You have a "get_line" sub that is never called; I think it's very good that you never actually use this sub, and it would be fine to remove it from the script.