in reply to Re: When is "use module" not the same as require+import?
in thread When is "use module" not the same as require+import?
There is an easy way.
>perl -wle "BEGIN { require CGI; CGI->VERSION(100) };" CGI version 100 required--this is only version 3.15 at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Also, Exporter emulates this behaviour, so your code would have worked if CGI used Exporter.
>perl -e"{ package Mod; $VERSION='3.15'; } Mod->import(100)" >perl -e"{ package Mod; $VERSION='3.15'; use Exporter; @ISA='Exporter' +; } Mod->import(100)" Mod version 100 required--this is only version 3.15 at c:/Progs/perl58 +8/lib/Exporter/Heavy.pm line 121.
|
|---|