Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

++ to GrandFather for asking about the wider problem.

It seems like the first question here is figuring out how the data in file format 1 maps to the data in file formats 2,3,4, etc. To work out this problem I would:

  1. Do a data model of each file format
  2. Note differences in terminology and cardinality of relationships. For example, is "category" in format 1 equivalent to "menu" in format 2? Does format X allow for recursive menus? Does format Y? Can a menu item belong to more than one menu? And so on.
  3. Note differences in data available for each format. For example, file format 2 appears to have four bits of information per menu item, whereas format 1 has only two (assuming each name/icon corresponds to a menu item)
  4. Define a standard data model that represents all available data
  5. For formats with missing information define defaults

And now that you have worked out the design issues, you can start thinking about how to morph file formats one into another. For a given format X and Y, this will involve two steps:

  1. Read in a file in format X and convert its data to the standard data model
  2. Traverse the standard data model to output the data in format Y.

You will need a read_format_to_standard() subroutine for each input format and a write_format_from_standard() routine for each output format. But without a good idea of the standard and how each format maps to it, you will be running in circles writing any of these.

Best, beth


In reply to Re: Building an arbitrary-depth, multi-level hash by ELISHEVA
in thread Building an arbitrary-depth, multi-level hash by Anonymous Monk

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 having a coffee break in the Monastery: (5)
As of 2024-04-19 06:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found