in reply to Splitting large module

When my module Types::Standard grew to over 2000 lines, I decided to split out some of the bigger method definitions into separate files. I replaced them in the main module with stub subs which when called, load the file where the real sub is called, grab the real function and replace the stub sub.

This has reduced the main module to about 870 lines, and I'm considering splitting out even more subs to reduce it further. It makes loading the main module measurably faster at the cost of slowing down the first calls of the functions which have been split out (they'll run at normal speed thereafter).

UPDATE: since writing the above, I've gotten it down to about 680 lines.

Replies are listed 'Best First'.
Re^2: Splitting large module
by jimmygoogle (Initiate) on Jul 19, 2018 at 16:59 UTC

    So I figured it out, I was given a program that would split the file for me (written by someone else). The file I was splitting was ~13K lines and there must have been a bug in the code. I split the file by hand and I have no issues now.