Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
First off, you speak of "some of the things I use in every script". To me, that screams "config file". There are literally dozens of config file handlers on CPAN. My current favorite is Config::Std, but I've also used others, like Config::ApacheFormat, to good benefit. All that matters is that you pick one and are consistent.
Second off, you say "my scripts pretty much do the same thing". Then, you very nicely list each one and ask "Does it make sense to build a genric script ...?" My answer to that question is "No." You don't want to build a generic script, you want to build a general-purpose library. For example, you always set up an ftp connection first. Ok, create a connect_ftp() function and house it in some library. Why do it that way? Well, there's a lot of reasons. The biggest reason from a software engineering standpoint is testability of your library. You will want to verify that each piece works correctly on its own. You can't do that without a well-defined interface. But, for these little scripty-doos, you may not have the time for all that jazz. The most important reason for you is that you will be asked to write a quick one-off script to do something just like what your generic script would do, but ever so slightly different. Maybe, it needs to process files that have already been downloaded. Or, you might want to run the file processing without the DB connection. Or, you want to create a report from the DB. I don't know and, more importantly, neither do you. If you have all your different actions in a tinker-toy/lego type of setup, it becomes easy to write that one-off script. So, here's what I'd recommend:
Please ask if you want more information on any point above or if you have questions about what you're doing. :-) My criteria for good software:
In reply to Re: Of strict, globals, packages and style
by dragonchild
|
|