in reply to Re^2: RSS Parsing not working on new machine
in thread RSS Parsing not working on new machine

It looks like the builtin try is getting depreciated, so I'm not keen on using it long term. Having said that, swapping in use experimental 'try'; works (for most feeds; see above). Swapping in Try::Tiny gives me this new error:

syntax error at /home/ross/scripts/podcasts/podcasts.pl line 233, near + ") {" Execution of /home/ross/scripts/podcasts/podcasts.pl aborted due to co +mpilation errors.

This is the section it's complaining about:

try { $curl->pushopt(CURLOPT_HTTPHEADER, [$ua_string]); $curl->setopt(CURLOPT_PROGRESSFUNCTION, \&no_progress); $curl->setopt(CURLOPT_NOPROGRESS, 0); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_CONNECT_ONLY, 0); $curl->setopt(CURLOPT_URL, $feedsrc); $curl->setopt(CURLOPT_WRITEDATA, \$feed); $curl->perform(); } catch { $broken = 1; #putting next in here complains that it's exi +ting a subroutine } if (!defined($feed)) { # <--- Line 233 $broken = 2; }

I can't see an error there, and it doesn't throw one without Try::Tiny, so that seems pretty weird.

EDIT

OK, I figured that out. The Try::Tiny try/catch blocks need a closing semicolon. So now I have a robust try that won't go away in future versions of perl, and isn't somehow messing up all the feeds, but some are still getting messed up in ways I don't understand.

Replies are listed 'Best First'.
Re^4: RSS Parsing not working on new machine
by ikegami (Patriarch) on Apr 15, 2025 at 19:26 UTC

    It looks like the builtin try is getting depreciated

    The word is deprecated. But what gives you that idea? It just stopped being experimental in the latest version (5.40), so why do you think it's going to be deprecated in the next one?

      I was sure I had a reference that said it was being deprecated (IIRC in 5.40), but now I can't find anything that looks similar so I have no idea if I just made it up. Sorry.

        It's the very opposite. 5.40 is when it became "a stable language feature". From perl5400delta,

        try/catch feature is no longer experimental

        Prior to this release, the try/catch feature for handling errors was considered experimental. Introduced in Perl version 5.34.0, this is now considered a stable language feature and its use no longer prints a warning. It still must be enabled with the 'try' feature.

        See "Try Catch Exception Handling" in perlsyn.

Re^4: RSS Parsing not working on new machine
by bliako (Abbot) on Apr 16, 2025 at 15:43 UTC

    a try{}catch{}; block needs a semicolon at the end!. It's not a block I guess. FYI, I have tried all of these and I ended up with plain old eval(). I can not be sure of the reasons now. But surely I went this routine a few times.