@filex7, Newparse2, $r1, $dom2... those are what I would call "magic numbers"... hard coded information inside code that really shouldn't be there, and that will eventually cause issues. Seems you're currently facing them.

You really want to fetch information from this website through a proper web API.

You can work many nights until 0300 hrs to patch this "large script" until you think it works, until it breaks again, and it will break again.

It's fragile, very poorly written, hard to understand at a glance, and what I'd call easy to break. I also think I'd be safe to say there are no unit tests to compare revisions.

This appears to be an X-Y problem. I would be hesitant to change this script in case it broke something irrelevant to the piece that you want to change. Instead, I'd write a new one to focus on the piece of information you need. At best, ensure you keep revisions of the current script as you change it. Depending on how big it is, with numbered variables like that, any change may break something far away.

Sorry to be the bearer of bad news, but my fix would be to fix it properly, not put a band-aid on it so that the next person has to deal with comments as informative as "#added stuff here 01142012" *

* - If I had a client where I read a comment like that and they didn't permit me to fix things properly, I'd fire them.


In reply to Re: perl Mojo DOM CSS syntax issues by stevieb
in thread perl Mojo DOM CSS syntax issues 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":



  • 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.