Skip Menu |

This queue is for tickets about the UNIVERSAL-require CPAN distribution.

Report information
The Basics
Id: 30086
Status: open
Priority: 0/
Queue: UNIVERSAL-require

People
Owner: Nobody in particular
Requestors: STEFFENW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in:
  • 0.10
  • 0.11



Subject: version check missung at method use
missing ------- use Module 123; use Module 123 @import_list; there is implemented only ------------------------- use Module; use Module @import_list;
Subject: Re: [rt.cpan.org #30086] version check missung at method use
Date: Thu, 18 Oct 2007 14:12:16 -0400
To: bug-UNIVERSAL-require [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Steffen Winkler via RT wrote: Show quoted text
> missing > ------- > use Module 123; > use Module 123 @import_list; > > there is implemented only > ------------------------- > use Module; > use Module @import_list;
I think I understand what you're saying, but some UNIVERSAL::require code illustrating the problem would help. Do you mean that $module->use() has no way to do a version check? Yes, and the magic syntax is problematic. How does one express "use Module 1.23 @import_list" as a method call? use_with_version_check( $version, @imports )? Incidentally, there is the magical Perl built-in version check which is "use Module 123 @import_list" and then Exporter has it's own version check. That makes "use Module 123, @import_list" work. For example... $ perl -wle 'use UNIVERSAL::require; print Exporter->use( 999, qw(foo) ); print $UNIVERSAL::require::ERROR' 0 Exporter version 999 required--this is only version 5.58 at /usr/local/perl/5.8.8/lib/Exporter/Heavy.pm line 121. But the module must be an Exporter for this to work. Things which write their own totally customized exports, like CGI, won't work. -- Whip me, beat me, make my code compatible with VMS!
From: STEFFENW [...] cpan.org
Thank youe fro anwering. The topic of my problem was - Find a module that is nearly the same like: my $code = "use $module $version"; # mustn't have import, because oo eval $code; $@ and die "$@ at $code"; I have tested your code examples and later I have found some code snippets in your source. Now I show you my idea. Please comment. perl -wle 'use strict; use UNIVERSAL::require; CGI->require(3.16) or die $UNIVERSAL::require::ERROR; CGI->use(qw(redirect)); print redirect (q(bla));' -- expected fail -- CGI version 3.16 required--this is only version 3.15 at -e line 1. perl -wle 'use strict; use UNIVERSAL::require; CGI->require(3.15) or die $UNIVERSAL::require::ERROR; CGI->use(qw(redirect)); print redirect (q(bla));' -- expected ok -- Status: 302 Moved Location: bla Buuuuuuut: There is no wrapper method use_with_version_check. You wrote exactly.