++ 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:
- Do a data model of each file format
- 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.
- 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)
- Define a standard data model that represents all available data
- 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:
- Read in a file in format X and convert its data to the standard data model
- 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
-
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.
|