[22031] in Perl-Users-Digest
Perl-Users Digest, Issue: 4253 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 12 06:05:41 2002
Date: Thu, 12 Dec 2002 03:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 12 Dec 2002 Volume: 10 Number: 4253
Today's topics:
Re: @INC error in in unix (Daveo)
Re: @INC error in in unix <me@privacy.net>
Re: A formating problem <goldbb2@earthlink.net>
can I ship perl interpreter & do I need to send importe (qanda)
Re: hidden eval variables (Anno Siegel)
how to download a website protected with NTLM-authentic <a@b.c>
Re: Re FAQ: How can I capture STDERR from an external c <goldbb2@earthlink.net>
Redirect output back to console <sunil_franklin@hotmail.com>
Re: Redirect output back to console (Anno Siegel)
Re: Redirect output back to console <nobull@mail.com>
Regex that would match email address format <bob@vdpcorp.com>
Re: Regex that would match email address format <jurgenex@hotmail.com>
Re: Regex that would match email address format <no@email.com>
repost : Read return value from a sql script using pipe <sunil_franklin@hotmail.com>
Re: repost : Read return value from a sql script using <nobull@mail.com>
Setting DOS buffer size. <spikey-wan@bigfoot.com>
Re: Setting DOS buffer size. <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Setting DOS buffer size. <spikey-wan@bigfoot.com>
Tk module <lois@hotmail.com>
Re: Why doesn't my array grow? <uri@stemsystems.com>
Re: Why doesn't my array grow? <bstutes@eskimo.com>
Re: Why doesn't my array grow? <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Dec 2002 22:07:52 -0800
From: david.c.obrien@citigroup.com (Daveo)
Subject: Re: @INC error in in unix
Message-Id: <7b343fef.0212112207.60779f60@posting.google.com>
> Aw come on, Brian didn't use much "vitrol" here, twas just a gentle nudge.
> Try some of Perlie Gurlie's stuff if you want to see vitrol.
> Dick Penny
Is Perl Gurl the new name for Godzilla? Zilla used to be a fiend on this board
------------------------------
Date: Thu, 12 Dec 2002 21:04:46 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: @INC error in in unix
Message-Id: <at9mvt$1103o2$1@ID-172104.news.dfncis.de>
"Daveo" <david.c.obrien@citigroup.com> wrote in message
news:7b343fef.0212112207.60779f60@posting.google.com...
> > Aw come on, Brian didn't use much "vitrol" here, twas just a gentle
nudge.
> > Try some of Perlie Gurlie's stuff if you want to see vitrol.
> > Dick Penny
>
> Is Perl Gurl the new name for Godzilla? Zilla used to be a fiend on this
board
Perl Gurl is an old name for Godzilla that has been revived (among many
others).
BTW, this is a newsgroup not a board.
------------------------------
Date: Thu, 12 Dec 2002 02:39:16 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: A formating problem
Message-Id: <3DF83D24.B652CF5B@earthlink.net>
Tad McClellan wrote:
> Jan Fure wrote:
[snip]
> > while (<@data1>) {
>
> You're using an awfully strange looking filehandle in the input
> operator...
No, he's using an awfully strange looking filename-spec to glob().
The above is equivilant to:
while( glob("@data1") ) {
This joins the elements of @data1 on $" and passes it to glob(). It
gets parsed into a filename-specifyer; since none of the elements of
@data1 contain "{" or "}", this means that it merely gets split on
whitespace into tokens. Since none of those tokens contains '*' or '?',
they simply get returned unchanged, regardless of whether or not they
match anything in the filesystem.
In other words, for his particular data, it's merely an expensive way of
saying:
> foreach ( @data1 ) {
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: 11 Dec 2002 23:58:31 -0800
From: fumail@freeuk.com (qanda)
Subject: can I ship perl interpreter & do I need to send imported modules
Message-Id: <62b4710f.0212112358.730b8687@posting.google.com>
Hi all
I've been slowly learning perl over the last few weeks and need to
know about deployment - I've tried a few searches and docs but can't
get a definate answer - I'm still learning where to find information!
If I want to send perl scripts as part of my companys product, can I
also send the perl interpreter (for any particular platform) and do I
need to ship anything else such as imported modules. I still don't
understand the implementation details of perl and its modules, are
some built into the perl interpreter itself, where do they live, etc?
Thanks in advance
------------------------------
Date: 12 Dec 2002 08:07:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: hidden eval variables
Message-Id: <at9g4k$ma6$1@mamenchi.zrz.TU-Berlin.DE>
According to Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca>:
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
[...]
> : Ah, but this isn't about "use vars" and "our()". Package variables
> : will always be accessible from anywhere, only lexicals can be protected.
>
> If you know what package variables you are using then do a `local varname'
> for each one before the eval. That way the package variable will still
> be protected.
>
>
> use vars qw( $my_package_var );
>
> sub my_eval
> { my $your_code = shift;
>
> local $my_package_var = $my_package_var; # protect my version
>
> eval $your_code ;
>
> ... etc ...
Oh, right. One could also mask it by declaring a like-named lexical,
though "my $my_package_var" is a bit oxymoronic.
Anno
------------------------------
Date: Thu, 12 Dec 2002 10:57:57 +0100
From: ZZT <a@b.c>
Subject: how to download a website protected with NTLM-authentication?
Message-Id: <at9mj5$r8h$1@news1.wdf.sap-ag.de>
Hi,
is there a module and chance to get a site within perl?
wget is not supporting NTLM but maybe there is a http-get module for
perl that support NTLM.
thanks a lot
------------------------------
Date: Thu, 12 Dec 2002 02:29:07 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Re FAQ: How can I capture STDERR from an external command?
Message-Id: <3DF83AC3.C6A5336F@earthlink.net>
Peter J. Acklam wrote:
>
> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>
> > Peter J. Acklam wrote:
> > >
> > > Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> > [snip]
> > > > In what way do FIFO files seem cleaner?
> > >
> > > I was scared by the all the warnings in the docs for
> > > Net::Open3. There seems to be so much that can go wrong
> > > (deadlocks etc.),
> >
> > Except that those exact same deadlocks would still occur if you
> > used fifos instead of pipes.
>
> I will never be writing to stdin, only reading from stdout and
> stderr, so I didn't think deadlocks would happen in that case,
> when I used FIFOs, but I am rather new to IPC, so I might be
> confused.
There are a whole multitude of ways that deadlock can occur -- the one I
am speaking of has *nothing* to do with stdin.
If stdout and stderr are FIFOs, this is *no* different (in terms of
possible deadlocks) from stdout and stderr being ordinary pipes.
If you do something like:
my $pid = open3( *IN, *OUT, *ERR, @program );
close(IN);
my @out = <OUT>;
my @err = <ERR>;
Then the '@out = <OUT>' line can deadlock, if the child process tries to
write more to it's stderr than can fit in a pipe's (fifo's) buffer.
Changing from pipes to fifos *will not help*.
> > > and I don't yet have that much experience with IPC, so I was
> > > worried about screwing things up. Separating stdout and
> > > stderr is so easy in the shell, but seems to be so complicated
> > > in Perl.
> >
> > Sending stdout and stderr to two seperate files is quite easy,
> > in both shell and perl.
>
> Most things are easy when you know how to do them... :-)
>
> > But simultaneously processing both stdout and stderr can be
> > quite complicated, in both shell and perl.
> >
> > How would you do it in the shell, if you consider it to be so
> > easy?
>
> In the shell I would just do
>
> command 1> log.stdout 2> log.stderr
But you are not processing these two files simultaneously!
You are merely dumping the data to two files. This is easy to do with
perl, too.
The simplest way of course is:
system("command 1> log.stdout 2> log.stderr");
But you can, if you choose to, do it more verbosely, in a way that
doesn't invoke the shell (useful if "command"'s arguments contain
metacharacters that you don't want the shell parsing):
# open the files.
# Use ">>" instead of ">" for append mode, if desired.
open( OUT, ">", "log.stdout" ) or die horribly;
open( ERR, ">", "log.stdout" ) or die horribly;
# start the program
my $pid = open3( Symbol::gensym(), ">&OUT", ">&ERR", @command );
# close the handles, unless you want to add something else.
close( OUT );
close( ERR );
# wait for the program to end
waitpid( $pid, 0 );
How do you use the shell to process the stdout and stderr of a command
*both at once*, *while the command is running*? I do not think you can
do it with just the shell. Please show me otherwise.
> but doing the same in Perl requires a _lot_ more work, unless I am
> mistaken.
To dump to std{out,err} to files is easy, in either language.
To process std{out,err} simultaneously, as they are being produced, is
less than simple -- it can be done with perl, but I don't think it can
be done with shell.
> > > I'll probably just redirect stdout and stderr to the same
> > > place and avoid all the hassle.
> >
> > If you don't explicitly need to deal them *seperately*, then
> > joining stdout and stderr certainly simplifies things; After
> > all, what could be easier than the following?
> >
> > open( my ($fh), "-|", "some program and args 2>&1" )
> > or die horribly;
>
> True. I would prefer to have them in separate files, but I doubt
> it is worth the trouble.
If that's *all* you want to do (and don't want to process the data as
it's produced), then just do it as I've shown you above.
But if you want the data as it's being produced, from both streams, with
the data from each stream seperate, then of course it's more work.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Thu, 12 Dec 2002 12:30:01 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: Redirect output back to console
Message-Id: <GwWJ9.12$mk.38@news.oracle.com>
I have got something like
open(STDOUT, '>>my_test.log');
# Do lots of stuff which does not write to the console
# but writes to my_test.log
# now need to reset the standard output back to the console
open(STDOUT, '>> 1'); # tried this, but does not work.
Can I do this?
Thanks,
Sunil.
------------------------------
Date: 12 Dec 2002 08:22:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Redirect output back to console
Message-Id: <at9gv9$ma6$2@mamenchi.zrz.TU-Berlin.DE>
According to Sunil <sunil_franklin@hotmail.com>:
> I have got something like
>
> open(STDOUT, '>>my_test.log');
>
> # Do lots of stuff which does not write to the console
> # but writes to my_test.log
>
> # now need to reset the standard output back to the console
> open(STDOUT, '>> 1'); # tried this, but does not work.
>
> Can I do this?
Yes. Look for "redirect" in "perldoc -f open", various methods are
discussed there.
Anno
------------------------------
Date: 12 Dec 2002 08:49:13 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Redirect output back to console
Message-Id: <u9pts7a7mx.fsf@wcl-l.bham.ac.uk>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> According to Sunil <sunil_franklin@hotmail.com>:
> >
> > open(STDOUT, '>>my_test.log');
> > # now need to reset the standard output back to the console
> > open(STDOUT, '>> 1'); # tried this, but does not work.
> Yes. Look for "redirect" in "perldoc -f open", various methods are
> discussed there.
In addition, if the OP is interested only in redirecting the output of
the Perl script and not the output of child processes, he should
consider using the 1-arg select() function rather than messing with
STDOUT.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 12 Dec 2002 05:37:26 GMT
From: "Bob Van Der Ploeg" <bob@vdpcorp.com>
Subject: Regex that would match email address format
Message-Id: <qgVJ9.20636$Db4.619606@twister.tampabay.rr.com>
I need a regex that would match an email address found anywhere in a line of
text.
Anybody got one they like?
Thanks
Bob
------------------------------
Date: Thu, 12 Dec 2002 06:21:19 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regex that would match email address format
Message-Id: <zVVJ9.2357$ce5.232@nwrddc03.gnilink.net>
Bob Van Der Ploeg wrote:
> I need a regex that would match an email address found anywhere in a
> line of text.
> Anybody got one they like?
Virtually impossible because there is no way to define how an email address
looks like (there are too many standards). And even if you manage to define
a common syntax, I doubt that a RE would be suitable to parse it.
See also "perldoc -q address":
"How do I check a valid mail address?"
jue
------------------------------
Date: Thu, 12 Dec 2002 10:44:39 -0000
From: "Brian Wakem" <no@email.com>
Subject: Re: Regex that would match email address format
Message-Id: <at9pao$11jhb7$1@ID-112158.news.dfncis.de>
"Bob Van Der Ploeg" <bob@vdpcorp.com> wrote in message
news:qgVJ9.20636$Db4.619606@twister.tampabay.rr.com...
> I need a regex that would match an email address found anywhere in a line
of
> text.
> Anybody got one they like?
>
> Thanks
> Bob
Probably impossible to match 100% of addresses.
m/[\w-.]+\@[\w-.]+/; # is a very simple way of doing it. It will match 99%
of addresses, but it can match stuff that aren't email addresses, it depends
on what else is in the text you are searching.
--
Brian Wakem
------------------------------
Date: Thu, 12 Dec 2002 11:06:37 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: repost : Read return value from a sql script using piped open
Message-Id: <EiVJ9.11$mk.119@news.oracle.com>
All,
I need to get the return value from a sql script and redirect the
output to a file. I do not want to see the output in the console and want to
avoid
showing passwords to 'ps' and the same code needs to run on win and unix. I
am not using dbi as I have a
huge investment in sql scripts which does the job for me. I was previously
using csh to execute these scripts.
I am now calling the script using code as below.
--------- Start My Code
open SQLP, "|sqlplus -s /nolog >> $output_file_name "
or die "cannot open sqlplus $ERRNO
\n";
# Connect and execute the script. This is done by writing to the stream we
open for sqlplus.
SQLP "connect $user_name/$password \n" or die "cannot write in doScript";
print SQLP "\@$script_name; \n" or die "cannot write in doScript";
close SQLP or die "cannot close in doScript";
print "Status is :" . ($? >> 8);
--------- End My Code
The sql script I execute is :-
****** Start t.sql
select sysdate from dual
/
exit 77
****** End t.sql
This works if the exit value is 0 but anything else fails.
................. Start Error I see
Uncaught exception from user code:
cannot close in doScript at sqlutils.pm line 160.
sqlutils::doSqlScript('t.sql', 'scott', 'tiger@iasdb.local',
'a.log') called at tutils.pl ine 21
................. End Error I see
Your suggestions please.
Thanks & Regards,
Sunil.
------------------------------
Date: 12 Dec 2002 08:54:23 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: repost : Read return value from a sql script using piped open
Message-Id: <u9lm2va7d7.fsf@wcl-l.bham.ac.uk>
"Sunil" <sunil_franklin@hotmail.com> writes:
> close SQLP or die "cannot close in doScript";
>
> print "Status is :" . ($? >> 8);
As you have observed, the above will always either die or print
"Status is :0".
> Your suggestions please.
I suggest you read: perldoc -f close
Pay particular attension to what is said about the return value of the
close() function the paragraph that starts "If the file handle came
from a piped open..."
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 12 Dec 2002 09:41:39 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Setting DOS buffer size.
Message-Id: <at9lia$qc7$1@newshost.mot.com>
Hello World!
I need to set the buffer size on the DOS window that starts when I double
click on my script. Currently I get a standard DOS window with no scroll
bar.
What I would like is to be able to specify the buffer height, and have a
scroll bar down the side of the window.
I have done web searches, but not turned up anything, and I don't know where
to start. Any help greatly appreciated.
Thanks.
R.
------------------------------
Date: Thu, 12 Dec 2002 09:58:27 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Setting DOS buffer size.
Message-Id: <at9mk2$9bl$2@korweta.task.gda.pl>
In article <at9lia$qc7$1@newshost.mot.com>, Richard S Beckett wrote:
> Hello World!
>
> I need to set the buffer size on the DOS window that starts when I double
> click on my script. Currently I get a standard DOS window with no scroll
> bar.
>
> What I would like is to be able to specify the buffer height, and have a
> scroll bar down the side of the window.
>
> I have done web searches, but not turned up anything, and I don't know where
> to start. Any help greatly appreciated.
What exactly does this have to do with Perl?
(Hint: Nothing)
Did you try right-clicking on the DOS window title bar and opening the
properties menu?
(Hint: Try)
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Thu, 12 Dec 2002 10:46:49 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: Setting DOS buffer size.
Message-Id: <at9pg4$r2q$1@newshost.mot.com>
"Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in
message news:at9mk2$9bl$2@korweta.task.gda.pl...
> In article <at9lia$qc7$1@newshost.mot.com>, Richard S Beckett wrote:
> > Hello World!
> >
> > I need to set the buffer size on the DOS window that starts when I
double
> > click on my script. Currently I get a standard DOS window with no scroll
> > bar.
> >
> > What I would like is to be able to specify the buffer height, and have a
> > scroll bar down the side of the window.
> >
> > I have done web searches, but not turned up anything, and I don't know
where
> > to start. Any help greatly appreciated.
>
>
> What exactly does this have to do with Perl?
> (Hint: Nothing)
I want to change the settings from within my perl script.
When I start my script it automatically starts a default size DOS window,
and I cannot change the size of it.
So that the users see what I want htem to see, I want to set the size
myself, so that it's the same for all users.
Some users are too stupid to be able to set the parameters themselves.
Where exactly can you set the DOS window properties for a .pl file?
If I right click on the title bar of my DOS window, and select Properties,
nothing happens.
> Did you try right-clicking on the DOS window title bar and opening the
> properties menu?
> (Hint: Try)
Yes, I did. Have YOU ever tried it? Obviously not, because you'd know that
if you're using Tk for a GUI, when you start your script, you get a default
size DOS window, that you CANNOT alter the properties of in the usual
manner.
Thankyou for your help.
(Hint: NOT!)
R.
------------------------------
Date: Thu, 12 Dec 2002 06:47:10 GMT
From: "Lois" <lois@hotmail.com>
Subject: Tk module
Message-Id: <OhWJ9.119088$pN3.8766@sccrnsc03>
Hi all,
Please advise which file to download in order to use the Tk module. I
went to CPAN and found at least a dozens of related files.
Thanks,
lois
------------------------------
Date: Thu, 12 Dec 2002 05:19:37 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why doesn't my array grow?
Message-Id: <x73cp3hl08.fsf@mail.sysarch.com>
>>>>> "BS" == Bob Stutes <bstutes@eskimo.com> writes:
>> $arraySize = @calendar;
BS> make this line: $arraySize = $#calendar;
BS> see perldata documentation.
you should look at the other (correct) answers before you jump in with
one that is very off target.
also learn to edit the quoted text since you added 2 lines to about 40
quoted lines.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 11 Dec 2002 23:30:50 -0600
From: Bob Stutes <bstutes@eskimo.com>
Subject: Re: Why doesn't my array grow?
Message-Id: <at96ub$40a$1@eskinews.eskimo.com>
Uri Guttman wrote:
>>>>>>"BS" == Bob Stutes <bstutes@eskimo.com> writes:
[ .. snip ..]
Dude .. you get yer jollies stepping on people?
--
Bob Stutes - St. Louis, Mo.
Unix Administrator and General Geek Wanna-Be
e-mail: bstutes@eskimo.com
The Wisdom of the ages may be found ... if you will only look up.
Unknown.
------------------------------
Date: Thu, 12 Dec 2002 05:35:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why doesn't my array grow?
Message-Id: <x7y96vg5pv.fsf@mail.sysarch.com>
>>>>> "BS" == Bob Stutes <bstutes@eskimo.com> writes:
BS> Uri Guttman wrote:
>>>>>>> "BS" == Bob Stutes <bstutes@eskimo.com> writes:
BS> [ .. snip ..]
BS> Dude .. you get yer jollies stepping on people?
do you get yours giving wrong answers to questions that have already
been answered correctly? we have a group troll already, don't add to it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 V10 Issue 4253
***************************************