Re: Checking Perl Module installed - How?

2005-07-27 Thread $Bill Luebkert
Arijit Das wrote: > Hi, > > How can I check if a Perl Module is installed in my System from a Perl > Program? > > I want to do something like this: > > #!/usr/local/bin/perl > > if () { > use Quota; > } You probably already have sufficient answers, but I use a slightly different metho

Re: hashrefs and curlies? please help!

2005-07-27 Thread Eric Amick
On Wed, 27 Jul 2005 13:20:39 -0700, you wrote: >I'm trying to dope out hashes, references, references to hashes, usw., >using my Perl books and something's confusing me > >Now as I understand it, $bios_info->{TargetOperatingSystem} would be a >reference to a hash, right? Now a plain (unrefe

Re: Requirement or Syntactic Sugar?

2005-07-27 Thread Eric Amick
On Wed, 27 Jul 2005 13:20:39 -0700, you wrote: >-start quoted >message-- >Since both work in the code that's using them, I suspect that the curlies >in the fancy example are not really necessary. Am I right in this? > >I know this is a trivial

Re: hashrefs and curlies? please help!

2005-07-27 Thread David Nicol
you do have a command line somewhere in your computer do you not? $ perl -wle '$H={a=>1,b=>2};print $H->{b}' 2 $ perl -wle '$H={a=>1,b=>2};print $H->b' Can't call method "b" on unblessed reference at -e line 1. ___ ActivePerl mailing list ActivePerl

Re: Requirement or Syntactic Sugar?

2005-07-27 Thread David Nicol
On 7/27/05, Brian Raven <[EMAIL PROTECTED]> wrote: > Then the first format is just: $thing = $stuff->member; > > This is a subrouting call. Assuming that $stuff is a blessed reference, > then this is effectively '$thing = ref($stuff)::member($stuff);' > > While the fancy one is:

RE: Variable reference

2005-07-27 Thread Lloyd Sartor
Bowie Bailey <[EMAIL PROTECTED]> wrote on 07/27/2005 01:47:12 PM: > Exactly right. You can't use a symbolic reference to refer to a lexical > variable (declared with "my"). Try this code: > > $test = 'global test'; > my $test = 'lexical test'; > my $name = 'test'; > $result = $$name; > print "$

RE: [Perl-unix-users] Checking Perl Module installed - How?

2005-07-27 Thread Darrell Gammill
Title: Message sub CheckLWP { # The following eval/if combination equates to a try/catch combination in C++     eval {     require LWP;     };     if ($@) {     #warn $@;     my ($bad_module) = $@ =~ m/Can't locate (.+?).pm in [EMAIL PROTECTED]/;     print "Failed to load P

Re: Variable reference

2005-07-27 Thread David Nicol
On 7/27/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > ``my'' variables (lexical variables) do not appear in the symbol table at > run time (as do package variables, whether declared or auto-vivified) and so > cannot be referenced ``symbolically''. lexical variables are dealt with > and

hashrefs and curlies? please help!

2005-07-27 Thread Deane . Rothenmaier
Hi, I'm trying to dope out hashes, references, references to hashes, usw., using my Perl books and something's confusing me Now as I understand it, $bios_info->{TargetOperatingSystem} would be a reference to a hash, right?  Now a plain (unreferenced) hash would be coded as $hash{key} to get

Re: Checking Perl Module installed - How?

2005-07-27 Thread Octavian Rasnita
Hi, Read: perldoc if NAME if - "use" a Perl module if a condition holds SYNOPSIS use if CONDITION, MODULE => ARGUMENTS; DESCRIPTION The construct use if CONDITION, MODULE => ARGUMENTS; has no effect unless "CONDITION" is true. In this case the effect is the same a

Re: Variable reference

2005-07-27 Thread Hugh Loebner
How about: $database_name = "Greg"; $text = "database_name"; $value = "\$" . $text; eval "print $value" ; This worked for me Hugh Loebner On 7/27/05, Brian Raven <[EMAIL PROTECTED]> wrote: > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Greg > Sent: 27 July 20

Re: [Perl-unix-users] Checking Perl Module installed - How?

2005-07-27 Thread Philip M. Gollucci
Arijit Das wrote: How can I check if a Perl Module is installed in my System from a Perl Program? #!/usr/local/bin/perl if () { use Quota; } my $has_quota = eval { require Quota; } ? 0 : 1; if ($has_quota) { require Quota; ... } else { ## not installed; } END

RE: Requirement or Syntactic Sugar? ([EMAIL PROTECTED]/Brian Raven)

2005-07-27 Thread JPerlmutter
-start quoted message-- Since both work in the code that's using them, I suspect that the curlies in the fancy example are not really necessary. Am I right in this? I know this is a trivial question, but I'm trying to unify a bunch of differen

RE: Variable reference

2005-07-27 Thread Bowie Bailey
From: Wayne Simmons [mailto:[EMAIL PROTECTED] > > > This is called a "Symbolic Reference". You do it like this: > > > > $database_name = "Greg"; > > $text = "database_name"; > > $value = $$text; > > print $value; > > ok this is kinda freaking me out. I got this to work but I fou

Re: Variable reference

2005-07-27 Thread Williamawalters
In a message dated 7/27/2005 2:31:22 P.M. Eastern Standard Time, [EMAIL PROTECTED] writes:   > > This is called a "Symbolic Reference".  You do it like this:> > > > > > $database_name = "Greg";> > $text = "database_name";> > $value = $$text;> > print $value;> > ok this is k

RE: Checking Perl Module installed - How?

2005-07-27 Thread Bowie Bailey
From: Arijit Das [mailto:[EMAIL PROTECTED] > > How can I check if a Perl Module is installed in my System > from a Perl Program? > > I want to do something like this: > > #!/usr/local/bin/perl > > if () { > use Quota; > } eval { require Quota }; if ($@) { print "Quota modu

Checking Perl Module installed - How?

2005-07-27 Thread Arijit Das
Hi,   How can I check if a Perl Module is installed in my System from a Perl Program?   I want to do something like this:   #!/usr/local/bin/perl   if () {     use Quota; }     Any help is appreciated.   Thanks, Arijit     Start your day with Yahoo! - make it your home page _

Fwd: Variable reference

2005-07-27 Thread Williamawalters
  --- Begin Message --- In a message dated 7/27/2005 12:48:35 P.M. Eastern Standard Time, [EMAIL PROTECTED] writes:   > From: Greg [mailto:[EMAIL PROTECTED]> > > > Sorry if this has been answered before but I am in a quandary.  > > > > I am trying to get the contents of a variable when t

RE: Variable reference

2005-07-27 Thread Bullock, Howard A.
Why not use a HASH?   %hash = ('database_name' => "Greg"); $text = "database_name"; print $hash{$text}; ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Variable reference

2005-07-27 Thread Lloyd Sartor
Greg <[EMAIL PROTECTED]> wrote on 07/27/2005 10:10:30 AM: > I am trying to get the contents of a variable when that variables name > is itself in a different variable. For example: > >     $database_name = "Greg"; >     $text = "database_name"; >     $value = "\$" . $text;         $value = $$t

RE: Variable reference

2005-07-27 Thread Wayne Simmons
> This is called a "Symbolic Reference". You do it like this: > > > $database_name = "Greg"; > $text = "database_name"; > $value = $$text; > print $value; ok this is kinda freaking me out. I got this to work but I found something strange. First off you have to do with strict off

RE: Variable reference

2005-07-27 Thread Brian Raven
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Sent: 27 July 2005 16:11 To: ActivePerl@listserv.ActiveState.com Subject: Variable reference ---INTERNET EMAIL NOTIFICATION--- This email originates from the Interne

RE: Variable reference

2005-07-27 Thread Bowie Bailey
From: Greg [mailto:[EMAIL PROTECTED] > > Sorry if this has been answered before but I am in a quandary. > > I am trying to get the contents of a variable when that variables name > is itself in a different variable. For example: > > $database_name = "Greg"; > $text = "database_name"; >

RE: Requirement or Syntactic Sugar?

2005-07-27 Thread Brian Raven
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 27 July 2005 14:46 To: activeperl@listserv.ActiveState.com Subject: Requirement or Syntactic Sugar? ---INTERNET EMAIL NOTIFICATION--- This email

Variable reference

2005-07-27 Thread Greg
Sorry if this has been answered before but I am in a quandary.  I am trying to get the contents of a variable when that variables name is itself in a different variable. For example:     $database_name = "Greg";     $text = "database_name";     $value = "\$" . $text;     print $value; I nee

Requirement or Syntactic Sugar?

2005-07-27 Thread Deane . Rothenmaier
Hi, wizards. I've a small question this time. Working with WMI code (Win32_whatnot), I see two different syntaxes and I'm wondering if the "fancy" one is a requirement or if it's just pretty formatting. Here they are. Both start from this point: $stuff = $self->WQL( -query  => "SELECT * FROM Win

RE: Threads:shared and arrays issues

2005-07-27 Thread a b
Hello Brian, Thanks for your reply In fact, I wanna create a pool of connections in order to read articles from one of these, like this : sub create_connections { for (my $i = 1 ; $i <= $max_connections ; $i++) { $all_connections[$i] = News::NNTPClient->new($best_ip, $port, $debug); if