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
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
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
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
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:
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 "$
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
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
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
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
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
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
-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
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
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
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
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 _
--- 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
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
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
> 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
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
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";
>
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
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
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
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
27 matches
Mail list logo