Richard Hainsworth
Richard Hainsworth

Reputation: 2125

Proper way of avoiding deprecated code warning

I use CompUnit::PrecompilationStore::File in a module, which passes all my tests under Rakudo v2022.02 (on my local machine I have not yet upgraded Raku).

Under Rakudo v2022.06, zef test . in the module directory causes a deprecation error (see details below) (reported to me in an issue on the module's github repo).

Simply replacing File with FileSystem in the relevant line locally now causes errors under Rakudo v2022.02.

What is the best way of handling this situation in the Module?

Details of error

Pod::From::Cache] Saw 1 occurrence of deprecated code.
[Pod::From::Cache] ================================================================================
[Pod::From::Cache] Use of the 'CompUnit::PrecompilationStore::File' class seen at:
[Pod::From::Cache]   /Users/coke/sandbox/raku-pod-from-cache/lib/Pod/From/Cache.rakumod (Pod::From::Cache), line 46
[Pod::From::Cache] Please use the 'CompUnit::PrecompilationStore::FileSystem' class instead.
[Pod::From::Cache] --------------------------------------------------------------------------------
[Pod::From::Cache] Please contact the author to have these occurrences of deprecated code
[Pod::From::Cache] adapted, so that this message will disappear!

Upvotes: 3

Views: 107

Answers (1)

Elizabeth Mattijsen
Elizabeth Mattijsen

Reputation: 26924

Run your code with the RAKUDO_NO_DEPRECATIONS environment variable set.

%*ENV<RAKUDO_NO_DEPRECATIONS> = 1;
CompUnit::PrecompilationStore::File.new(:prefix(".".IO));

Upvotes: 3

Related Questions