Here's the nugget in the back on my brainpan today. I'm working on a project in which I need to create uuid/guid strings.

This currently involves some Makefile.PL and module hackery jiggery pokery because some uuid modules don't compile on windows, and some don't work on non windows. All code quality aside, this roughly equates to:

## Makefile.PL : PREREQ_PM if ($^O eq 'MSWin32') { eval 'use UUID 0.02;'; eval 'use Win32::Guidgen 0.02;' if $@; eval 'use Win32API::GUID 0.02;' if $@; %modules = ('UUID' => 0.02) if $@; } else { %modules = ('Data::UUID' => 0.10); }; ## module code sub uuid { my $uuidstring; if (eval{require UUID}) { my $uuid; UUID::generate($uuid); UUID::unparse($uuid, $uuidstring); } elsif (eval{require Data::UUID}) { my $ug = Data::UUID->new; my $uuid = $ug->create; $uuidstring = $ug->to_string($uuid); } elsif (eval{ # for some reason 'no warnings' won't squelch # the 'too late for INIT' warning in Win32::API::Type local $^W = 0; require Win32::Guidgen; }) { $uuidstring = Win32::Guidgen::create(); } elsif (eval{require Win32API::GUID}) { $uuidstring = Win32API::GUID::CreateGuid(); } else { throw Handel::Exception( -text => 'Required modules not found', -details => 'UUID/Data::UUID' ); }; return $uuidstring; };

As part of the refactoring process, I'd like to move all of this into a seperate module that Does The Right thing based on what is installed, and then only one module is needed in PREQ_PM.

Maybe I'm reading to much into it, but I think such a module that would abstract out which uuid core is being used might be useful to others on CPAN. As usual, the code is easy, but I'm having a hard time coming up with an appropriate module namespace/name for said module.

Any suggestions? Is it even worth it to others to have such a generic wrapper?


In reply to Module Naming Advice by jk2addict

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.