Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Reusing Compiled Perl or Opcode for Apache Server

by RonW (Parson)
on Aug 16, 2017 at 23:05 UTC ( #1197526=note: print w/replies, xml ) Need Help??


in reply to Re^2: Reusing Compiled Perl or Opcode for Apache Server
in thread [CLOSED] Reusing Compiled Perl or Opcode for Apache Server

I was wondering if there was a way to store the result of all these use calls in a way that would make it faster to load next time.

For a mod_perl application, I think it's impossible. Besides the many problems presented by Perl itself, mod_perl and Apache impose additional problems.

For a stand-alone Perl application, it's remotely possible, depending on what the modules loaded by use do and how. Also, how your Perl application uses those modules, what your application is doing and how it does it.

If any of those modules require shared libraries (also known as DLLs), probably impossible. There are also other things that use-ing a module can do that make loading a saved cache impossible.

The problems arise because in Perl use doesn't simply load a module. Modules can and often do have initialization code that has effects that can't be saved and reloaded. They have to be done every time the module is loaded.

Ideally, modules should be written to separate initialization from loading, but (1) initialization is often a big chuck of the "loading" time, (2) most people want the convenience of the automatic initialization and (3) too few people have a need to defer initialization that the extra logic to support a "load only" option in modules isn't worth the effort to maintain.

It's very likely to be impossible. I can understand that your employer may want you to try. You could look at https://metacpan.org/pod/distribution/B-C/script/perlcc.PL, but very doubtful anyone will be able to help you. Even if you were to write a new application completely on your own, it would still be very difficult to make the end result work correctly.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2019-05-26 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (153 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!