Skip to main content

Greetings monks, question about reorganizing a Perl module, and if the following is a good approach:

The module is 7300 lines in one file and has 106 subs. I'll call it, its mostly called as an object like Cat->new(); but could be called like Cat->black() or Cat::Black::meow

To simplify maintaining this file I am thinking I can make a new sub directory in the same folder as the file call it Cat/ and move the 105 of the 106 subs to about 12 or 15 new .pm's in the new folder.

I plan later to rewrite one or more of those as XS modules. Cat/ etc.

Then in I would just have use Cat::Black; use Cat::White; use Cat:;tabby; ...etc in

The only sub I'd keep in is sub new which looks like this:

sub new { #Object Interface # my $type = shift; my $self = {}; $self->{dbh} = shift; bless $self, $type; $self; } 

I have a book on cleaning up old perl code but it is now a very old book LOL, will moving the subroutines to new files break old code that depends on TIA

submitted by /u/bug_splat
[link] [comments]