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.
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
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
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 at
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
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
On Wed, Mar 04, 2015 at 06:26:41PM -0800, SSC_perl wrote:
So there's only really a difference for loading modules, not
for setting the minimum version number?
There could be a difference if code with side effects is done
first. By being done at compile-time, Uri means that use is
effectively
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:
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
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
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
...@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
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
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
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,
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:
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
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
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
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
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 is
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.
-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
23 matches
Mail list logo