Unable to connect to calendars with Perl's Cal::DAV module

I’m attempting to connect to the url that is made available when you click the triple-dot next to the calendar and select “Link” from the list that appears. It’s in the form of:

https://x.com/remote.php/dav/calendars/username/calendarname/

My perl code is pretty basic:

my $cal = Cal::DAV->new( user => $user, pass => $password, url => $calendar);

Yet it errors out, with this message:

This is the WebDAV interface. It can only be accessed by WebDAV clients such as the ownCloud desktop sync client

I’m supplying the correct username and password, in the nginx access logs I see the requests… with the wrong password I get a 401 (unauthorized), but with the correct password it’s a 200.

The username was created specifically for this script, and it does have permissions to the calendar (including edit permissions).

As far as I know, Cal::DAV and the underlying HTTP::DAV modules are webdav-compliant libraries. Google and Stack Overflow come up with nothing relevant, at least that I’m able to find. I’m not entirely sure how to go about debugging this.

I’ve had only minor troubles connecting my iPhone and Macs to the Nextcloud calendars. I expected connecting a perl script to it to be less difficult than it has been so far.

Am I supplying the wrong url? Is this something else?