> the one thing that > seems a bit odd is that Greg's example didn't have separate packages for > the separate files
yeah, I did something like this a long time ago, and can't remember how I did it exactly. Basically, I pulled the file in like a #include so no enclosing package because I wanted the constants to be #included directly into the package that was doing the #include. It's vaguely coming back to me that "use" just reads the file once, and after the first "use" perl just calls the import function. So, whatever I did way back when, I didn't use the "use" directive. I might have slurped the file and evaled it or something. Probably going to programmer hell for that. Anyway, I can't remember what I did, so I put a package around it and use the Exporter module to export the constants. Is there a way to tell Exporter to export all the subs in the package? I'm not very familiar with Exporter, but reading the docs, it is kind of funny that its an export module that discourages people from exporting. If exporting is really, really bad, then the module shouldn't exist at all. If the module exists, then let me export everything if I really want to. A file full of constants is only useful if they're exported. Greg > On Tue, 2013-03-05 at 08:12 -0500, Jordan Adler wrote: >> Using the constant pragma is best. Perldoc constant. > > the constant pragma (or Readonly) does express intent better than > prototyped subroutines named with uppercase letters that return constant > values. That doesn't apply to the problem here. > > The issue here seems to be how to have a module full of constants that > can be used in a (or more likely many different) modules, and the > constant pragma doesn't implement that part of the solution. > Mike's suggestion about exporting makes sense, but the one thing that > seems a bit odd is that Greg's example didn't have separate packages for > the separate files. Exporting is from one package to another, and a > separate file doesn't create an implicit package. (it could be the > packages were stripped in the "simplified" example posted but were in > Greg's original code.) > > > _______________________________________________ > Boston-pm mailing list > [email protected] > http://mail.pm.org/mailman/listinfo/boston-pm > -- _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

