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 do

Re: Use vs Require with version number

2015-03-05 Thread Kent Fredric
On 5 March 2015 at 17:15, Brandon McCaig 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 special sub t

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

Re: Use vs Require with version number

2015-03-04 Thread Brandon McCaig
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. That could matter in rare, silly cases. In most cases, it wouldn't really matter (usually we "require" modules and assert versions at the b

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 &

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--th

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

Re: using require "file.txt"

2011-11-22 Thread Jim Gibson
On 11/22/11 Tue Nov 22, 2011 2:04 PM, "Chris Stinemetz" scribbled: > I am working on a Perl script that is getting quite lengthy so I thought I > would put the sub routines, hashes, and arrays in a seperate script from > the main. > > The program will run when I turn use strict off in the main

using require "file.txt"

2011-11-22 Thread Chris Stinemetz
h and array delaration in the second script. main script first few lines: #!/usr/bin/perl use warnings; use strict; use POSIX; use FileHandle; require "rt_evdo_pcmd_lib.pl"; #Market configurations has for cells my %marketInfo = ( "xxx" => { "start" => 300,

Re: Perl "require" and PERL5OPT

2009-11-11 Thread Paul Johnson
On Wed, Nov 11, 2009 at 08:54:55AM +0530, vaishnavi krishnan wrote: > Hi, > > I am trying to use a perl script like the following : > > main.pl: > require "abc.pl"; > print "In parent script\n"; > > abc.pl: > print "In abc.pl script\n&

Perl "require" and PERL5OPT

2009-11-10 Thread vaishnavi krishnan
Hi, I am trying to use a perl script like the following : main.pl: require "abc.pl"; print "In parent script\n"; abc.pl: print "In abc.pl script\n"; I have some perl options set in PERL5OPT, which work fine for main.pl but not for abc.pl. This is how my

Fwd: Require help in perl

2009-03-23 Thread Rajini Naidu
-- Forwarded message -- From: Rajini Naidu Date: Tue, Mar 24, 2009 at 10:12 AM Subject: Re: Require help in perl To: "Chas. Owens" Hi Chas, Thanks for the reply. Please find my answers inlined. > > > > Context : > > > > I am working on

Re: Require help in perl

2009-03-23 Thread Chas. Owens
On Tue, Mar 24, 2009 at 00:01, Rajini Naidu wrote: > Hi, > > Context : > > I am working on displaying load graph for all the days. > > > > I require a perl module which displays, > > all the days of the week and when I click > > On the particular day, it sho

Require help in perl

2009-03-23 Thread Rajini Naidu
Hi, Context : I am working on displaying load graph for all the days. I require a perl module which displays, all the days of the week and when I click On the particular day, it should go to the particular load graph. Any help is much appreciated. -Rajini

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: beginners-h...@pe

Re: use vs require

2009-01-22 Thread Ralf Peng
2009/1/23 ben perl : > 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'. Fo

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 19:12, Rob Dixon 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 $s

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: beginners-unsubscr...@perl

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 18:35, Owen 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 > >

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 18:01, ben perl 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'

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 pr

Re: use vs require

2009-01-22 Thread ben perl
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 On Thu, Jan 22, 2009 at 2:50 PM, Chas. Owens wrote: > On Thu, Jan 22, 2009 at 17:33, ben perl wrote: > > Hi

Re: use vs require

2009-01-22 Thread Chas. Owens
On Thu, Jan 22, 2009 at 17:33, 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. snip Well, first off, because use uses require. The use looks

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

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

Testing for a condition immediately after require

2008-06-06 Thread Travis Thornhill
I want to be able to tag a module with one or more tags that can be tested for after requiring it.   require 'module'; <test for existence of tags in 'module'>   Any ideas on the best way to accomplish this?   Thanks in advance  

Re: "require" question

2007-07-05 Thread oryann9
> When I see code that starts with: > > require 5.6.0; > > Does that mean that the version of Perl can be 5.6.0 > and above or that > it *has to be* 5.6.0? ...that version and above see the output fro

Re: "require" question

2007-07-05 Thread Chas Owens
On 7/5/07, Robert Hicks <[EMAIL PROTECTED]> wrote: When I see code that starts with: require 5.6.0; Does that mean that the version of Perl can be 5.6.0 and above or that it *has to be* 5.6.0? Robert from perldoc -f require VERSION may be either a numeric argument s

"require" question

2007-07-05 Thread Robert Hicks
When I see code that starts with: require 5.6.0; Does that mean that the version of Perl can be 5.6.0 and above or that it *has to be* 5.6.0? Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: is require a keyword ?

2007-06-15 Thread Garg, Mayank IN BOM SISL
Thanks Jeff, It helped -Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Friday, June 15, 2007 10:46 AM To: Subject: Re: is require a keyword ? Garg, Mayank IN BOM SISL 写道: > > > Hi Guys, > > I was going thru a script which ha

Re: is require a keyword ?

2007-06-15 Thread Jeff Pang
Garg, Mayank IN BOM SISL 写道: Hi Guys, I was going thru a script which had the the lines: require Exporter; require DynaLoader; what does these lines mean You may take a look at: perldoc -f require -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

is require a keyword ?

2007-06-15 Thread Garg, Mayank IN BOM SISL
Hi Guys, I was going thru a script which had the the lines: require Exporter; require DynaLoader; what does these lines mean Regards, Mayank

Re: how to use require??

2007-03-14 Thread Randal L. Schwartz
> ""Mumia" == "Mumia W " writes: "Mumia> $dsn and $dbh are lexical variables that are restricted to dbcon.pl. You might "Mumia> want to consider using package variables. e.g: Or, just figure out how to break apart your program properly. Export behavior, not data. Create a package that pro

Re: how to use require??

2007-03-14 Thread Mumia W.
g package variables. e.g: our $dbh = ...blah blah Now I have created a another file login.pl there i include dbcon.pl using require. -- #!/usr/local/bin/perl -w require "include/dbcon.pl"; use warnings; Missing: use strict; use CGI; use CGI::Session; my $cgi

Re: how to use require??

2007-03-14 Thread Jeff Pang
-Original Message- >From: Umar Draz <[EMAIL PROTECTED]> >Sent: Mar 14, 2007 6:37 PM >To: beginners@perl.org >Subject: how to use require?? > >HI dear members! I have a file called dbcon.pl into include directory. > >#!/usr/local/bin/perl > >use DBI;

how to use require??

2007-03-14 Thread Umar Draz
"; my $tnt="xyz"; # Connect Database my $dsn = "DBI:$driver:database=$db;host=$host"; my $dbh = DBI->connect($dsn, $user, $pass); Now I have created a another file login.pl there i include dbcon.pl using require. -- #!/usr/local/bin/perl -w require "inclu

Re: Compilation failed in require

2006-08-23 Thread Ranish George
Bala Murugan wrote: Hi All, While running the following temp.pl script, it throws the following error message. $ perl temp.pl HELLO Compilation failed in require at temp.pl line 2. $ $ cat temp.pl #!/usr/bin/perl require "/home/bala/hello.pl"; $ cat hello.pl #!/usr/bin/perl di

Re: Compilation failed in require

2006-08-23 Thread John W. Krahn
Bala Murugan wrote: > Hi All, Hello, > While running the following temp.pl script, it throws the following error > message. > > $ perl temp.pl > HELLO > Compilation failed in require at temp.pl line 2. > $ > > $ cat temp.pl > #!/usr/bin/perl > require "

Compilation failed in require

2006-08-23 Thread Bala Murugan
Hi All, While running the following temp.pl script, it throws the following error message. $ perl temp.pl HELLO Compilation failed in require at temp.pl line 2. $ $ cat temp.pl #!/usr/bin/perl require "/home/bala/hello.pl"; $ cat hello.pl #!/usr/bin/perl die "HELLO\n"; If

Re: require or use

2006-05-09 Thread Gopal Krishnan
Hi, require $file is like do $file, except the former: checks for redundant loading, skipping already loaded files. raises an exception on failure to find, compile, or execute $file. use Module is like require Module, except the former: loads the module at compile time

Re: require or use

2006-05-09 Thread Paul Johnson
On Tue, May 09, 2006 at 03:16:45PM +0800, Practical Perl wrote: > Could anyone tell me what's the difference between 'use' and 'require'? > And,is there any difference for these two statements? > > use Exporter (); > require Exporter; I think that "p

require or use

2006-05-09 Thread Practical Perl
Could anyone tell me what's the difference between 'use' and 'require'? And,is there any difference for these two statements? use Exporter (); require Exporter; Thank you.

Re: Package require question again

2005-09-19 Thread Jeff 'japhy' Pinyan
On Sep 19, Luinrandir said: From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> my $g = $main::{$Player{Location} . "::"}{Options}; my $value = $$g; or, as one line: my $value = ${ $main::{$Player{Location} . "::"}{Options} }; is the double $$ in $$g a mistake or real? If it was a

RE: Package require question again

2005-09-19 Thread Charles K. Clarkson
Luinrandir wrote: : : is the double $$ in $$g a mistake or real? Real. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Package require question again

2005-09-19 Thread Chris Devers
On Mon, 19 Sep 2005, Luinrandir wrote: > From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> > > >my $g = $main::{$Player{Location} . "::"}{Options}; > >my $value = $$g; > > is the double $$ in $$g a mistake or real? It's real. He's dereferencing that which $g refers to. Read up on refer

Re: Package require question again

2005-09-19 Thread Luinrandir
- Original Message - From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> To: "Luinrandir" <[EMAIL PROTECTED]> Cc: Sent: Monday, September 19, 2005 6:43 AM Subject: Re: Package require question again > >my $g = $main::{$Player{Location} . &

Re: Package require question again

2005-09-19 Thread Jeff 'japhy' Pinyan
On Sep 17, Luinrandir said: ok I have the program working again. but how do I get a var from the package? and the cgi calls the var in the package like this my $V = $main::{$Player{Location} . "::"}{Options}; What does that return to you? A glob. And a glob is like a reference to every dat

Package require question again

2005-09-17 Thread Luinrandir
I want to thank everyone who has helped me with this. and I'm trying to remember to bottom post ok I have the program working again. but how do I get a var from the package? At the time you are reading this I am still experimenting wih the following: the package has this line in it. $Options="B

Re: Why wont this work? Package require question

2005-09-14 Thread Jeff 'japhy' Pinyan
On Sep 14, Luinrandir said: but what if I want to pass a var? then $glob->($foo,$bar); ? But I still have no clue as to why this works... esp. $glob->(); just looked in my book.. am I dereferencing a reference? Basically, yes. $glob ends up being a glob, a reference to everything with

RE: Why wont this work? Package require question

2005-09-14 Thread Bob Showalter
Jeff 'japhy' Pinyan wrote: > Now you want to call the Inn::HTML() function, right? You can't > easily do it if strict is turned on. Here's one way, though: > >my $glob = $main::{$Player{Location} . "::"}{HTML}; >$glob->(); Or just turn off strict for a sec: { no strict 'refs'; &{"$P

Re: Why wont this work? Package require question

2005-09-14 Thread Luinrandir
="Inn"; $Player{Action}="Sell"; $Item="Blueberry"; require "$Player{Location}.pl"; # this code calls on the package # my $glob = $main::{$Play

Re: Why wont this work? Package require question

2005-09-14 Thread Luinrandir
I also got this to work: $Player{Location}="Inn"; $Player{Action}="Sell"; require "$Player{Location}.pl"; # this code calls on the package # my $glob = $main::{$Player{Location} . &q

Re: Why wont this work? Package require question

2005-09-14 Thread Luinrandir
> > Now you want to call the Inn::HTML() function, right? You can't easily do > > it if strict is turned on. Here's one way, though: > > > >my $glob = $main::{$Player{Location} . "::"}{HTML}; > >$glob->(); Ok.. that works.. why? what is ->() -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: Why wont this work? Package require question

2005-09-14 Thread Luinrandir
> Now you want to call the Inn::HTML() function, right? You can't easily do > it if strict is turned on. Here's one way, though: > >my $glob = $main::{$Player{Location} . "::"}{HTML}; >$glob->(); ah yes.. must bottom post ok in the first line you set the var $glob to equal the packa

Re: Why wont this work? Package require question

2005-09-14 Thread Luinrandir
OK I got this to work require "$Player{Location}.pl"; but not "$Player{Location}"::HTML(); #error or "$Player{Location}::HTML()"; # ignored completely! or '$Player{Location}::HTML()';# ignored completely! or '$Player{Location}'::HTML(); #error o

Re: Why wont this work? Package require question

2005-09-14 Thread Wiggins d'Anconia
No need to top post, please don't. Luinrandir wrote: > Ok.. and i'm actually going to top post for this... > > when done is should read > $Player{Location}="Inn"; > > require '$Player{Location}.pl'; > whixh is the same as > require &#

Re: Why wont this work? Package require question

2005-09-14 Thread Jeff 'japhy' Pinyan
On Sep 14, Luinrandir said: $Player{Location}="Inn" require '$Player{Location}.pl'; #no error here, I think. '$Player{Location}'::HTML(); #error occurs here The single quotes are wrong. $Player{Location} = "Inn"; require "$Player{Location}.

Re: Why wont this work? Package require question

2005-09-14 Thread Luinrandir
Ok.. and i'm actually going to top post for this... when done is should read $Player{Location}="Inn"; require '$Player{Location}.pl'; whixh is the same as require 'Inn.pl'; and then '$Player{Location}'::HTML(); which is the same as Inn::HTML(); Do

Re: Why wont this work? Package require question

2005-09-14 Thread Wiggins d'Anconia
Luinrandir wrote: > $Player{Location}="Inn" You are missing a semi-colon, and there is no reason to use double quotes above. > require '$Player{Location}.pl'; #no error here, I think. Single quotes don't interpolate. > '$Player{Location}'::HTML();

Why wont this work? Package require question

2005-09-14 Thread Luinrandir
$Player{Location}="Inn" require '$Player{Location}.pl'; #no error here, I think. '$Player{Location}'::HTML(); #error occurs here I'd hate to have to make a big if then else just to do this... Thanks Luinrandir -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: require and true value

2005-08-17 Thread gui
wrote: > gui am Mittwoch, 17. August 2005 14.53: > >>hi, > > [...] > >>pb arrives when I'm using require, I keep getting a "tools.pl did not >>return a true value" message. In the archives I noticed that everybody >>is saying that "you must no

Re: require and true value

2005-08-17 Thread John Doe
gui am Mittwoch, 17. August 2005 14.53: > hi, [...] > pb arrives when I'm using require, I keep getting a "tools.pl did not > return a true value" message. In the archives I noticed that everybody > is saying that "you must not forget to add à '1;' at the

require and true value

2005-08-17 Thread gui
hi, I've looked in the archive but somehow my pb isn't solved. I've started to create a file that will containes a bunch of subroutines (file called "tools.pl"), which I intend to use later in my upcoming programs. I wanted to try out the require function, so I just

Require info on encoding iso-8859-16 on EBCDIC platform

2005-07-13 Thread Sastry
Hi I am getting strange result when I run this Perl Script on EBCDIC platform. The $enc_string contains >ñ=Á When I run the same on linux, I get the same string as "ravi". can someone enlighten me as how the encode method is supposed to work on? use Encode; $string = "ravi"; enc_string = encode(

Re: require "sys/socket.ph";

2005-06-02 Thread John W. Krahn
Gayatri wrote: Sorry to trouble you again but John when I run like that it is giving error as follows "Couldn't disable Nagle's algorithm: Permission denied" The code is as follows. use Socket ':all'; socket($sock, AF_INET, SOCK_STREAM,$proto)||die "Socket call failed"; setsock

Re: require "sys/socket.ph";

2005-06-02 Thread John W. Krahn
Gayatri wrote: Hello John, Hello, Thanks for ur Reply. But Now I am getting the following error please help if u can. Thanks in advance ---if i remove require "sys/socket.ph"; line it gives error as Undefined subroutine &main::TCP_NODELAY called at /home/l

RE: require "sys/socket.ph";

2005-06-01 Thread Gayatri
Hello John, Thanks for ur Reply. But Now I am getting the following error please help if u can. Thanks in advance ---if i remove require "sys/socket.ph"; line it gives error as Undefined subroutine &main::TCP_NODELAY called at /home/laxmig/Projects/NMD/Tes

Re: require "sys/socket.ph";

2005-05-30 Thread John W. Krahn
Gayatri wrote: Dear All, Hello, I am facing one problem if any body knows the solution please let me know. file name : ch.pl.. use Socket; require "sys/socket.ph";# for &TCP_NODELAY ^^ Remove that line and it should work (TCP_NODELAY is i

require "sys/socket.ph";

2005-05-30 Thread Gayatri
Dear All, I am facing one problem if any body knows the solution please let me know. file name : ch.pl.. use Socket; require "sys/socket.ph";# for &TCP_NODELAY socket (SERVER, AF_INET, SOCK_STREAM,0); setsockopt(SERVER, SOL_SOCKET, &TCP_NODELAY, 1) or die

Re: Require / Use

2005-04-21 Thread Wijaya Edward
This is the reading suggested when I asked the same questions some time ago . http://perldoc.perl.org/perlfaq8.html#What-s-the-difference-between-require-and-use- --- Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Require / Use

2005-04-21 Thread mgoland
- Original Message - From: merlyn@stonehenge.com (Randal L. Schwartz) Date: Thursday, April 21, 2005 12:10 pm Subject: Re: Require / Use > >>>>> "mgoland" == mgoland <[EMAIL PROTECTED]> writes: > > mgoland> if ($certain_condition) { &

Re: Require / Use

2005-04-21 Thread Randal L. Schwartz
>>>>> "mgoland" == mgoland <[EMAIL PROTECTED]> writes: mgoland> if ($certain_condition) { mgoland> require Expensive::Module; mgoland> my $object = Expensive::Module->new(blah); mgoland> ... mgoland> } mgoland> and

Re: Require / Use

2005-04-21 Thread mgoland
- Original Message - From: merlyn@stonehenge.com (Randal L. Schwartz) Date: Thursday, April 21, 2005 11:39 am Subject: Re: Require / Use > >>>>> "Paul" == Paul Kraus <[EMAIL PROTECTED]> writes: > > >> Because you want the action at run-time

Re: Require / Use

2005-04-21 Thread Randal L. Schwartz
>>>>> "Paul" == Paul Kraus <[EMAIL PROTECTED]> writes: >> Because you want the action at run-time (require) vs. compile time >> (use), is the usual reason, I would guess. Paul> Not to sound daft but why would you want to do that? What would be Paul>

RE: Require / Use

2005-04-21 Thread Charles K. Clarkson
es not apply just to multiple loading of a single module. It could also be used to check the existence of a module before loading it. An answer to the original question is incomplete without at least a mention of the usefulness of 'require' under some intermediate to advanced perl

Re: Require / Use

2005-04-21 Thread Chris Devers
On Thu, 21 Apr 2005, Peter Scott wrote: > Ahem. It is most useful when I want to determine the module to load > dynamically, or when I want to load a module only if necessary to save > the time spent compiling it in the cases when it is not needed. :-) I think that counts as an esoteric-enoug

RE: Require / Use

2005-04-21 Thread Manav Mathur
perldoc perlmod also goes to say An exception would be if two modules each tried to "use" each other, and each also called a function from that other module. In that case, it's easy to use "require"s instead. anyone knows how/why require is useful in this case ?

Re: Require / Use

2005-04-21 Thread Peter Scott
On Thu, 21 Apr 2005 09:39:03 -0400, Chris Devers wrote: > On Thu, 21 Apr 2005, Paul Kraus wrote: > >> Not to sound daft but why would you want to do that? What would be >> gained or lossed. What would be an advantage of using require? > > Normally, you wouldn't.

Re: Require / Use

2005-04-21 Thread Paul Kraus
> Think of 'require' as a vestigal organ from Perl4 that has little or no > purpose today with Perl5. > > For the most part, it's safe to pretend that 'require' doesn't exist. Perfect. Just wanted to make sure I wasn't missing something. -

Re: Require / Use

2005-04-21 Thread Chris Devers
On Thu, 21 Apr 2005, Paul Kraus wrote: > Not to sound daft but why would you want to do that? What would be > gained or lossed. What would be an advantage of using require? Normally, you wouldn't. Think of 'require' as a vestigal organ from Perl4 that has little or no pur

Re: Require / Use

2005-04-21 Thread Paul Kraus
> Because you want the action at run-time (require) vs. compile time > (use), is the usual reason, I would guess. Not to sound daft but why would you want to do that? What would be gained or lossed. What would be an advantage of using require? Paul -- To unsubscribe, e-mail: [EMAIL PRO

RE: Require / Use

2005-04-21 Thread Manav Mathur
Additionally, the import method defined in a package(or inhertied by it) is not called when you 'require' a module. So, even @EXPORT symbols in the 'require'd module (which are by default imported in the current namespace when you 'use' it) are not imported. See pe

Re: Require / Use

2005-04-21 Thread Offer Kaye
On 4/21/05, Paul Kraus wrote: > Why would one use Require instead of Use? > Because you want the action at run-time (require) vs. compile time (use), is the usual reason, I would guess. -- Offer Kaye -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Require / Use

2005-04-21 Thread Paul Kraus
Why would one use Require instead of Use? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: Which script called require?

2005-04-07 Thread Charles K. Clarkson
Charles K. Clarkson wrote: : BEGIN { : printf qq~ : In LIST context: : Package: %s : File: %s : Line number: %s : : ~, caller(); : : printf qq~ : In SCALAR context: : Package: %s : : ~, scalar caller(); : }

RE: Which script called require?

2005-04-07 Thread Charles K. Clarkson
Ankur Gupta <mailto:[EMAIL PROTECTED]> wrote: : I just want to know who called require.file in the require.file : script. It looks like you need the built-in caller() function. a.pl: #!/usr/bin/perl use strict; use warnings; use lib '.'; require 'aa.pl'; _

Which script called require?

2005-04-06 Thread Ankur Gupta
Hi, I have many perl files which have the following require statement. require "require.file"; I just want to know who called require.file in the require.file script. Right now I am setting an environmental variable in each of the scripts and checking its va

Re: Problem com var on a require...

2004-11-10 Thread Paul Lalli
"Jair V. B. Junior" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, here comes a little confusing question :-) > > a.pl: > #!/usr/bin/perl use warnings; #this will help show you where you went wrong > require 'b.def'; The co

Re: Problem com var on a require...

2004-11-09 Thread David Greenberg
I don't want to begin to understand why you're doing this, but if you make a.pl read: #!/usr/bin/perl $test = 'World!'; require 'b.def'; print $abacus; it should work. If you mean for b.def to define some standard functionality, try defining subs in it instead. -Da

Problem com var on a require...

2004-11-09 Thread Jair V. B. Junior
Hi all, here comes a little confusing question :-) a.pl: #!/usr/bin/perl require 'b.def'; $test = 'World!'; print $abacus; b.def: $abacus = "Hello $test"; When I run it: $ perl a.pl Hello Why is this going wrong? Thanks! -- To unsubscribe, e-mail: [EMAIL PROT

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 'Export

Re: use vs. require in modules

2004-08-04 Thread Randal L. Schwartz
> "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 it needs to be require'd instead of use'd. -- Randal L. Sc

use vs. require in modules

2004-08-04 Thread Christopher J. Bottaro
i have 4 packages: PackageA use IO::File; require My::Utils::Reader PackageB use IO::File; use XML::Writer; My::Utils::Reader use My::Utils; My::Utils use Exporter; in my perl program, i dynamically load PackageA and PackageB like this: eval("require $package_name1"); eva

Re: use, require or none of the above?

2004-07-01 Thread perl.org
gure out how to resolve it. > b. How would you test such a dependency? Not sure what you mean by test - I use the code every day and it works, it's only perl -c that objects. Anyway, my core issue has been resolved - I always need to explicitly either use or require any module I a

Re: use, require or none of the above?

2004-07-01 Thread Wiggins d Anconia
Please bottom post... > Great, thanks for the detailed response. I have read the docs several times, > but each time it becomes a little less clear... > > I like the extra braces because they look pretty in syntax-highlighting > editors. I am always using strict. Not sure what the second call

Re: use, require or none of the above?

2004-07-01 Thread perl.org
of the modules I get warnings about variable redefinition. Thanks again, -John On Thu, 1 Jul 2004 09:42:59 -0600, Wiggins d Anconia wrote > > I have read the docs but I'm still not quite clear on the difference > between > > use and require and if either is even needed.

Re: use, require or none of the above?

2004-07-01 Thread Wiggins d Anconia
> I have read the docs but I'm still not quite clear on the difference between > use and require and if either is even needed. > The two key differences are that 'use' happens at compile time, rather than runtime, and that 'use' automatically calls the &#

use, require or none of the above?

2004-06-30 Thread perl.org
I have read the docs but I'm still not quite clear on the difference between use and require and if either is even needed. I just moved some code from one module to another. The orignal module has use Net::SMTP in it, but the module I moved the code to does not (it does use the first m

AW: AW: Problem using require()

2004-03-15 Thread B. Fongo
I've checked cpan AppConfig. I may get back to it. Thanks Randy -Ursprüngliche Nachricht- Von: Randy W. Sims [mailto:[EMAIL PROTECTED] Gesendet: Montag, 15. März 2004 12:36 An: B. Fongo Cc: [EMAIL PROTECTED] Betreff: Re: AW: Problem using require() On 03/15/04 06:19, B. Fongo

Re: AW: Problem using require()

2004-03-15 Thread Randy W. Sims
rity risk. Consider using a plain text configuration file and read it manually into variables or use a module like AppConfig. As for your example, I was able to use the variables defined in 'global.txt' with: #!/usr/bin/perl use strict; use warnings; use vars qw($shop $sendmail

  1   2   3   >