Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This might sound like it's coming from nowhere, but your module belongs nowhere more than in the Lingua::EN namespace. Perhaps Lingua::EN::Time::Duration would work.

Let me explain. Your module is, after all, Anglocentric. A module in DateTime or other general-purpose namspaces in my opinion should not be so centered on a single natural language. I certainly wouldn't want to use an application library that only accounted for Brazilian Portuguese users or Chinese users that came from a general-purpose repository.

I think the criteria for putting such a thing in the DateTime namespace should include some more than just working with dates and times. It should be more data-centric, with language definitions that allow one to specify a language and get the duration in that language. If it defaults to English and the only initial language definition is English, those two things wouldn't bother me a bit. However, I think it's pretty arrogant of Anglophones to assume that a general-purpose tool should be built around English as an intimate part of the problem description (and I'm a corn-fed Midwestern guy, so this isn't just some anti-American backlash).

Alternatively, instead of having a data-centric solution under DateTime, multiple different Lingua::foo::Time::Duration modules could pop up once the theme is set. That would be bad for code reuse, but it would allow each to combine the strings with the code with no problem and also allow any special idea of time we don't understand (half or quarter hours being special, a four-hour watch, etc) to be coded separately. In all, it's probably best to make it based around a language definition and share the code, though. Special cases could be taken care of by subclassing.

I guess what my point boils down to is that your killer feature that should be offered to an existing module maintainer or used as the justification of a new CPAN module should be natural language independence. I think a DateTime::Duration or DateTime::NaturalLanguage or whatever that is easy to make work with more than one natural language would be a heck of a tool. Time::Duration has already been localized into at least Swedish and Japanese, and it'd be really nice if that could be done without changing strings in the code.


In reply to Re: RFC: My duration-formatting module by mr_mischief
in thread RFC: My duration-formatting module by Spidy

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-24 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found