bugsbunny has asked for the wisdom of the Perl Monks concerning the following question:

hi there,

I'm working as sysadmin at the moment (not as programmer :"( ) .. and what I see I'm doing from a long time is that instead of making a OO oriented tools for doing my work I mostly do a small and quick scripts to do this and that (which is not bad of course)...
I look now and see many small ones... at the start of my work i started common framework but after a while i got in situation that I can't cope with supporting this effort, 'cause more thinking is needed before u start changing OO stuff, rather than just write some lines of code...
Now I know for most of the handy sysadmin tasks small simple tools are better..
But !! I was thinking may be if there is some way to do both things simultaneously it would be much much better ...
So I'm asking here for your ideas !
How to combine writing small simple scripts and in the same way be able to call these tools with smallest possible overhead as object/methods of some bigger OO framework that can have a decent API and so on... u know code reuse..:")
The main problems as I see them are :

1. Scripts can be on different machines
2. Syncronizing the framework between machines i.e. /lib /scripts /etc ..directories consistent is harder
3. Isolation of the classes/methods of each other can be a tricky thing. Changing of a script, module must preserve the whole system working, but just this small portion u are working in flux
4. Keep call/fork overhead small

Preserve easy adhoc programming with the GRAND DESIGN(tm) :")
How u DO this ?

Replies are listed 'Best First'.
Re: OO + command line tools
by jeffa (Bishop) on Oct 10, 2003 at 20:18 UTC
    Make CPAN modules. Seriously.

    First, of course, you need to decide what functions will become library "methods" and take the time to design your classes. You don't even need to make full blown OO classes, just enough to be able to 'use' them in your client scripts.

    Then, read perlnewmod and learn how to make CPAN modules (also take a gander at Module::Build). Once you have a tar ball, you can install it on any box that you need (root access is best). You can even make your own local "in-house" CPAN mirror site that only contains your modules, if you like. Then you just configure the CPAN.pm cpan shell command to fetch from it. Now updating and installing new modules is a breeze.

    One thing to consider however ... maybe all of these 'utility functions' that you want to incorporate already exist in one CPAN module or another. Since i really started using the CPAN, i find that most of my code is small scripts that just glue existing modules together.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      thanx, how to make my own small CPAN.. do u have a link..