Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Organizing personal perl library (AKA, personal CPAN)

by rational_icthus (Sexton)
on Jan 31, 2006 at 20:40 UTC ( [id://526873]=note: print w/replies, xml ) Need Help??


in reply to Organizing personal perl library (AKA, personal CPAN)

Here's what I do:

I make sure to name all of my subroutines in each file sequentially like "sub s1", "sub s2", "sub s3"... This helps minimize the amount of space the file takes up on disk. Then, so I never lose track in a file, I split all subs into separate files (deleting all comments to save space) and name them sequentially as well, "f1s1.pm", "f1s2.pm", ..., "f1238s13.pm". I store all files right on C: (fewer directories means fewer bytes taken up on my machine) and then I use Google Desktop to search for files when I need them. With 12,462 files, Google Desktop still manages to find what I need in no time at all. I just sift through the ten or twenty results it kicks back until I find what I need and I'm set to go. Most of my files look like this:
use f1.s1; use f1.s2; use f1.s3; ... # about twenty or thirty lines omitted ... use f132.s12; if(f1::s3($a,$b)){f12:s3(f3:s2($b)+$a)} ...
What'cha think?

Replies are listed 'Best First'.
Re^2: Organizing personal perl library (AKA, personal CPAN)
by dimar (Curate) on Jan 31, 2006 at 22:21 UTC

    My guess is a lot of people will not like it, because the names are not descriptive at all. your idea, however, points to a long standing problem caused by the 'files and folders' paradigm of information management:

    • some people use filenames and directory names as a "UniqueID" (eg 20040123_001.pl)
    • some people use file and dir names as a "Description" (eg my_convert_to_html.pl)
    • some people use file and dir names as a "combination field" (eg conv_html_20040123_ver1_utf8.pl)
    • some people use file and dir names with special "symbols" to denote extra meaning, or influence the sort order when listing contents (eg 1docs, _about, !old)

    The problem with *all* of these approaches is that they are of diminished used unless you use them 100% consistently, and things can tend to 'break' when you find yourself needing to change a name for whatever reason.

    One approach is to use something like folksonomy tagging on your own local files, or use any of the various desktop search solutions. You can also be dilligent about adding metadata to your files (NOTE: some prefer a more neutral syntax, since it can be a lot less annoying if you can use the exact same documentation style in all of your code, regardless of programming language).

    All of the approaches mentioned here and elsewhere in this thread, however, are pale vestiges of what could be possible if filesystems were more 'tag' oriented or 'object' oriented than the old-but-popular 'folders and files' paradigm.

    =oQDlNWYsBHI5JXZ2VGIulGIlJXYgQkUPxEIlhGdgY2bgMXZ5VGIlhGV
Re^2: Organizing personal perl library (AKA, personal CPAN)
by sfink (Deacon) on Feb 01, 2006 at 07:01 UTC
    I don't think that's a very good idea.
    • First, "use f1.s1" is invalid syntax, proving that you are at least distantly descended from a breed of bears that was unable to hibernate properly.
    • Second, "f12:s3" isn't valid syntax either, raising serious doubts as to the identity of your father, and suggesting that you probably shouldn't be too confident of your mother either.
    • Third, you are going to a lot of work to save space, then completely covering up the fact that you have to put "1;" at the end of every file, frivolously throwing thousands of innocent bytes into the trash. If you had any brains at all left over from your unfortunate heritage, you would load them all from a single file.
    • The previous item is completely swamped by another source of waste evidently deriving from your tendency to lick the wrong side of stamps: the very first sentence of your post points out that you're repeating "sub " over and over again. Together with having all of these subroutines in separate files, that means that you will be placing the same uselessly repeated four bytes at the start 12,462 disk sectors. After lining up that many ones and zeroes, the magnetic field on your hard drive would set up excessively strong polarization in those areas, and would corrupt all surrounding data and probably destabilize the platters' rotation, causing them to hurl themselves at your neck. Although I doubt your exact species, I still don't think you could survive such a blow, and hence I highly suspect your assertion that you are actually using the techniques you describe (see the first two items in this list for corroboration.) Do you honestly expect us to believe that you wouldn't just install a subroutine into @INC that split apart the subroutines bodies appended immediately after each other and put them in a dummy filehandle wrapped with the appropriate subroutine declaration? I mean, you pretty much gave it away by naming your subroutines "s1", "s2", etc -- obviously, your @INC routine generates the subroutine names by constantly increasing a unique id.
    • Finally, you are revealed as the fraudulent peacock massage therapist we all know you truly are by your ridiculous filenames. If you had really gone to all that work to save space, obviously you would have put the subroutine definitions directly into the filenames themselves -- after all, we know you have an @INC routine to really load the subroutines, so why not use it for converting the restricted character set allowable in filenames into the full Perl alphabet? As a side benefit, searching is far easier (the original point of this thread), because the character set through which you search is much condensed. Ever try to Google for '/(?>.*?)/' ?
    In short, I feel your scheme is quite clever, but I am uncertain as to why you are concealing it from us behind such flimsy pretenses.
Re^2: Organizing personal perl library (AKA, personal CPAN)
by water (Deacon) on Feb 01, 2006 at 02:21 UTC
    this is a joke, right?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found