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

If reading the file seems weird, maybe it is an issue of file/directory permissions?

Can you check whether the user your cron job runs as can access all directories in the path, starting from / ?

Also, does the minimal script still work when running from cron ?

Replies are listed 'Best First'.
Re^4: RSS Parsing not working on new machine
by wintermute115 (Acolyte) on Apr 15, 2025 at 12:07 UTC

    I haven't yet gotten to the point of running it from cron; so far I'm still testing it on the command line, but it's successfully writing these files, so permissions don't seem to be a problem.

    I have the minimal test reading successfully from cURL, and doing everything that the main script is doing to the Parser object.

    #!/usr/bin/perl use strict; use Data::Dumper; use Net::Curl::Easy qw(:constants); use XML::RSS::Parser; my $ua_string = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; r +v:30.0) Gecko/20100101 Firefox/30.0"; my $curl = Net::Curl::Easy->new; my $feedsrc = "https://feeds.simplecast.com/o4MKcfjK"; my $feed; $curl->pushopt(CURLOPT_HTTPHEADER, [$ua_string]); $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(); my $parser = XML::RSS::Parser->new(); $parser->register_ns_prefix('lc_itunes', 'http://www.itunes.com/dtds/p +odcast-1.0.dtd'); my $rss = $parser->parse_string($feed); print $rss . "\n";
    Which results in:
    $ ./test.pl % Total % Received % Xferd Average Speed Time Time Time + Current Dload Upload Total Spent Left + Speed 100 164k 100 164k 0 0 1267k 0 --:--:-- --:--:-- --:--: +-- 1271k XML::RSS::Parser::Feed=HASH(0x618af3317380)

    So that's working. I just can't see why it's breaking as part of the actual script, when it's clearly readable in isolation, and works fine on a different machine.