Re: Use vs Require with version number

2015-03-05 Thread SSC_perl
On Mar 4, 2015, at 8:15 PM, Brandon McCaig wrote: That could matter in rare, silly cases. In most cases, it wouldn't really matter (usually we require modules and assert versions at the beginning of a program or module before anything else is actually done). That explains it.

Re: Use vs Require with version number

2015-03-05 Thread Kent Fredric
On 5 March 2015 at 17:15, Brandon McCaig bamcc...@gmail.com wrote: Uri means that use is effectively requiring the module with a BEGIN block. That means that it will execute before any other code that isn't in a BEGIN block. It may also be worth mentioning that BEGIN is actually a sub. A

Use vs Require with version number

2015-03-04 Thread SSC_perl
Hi all, I'm just curious about something. What's the difference between using require 5.016; or use 5.016; The only thing I've seen is that if 5.16 isn't installed, 'use' outputs: Perl v5.16 required--this is only v5.10.1, stopped at shop.cgi line 26. BEGIN failed

Re: Use vs Require with version number

2015-03-04 Thread Uri Guttman
On 03/04/2015 09:12 PM, SSC_perl wrote: Hi all, I'm just curious about something. What's the difference between using require 5.016; or use 5.016; The only thing I've seen is that if 5.16 isn't installed, 'use' outputs: Perl v5.16 required--this is only v5.10.1, stopped

Re: Use vs Require with version number

2015-03-04 Thread SSC_perl
On Mar 4, 2015, at 6:14 PM, Uri Guttman wrote: it is more about when the check is done. use is done at compile time and require is done at run time. also use effectively calls require to load the module and then it may do importing as well. when a module is loaded it will run any use

Re: Use vs Require with version number

2015-03-04 Thread Uri Guttman
On 03/04/2015 11:15 PM, Brandon McCaig wrote: I think that generally you should be using `use' unless you have a specific need to use require directly. `use' will call require() under the surface when needed so to you it's basically the same, but it has added benefits that make sense generally

Re: Use vs Require with version number

2015-03-04 Thread Brandon McCaig
then and there before any consequences can be carried out. I think that generally you should be using `use' unless you have a specific need to use require directly. `use' will call require() under the surface when needed so to you it's basically the same, but it has added benefits that make sense generally

trim (was: Re: use vs require)

2009-01-24 Thread Dr.Ruud
Chas. Owens wrote: [trim] $string =~ s/^[ ]*(.*)[ ]*$/$1/; That changes the string when not necessary. I prefer this: s/\s+$//, s/^\s+// for $string; # rtrim + ltrim -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail:

use vs require

2009-01-22 Thread ben perl
Hi Everyone, I am could never understand the difference between use vs require? If require is older way of including modules, why not just make it obsolete. Thanks, -Bandeep

Re: use vs require

2009-01-22 Thread Sebastian Cabrera
Hi ben, ben perl wrote: Hi Everyone, I am could never understand the difference between use vs require? If require is older way of including modules, why not just make it obsolete. nope there's even more than that. use loads the source when starting the script. require just loads it when

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 17:33, ben perl ben.pe...@gmail.com wrote: Hi Everyone, I am could never understand the difference between use vs require? If require is older way of including modules, why not just make it obsolete. snip Well, first off, because use uses require. The use looks

Re: use vs require

2009-01-22 Thread ben perl
...@gmail.com wrote: Hi Everyone, I am could never understand the difference between use vs require? If require is older way of including modules, why not just make it obsolete. snip Well, first off, because use uses require. The use looks something like this internally BEGIN { require

Re: use vs require

2009-01-22 Thread Owen
Hi Chas, Can you give me an example when one would be used over the other? So, is require used more for efficiency, so we load the module only if we need it? Thanks, -Ben Bit of a conundrum there, if you don't need a module, why include it in your program. Anyway you might have your own

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 18:01, ben perl ben.pe...@gmail.com wrote: Hi Chas, Can you give me an example when one would be used over the other? So, is require used more for efficiency, so we load the module only if we need it? Thanks, snip Efficiency is one reason (loading modules you won't use

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 18:35, Owen rc...@pcug.org.au wrote: Hi Chas, Can you give me an example when one would be used over the other? So, is require used more for efficiency, so we load the module only if we need it? Thanks, -Ben Bit of a conundrum there, if you don't need a module,

Re: use vs require

2009-01-22 Thread Rob Dixon
Chas. Owens wrote: What is so hard about $string =~ s/^[ ]*(.*)[ ]*$/$1/; It's not hard, it just won't strip trailing spaces because your captured string has a greedy quantifier! I usually use s/^\s+//, s/\s+$// for $string; Rob -- To unsubscribe, e-mail:

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 19:12, Rob Dixon rob.di...@gmx.com wrote: Chas. Owens wrote: What is so hard about $string =~ s/^[ ]*(.*)[ ]*$/$1/; It's not hard, it just won't strip trailing spaces because your captured string has a greedy quantifier! I usually use s/^\s+//, s/\s+$// for

Re: use vs require

2009-01-22 Thread Ralf Peng
2009/1/23 ben perl ben.pe...@gmail.com: Hi Chas, Can you give me an example when one would be used over the other? So, is require used more for efficiency, so we load the module only if we need it? Thanks, -Ben Many time we need 'require' not 'use'. For example, given this .pm: package

Re: use vs. require in modules

2004-08-04 Thread Christopher J. Bottaro
heh, that was it, thanks a bunch. Randal L. Schwartz wrote: Christopher == Christopher J Bottaro [EMAIL PROTECTED] writes: Christopher My::Utils Christopher use Exporter; Do you have @ISA = Exporter too? Much easier to write this as use base 'Exporter'; This might be why

Re: Use and Require

2004-01-31 Thread Robert
Wiggins D Anconia wrote: Mallik wrote: What is the difference between Use and Require. See perldoc -f use perldoc -f require Why do you ask? /R Wow such a civilized answer. Some would say... S R Q I R E This is such a nice list. Time to revisit: http://www.catb.org/~esr/faqs/smart

Re: Use and Require

2004-01-31 Thread Wiggins d'Anconia
Robert wrote: Wiggins D Anconia wrote: Mallik wrote: What is the difference between Use and Require. See perldoc -f use perldoc -f require Why do you ask? /R Wow such a civilized answer. Some would say... S R Q I R E This is such a nice list. Time to revisit: http://www.catb.org

Re: Use and Require

2004-01-30 Thread drieux
On Jan 29, 2004, at 9:57 AM, Mallik wrote: [..] What is the difference between Use and Require. [..] The easiest way to think about it was that once upon a time we wanted to have 'functions' that would be in 'perl libraries' - so there needed to be a directive that indicated that the code

Re: Use and Require

2004-01-30 Thread Peter Scott
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mallik) writes: Dear Perl Gurus, What is the difference between Use and Require. use Foo; is equivalent to: BEGIN { require Foo; Foo-import; } -- Peter Scott http://www.perldebugged.com

Re: Use and Require

2004-01-30 Thread mcdavis941
[.. old posts snipped ..] One important difference between 'use' and 'require' has to do with allowing your program to decide whether to include it or not. You CAN put 'require' inside an if statement, and it will only be executed if the if condition is true, allowing your program to decide

Use and Require

2004-01-29 Thread Mallik
Dear Perl Gurus, What is the difference between Use and Require. Thanks, Malliks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Use and Require

2004-01-29 Thread Rob Dixon
Mallik wrote: What is the difference between Use and Require. See perldoc -f use perldoc -f require Why do you ask? /R -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Use and Require

2004-01-29 Thread Wiggins d Anconia
Mallik wrote: What is the difference between Use and Require. See perldoc -f use perldoc -f require Why do you ask? /R Wow such a civilized answer. Some would say... S R Q I R E This is such a nice list. Time to revisit: http://www.catb.org/~esr/faqs/smart

RE: Use and Require

2004-01-29 Thread Dan Muey
Mallik wrote: What is the difference between Use and Require. See perldoc -f use perldoc -f require Why do you ask? /R Wow such a civilized answer. Some would say... S R Q I R E Who is Senior Qire? This is such a nice list. Time to revisit

Re: Use and Require

2004-01-29 Thread Jan Eden
definitely be found there. - Jan Mallik wrote: Dear Perl Gurus, What is the difference between Use and Require. Thanks, Malliks -- How many Microsoft engineers does it take to screw in a lightbulb? None. They just redefine dark as the new standard. -- To unsubscribe, e-mail: [EMAIL

Re: Use and Require

2004-01-29 Thread wolf blaum
For Quality purpouses, Mallik 's mail on Thursday 29 January 2004 18:57 may have been monitored or recorded as: Dear Perl Gurus, that must be someone else What is the difference between Use and Require. try perldoc -f use on your box (or www.perldoc.com): use Module VERSION LIST

'use' and 'require'

2003-08-04 Thread Allison, Jason (JALLISON)
Hello all, Is there a way to 'variablize' the version for a 'use' statement. This way, if I wanted to change version I could only change it in one place with those changes cascading across all apps. Usage would look something like this: use $perl_version; Thanks in advance, Jason Allison

RE: 'use' and 'require'

2003-08-04 Thread Bob Showalter
Allison, Jason (JALLISON) wrote: Hello all, Is there a way to 'variablize' the version for a 'use' statement. This way, if I wanted to change version I could only change it in one place with those changes cascading across all apps. Where would that one place be? Wherever that is, put the

RE: 'use' and 'require'

2003-08-04 Thread Allison, Jason (JALLISON)
The 'use' is giving me warning's against 5.6.1 code with 5.8.0: v-string in use/require non-portable at /PATH line #. I will need to update all of the 'use' statements from use 5.6.1; to use 5.006_001; My question is: How are others implementing common 'use' clauses across the applications so

Re: use and require

2003-01-23 Thread Rob Dixon
Beau E. Cox wrote: Hi - I thought I had a grip on this, but... Most of my reading (Camel, perldocs, etc) suggest that 'require Foo::Bar' should be used instead of 'use Foo::Bar' within modules. I am in the process of building a series of modules for a project and am having problems with

RE: use and require

2003-01-23 Thread Beau E. Cox
Hi Rob - -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 1:20 AM To: [EMAIL PROTECTED] Subject: Re: use and require Beau E. Cox wrote: Hi - I thought I had a grip on this, but... ... need it? Will I get multiple copies

use and require

2003-01-22 Thread Beau E. Cox
Hi - I thought I had a grip on this, but... Most of my reading (Camel, perldocs, etc) suggest that 'require Foo::Bar' should be used instead of 'use Foo::Bar' within modules. I am in the process of building a series of modules for a project and am having problems with 'require'; does whoever

Use vs Require

2002-07-11 Thread Jeff
I'm new to perl, but have a background in C. Can someone tell me what is the difference between 'use' and 'require'? When do you use one and not the other? Seems they both are comparable to a C header file (.h). Thanks in advance. Jeff

RE: Use vs Require

2002-07-11 Thread Shishir K. Singh
I'm new to perl, but have a background in C. Can someone tell me what is the difference between 'use' and 'require'? When do you use one and not the other? Seems they both are comparable to a C header file (.h). Thanks in advance. use is resolved during compile time whereas require

RE: Use vs Require

2002-07-11 Thread Peter Scott
At 01:27 PM 7/11/02 -0400, Shishir K. Singh wrote: I'm new to perl, but have a background in C. Can someone tell me what is the difference between 'use' and 'require'? When do you use one and not the other? Seems they both are comparable to a C header file (.h). Thanks in advance

RE: Use vs Require

2002-07-11 Thread Bob Showalter
-Original Message- From: Jeff [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 11, 2002 1:24 PM To: [EMAIL PROTECTED] Subject: Use vs Require I'm new to perl, but have a background in C. Can someone tell me what is the difference between 'use' and 'require'? When do you

use, do, require was Re: How to remove the loaded file

2002-05-31 Thread drieux
On Friday, May 31, 2002, at 02:30 , Sharan Hiremath wrote: [..] It is not the config file which will be used via require. I'm Gonna toss this back into the list - since this is a 'design issue' that I fear can frag other folks as well... { I think we all abuse the 'use', 'require' , 'do

USE IMPORT REQUIRE

2002-01-06 Thread nafiseh saberi
hi dear team. what is the difference between use , import , require. use HTML::Template; import HTML::Template; require HTML ::Template; thx. ___ Sincerely yours Nafiseh Saberi People will forget what you said ... People will forget what you did

Re: USE IMPORT REQUIRE

2002-01-06 Thread Chris Ball
On Sun, Jan 06, 2002 at 02:17:50PM +0330, nafiseh saberi wrote: what is the difference between use , import , require. See 'perldoc -q use require'. 'import' is not a perl keyword, and I'm guessing that you got it from looking at Python source somewhere. It does have a use in perl

USE IMPORT REQUIRE

2002-01-05 Thread nafiseh saberi
hi dear team. what is the difference between use , import , require. use HTML::Template; import HTML::Template; require HTML ::Template; thx. ___ Sincerely yours Nafiseh Saberi People will forget what you said ... People will forget what you did

Re: USE IMPORT REQUIRE

2002-01-05 Thread Jeff 'japhy' Pinyan
On Jan 5, nafiseh saberi said: what is the difference between use , import , require. The code: use Module qw( this $that ); is the same as: # BEGIN { } happens at compile-time BEGIN { require Module; Module-import(qw( this $that )); } Read 'perldoc -q require' for more

use or require?

2002-01-04 Thread Connie Chan
I 've read some doc about the difference of require and use... but I don't know what exactly that all means ?... what is run time and what is compile time ? all I hope to know is. which one will be faster and cost the minium loading vs time to the system, for a 1 time process.

RE: use or require?

2002-01-04 Thread Bob Showalter
-Original Message- From: Connie Chan [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 8:30 AM To: [EMAIL PROTECTED] Subject: use or require? I 've read some doc about the difference of require and use... but I don't know what exactly that all means ?... what is run

Re: use or require?

2002-01-04 Thread Christopher Solomon
On Fri, 4 Jan 2002, Connie Chan wrote: I 've read some doc about the difference of require and use... but I don't know what exactly that all means ?... what is run time and what is compile time ? all I hope to know is. which one will be faster and cost the minium loading vs time

use of require causing name space problems?

2001-06-21 Thread Rodney Holm
I have a few functions that are common to many different perl applications. All of these functions live in one file. I have many perl programs that run from cron that make use of these functions. So, in each of these programs I use require to gain access to these functions. Example: doit.pl

RE: use of require causing name space problems?

2001-06-21 Thread Rodney Holm
( a namespace ) of its own choosing, not your package. Second, require happens at run-time, so the decleration occurs to late to serve as a declaration in the file invoking the require. use - performs a require at compile time, then lets you import declerations

Re: use of require causing name space problems?

2001-06-21 Thread Me
Ok, I entirely retract my post to which this is a reply. Hey, I've been up all night. If the scripts are running as separate processes, then, well, I don't know. Does anyone know why perl behaves like this? [see earlier posts in thread]