Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What's the best way to use Any YAML (not YAML::Any)

by CountZero (Bishop)
on Mar 15, 2014 at 12:52 UTC ( [id://1078439]=note: print w/replies, xml ) Need Help??


in reply to What's the best way to use Any YAML (not YAML::Any)

You will have to have some YAML-modules installed, so why don't you install YAML::Any?

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics
  • Comment on Re: What's the best way to use Any YAML (not YAML::Any)

Replies are listed 'Best First'.
Re^2: What's the best way to use Any YAML (not YAML::Any)
by djerius (Beadle) on Mar 15, 2014 at 16:32 UTC
    That's a valid question. I'm not comfortable doing so for a few reasons:
    • YAML::Any is distributed as part of YAML. This is a module, not an application, so it might run in an environment where YAML is not available. I could certainly specify YAML as a requirement, but requiring installation of all of YAML just for YAML::Any seems like overkill. If YAML::Any were standalone, then I would have no reticence in requiring it.
    • As I read its code, YAML::Any won't use an already loaded module. I've decided that's an important thing to do.
      Does your application only rely on CORE modules? If not, you will have to assume that those non-CORE modules are installed with the users anyhow or they know how to install them. Little extra effort to install *some* YAML module too.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics
        This particular distribution does depend upon non-CORE modules, but the YAML support is optional (which apparantly I haven't stated).

        I don't think that requiring installation of a particular package when an adequate alternative is already installed is a satisfying solution. I haven't attempted to code such a requirement into Makefile.PL (or cpanfile) and see how the various CPAN clients handle it. I should probably do so.

        The run-time code would still need to select amongst the installed packages, so the original question woould still be cogent.

        I wonder if some sort of capabilities database would be of help here. Modules providing capabilities would be registered upon installation. At run time the database would be queried to determine which modules were available; if one hadn't been loaded, one would be.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1078439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 16:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found