# from Ken Williams # on Monday 12 November 2007 20:00: >That doesn't jibe very well with the module case - otherwise we'd all > be setting variables like $lib::Module::Build::VERSION .
Except bin isn't in @INC and foo isn't a .pm file. But, require("./bin/foo") allows it to be loaded (assuming the bin::foo::main() sort of structure.) >In other words, 'bin' is not part of the name of the script, it's >just where the script lives by default. I would rather do >"program_name => 'foo'" and have it look for 'foo' in script/ . I think we still need to tell it where to look, even if we decide that's not part of the distro/package name. Hmm, perldoc searches the $PATH, so technically there's already a namespace collision between bin/foo and lib/foo.pm, though this gets solved by 'man', right? >> Would expect $bin::foo::VERSION and give you a >> 'bin-foo-v0.0.1.tar.gz' tarball. > >Here too I think 'bin' shouldn't be present. What if you decide you >want to offload some of the code from the 'foo' script into a module >in lib/? And then expose some of the guts with APIs? The 'bin' >moniker isn't really appropriate anymore. True. I sort of see the the applicability of bin:: as being somewhat of a frontend-only namespace though. As in: maybe it would be neat if bin::foo->VERSION told me something about $0, but I guess that's what $0 is for. Do we just go by $main::VERSION then? When your program grows-up into a module, it can use the App:: namespace or whatever. The guts could even be yanked into their own distro and made into a dependency of the script-only distro (of course, just `mkdir lib` and shipping with it would be fine too.) I think we should be talking about keeping 'bin/' or 'sbin/' or 'cgi-bin/' in the name in terms of possibly a META.yml field (which would potentially solve the downstream packager issue that Adam mentions.) program_name: bin/foo I guess it would become the debian package 'foo' (because they need to address the namespace collision at the $PATH level.) There is still a catch to addressability and namespace collision on CPAN though. Because the index has nothing for scripts, I was thinking that a "bin-foo" distro would hack that without interfering with any pragmas. Unfortunately, I seem to be mistaken. See bin::sqlpp, where a .pm file has been included apparently just to trick pause. So, should we try to address this in pause, the indices, CPAN(PLUS).pm, or just create a dummy .pm file? --Eric -- software: a hypothetical exercise which happens to compile. --------------------------------------------------- http://scratchcomputing.com ---------------------------------------------------