Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Freeze @INC?

by gaal (Parson)
on Jul 24, 2008 at 19:58 UTC ( [id://699953] : note . print w/replies, xml ) Need Help??

in reply to Freeze @INC?

I read this several times and it's not clear to me if you mean you want to cache the value of @INC, the variable, or snapshot the state on disk.

If it's the former, and you only have data in your computed @INC (not code), you can indeed just serialize to a file and load it in a BEGIN block. You'd probably want your own serialization as Storable might be on the list of things you want to control!

If the latter, I'd suggest avoiding symlink hell and just using PAR.

Replies are listed 'Best First'.
Re^2: Freeze @INC?
by Surge (Initiate) on Jul 24, 2008 at 21:40 UTC

    I apologize for lack of clarity.

    I do not want to snapshot the disk - the contents will not change.

    As thinking about it makes me realize, I wanted to do two things at once:

    • do the work of computing @INC in advance
    • reduce the number of computed elements in @INC by consolidating contents of multiple locations into one with symlinks

    The first is primarily for manageability and stability, the second is primarily for performance.

    I intend to follow your advice and snapshot a serialized @INC after it is computed. Data::Dumper seems to be the right answer, as it is readily available, if 5.8 or later can be assumed.

    Then I can do a few tests to see whether the performance component is actually a real concern in any of my cases. If so, I can add a sepearate step for consolidating many @INC components into one by caching symlinks.


      Data::Dumper is available for many versions into the past. I'd be surprised if it wasn't available in 5.0.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊