force using the version of a module

force using the version of a module

am 26.12.2009 17:02:24 von Jeff Peng

Hello,

The latest version of LWP::UserAgent (v5.834) has a method of
"local_address", which is needed by my software.

The lower version of this module (for example, v5.824) doesn't have that
method.

So how to force to use the latest version of LWP::UserAgent in the perl
script?

Thanks.
Merry Holidays!

Jeff.
____________________________________________________________
Love Spell
Click here to light up your life with a love spell!
http://thirdpartyoffers.netzero.net/TGL2241/c?cp=WY6rCVc8u7r 0rhlGINenTgAAJ1F5p0Q5uwV0jfKaKm9vU9yEAAYAAAAAAAAAAAAAAAAAAAD NAAAAAAAAAAAAAAAAAAAARwAAAAA=

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: force using the version of a module

am 26.12.2009 21:15:12 von derykus

On Dec 26, 8:02=A0am, jeffp...@netzero.net (Jeff Peng) wrote:
> Hello,
>
> The latest version of LWP::UserAgent (v5.834) has a method of
> "local_address", which is needed by my software.
>
> The lower version of this module (for example, v5.824) doesn't have that
> method.
>
> So how to force to use the latest version of LWP::UserAgent in the perl
> script?
>

use LWP::UserAgent 5.834; # See perldoc -f use

I'm not sure if there's a simpler way if loading with 'require
rather than 'use'. Perhaps:

use constant LWP_MIN_VER =3D> 5.834;
require LWP::UserAgent;
unless ( $LWP::UserAgent::VERSION >=3D LWP_MIN_VER ) {
die "LWP::UserAgent version ", LWP_MIN_VER, " required",
"--this is only version $LWP::UserAgent::VERSION\n";
}

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: force using the version of a module

am 27.12.2009 05:56:00 von Peter Scott

On Sun, 27 Dec 2009 00:02:24 +0800, Jeff Peng wrote:
> The latest version of LWP::UserAgent (v5.834) has a method of
> "local_address", which is needed by my software.
>
> The lower version of this module (for example, v5.824) doesn't have that
> method.
>
> So how to force to use the latest version of LWP::UserAgent in the perl
> script?

% perldoc -f use
use Module VERSION LIST
use Module VERSION
[...]
If the VERSION argument is present between Module and LIST,
then the "use" will call the VERSION method in class Module
with the given version as an argument. The default VERSION
method, inherited from the UNIVERSAL class, croaks if the
given
version is larger than the value of the variable
$Module::VERSION.

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: force using the version of a module

am 27.12.2009 08:11:10 von Jeff Peng

Peter Scott :

>
> % perldoc -f use
> use Module VERSION LIST
> use Module VERSION
> [...]
> If the VERSION argument is present between Module and LIST,
> then the "use" will call the VERSION method in class Module
> with the given version as an argument. The default VERSION
> method, inherited from the UNIVERSAL class, croaks if the
> given
> version is larger than the value of the variable
> $Module::VERSION.
>


Thanks. That's right for me.

Regards,
Jeff.


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/