I'm gone try to give a (partially) response to your question by formulating it otherwise. I understand your question as: "Which is better: use objects (blessed reference) or use structs (just references) to pass my data around in my application?"

The answer on this rephrased question is not easy because the answer is partly depending on your situation and partly about the principle.

If you are using blessed references, you're chosing the object oriented approach. If you are using simply references, you take the procedural approach. Both sides have their supporters, advantages and disadvantages.

Should you use objects? Depends on a couple of things. Are you familiar with OO? Are you familiar with OO in perl? Is this a simple one shot script or does will it be a part of a bigger system? Is your input data well structured and stable in time or is it subject of changes? Is the data heavily interconnected with other data? Do you need fast access? Will your application grow or is it a small script?... I refer you to the literature available about the subject for more information.

By looking at you'r code I personally would use the OO approach because it would confine all business logic about waypoints in one place. That should make you're code a lot easier to maintain.

But hey, I'm someone who uses OO all the time, even if it sometimes overkill...

The moral off the story: I think you can't really expect a clear answer because the answer is: it depends...


In reply to Re^2: reference versus bless by martell
in thread reference versus bless by arcnon

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.