in reply to Re^5: Do modules know the callers full path?
in thread Do modules know the callers full path?

The module can already download, parse and compare the old and new data to determine if there's an update. I can lose the DATA section and have the module install the data ~/.somewhere but that should be a place that is accessible to all users in any scenario (system, perlbrew, etc) who may run the module in a cross platform compliant manner; and that the module can write to. Is there even such a place?

It seems reasonable until I realized that checking for updated modules is probably not a very common activity among casual users of software. I could make the module expire by failing to run after a certain date, but that seems more evil than providing the (slightly) wrong data.

I was thinking about one way to do it, by invoking the module from the folder one wants the new data to reside, and then telling the module about it like:

[user@to] perl -MMy::Mod=:all -e 'update()' [user@to] Update detected! File saved to /path/to/data [user@to] perl -MMy::Mod=:all -e 'foobar(data=>"/path/to/data");baz()'
That would work but I don't like it because scripts and such would have to be changed too. It would be better if the module installed the data to some standard place and simply updated the data file:
[user@to] perl -MMy::Mod=:all -e 'update()' [user@to] Update detected! Using new data...
Or better make the module remember things and check once a month or so:
[user@to] perl -MMy::Mod=:all -e 'foobar();baz()' [user@to] Update detected! Using new data...
As you did intuit, it was a bad idea that inspired the OP node. ⛐

Thanks for helping!

Replies are listed 'Best First'.
Re^7: Do modules know the callers full path?
by soonix (Chancellor) on Feb 18, 2023 at 16:03 UTC
    that should be a place that is accessible to all users in any scenario (system, perlbrew, etc) who may run the module in a cross platform compliant manner; and that the module can write to. Is there even such a place?
    That sounds more or less like a place where "everyone" can write to. Being a systems admin at my employer's, I can tell you sysadmins don't like such places.

    I think the most reasonable approach would be to explicitly ask (e.g. via Parameter) for the place to store this info, so that the users would then forward this to their sysadmin who then could set up a place readable to all, and schedule an update job (e.g. monthly, or some schedule to be suggested by you)