http://www.perlmonks.org?node_id=636332


in reply to Re: How do I bury some code ?
in thread How do I bury some code ?

Sorry. I meant that the above works only if I put use WordExposed::LanguagesPrivate::French; and use WordExposed::LanguagesPrivate::Italian; in Word.pm, while I'd like to put those two instructions in Languages.pm only
# Word.pm package Word; use strict; use Class::Struct; use WordExposed::Languages; use WordExposed::LanguagesPrivate::French; # IT WORKS use WordExposed::LanguagesPrivate::Italian; # IT WORKS struct Word => { english => '$', language => '$', translation => '$', }; sub set { my $self = shift(); my $english = shift(); my $language = shift(); $self->english($english); $self->language($language); $self->_translate(); } 1;
My idea is to separate the bunch of methods I have around for a given structure into some different modules/files, without having to refer to all of them in the Module that defines the structure (Word.pm above). In such a way that only Languages.pm deals with Fench.pm and Italian.pm and I only have to make changes to Languages.pm if I want to add - say - German.pm

I thought that the above is the only way to make available the translate() method to the Word structure, if it is defined in another file. I understand it is not :)