rpaskudniak has asked for the wisdom of the Perl Monks concerning the following question:
(I was going to post on perlguru.com but some database issue seems to have gone wrong with that site. That aside..)
Greetings again.
2 years ago I wrote a module with utilities that invoke it. It all works well but it was not properly organized for CPAN. So the code is all there but I need to start fresh and transplant code from the older module as appropriate. However, I also want to use this as an opportunity to practice Moose and Function::Parameters and other trappings of "Modern Perl". And at the gate I have run into question on how to proceed. Here is the stub code that my h2xs invocation created; I have joined lines to keep it clear.
package DBD::Informix::DBspaces; use 5.022001; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( ); our $VERSION = '0.01';
(Yes, this is Informix oriented, for those who recognize the buzz words.) I'm planning three packages in here, with the "DBD::Informix::DBspaces" package referencing the other two. So now I have two questions:
- Do I need to specify "use Moose" in every package I define in that .pm file? Or will the one "use Moose" in the first package suffice for the other packages as well. Or how about "use Moose" even before the first "package" directive?
- All those "our" declarations and the "require", generated by h2xs: Do those need to be repeated in each package or is is sufficient to put them all up front, outside all the packages? I suspect that outside all packages will be fine but if it is not fine I will be greeted by a barrage of errors masking any syntax errors and other small stuff.
So this misunderstood less-than-genius seeks the experience of those who have already played in these fields and humbly thanks thee. (What's plural for thee? :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose in a module created with h2xs
by haukex (Archbishop) on Feb 22, 2019 at 19:48 UTC | |
by rpaskudniak (Novice) on Feb 22, 2019 at 20:07 UTC | |
|
Re: Moose in a module created with h2xs
by tobyink (Canon) on Feb 23, 2019 at 10:22 UTC | |
by Laurent_R (Canon) on Feb 23, 2019 at 10:41 UTC | |
by tobyink (Canon) on Feb 23, 2019 at 10:52 UTC | |
by soonix (Chancellor) on Feb 23, 2019 at 11:51 UTC |