A rambling on the topic of generative AI.
By Adam on 1 Feb 2025, 08:22 - Ramblings - Permalink
While trying to write the script mentioned in a prior post, I decided that I would use an XML parsing module of some sort rather than writing my own. A quick google search turned up a number options, but I wasn't quite sure which would be best for my use-case. I knew that I wanted to specifically read RSS feeds, so using a general purpose XML parser was probably overkill if there was a more RSS-focused option available. I found several RSS-focused modules to choose from, including XML::RSSLite; which sounded promising as a light-weight RSS-specific module.
The documentation was rather sparse, though, and I thought I might get a better idea of how to use it if I could see some examples. When a google search didn't turn up much in the way of results, I decided I would just ask an AI to create an example for me.
In its example, it makes this call:
my $rss = XML::RSSlite->new();
...Which might look reasonable on the surface, but it didn't actually work. Now, instead of understanding how the module works by reviewing a working example, I get to learn by trying to troubleshoot something else's broken code. After actually checking the documentation, it seems that "XML::RSSlite" isn't an object and the module never uses a "new" method. After I pointed this out, the AI gave it another go:
my $rss = XML::RSSlite->parse_url($feed_url);
Closer, I guess? It still doesn't work, though, because it's still trying to call on objects and functions that don't exist. I pointed that out again and let it try one more:
my $rss = XML::RSSlite->new();
Really?
Despite trying to prompt it into a correct answer, it kept admitting that each answer was wrong and then produced the same incorrect code again and again.
For reference, here's how the module is intended to be used:
use XML::RSSLite; parseRSS(\%result, \$content);
They can create an image of a cat riding a Craftsman lawnmower, because they know what cats and Craftsman lawnmowers should look like.

