develooper Front page | perl.perl5.porters | Postings from February 2022

pre-RFC: auto-require

Thread Next
From:
Felipe Gasper
Date:
February 18, 2022 16:41
Subject:
pre-RFC: auto-require
Message ID:
7E3F2CE6-F8F6-4A2B-A7C5-C6B36C3D0B80@felipegasper.com
Hi all,

	What if Perl included a feature to “auto-require” missing namespaces?

	That way you could, if we made a new “-R” flag to enable this feature, do:

perl -Re 'print JSON::to_json(["foo"])'

… and Perl would, when it sees that there’s no JSON::to_json() function defined, do a `require JSON` and then re-attempt.

	It’s not the kind of thing I’d advocate for more substantive projects, but for one-liners it’d be a boon.

	Thoughts?

-FG

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About