They should be pasted into your code. It makes it easy to see what it's doingIf the sub/module is named reasonably and it has a good interface, it's trivial to figure out what the calling code is doing, and will take much less space than a cut-and-paste job. Not everything has to be named "foo" ;) ..
I'd make "snippet" a new function. It would take two arguments:How is snippet(12345678) easier to understand than a well-thought-out modular interface?
and it eliminates a file operation.Is checking a remote site for updates any better? It sure seems less safe. I know that you as a snippet server administrator would have the best of intentions, but someone more malicious could spoof the site and send back any snippet. So now you're probably looking at doing cryptographic signatures, etc, before this would be taken seriously. Sounds like a lot to save a file operation.
It sounds like your problem with these small modules is not their size, but perhaps a dumb interface. You actually propose to solve a completely orthogonal problem, that of keeping code up-to-date. This does seem like a good problem to look at. Personally, I'd prefer something that planted itself in @ISA and checked CPAN for module auto-updates (I'm sure there are many tools like this out there already). This would happen behind the scenes of my current use statements, so would be of minimal impact.
To solve your original beef with these small modules, it's fine to tailor them to your own needs. Cut and paste the snippets into your code if they're trivial. Write your own with a better interface. Bug the original author to do it ;)
If I do this, you all must contribute to my snippet library (recommended max length per snippet will be announced), and you all must use it.Charming.
blokhead
In reply to Re: Auto-updating snippets.
by blokhead
in thread Auto-updating snippets.
by Wassercrats
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |