[16111] in Perl-Users-Digest
Perl-Users Digest, Issue: 3523 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 30 11:05:25 2000
Date: Fri, 30 Jun 2000 08:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962377511-v9-i3523@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 30 Jun 2000 Volume: 9 Number: 3523
Today's topics:
Re: +<< operator - cant find string delimiter (Rafael Garcia-Suarez)
Re: +<< operator - cant find string delimiter <steven.van-poeck@SPAM.wanadoo.com>
Re: +<< operator - cant find string delimiter <jeffp@crusoe.net>
Re: +<< operator - cant find string delimiter (Bill)
Re: a large amount of unique numbers in an efficient wa <aqumsieh@hyperchip.com>
Can't call method on an undefined value [was: Win32::OD <iltzu@sci.invalid>
Re: Changing .htpasswd on the fly.. <flavell@mail.cern.ch>
Re: Changing .htpasswd on the fly.. <tony_curtis32@yahoo.com>
Re: DANGEROUS CODE ABOVE (was Re: Perl Help Please!) <dmeyers@panix.com>
Re: how do i create an array of hashes? <TheEx0rcist@fanclub.org>
Re: how do i create an array of hashes? <aqumsieh@hyperchip.com>
Re: How to open another browser in Perl? <robert@pharmapartners.nl>
Re: Logical Not : 'not' vs '!' (Gwyn Judd)
Re: Logical Not : 'not' vs '!' <jeffp@crusoe.net>
Re: Logical Not : 'not' vs '!' <ed@cheetahmail.com>
Re: Logical Not : 'not' vs '!' (Rafael Garcia-Suarez)
Re: Logical Not : 'not' vs '!' <jeffp@crusoe.net>
No connection to Oracle DB <Hans.X.Eriksson@etx.ericsson.se>
Re: No connection to Oracle DB manchester_united@my-deja.com
Re: NT vs Unix detection (Bart Lateur)
Re: PPM not work on ActivePerl 5.6 for NT ? <cawood@ncompasslabs.com>
Q: What happens if a 'path' had a space in it? manchester_united@my-deja.com
Re: Q: What happens if a 'path' had a space in it? (Peter J. Acklam)
Re: Q: What happens if a 'path' had a space in it? manchester_united@my-deja.com
Re: Repeated regex matching. <iltzu@sci.invalid>
Re: running script on remote server <jmarsan@my-deja.com>
Re: Specifying smtp server in Mail::Mailer <rosenbse@my-deja.com>
Re: STDOUT and IIS <dmeyers@panix.com>
Web Online : Web Technology Site Web <tepes@cybercable.fr>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 30 Jun 2000 13:52:14 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: +<< operator - cant find string delimiter
Message-Id: <slrn8lp9od.qnn.garcia_suarez@rafael.kazibao.net>
redtux wrote in comp.lang.perl.misc:
>I have the following peice of code of code which I am trying to use in
>smtp procedure
[snip]
> my $mail_message = <<__END_OF_MAIL__;
> To: $to From: $from Subject: $subject
>
> $body
>
> __END_OF_MAIL__
[snip]
>This fails when at __END_OF_MAIL__ with debugging error of Can't find
>string terminator "__END_OF_MAIL__" anywhere before EOF
__END_OF_MAIL__ must be the first thing on the line. No whitespace
before the _.
And your mail headers are malformed. Each header must be on a separate
line, and the headers must be separated from the body by a completely
empty line (i.e., "\n\n").
--
Rafael Garcia-Suarez
------------------------------
Date: Fri, 30 Jun 2000 15:57:15 +0200
From: "Steven Van Poeck" <steven.van-poeck@SPAM.wanadoo.com>
Subject: Re: +<< operator - cant find string delimiter
Message-Id: <8ji90a$8em$1@wanadoo.fr>
From the code snippet you gave, it seems you have spaces in front of your
EOF delimiter. The code
my $mail_message =<<__END_OF_MAIL__; expects an EOF without any white space
in front of it, thus:
__END_OF_MAIL__
and not :
__END_OF_MAIL__
^^^
| | |
Also, on Win32 systems, an EOF at the very end of the script will often not
work properly. Just add a blank line after the EOF and all will go smoothly.
HTH,
Steven Van Poeck
mailto:steven.van-poeck@wanadoo.com
redtux <mike@cyborg-group.com> a écrit dans le message :
962369895.3970.0.nnrp-10.9e986064@news.demon.co.uk...
> I have the following peice of code of code which I am trying to use in
> smtp procedure
>
> use Net::SMTP ();
> use Carp qw(carp verbose);
>
> #
> # Sends email by using the SMTP Server
> #
> # The SMTP server as defined in Net::Config
> # Alternatively you can hardcode it here, look for
> $smtp_server below
> #
> sub send_mail{
> my ($from, $to, $subject, $body) = @_;
>
>
>
>
> carp "From missing" unless defined $from ; # Prefer to
> exit early if
> errors
> carp "To missing" unless defined $to ;
>
> my $mail_message = <<__END_OF_MAIL__;
> To: $to From: $from Subject: $subject
>
> $body
>
> __END_OF_MAIL__
>
> # Set this parameter if you don't have a valid
> Net/Config.pm
> # entry for SMTP host and uncomment it in the
> Net::SMTP->new
> # call
> # my $smtp_server = 'localhost';
>
> # init the server
> my $smtp = Net::SMTP->new(
> # $smtp_server,
> Timeout => 60, Debug => 0,
> );
>
> $smtp->mail($from) or carp ("Failed to specify a sender
> [$from]\n");
> $smtp->to($to) or carp ("Failed to specify a recipient
> [$to]\n");
> $smtp->data([$mail_message]) or carp ("Failed to send a
> message\n");
>
> $smtp->quit or carp ("Failed to quit\n");
>
> } # end of sub send_mail
>
> This fails when at __END_OF_MAIL__ with debugging error of Can't find
> string terminator "__END_OF_MAIL__" anywhere before EOF
>
> Can anyone shed some light on this - is this depreciated?
------------------------------
Date: Fri, 30 Jun 2000 10:25:36 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: +<< operator - cant find string delimiter
Message-Id: <Pine.GSO.4.21.0006301023220.7544-100000@crusoe.crusoe.net>
[posted & mailed]
On Jun 30, redtux said:
> my $mail_message = <<__END_OF_MAIL__;
> To: $to From: $from Subject: $subject
>
> $body
>
> __END_OF_MAIL__
>This fails when at __END_OF_MAIL__ with debugging error of Can't find
>string terminator "__END_OF_MAIL__" anywhere before EOF
>
>Can anyone shed some light on this - is this depreciated?
Using here-docs is by NO means deprecated. However, when you say:
print << "SOME LABEL HERE";
Perl expects to find SOME LABEL HERE exactly as you wrote it, at the
BEGINNING of a line (meaning, NO leading whitespace):
print << "FOO BAR";
not yet
FOO BAR
not yet
FOO BAR
NOW!
FOO BAR
In your case, you have leading whitespace. Get rid of it, or adjust your
label:
print << " FOO BAR";
end it now!
FOO BAR
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Fri, 30 Jun 2000 14:25:25 GMT
From: wfeidt@cpcug.org (Bill)
Subject: Re: +<< operator - cant find string delimiter
Message-Id: <8F63648B8wfeidthiscom@207.126.101.97>
mike@cyborg-group.com (redtux) wrote in <962369895.3970.0.nnrp-
10.9e986064@news.demon.co.uk>:
>I have the following peice of code of code which I am trying to use in
>smtp procedure
>
>use Net::SMTP ();
> use Carp qw(carp verbose);
>
> #
> # Sends email by using the SMTP Server
> #
> # The SMTP server as defined in Net::Config
> # Alternatively you can hardcode it here, look for
> $smtp_server below
> #
> sub send_mail{
> my ($from, $to, $subject, $body) = @_;
>
>
>
>
> carp "From missing" unless defined $from ; # Prefer to
> exit early if
>errors
> carp "To missing" unless defined $to ;
>
> my $mail_message = <<__END_OF_MAIL__;
> To: $to From: $from Subject: $subject
>
> $body
>
> __END_OF_MAIL__
>
> # Set this parameter if you don't have a valid
> Net/Config.pm
> # entry for SMTP host and uncomment it in the
> Net::SMTP->new
> # call
> # my $smtp_server = 'localhost';
>
> # init the server
> my $smtp = Net::SMTP->new(
> # $smtp_server,
> Timeout => 60, Debug => 0,
> );
>
> $smtp->mail($from) or carp ("Failed to specify a sender
> [$from]\n");
> $smtp->to($to) or carp ("Failed to specify a recipient
> [$to]\n");
> $smtp->data([$mail_message]) or carp ("Failed to send a
> message\n");
>
> $smtp->quit or carp ("Failed to quit\n");
>
> } # end of sub send_mail
>
>This fails when at __END_OF_MAIL__ with debugging error of Can't find
>string terminator "__END_OF_MAIL__" anywhere before EOF
>
>Can anyone shed some light on this - is this depreciated?
The "heredoc" end marker must be left flush. So if you have
"__END_OF_MAIL__" indented, make it left flush.
HTH,
Bill
wfeidt@cpcug.org
------------------------------
Date: Fri, 30 Jun 2000 14:22:17 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: a large amount of unique numbers in an efficient way?
Message-Id: <7aaeg35jvo.fsf@merlin.hyperchip.com>
Ala Qumsieh <aqumsieh@hyperchip.com> writes:
> Well, first of all, you can guarantee that your number is between 1000
> and 9999 (inclusive) by the following:
>
> int(1000 + rand 10000)
This is wrong. I apologize. It should be:
int(1000 + rand 9000)
--Ala
------------------------------
Date: 30 Jun 2000 13:46:48 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Can't call method on an undefined value [was: Win32::ODBC error]
Message-Id: <962372181.17251@itz.pp.sci.fi>
In article <tuQ35.207996$MB.3779138@news6.giganews.com>, Chad Gilless wrote:
>use Win32::ODBC;
>$Data = new Win32::ODBC("KScriptDB");
>$tester = 'SELECT * FROM Sauces';
>$Data->Sql($tester);
>
>I get the following error at the command line:
>Can't call method "Sql" on an undefined value at odbctester.pl line 4.
>Any ideas? It would appear that $tester is a good value.
The value of $tester should be just fine, it's $Data that's undefined.
Generally this means the connection failed.
If you had read "perldoc perldiag" you would've found an explanation
of this error message, which seems rather obvious to me. Nonetheless,
this is the second time this month that I've encountered precisely the
same miscomprehension. Is there any way in which this message could
be improved to make it clearer?
[This thread has nothing to do with modules, so I'm moving it to .misc]
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Fri, 30 Jun 2000 15:24:20 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Changing .htpasswd on the fly..
Message-Id: <Pine.GHP.4.21.0006301501421.21594-100000@hpplus03.cern.ch>
On Fri, 30 Jun 2000, Mark Cain wrote:
> $pass = "bar";
^^^^^
Around here that would be written 'bar', since no interpolation is
involved. Sure, this was only an example, but even examples can be
used as examples of good coding style.
> $pass = crypt($pass, $pass);
Where did you get this idea from? It publishes the first two
characters of every password, to anyone who can read the file.
> open(FILEA, "> ./path/.htpasswd") or die "Can not open htpasswd";
Who told you that the current directory was a suitable place to
write this file?
Wouldn't it be a nice idea to include the reason ($!) in the
diagnostic message?
I can't help suspecting that the original poster is going to want to
do this from a CGI script. As such, you would want to look into
issues of file locking.
> print FILEB "<Limit GET>\n";
> print FILEB "require valid-user\n";
Oh dear, another cargo-culter who hasn't read the Apache
documentation. Did you _really_ want to allow anyone to PUT, POST,
DELETE etc., while only applying authentication to GET?
Ah, an upside-down quoter. it all fits.
Me, I'd take a look at Randal's WebTechniques. Bound to be some
more-reliable examples to follow there, although I see that in col.5
where something similar is done, he's still using numerical constants
for lock modes.
Oh dear, I'm reluctant to teach Randal to suck eggs, but he seems to
do this consistently, and in col 34 he even compounds it by coding
flock($master, 2); # LOCK_EX
Comments?
------------------------------
Date: 30 Jun 2000 09:16:32 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Changing .htpasswd on the fly..
Message-Id: <87puozmeyn.fsf@limey.hpcc.uh.edu>
>> On Fri, 30 Jun 2000 11:13:41 +0200,
>> Hans <hans@exonet.net> said:
> Hi, Is there a way to change .htpasswd on the fly from a
> Perl script? I have users who must register on my site,
> and I want to be able to add a new line to .htpasswd so
> the new user can login at once.
http://search.cpan.org/search?mode=module&query=UserAdmin
==> HTTPD-User-Manage-1.54 by Lincoln D. Stein
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: 30 Jun 2000 09:47:45 -0400
From: David Meyers <dmeyers@panix.com>
Subject: Re: DANGEROUS CODE ABOVE (was Re: Perl Help Please!)
Message-Id: <yobhfabb7r2.fsf@panix6.panix.com>
Magic <Magic@mattnet.freeserve.co.uk> writes:
> On 29 Jun 2000 07:11:59 -0700, merlyn@stonehenge.com (Randal L.
> Schwartz) wrote:
>
> > Paul> open PAGE, $page ;
>
> Could I just added the line
>
> $page = 'http://www.mydomain.co.uk/' + $page;
NOnonono.
First off, see all the previous discussion about security,
taint, and cleaning up that $page variable. man perlsec.
Second, even if $page is nice and clean and safe, let's say
that $page eq 'filename', then consider the perl command you've
constructed:
open PAGE, 'http://www.somedomain.whatever/filename';
Unless you have a really weird local file filesystem,
that's just not going to work. You can, in fact, pull
a file off of an http server (look up LWP::Simple in
the docs), but check out man perlfunc first and read
about what "open" does.
> > So I just invoke
> >
> > http://www.your.server.org/yourscript?PAGE=rm+-rf+/+|
Once you've decoded that into your local variable,
it no longer says rm+rf+/+|. It says 'rm -rf / |'.
> Wouldn't that now try to open "http://www.mydomain.co.uk/rm+-rf+/+|"
> and fail?
What if the arg was ';rm -rf / |' ?
--d
------------------------------
Date: Fri, 30 Jun 2000 16:34:15 +0200
From: "TheEx0rcist" <TheEx0rcist@fanclub.org>
Subject: Re: how do i create an array of hashes?
Message-Id: <8jic6c$l58$1@reader1.fr.uu.net>
> @a=({k1=>'v1',k2=>'v2},{k3=>'v3',k4=>'v4'});
Thanks Bob,
that's what I needed !!
:)
------------------------------
Date: Fri, 30 Jun 2000 14:44:20 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: how do i create an array of hashes?
Message-Id: <7a7lb75iuw.fsf@merlin.hyperchip.com>
"TheEx0rcist" <TheEx0rcist@fanclub.org> writes:
> how do i create an array of hashes?
Why don't you read 'perldsc' and figure it out for yourself?
--Ala
------------------------------
Date: Fri, 30 Jun 2000 16:03:06 +0200
From: "Robert Voesten" <robert@pharmapartners.nl>
Subject: Re: How to open another browser in Perl?
Message-Id: <8ji9bp$6l9$1@porthos.nl.uu.net>
DOOOOOOOOOOOH
This is a very easy one
This is an <a href="some URL" target="_blank">example link</a>
"Lookup
> some docs about HTML (e.g. www.htmlhelp.com) and about the <a> tag and its
> 'target' attribute.
>
> --
> Rafael Garcia-Suarez
------------------------------
Date: Fri, 30 Jun 2000 14:10:30 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <slrn8lpank.amp.tjla@thislove.dyndns.org>
I was shocked! How could Patrick.Hochstenbach <pat@isiserv.rug.ac.be>
say such a terrible thing:
>
>
>Am I missing something?
>
>Why does this code give me answer '1':
<snip>
>while this code gives me answer '0':
<snip>
Beats me. I get '1' for both.
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Sex is not the answer. Sex is the question. "Yes" is the answer.
-- Swami X
------------------------------
Date: Fri, 30 Jun 2000 10:22:29 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <Pine.GSO.4.21.0006300959090.7544-100000@crusoe.crusoe.net>
On Jun 30, Neil Kandalgaonkar said:
>>'not' is an operator, not a function. Thus
>> not($a) && not($b)
>>is equivalent to
>> not (($a) && not ($b))
>>because of operator precedence.
>
>Not.
In Perl 5.005, not was an operator. In Perl 5.6, it was decided that "if
it looks like a function, it is a function" so that not($foo) "behaves
properly". Check perldelta.
>$ perl -MO=Deparse,-p -e ' ! $a && ! $b ' 2>&-
>((not $a) and (not $b));
>
>$ perl -MO=Deparse,-p -e ' not($a) && not($b) ' 2>&-
>((not $a) and (not $b));
>
>$ perl -MO=Deparse,-p -e ' (not $a) && (not $b) ' 2>&-
>((not $a) and (not $b));
>
>$ perl -MO=Deparse,-p -e ' not $a && not $b ' 2>&-
>(not ($a && (!$b)));
My 5.005_02 O::Deparse says:
jeffp@friday [10:21am] ~ #615> perl -MO=Deparse,-p
not($A) and not($B);
not $A and not $B ;
not($A) && not($B);
not $A && not $B ;
- syntax OK
((not $A) and (not $B));
((not $A) and (not $B));
(not ($A && (!$B)));
(not ($A && (!$B)));
However, check 5.6, and not() is indeed a function now.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Fri, 30 Jun 2000 10:47:50 -0400
From: Ed Summers <ed@cheetahmail.com>
To: neil@brevity.org
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <395CB316.1091A447@cheetahmail.com>
Cool toy! I took a quick look around and couldn't find any mention for
the '-MO=Deparse' switch ( Camel, perldoc -f )... Is there any
description available for it?
//Ed
Neil Kandalgaonkar wrote:
> In article <slrn8lop6j.pn0.garcia_suarez@rafael.kazibao.net>,
> Rafael Garcia-Suarez <garcia_suarez@hotmail.com> wrote:
>
> >You misplaced the parentheses.
> >'not' is an operator, not a function. Thus
> > not($a) && not($b)
> >is equivalent to
> > not (($a) && not ($b))
> >because of operator precedence.
>
> Not.
>
> $ perl -MO=Deparse,-p -e ' ! $a && ! $b ' 2>&-
> ((not $a) and (not $b));
>
> $ perl -MO=Deparse,-p -e ' not($a) && not($b) ' 2>&-
> ((not $a) and (not $b));
>
> $ perl -MO=Deparse,-p -e ' (not $a) && (not $b) ' 2>&-
> ((not $a) and (not $b));
>
> The only really different one is low-precedence 'not' without any
> parens:
>
> $ perl -MO=Deparse,-p -e ' not $a && not $b ' 2>&-
> (not ($a && (!$b)));
>
> I see no difference in behaviour, and Deparse seems to confirm it.
> (Forgive the use of Deparse twice in one thread, it's my favorite
> new toy. :)
>
> --
> Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: Fri, 30 Jun 2000 15:01:09 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <slrn8lpdpk.r2f.garcia_suarez@rafael.kazibao.net>
Ed Summers wrote in comp.lang.perl.misc:
>Cool toy! I took a quick look around and couldn't find any mention for
>the '-MO=Deparse' switch ( Camel, perldoc -f )... Is there any
>description available for it?
>//Ed
man B::Deparse
and, more generally,
man O
the -M switch to perl is documented in perlrun.
--
Rafael Garcia-Suarez
------------------------------
Date: Fri, 30 Jun 2000 11:01:10 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Logical Not : 'not' vs '!'
Message-Id: <Pine.GSO.4.21.0006301057350.7544-100000@crusoe.crusoe.net>
On Jun 30, Ed Summers said:
>Cool toy! I took a quick look around and couldn't find any mention for
>the '-MO=Deparse' switch ( Camel, perldoc -f )... Is there any
>description available for it?
The -M option to perl (explained in: perldoc perlrun) is like use(). The
= sign is the list of things to import, so:
perl -MO=Deparse,-p -e '1 .. 5'
is like writing a program that says:
#!/usr/bin/perl
use O qw( Deparse -p );
1 .. 5;
The O hierarchy of modules is a frontend to the B hierarchy. They allow
you to do things like deparse your Perl code to what Perl sees (this
usually works).
perldoc B
perldoc O
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Fri, 30 Jun 2000 15:51:30 +0200
From: Hans Eriksson <Hans.X.Eriksson@etx.ericsson.se>
Subject: No connection to Oracle DB
Message-Id: <395CA5E2.80BF2BA2@etx.ericsson.se>
Hello,
I'm writing a genereral subroutine for connecting to an Oracle DB. What
first entered my mind was just replacing the existing values in the
connect function with variables passed to the subroutine. I was thinking
of something like this:
$dbh=DBI->connect('dbi:Oracle:',
q{$user/$pass@(DESCRIPTION=
(ADDRESS=(PROTOCOL=$protocol)(HOST=$host)(PORT=$port))
(CONNECT_DATA=(SID=$sid)))},'')
But this is obviously the wrong approach...
Does anyone know how to do this right?
------------------------------
Date: Fri, 30 Jun 2000 14:46:15 GMT
From: manchester_united@my-deja.com
Subject: Re: No connection to Oracle DB
Message-Id: <8jibrh$a71$1@nnrp1.deja.com>
In article <395CA5E2.80BF2BA2@etx.ericsson.se>,
Hans.X.Eriksson@etx.ericsson.se wrote:
> Hello,
>
> I'm writing a genereral subroutine for connecting to an Oracle DB.
What
> first entered my mind was just replacing the existing values in the
> connect function with variables passed to the subroutine. I was
thinking
> of something like this:
>
> $dbh=DBI->connect('dbi:Oracle:',
> q{$user/$pass@(DESCRIPTION=
> (ADDRESS=(PROTOCOL=$protocol)
(HOST=$host)(PORT=$port))
> (CONNECT_DATA=(SID=$sid)))},'')
>
> But this is obviously the wrong approach...
>
> Does anyone know how to do this right?
>
Your lucks in - this code works for, it's simple, but it works:-
$dbh = DBI->connect("dbi:Oracle:$dbname", $user, $passwd,{ RaiseError
=> 1, AutoCommit => 0 }) or $result = 1;
$confirm_connection = holsdb::connectToDB
( "ora_sepro_x4server", "host_name", "password" );
...where $dbname is your DB name, $user & $passwd are the host name and
password you would normally use to log on to SQL.
$dbh is then your database handle.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 30 Jun 2000 13:04:28 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: NT vs Unix detection
Message-Id: <395d918b.827445@news.skynet.be>
Paulo Dutra wrote:
>I pulled this from CGI.pm. It's system independent.
It still won't tell you if it's running on NT or on Win98.
--
Bart.
------------------------------
Date: Fri, 30 Jun 2000 07:36:48 -0700
From: "Stephen Cawood" <cawood@ncompasslabs.com>
Subject: Re: PPM not work on ActivePerl 5.6 for NT ?
Message-Id: <db275.4929$j7.260002@news.bc.tac.net>
There is a hot fix at:
http://www.activestate.com/Products/ActivePerl/Download.html
This might help.
Stephen Cawood
"Aurélien BRUNO" <a.bruno.SII@ifrance.com> wrote in message
news:8ji4a7$1i36$1@news2atm.raleigh.ibm.com...
> Good Afternoon,
>
> I have the following problem under NT when I use PPM:
>
> PPM> verify /upgrade
> Error verifying HTML-Parser: Could not locate a PPM binary of
'HTML-Parser'
> for this platform
> Package 'URI' is up to date.
> Package 'Compress-Zlib' is up to date.
> Package 'XML-Element' is up to date.
> Package 'PPM' is up to date.
> Error verifying libwww-perl: Could not locate a PPM binary of
'libwww-perl'
> for this platform
> Package 'MIME-Base64' is up to date.
> Package 'Archive-Tar' is up to date.
> Package 'libwin32' is up to date.
> Cannot forceunlink D:\Perl\site\lib\auto\XML\Parser\Expat\Expat.dll:
> Permission denied at D:/Perl/site/lib/PPM
> .pm line 617
> Error verifying XML-Parser: Could not locate a PPM binary of 'XML-Parser'
> for this platform
>
> after exit I can't restart ppm : the next message appears :
>
> Can't locate HTML/HeadParser.pm in @INC (@INC contains: D:/Perl/lib
> D:/Perl/site/lib .) at D:/Perl/site/lib/LW
> P/Protocol.pm line 47.
> Compilation failed in require at D:/Perl/site/lib/LWP/UserAgent.pm line
103.
> BEGIN failed--compilation aborted at D:/Perl/site/lib/LWP/UserAgent.pm
line
> 103.
> Compilation failed in require at D:/Perl/site/lib/PPM.pm line 8.
> BEGIN failed--compilation aborted at D:/Perl/site/lib/PPM.pm line 8.
> Compilation failed in require at D:\Perl\bin\ppm.bat line 21.
> BEGIN failed--compilation aborted at D:\Perl\bin\ppm.bat line 21.
>
> All files under HTML/ directory are removed :
>
> What the problem ?
>
> --
> A. BRUNO
>
>
------------------------------
Date: Fri, 30 Jun 2000 13:46:42 GMT
From: manchester_united@my-deja.com
Subject: Q: What happens if a 'path' had a space in it?
Message-Id: <8ji8bs$7cg$1@nnrp1.deja.com>
This ones has me beat - PERL cannot read a file from a Windows folder
that has a space in it...
e.g. c:\Program Files\test.txt
Try it and see. Escaping ('\') the space doesn't work, nor does using
short filenames...
i.e. c:\Progra~1\test.txt
Only smarties have the answer!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Jun 2000 16:08:07 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Q: What happens if a 'path' had a space in it?
Message-Id: <cxcem5fgt2w.fsf@masterblaster.uio.no>
manchester_united@my-deja.com writes:
> This ones has me beat - PERL cannot read a file from a Windows folder
> that has a space in it...
> e.g. c:\Program Files\test.txt
>
> Try it and see. Escaping ('\') the space doesn't work, nor does using
> short filenames...
> i.e. c:\Progra~1\test.txt
Exactly what code are you using? Are you using something like
$file = "c:\Program Files\test.txt";
If so, it won't work as expected.
Peter
--
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];
------------------------------
Date: Fri, 30 Jun 2000 14:36:03 GMT
From: manchester_united@my-deja.com
Subject: Re: Q: What happens if a 'path' had a space in it?
Message-Id: <8jib8h$9na$1@nnrp1.deja.com>
In article <cxcem5fgt2w.fsf@masterblaster.uio.no>,
jacklam@math.uio.no (Peter J. Acklam) wrote:
> manchester_united@my-deja.com writes:
>
> > This ones has me beat - PERL cannot read a file from a Windows
folder
> > that has a space in it...
> > e.g. c:\Program Files\test.txt
> >
> > Try it and see. Escaping ('\') the space doesn't work, nor does
using
> > short filenames...
> > i.e. c:\Progra~1\test.txt
>
> Exactly what code are you using? Are you using something like
>
> $file = "c:\Program Files\test.txt";
>
> If so, it won't work as expected.
>
> Peter
>
> --
> $\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
> //)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];
>
Specifically, I'm trying to use the 'glob' command, so, using the above
$file, try something like:-
@array = glob ($file);
It will not return the files and folders of Program Files, no matter
what permutations of back-slashes and forward-slashes I've tried.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Jun 2000 13:00:29 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Repeated regex matching.
Message-Id: <962369130.11982@itz.pp.sci.fi>
In article <240620001645453398%ken@forum.swarthmore.edu>, Ken Williams wrote:
> $foo = "popopop";
>
> while(($foo =~ m/pop/gi)){
> print "MATCHED: ", pos($foo), "\n";
> pos($foo)--;
> }
Of course, this assumes we know the pattern in advance. If we don't,
we could do it like this:
$foo = "popopop";
while ($foo =~ m/pop/gi) {
print "MATCHED: ", pos($foo), "\n";
pos($foo) -= length($&) - 1;
}
This still does not find all the ways the pattern can match the given
string, merely every possible starting position. This is not an issue
if the pattern has no regex metacharacters, but in that case it makes
much more sense to use index() instead:
$foo = "popopop";
for (my $pos = 0; ($pos = index $foo, 'pop', $pos) >= 0; $pos++) {
print "FOUND: $pos\n";
}
The difference in the output is because the former code gives the
ending and the latter the starting positions of the matches.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Fri, 30 Jun 2000 12:58:06 GMT
From: JMarsan <jmarsan@my-deja.com>
Subject: Re: running script on remote server
Message-Id: <8ji5gm$52m$1@nnrp1.deja.com>
In article <u9g0pxo5ac.fsf@wcl-l.bham.ac.uk>,
nobull@mail.com wrote:
> JMarsan <jmarsan@my-deja.com> writes:
>
> > I would like to know what is the simplest way to call a shell
script on
> > a remote server from my Perl script and get the output of the shell
> > script in my Perl script.
>
> Backticks and rsh.
>
> @script_output = `rsh some.other.server some_script`;
>
> That's the simplest way. It may not be the best way (or even a
> possible way) in your cirvcumstances.
>
> But then you didn't describe your circumstances so I gave you the
> simplest way that would exist under ideal circumstances.
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
>
Hi, thank you for your reply.
I tried your solution this way:
@output = `rsh -l lilas blackcat directory.pl`;
but I got the message "Permission denied" from blackcat server. The
thing is that I can Telnet blackcat as lilas anytime so why can't I log
on via my Perl script?
--
J. Marsan
Technician, IT
N.S.D.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 30 Jun 2000 14:02:17 GMT
From: Shana Rosenberg <rosenbse@my-deja.com>
Subject: Re: Specifying smtp server in Mail::Mailer
Message-Id: <8ji98s$86u$1@nnrp1.deja.com>
In article <8jhm28$c4m$1@orpheus.gellyfish.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> You are indeed using the module correctly ?
As far as I know I am. Perhaps I should have put "Newbie" in my post
title :)
> have you thought that the server in question might not allowing
relaying
> for the host you are sending from ?
The server will allow relaying from my host. I am in the same domain
and this is the only restriction set up on our SMTP server, that
senders be in the same domain.
> What you might want to do is to
> temporarily alter Mail::Mailer::smtp so that it turns the debugging on
> for Net::SMTP - or you could use Net::SMTP directly to talk to the
> server in question.
Once again, forgive my newbieness at Perl. I don't know how to do this
so I would appreciate suggestions for taking this course of action.
I'm just absolutely stymied because my code appears correct, and yet
the script (and other test scripts I have written since to try and
figure out the problem) seems to demand my own mail server. I have
specified several other (that would relay) SMTP servers with the same
(bad) results.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Jun 2000 09:53:33 -0400
From: David Meyers <dmeyers@panix.com>
Subject: Re: STDOUT and IIS
Message-Id: <yobbt0jb7he.fsf@panix6.panix.com>
"Michael R. Harper" <mikihasa@att.net> writes:
[under IIS2.0]
> Basically, I am trying to do something like this:
>
> open(IN, "program.exe < tempfile.txt|");
> @response = <IN>;
> close(IN);
This has to do with how IIS spawns it's processes. It's
a real pain in the ass and the workaround you mentioned
in your followup, redirecting output to a temp file, is
not a bad solution. However, here's some more info about
the problem:
http://www.whitecrow.demon.co.uk/steve/perlfaq/iis3.html#io
--d
------------------------------
Date: Fri, 30 Jun 2000 17:04:43 +0200
From: "Matthieu nicolescu" <tepes@cybercable.fr>
Subject: Web Online : Web Technology Site Web
Message-Id: <8jicn3$1v8h$1@news6.isdnet.net>
http://webonline.dynip.com
Web Online : Web Technology Site Web
LOTS OF GUIDE AND TUTORIAL FOR XML, DHTML, FLASH, JAVASCRIPT, PHP AND PERL
http://webonline.dynip.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3523
**************************************