good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: perl Mojo DOM CSS syntax issuesby stevieb (Canon) |
on Jan 27, 2024 at 15:51 UTC ( [id://11157302]=note: print w/replies, xml ) | Need Help?? |
@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 Section
Seekers of Perl Wisdom
|
|