[18223] in Perl-Users-Digest
Perl-Users Digest, Issue: 391 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 1 18:10:55 2001
Date: Thu, 1 Mar 2001 15:10:22 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983488221-v10-i391@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 1 Mar 2001 Volume: 10 Number: 391
Today's topics:
Re: Radical readdir suggestion (Joe Smith)
Re: Radical readdir suggestion (Joe Smith)
Re: Reading and Writing to Serial Port <mtsouk@freemail.gr>
Re: Reading and Writing to Serial Port <um@no.com>
referer() and https? <jhall@ifxonline.com>
Re: referer() and https? <jhall@ifxonline.com>
Re: referer() and https? (Joe Smith)
Re: referer() and https? <micah@cowanbox.com>
Re: regex help please (The Mosquito ScriptKiddiot)
Re: Shell to perl conversion. (Peter L. Berghold)
Re: TCP socket writer. <um@no.com>
use strict; <todd@mrnoitall.com>
Re: use strict; <joe+usenet@sunstarsys.com>
What is \cM ? <garcia868@yahoo.com>
Re: What is \cM ? <elijah@workspot.net>
Re: What is \cM ? (Abigail)
Re: What is \cM ? (Peter J. Acklam)
Re: What is \cM ? <micah@cowanbox.com>
Re: wierd syntax/end of file error <um@no.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Mar 2001 22:10:48 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Radical readdir suggestion
Message-Id: <97mhd8$2mtn$1@nntp1.ba.best.com>
In article <ldo-075172.21190407022001@news.wave.co.nz>,
Lawrence DčOliveiro <ldo@geek-central.gen.new_zealand> wrote:
>In article <3a7e6526.4cce$d8@news.op.net>, mjd@plover.com (Mark Jason
>Dominus) wrote:
>
>>In article <ldo-BD3CE2.16005405022001@news.wave.co.nz>,
>>Lawrence DčOliveiro <ldo@geek-central.gen.new_zealand> wrote:
>>>What is the use of readdir returning the "." and ".." entries?
>>
>>The Principle of Least Surprise.
>
>In what way?
>
>>>Has anybody ever written a Perl script that depended on these entries
>>>being returned in order to work?
>>
>>Yes.
>
>Such as...?
Such as writing the equivalent of /bin/ls in perl.
The output of `ls -la` should NOT be the same as the output of `ls -lA`.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 1 Mar 2001 22:17:01 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Radical readdir suggestion
Message-Id: <97mhot$2neh$1@nntp1.ba.best.com>
In article <ldo-E8934A.21213307022001@news.wave.co.nz>,
Lawrence DčOliveiro <ldo@geek-central.gen.new_zealand> wrote:
>I believe that _all_ real-world uses of readdir are concerned with
>returning the contents of the directory, not with its entries.
So, you are saying that when it comes to `ls -la` and `ls -lA`,
everyone uses the latter and no-one uses the former.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Thu, 1 Mar 2001 23:35:26 +0200
From: "Mihalis Tsoukalos" <mtsouk@freemail.gr>
Subject: Re: Reading and Writing to Serial Port
Message-Id: <97mfl5$1dhf$1@ulysses.noc.ntua.gr>
Linux SuSE 7.0
cheers,
Mihalis.
Ben L. <um@no.com> wrote in message news:3a9d732c$1_1@news2.one.net...
> What platform are you using?
------------------------------
Date: Thu, 1 Mar 2001 17:16:08 -0800
From: "Ben L." <um@no.com>
Subject: Re: Reading and Writing to Serial Port
Message-Id: <3a9ecc72_1@news2.one.net>
I would suggest taking a look at Device::SerialPort. You can find it on
CPAN:
http://www.perl.com/CPAN-local/authors/id/C/CO/COOK/
It has all the methods to do exactly what you want. Good luck!
Ben
Mihalis Tsoukalos <mtsouk@freemail.gr> wrote in message
news:97mfl5$1dhf$1@ulysses.noc.ntua.gr...
> Linux SuSE 7.0
>
> cheers,
> Mihalis.
>
> Ben L. <um@no.com> wrote in message news:3a9d732c$1_1@news2.one.net...
> > What platform are you using?
>
>
------------------------------
Date: Thu, 01 Mar 2001 19:54:38 GMT
From: "John Hall" <jhall@ifxonline.com>
Subject: referer() and https?
Message-Id: <2Oxn6.108$hM2.129399@news1.rdc1.sdca.home.com>
This might be a wierd one, but I am using referer() in CGI.pm and it looks
like it isn't working for requests from https sites. Am I crazy? If not, is
there a way to get the referer for https sites?
------------------------------
Date: Thu, 01 Mar 2001 20:01:13 GMT
From: "John Hall" <jhall@ifxonline.com>
Subject: Re: referer() and https?
Message-Id: <dUxn6.110$hM2.131183@news1.rdc1.sdca.home.com>
I have more information;
This _does_ work on Netscape, so apparently it's an IE 5.5 problem. ! Daft!
Since this isn't the right list for browser issues, i'll pose a different
question:
Is there another method to get the "referer"?
"John Hall" <jhall@ifxonline.com> wrote in message
news:2Oxn6.108$hM2.129399@news1.rdc1.sdca.home.com...
>
> This might be a wierd one, but I am using referer() in CGI.pm and it looks
> like it isn't working for requests from https sites. Am I crazy? If not,
is
> there a way to get the referer for https sites?
>
>
>
>
>
>
------------------------------
Date: 1 Mar 2001 22:26:29 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: referer() and https?
Message-Id: <97mial$2o72$1@nntp1.ba.best.com>
In article <dUxn6.110$hM2.131183@news1.rdc1.sdca.home.com>,
John Hall <jhall@ifxonline.com> wrote:
>This _does_ work on Netscape, so apparently it's an IE 5.5 problem. ! Daft!
>Is there another method to get the "referer"?
No. You are at the mercy of the browser. If the browser doesn't want
to cooperate, there is nothing the server can do to get that info.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 01 Mar 2001 14:48:36 -0800
From: Micah Cowan <micah@cowanbox.com>
Subject: Re: referer() and https?
Message-Id: <yu8y9upjebf.fsf@mcowan-linux.transmeta.com>
"John Hall" <jhall@ifxonline.com> writes:
> I have more information;
>
> This _does_ work on Netscape, so apparently it's an IE 5.5 problem. ! Daft!
>
> Since this isn't the right list for browser issues, i'll pose a different
> question:
>
> Is there another method to get the "referer"?
the Referer field isn't guaranteed to be provided in any case. One
might argue that, for once, Microsoft is doing the right thing in this
case, since it may not be prudent to divulge the URL of a connection
which was supposed to be secure. Providing it, though, isn't
necessarily the wrong thing, either.
Micah
------------------------------
Date: 01 Mar 2001 22:42:59 GMT
From: anotherway83@aol.com (The Mosquito ScriptKiddiot)
Subject: Re: regex help please
Message-Id: <20010301174259.20286.00000110@ng-ch1.aol.com>
>The problem isn't that trivial, as the program most be able to reduce
>"(2*x)+(x*3)" to "(5*x)", or "(2*x*4)" to "(8*x)", as some simple
>example. That's why symbolic manipulations of the expressions as lists
>(array, in Perl lingo) and not as string, makes life a LOT easier. So I
>turned "(2*x)" into [ '*', 2, '$x' ], and
>"(2*x)+(x*3)" into [ '+', [
>'*', 2, '$x'], ['*', '$x', 3 ] ]; '(2*x*3)' becomes [ '*', 2, '$x', 3].
i don't c why that is any more difficult...i may be wrong, so correct me
i mean, as for the first example,
it could easily be derived...why is there a need to simplify it to 5x??
same for the next one
y should (2*x*8) first be simplified??
thats equivalent to ((2*x)*8)
then u can derive it more simply to get 16
btw, if u did such a thing in the past, can u tell me what r the major hurdles
to overcome first
thanks
peace
The Mosquito ScriptKiddiot
Championing the Cause of Mosquitoes in Technology
------------------------------
Date: Thu, 01 Mar 2001 19:09:39 GMT
From: peter@uboat.berghold.net (Peter L. Berghold)
Subject: Re: Shell to perl conversion.
Message-Id: <slrn99t7jj.t4r.peter@uboat.berghold.net>
On Thu, 1 Mar 2001 13:56:12 -0500, V.Jay Lescoe <vjayl@emc.com> wrote:
>
>$OMNIHOME/bin/nco_sql -server NCOMSPRIM -user automation -password
>automation <<EOF >> $OMNIHOME/log/CM-sql.fail.log
>
>update alerts.status set BVLStatus = 'FAILED' where Serial = $1 ;
>go
>exit
>EOF
>
>
>
becomes something like:
#!/usr/bin/perl -w
##########################################
use strict;
# Let's chop the command line up into bite sized pieces
my $cmd = $ENV{OMNIHOME} . "/bin/nco_sql";
my $sv = "-server NCOMSPRIM";
my $us = "-user automation";
my $pw = "-password automation";
my $log = $ENV{OMNIHOME} . "/log/CM-sql.fail.log";
open PIPE,"| $cmd $sv $us $pw >> $log"
or die "Could not open the pipe :$!";
while (my $line=<DATA>){
print PIPE $line;
}
close PIPE
exit(0);
__END__
update alerts.status set BVLStatus = 'FAILED' where Serial = $1 ;
go
exit
----------------- 8< snip 8<-----------------------------------
Now, I just gotta say it... this is a horribly inefficient use of
perl. Not what I would consider a good use unless you were to
modify the above and have your command text pulled in from a file.
--
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold Peter@Berghold.Net
"Linux renders ships http://www.berghold.net
NT renders ships useless...."
------------------------------
Date: Thu, 1 Mar 2001 17:18:11 -0800
From: "Ben L." <um@no.com>
Subject: Re: TCP socket writer.
Message-Id: <3a9ecce9$1_2@news2.one.net>
> I am new to perl and I need some help. I am trying to
> put together an easy way to open a TCP port write
> and write a text string to it.
See the interproccess communication tutorial for exapmles of what you
want to do:
http://www.perl.com/pub/doc/manual/html/pod/perlipc.html
> right direction? Please respond directly to me. My E-mail
> is vjayl@emc.com Thanks!
No!
------------------------------
Date: Thu, 01 Mar 2001 16:06:48 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: use strict;
Message-Id: <3A9EC602.C399F46C@mrnoitall.com>
Dear persons,
Is it true with... "use Strict;" you can't ... " require 'files.pl';
" ?
------------------------------
Date: 01 Mar 2001 17:59:59 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: use strict;
Message-Id: <m38zmp14eo.fsf@mumonkan.sunstarsys.com>
Todd Anderson <todd@mrnoitall.com> writes:
> Dear persons,
> Is it true with... "use Strict;" you can't ... " require 'files.pl';
> " ?
Maybe- did you try... compiling it?
% perl -wce "use Strict; require 'files.pl';"
Can't locate Strict.pm in @INC (@INC contains:
/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl
/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
--
Joe Schaefer "I was gratified to be able to answer promptly, and I did. I
said I didn't know."
--Mark Twain
------------------------------
Date: Thu, 1 Mar 2001 12:10:38 -0800 (PST)
From: J Garcia <garcia868@yahoo.com>
Subject: What is \cM ?
Message-Id: <20010301201038.26450.qmail@web1611.mail.yahoo.com>
I know that \c[ is the control character, but what is
\cM? thanks for helping out.
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
------------------------------
Date: 1 Mar 2001 21:01:52 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: What is \cM ?
Message-Id: <eli$0103011541@qz.little-neck.ny.us>
In comp.lang.perl.misc, J Garcia <garcia868@yahoo.com> wrote:
> I know that \c[ is the control character, but what is
> \cM? thanks for helping out.
\c{FOO} is control character {FOO}. So \c[ is <ESC> and
\cM is <CR>. In general, {FOO} is the ascii char of the
control char plus 64. \c? is one exception, it is minus
64. Lower case letters are treated as uppercase ones by
perl for this.
seq dec char
\c@ 000 <NUL>
\cA 001 <SOH>
\cB 002 <STX>
etc
\cZ 026 <SUB>
\c[ 027 <ESC>
\c\\ 028 <FS>
\c] 029 <GS>
\c^ 030 <RS>
\c_ 031 <US>
\c? 127 <DEL>
Elijah
------
print "\c*\c5\c3\c4 \c!\c.\c/\c4\c(\c%\c2 \c0\c%\c2\c, \c(\c!\c#\c+\c%\c2\cJ"
------------------------------
Date: 1 Mar 2001 21:14:30 GMT
From: abigail@foad.org (Abigail)
Subject: Re: What is \cM ?
Message-Id: <slrn99tetm.8nt.abigail@tsathoggua.rlyeh.net>
J Garcia (garcia868@yahoo.com) wrote on MMDCCXXXIX September MCMXCIII in
<URL:news:20010301201038.26450.qmail@web1611.mail.yahoo.com>:
^^ I know that \c[ is the control character, but what is
^^ \cM? thanks for helping out.
It's the other control character.
Abigail
--
print "${\<<''}";
Just another Perl Hacker
------------------------------
Date: 01 Mar 2001 22:44:22 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: What is \cM ?
Message-Id: <wksnkxyxlu.fsf@math.uio.no>
J Garcia <garcia868@yahoo.com> writes:
> I know that \c[ is the control character, but what is
> \cM? thanks for helping out.
"\cM" is the CR (carriage return) character
% perl -wle 'print ord "\cM"'
13
Peter
--
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!
------------------------------
Date: 01 Mar 2001 14:46:13 -0800
From: Micah Cowan <micah@cowanbox.com>
Subject: Re: What is \cM ?
Message-Id: <yu83dcxkszu.fsf@mcowan-linux.transmeta.com>
J Garcia <garcia868@yahoo.com> writes:
> I know that \c[ is the control character, but what is
> \cM? thanks for helping out.
Newline character.
------------------------------
Date: Thu, 1 Mar 2001 17:29:04 -0800
From: "Ben L." <um@no.com>
Subject: Re: wierd syntax/end of file error
Message-Id: <3a9ecf77$1_1@news2.one.net>
> > Missing right bracket at
^^^^^^^
> > /usr/local/etc/httpd/cgi-bin/psr_input.cgi line 141, at
You forgot a right bracket somehwere else in your code ... its searching
until EOF and not finding it.
------------------------------
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 V10 Issue 391
**************************************