I have a module like this:
and I'd like to break it up into smaller modules. The normal sub names are public methods, and the sub names with the leading underbar are private methods, so the private methods could go into another module. I managed to dopackage Foo; sub aa { my ( $self, $args ) = @_; my $val = $self->_aa ( $args->{'bar'} ); } sub _aa { my $self, $quux ) = @_; } sub bb { my ( $self, $args ) = @_; my $val = $self->_bb ( $args->{'foo'} ); } sub _bb { my $self, $fazoo ) = @_; }
and call that aspackage Foo::Bar; sub _aa { my $self, $quux ) = @_; } ..
but that's a bigger change than I'd like, and isn't as clean as the original.package Foo; sub aa { my ( $self, $args ) = @_; my $val = Foo::Bar::_aa ( $self, $args->{'bar'} ); } ..
I'd like to be able to have Foo::Bar (with the _aa method, and others) just be more of the Foo class (so I could still call $self->_aa in Foo, but the sub _aa would live in Foo::Bar. There's a way, but my digging so far hasn't uncovered it.
In reply to Breaking up a big module by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |