On Mon, Apr 12, 2010 at 9:45 AM, Harry Putnam <rea...@newsguy.com> wrote:
> Shawn H Corey <shawnhco...@gmail.com> writes:
>> Perhaps you should consider writing the data in XML:
> I guess you're thinking of some automated way to enter the necessary
> info eh?
>
> I mean it looks like a heck of a lot more typing.. Or a much more
> complex abbrev expansion.
>
> Then finding the place to start editing would be more messing around
> too.  Plus it would require specific perl modules to be present.

XML is as machine-friendly as it is user-friendly. Additionally, it's
standardized and is well supported by existing libraries and tools.
It's more verbose than a purely user-friendly format, but it's also
easier to parse and deal with from a machine.

For the best of both worlds, you could write a simple interface tool
that takes in a simpler format, such as the one you propose now, and
outputs the corresponding XML. This would make it just as
user-friendly as your format, but ultimately make the output data more
accessible.

$ mkev
20110401

Avenge my honor...
^D
<event date="20100401">
    <![CDATA[
    Avenge my honor...
    ]]>
</event>

> I'm not sure I get why I'd want to do that rather than a more simple
> and primitive script that any basic perl installation will handle.

That's something you'll need to weigh. Personally, I find working with
XML to be satisfying. Existing tools make it a breeze to work with.
Not only for validation and parsing, but also for transformation
(converting to another format for another application, possibly
written by someone else) or styling (e.g., prettified output in a Web
browser).

> The format I came up with is easily verifiable in a glance.
>
> Currently I was trying to use the closing `ev' on a line by itself to
> trigger what ever action is required.
>
> I'm thinking now about reworking some of the script so that the last
> line `ev$' can be dropped too.  Using the next `ev YYMMDD' pattern, or
> eof to trigger writing
>
> So the format would then be even easier to verify in a glance.

I'm not 100% sure about what the rules of your format are, but what if
a user wanted an event to literally just contain "ev"? It doesn't mean
much to me, or probably you, but it might to a user. You could allow
them to escape it or something (e.g., "\ev"), but that complicates the
format. XML can obviously be complicated as well, but the advantage is
that it's already been designed, standardized, and implemented many
times. The thinking and heavy lifting is already done.

I'm not saying that you should absolutely use XML. I'm just urging you
to consider it. :)

-- 
Brandon McCaig <bamcc...@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to