[13295] in Perl-Users-Digest
Perl-Users Digest, Issue: 705 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 2 19:07:42 1999
Date: Thu, 2 Sep 1999 16:05:09 -0700 (PDT)
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, 2 Sep 1999 Volume: 9 Number: 705
Today's topics:
Re: $x=('a','b','c','d'); $x=('a'..'d'); $x=(($m,$n)= (Abigail)
Re: -F/foobar/ on #! line <crdevilb@mtu.edu>
array index <jc@austin.ibm.com>
Re: Case insensitive SQL query mrbog@my-deja.com
Re: Case insensitive SQL query mrbog@my-deja.com
Re: editors?? (Abigail)
Re: Equivalence <johnohara@compuserve.com>
How to get Widows version? tsackett@iname.com
Re: How to get Widows version? <theglauber@my-deja.com>
Re: How to get Widows version? tsackett@iname.com
Inter-process Queues (Guy Rosen)
Re: Password Protection? <ughridk@abchotmail.com>
Re: Password Protection? <firebrand@mail.usa.com>
Perl ds question sxbktm@my-deja.com
perl/irix: make test fails ipc_sysv <mkreutzer@my-deja.com>
progressive display of CGI output krubba@my-deja.com
Re: SEARCH and REPLACE <madebeer@igc.apc.org>
Serialization (Guy Rosen)
Re: Simulating Carriage Returns (Ilya Zakharevich)
Re: Simulating Carriage Returns (Alan Curry)
Re: Size (Larry Rosler)
TSAIHBATDA: Device numbers from stat (Tramm Hudson)
Re: using the exec command. sbrkic@my-deja.com
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Sep 1999 16:35:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: $x=('a','b','c','d'); $x=('a'..'d'); $x=(($m,$n)=('a'..'d'))
Message-Id: <slrn7strj1.au2.abigail@alexandra.delanet.com>
John Lin (johnlin@chttl.com.tw) wrote on MMCXCI September MCMXCIII in
<URL:news:7qfhie$dlg@netnews.hinet.net>:
|| # Here is a quiz. Guess the outputs before you run it.
||
|| @a=('a','b','c','d'); $x=@a; print "output1= @a,$x\n";
|| $x=('a','b','c','d'); print "output2= $x\n";
|| @a=('b','c','d'); $x=('a',@a); print "output3= $x\n";
|| @a=('a'..'d'); $x=@a; print "output4= @a,$x\n";
|| $x=('a'..'d'); print "output5= $x\n";
||
|| @a=(($m,$n)=('a'..'d')); $x=@a; print "output6= @a,$x\n";
|| $x=(($m,$n)=('a'..'d')); print "output7= $x\n";
||
|| print "output8= ",('a','b','c','d'),"\n";
|| print "output9= ",('a'..'d'),"\n";
|| print "output10= ",(($m,$n)=('a'..'d')),"\n";
||
|| # Could anyone please give me some examples to show that
|| # output3= 3, output5= "" and output7= 4
|| # are very useful?
Easy.
@a = ('b', 'c', 'd');
$x = ('a', @a);
The second assignment is in scalar context. @a in scalar context is 3.
So, $x gets the value 3. Where it is useful? Well, for instance in:
print scalar (localtime);
I certainly don't want the () around localtime force list context on
localtime....
$x = ('a' .. 'd');
This is of course going to give "". `..' is in scalar context, and
`..' in scalar context is the flip flop operator, and not the list
operator. 'a' .. 'd' in scalar context has nothing to do with the
list 'a', 'b', 'c', 'd'.
Where it is useful is for instance in:
print if /begin/ .. /end/;
The usefulness of item 7 might be a bit more obscure, but consider:
$x = () = "a" .. "e";
print $x;
That will print `5'. I am not sure if that was a deliberate design decision,
or something that just happens, and turned out to be (marginally) useful.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 2 Sep 1999 21:12:46 GMT
From: Colin R. DeVilbiss <crdevilb@mtu.edu>
Subject: Re: -F/foobar/ on #! line
Message-Id: <7qmp8e$e6n$1@campus1.mtu.edu>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
> Colin R. DeVilbiss <crdevilb@mtu.edu> writes:
> > Ala Qumsieh <aqumsieh@matrox.com> wrote:
> > > I don't get this error on my version of Perl:
> > > This is perl, version 5.004_04 built for sun4-solaris
> > > What is your version of Perl?
> > 5.005_03--sorry for forgetting to post it the first time.
> I don't have that version of Perl handy. Maybe someone else can help
> here.
actually, this is sort of interesting; the following script:
1 #!/usr/bin/perl -wanF/(\s+)/
2
3 BEGIN {}
4
5 chomp $F[$#F];
6 __END__
(without the line numbers) gives the errors:
Semicolon seems to be missing at bob.pl line 2.
syntax error at bob.pl line 3, near "BEGIN "
syntax error at bob.pl line 6, near ";}"
Execution of bob.pl aborted due to compilation errors.
when run on both v5.005_03 i586-linux and v5.004_04 sun-solaris.
maybe I just am missing something really really obvious here.
Thanks for any further comments--
Colin DeVilbiss
------------------------------
Date: Thu, 02 Sep 1999 16:00:34 -0500
From: Jay Chaudhury <jc@austin.ibm.com>
Subject: array index
Message-Id: <37CEE572.598F8F8F@austin.ibm.com>
the array that i am passing to GDgraphic is treating the first index as
string. how can i make sure that the indices in an array are all
integer? or is GDgraphic module is doing something? anybody run into
this problem?
btw, i am using "use strict".
thanks for you time.
--
----------------------------------------------------------
Jay Chaudhury <jc@austin.ibm.com>
Direct: 512-823-6919 T/L: 793-6919
----------------------------------------------------------
America's new malaise: Morning DJ's
----------------------------------------------------------
------------------------------
Date: Thu, 02 Sep 1999 22:16:20 GMT
From: mrbog@my-deja.com
Subject: Re: Case insensitive SQL query
Message-Id: <7qmsva$7na$1@nnrp1.deja.com>
Yes, I did consult the documentation and no it didn't solve my problem.
All the documentation says is to do something like "LIKE '%joe%'" and
that doesn't solve my problem.
I still contest that SQL IS tangentially related to perl, given that as
much as 30 to 40% of people who program perl for a living have to write
code that consults a database. That's in the "duh" category.
Furthermore, since I'm consulting the db with perl, then there could
certainly be a way around the problm with perl rather than with the sql
query.
Thanks for your help, I really do appreciate it.
-Mike
In article <slrn7sr22k.g1h.M.Ray@carlova.ulcc.ac.uk>,
M.Ray@ulcc.ac.uk (Malcolm Ray) wrote:
> On Tue, 31 Aug 1999 19:28:23 GMT, mrbog@my-deja.com <mrbog@my-
deja.com> wrote:
> >Oh please, SQL is obviously tangentially related to perl.
>
> Why? I don't see why you'd think that.
>
> >Not only
> >that but I'm sure my question is a common one and doesn't require
heaps
> >of documentation to solve.
>
> The same is true of recipes for pasta sauces, but you wouldn't ask
about
> that in clpm.
>
> By the way, having access to heaps of documentation is *good*. You
make
> it sound like a bad thing.
>
> >And BTW mysql.com doesn't solve my problem.
>
> Like Perl, MySQL comes with 'heaps of documentation'. Did you consult
> it? It will be on your system, and is also available at
www.mysql.com.
> It has this to say:
>
> SQL pattern matching allows you to use `_' to match any single
> character, and `%' to match an arbitrary number of characters
(including
> zero characters). SQL patterns are case insensitive. Some
examples are
> shown below. Note that you do not use `=' or `!=' when you use SQL
> patterns; use the `LIKE' or `NOT LIKE' comparison operators instead.
>
> To find names beginning with `b':
>
> mysql> SELECT * FROM pet WHERE name LIKE "b%";
> +--------+--------+---------+------+------------+------------+
> | name | owner | species | sex | birth | death |
> +--------+--------+---------+------+------------+------------+
> | Buffy | Harold | dog | f | 1989-05-13 | NULL |
> | Bowser | Diane | dog | m | 1989-08-31 | 1995-07-29 |
> +--------+--------+---------+------+------------+------------+
>
> ...which contradicts the problem you're seeing.
>
> If your LIKE clauses are case-sensitive when tried like this from the
> MySQL monitor, then clearly it's not a Perl matter and you'd be better
> asking somewhere database people hang out, like maybe comp.databases.
> If they're case-insensitive, as desired, in the monitor but somehow
> become case-sensitive when using DBI from Perl, then obviously clpm
> is a reasonable place to discuss the problem.
>
> My guess is that you have an elderly version of MySQL: it used to
> have some inconsistencies around case-sensitivity in LIKE. Test your
> queries from the monitor, find out what version of MySQL you're
running,
> consult the documentation at www.mysql.com to find out whether that
> version suffers from that bug, and then upgrade, because if it's that
> old you have other problems.
>
> --
> Malcolm Ray University of London Computer
Centre
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 22:22:34 GMT
From: mrbog@my-deja.com
Subject: Re: Case insensitive SQL query
Message-Id: <7qmtav$81o$1@nnrp1.deja.com>
First of all, no, I will NOT conform to "the usenet standard" of
responding to posts at the bottom. I dissagree with it and luckily I'm
on the *internet* which is at its fundament, a medium of free speech
and expression. I happen to dissagree with the standard and I choose to
respond at the top. If you don't like that, don't read my messages.
In article <MPG.12380b6f6545b879989ca1@news-server>,
elephant@squirrelgroup.com (elephant) wrote:
> first .. please try to follow the posting guidelines for usenet by
> putting your reply AFTER the text that you're replying to - it just
> makes more sense
>
> mrbog@my-deja.com writes ..
> >Oh please, SQL is obviously tangentially related to perl.
>
> guess again .. some of us will program Perl our whole lives without
ever
Guess yet again, my friend. While it is certainly possible that someone
can program perl their whole life and never touch a database, at least
30% of all profession programmers WILL deal with SQL at some point if
not frequently. That's what I call a tangential relation.
> >And BTW mysql.com doesn't solve my problem.
>
> then you didn't look hard enough
>
By your logic there's no point in having a newsgroup, because everyone
should "just read the documentation" and if anyone has a question, then
they "didn't look hard enough".
If anyone doesn't belong in the newsgroup, its the person who thinks
that the newsgroup has no purpose.
-Mike
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 2 Sep 1999 16:37:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: editors??
Message-Id: <slrn7strn4.au2.abigail@alexandra.delanet.com>
Caper (stevencNOSPAM@nbnet.nb.ca) wrote on MMCXCII September MCMXCIII in
<URL:news:7qhraa$1rn$1@garnet.nbnet.nb.ca>:
@@ Any good Perl debuggers or editors to suggest?
vi
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 2 Sep 1999 14:05:02 -0700
From: "John M. O'Hara" <johnohara@compuserve.com>
Subject: Re: Equivalence
Message-Id: <3EBz3.5179$iy.108021@newsr1.san.rr.com>
Gareth Rees wrote in message ...
>SG <sg@midwal.ca> wrote:
>> I'd like to create something like FORTRAN's "equivalence" statement:
>>
>> DIMENSION ARRAY(2)
>> EQUIVALENCE (ARRAY(1), A)
>> EQUIVALENCE (ARRAY(2), B)
>>
>> In this case A and ARRAY(1) will point to the same memory location, so
>> A = 1 and ARRAY(1) = 1 are equal actions. How can I create the same
>> structure in perl?
>
>This is a job for a tied scalar. See the `perltie' manpage for the
>details. Here's an example:
>
> [ code snipped ... ]
This could also be done with a tied array class that takes scalar vars in
the constructor
package Equivalence_Array;
use Tie::Array;
@ISA = Tie::StdArray;
sub TIEARRAY {
my $class = shift;
my @arr;
foreach (@_) {
push @arr, \$_;
}
return bless [@arr], $class;
}
sub STORE {
my ($self, $index, $val) = @_;
${$self->[$index]} = $val;
return $self;
}
sub FETCH {
my ($self, $index) = @_;
return ${$self->[$index]};
}
# [ ... ]
package main;
$r1 = $r2 = 0;
tie @arr, 'Equivalence_Array', $r1, $r2;
$r1 = 1;
$r2 = 2;
print "@arr\n"; # prints 1 2
$arr[0] = 3;
$arr[1] = 4;
print "$r1 $r2\n"; # prints 3 4
========
-- JohnO'
------------------------------
Date: Thu, 02 Sep 1999 21:30:28 GMT
From: tsackett@iname.com
Subject: How to get Widows version?
Message-Id: <7qmq8k$5qc$1@nnrp1.deja.com>
Is there some way that my perl script can find out which version of
windows it's running on?
I have a script that runs on Win 95, 98, NT4, and Windows 2000
(pre-release). Among other things, it copies folders using xcopy. Win
95, 98 and Windows 2000 require that I use xcopy with the "/y" switch,
so that it will suppress any "file already exists" messages. However,
not only does NT4 not require this switch, it chokes on it, refusing to
execute xcopy.
I need to leave the /y switch off the call to xcopy when the script runs
on NT4, but I don't know how my script can know which OS it's running
on. I notice that there is an environmental variable in NT and 2000, but
in each case it says that the OS is "Windows NT".
thanks,
Tom Sackett
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 21:58:01 GMT
From: The Glauber <theglauber@my-deja.com>
Subject: Re: How to get Widows version?
Message-Id: <7qmrt4$6ri$1@nnrp1.deja.com>
In article <7qmq8k$5qc$1@nnrp1.deja.com>,
tsackett@iname.com wrote:
> Is there some way that my perl script can find out which version of
> windows it's running on?
If you are using ActivePerl, try this:
Win32::GetOSVersion()
[CORE] Returns the array (STRING, MAJOR, MINOR, BUILD, ID), where the
elements are, respectively: An arbitrary descriptive string, the major
version number of the operating system, the minor version number, the
build number, and a digit indicating the actual operating system. For
ID, the values are 0 for Win32s, 1 for Windows 9X and 2 for Windows NT.
In scalar context it returns just the ID.
My Win95 machine returns:
B 4 0 67306684 1
The 3rd value (build) is probably useless, but the others, perhaps
combined with Win32::IsWinNT(), should tell you what you are running
under. Be sure to experiment with a couple different machines, since
things sometimes change and Windows versions are not very well
documented.
Good luck!
g
--
Glauber Ribeiro
theglauber@my-deja.com
"Opinions stated are my own and not representative of Experian"
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 22:34:56 GMT
From: tsackett@iname.com
Subject: Re: How to get Widows version?
Message-Id: <7qmu2g$8fp$1@nnrp1.deja.com>
This looks like it will work great. Thank you.
For anyone else who runs into this issue, here's what I've found out
about the build numbers, leaving out the BUILD element of the versino
array:
OS STRING MAJOR MINOR BUILD ID
Win 95revB " B" 4 0 1
Win 98 " " 4 10 1
Win NT4 w/SP3 "Service Pack 3" 4 0 2
Win 2000 " " 5 0 2
It looks like I'll have no problem distinguising between the OS versions
if I check MAJOR, MINOR, and ID.
In article <7qmrt4$6ri$1@nnrp1.deja.com>,
The Glauber <theglauber@my-deja.com> wrote:
> In article <7qmq8k$5qc$1@nnrp1.deja.com>,
> tsackett@iname.com wrote:
> > Is there some way that my perl script can find out which version of
> > windows it's running on?
>
> If you are using ActivePerl, try this:
>
> Win32::GetOSVersion()
> [CORE] Returns the array (STRING, MAJOR, MINOR, BUILD, ID), where the
> elements are, respectively: An arbitrary descriptive string, the major
> version number of the operating system, the minor version number, the
> build number, and a digit indicating the actual operating system. For
> ID, the values are 0 for Win32s, 1 for Windows 9X and 2 for Windows
NT.
> In scalar context it returns just the ID.
>
> My Win95 machine returns:
> B 4 0 67306684 1
>
> The 3rd value (build) is probably useless, but the others, perhaps
> combined with Win32::IsWinNT(), should tell you what you are running
> under. Be sure to experiment with a couple different machines, since
> things sometimes change and Windows versions are not very well
> documented.
>
> Good luck!
>
> g
>
> --
> Glauber Ribeiro
> theglauber@my-deja.com
> "Opinions stated are my own and not representative of Experian"
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 22:24:57 GMT
From: grosen@idc.ac._il_ (Guy Rosen)
Subject: Inter-process Queues
Message-Id: <37cef7f8.9637912@news.inter.net.il>
Hi,
I was thinking of making my application multithreaded and having the
threads communicate via Thread::Queue. Reading up on PERL Threads has
made me sceptical as to whether to use it, considering my project is
rather critical.
I'm thinking of putting some of the functionality in a forked off
process. Has anyone found a useful way to manage a queue of PERL data
structures across processes, efficiently? I may be using large amounts
of data, so serializing the thing into a pipe is out of the question.
I've given SysV shared memory a thought, but how efficient is it, and
has anyone used it as an inter-process queue?
Any ideas would be really welcome.
Guy R.
-----
Guy Rosen <grosen@idc.ac._il_> (Remove underscores)
------------------------------
Date: Thu, 2 Sep 1999 17:04:49 -0400
From: "Stéphane Gauthier" <ughridk@abchotmail.com>
Subject: Re: Password Protection?
Message-Id: <7qmopj$gno$1@news.quebectel.com>
I went to your page.
1- I don't think it's a good idea to force your users to download a software
to see your website. I refused to download the software but I've found
another way to pick your password. A password in JavaScript is to easy to
pick. I've just change my set-up to not execute JavaScript and went to
index2.html. When I check the source code, I've seen the password.
2- So, you need another way. I don't know if you have access to a cgi-bin
directory but if yes, you should make a sub-directory of cgi-bin. You save
your index3.html there. At that time, nobody will be able to read that page
directly. You make a Perlscript which check the password and read the file
for them and print it to the standard output. Every time they will want to
see your page, they will have to enter the password again.
But, if somebody goes to your page regularly, I don't think he or she will
click on the banner every time. They will just enter the password anyway!
Stéphane Gauthier
------------------------------
Date: Thu, 2 Sep 1999 18:50:36 -0300
From: "Yellow Beetle" <firebrand@mail.usa.com>
Subject: Re: Password Protection?
Message-Id: <7qmrfg$h48$1@garnet.nbnet.nb.ca>
Thank You for your help, yes I double checked that
link. I did not know that it lead to something that made
you dowload a program. It should be fixed now. How
well do you think this will work for the average computer
user? I would like to make it so you that you can't go to
index3.html without going to index.html. Unfortunitly I
don't have a cgi-bin, is there any other way to do it, or
can I link it to another cgi-bin that I could get for free?
I don't know Perl at all, so I wouldn't know how to make
a script to do this, do you know of anyone that would make
one for me, or is this hard to do?
Thank You For Your Help,
Jimmy
theromroom@hotmail.com
- Original Message -----
From: Stéphane Gauthier <ughridk@abchotmail.com>
Newsgroups: comp.lang.perl.misc
Sent: Thursday, September 02, 1999 6:04 PM
Subject: Re: Password Protection?
I went to your page.
1- I don't think it's a good idea to force your users to download a
software
to see your website. I refused to download the software but I've found
another way to pick your password. A password in JavaScript is to easy to
pick. I've just change my set-up to not execute JavaScript and went to
index2.html. When I check the source code, I've seen the password.
2- So, you need another way. I don't know if you have access to a cgi-bin
directory but if yes, you should make a sub-directory of cgi-bin. You save
your index3.html there. At that time, nobody will be able to read that page
directly. You make a Perlscript which check the password and read the file
for them and print it to the standard output. Every time they will want to
see your page, they will have to enter the password again.
But, if somebody goes to your page regularly, I don't think he or she will
click on the banner every time. They will just enter the password anyway!
Stéphane Gauthier
------------------------------
Date: Thu, 02 Sep 1999 20:56:05 GMT
From: sxbktm@my-deja.com
Subject: Perl ds question
Message-Id: <7qmo8f$46t$1@nnrp1.deja.com>
Hi all,
I have a list of items such as,
LEFT MID RIGHT
---- --- -----
ABCD 5 aa
MNOP 5 bb
MNOP 4 dd
ABCD 4 ff
MNOP 5 gg
ABCD 6 hh
If any of the items on the left is greater than 10, I want to repeat it
again. But I would like to see the outputs on the right being
reflected correspondingly too. By that I mean, I want to produce the
output in the following way:
LEFT MID RIGHT
---- --- -----
ABCD 9 aa
ff
ABCD 6 hh
MNOP 10 bb
dd
MNOP 5 gg
I am newbie to the data structures of Perl, although I tried using
HashofList{LEFT},but the problem with this approach is that it only
gives unique values, ABCD and MNOP, as opposed to the above output.
Could you help. Thanks in advance.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 22:25:52 GMT
From: Michiel Kreutzer <mkreutzer@my-deja.com>
Subject: perl/irix: make test fails ipc_sysv
Message-Id: <7qmth5$842$1@nnrp1.deja.com>
I have tried to compile perl 5.00503 on a Indigo2 running Irix 6.5.4m. I
use the gcc 2.95 compiler. I ran 'sh Configure -Dcc=gcc', left the
default at most of the questions, but enabled threading. than I did a
'gmake', which compiled with the following warnings:
`sh cflags libperl.a miniperlmain.o` miniperlmain.c
CCCMD = gcc -DPERL_CORE -c -D_BSD_TYPES -D_BSD_TIME
-D_POSIX_C_SOURCE -I/usr/local/include -DLANGUAGE_C -O3
In file included from perl.h:1163,
from miniperlmain.c:11:
/usr/include/pthread.h:220: warning: `struct timespec' declared inside
parameter list
/usr/include/pthread.h:220: warning: its scope is only this definition
or declaration, which is probably not what you want.
It compiled OK though. After that I ran 'gmake test', which passed all
tests but one:
...
lib/io_tell........ok
lib/io_udp.........ok
lib/io_xs..........ok
lib/ipc_sysv.......FAILED at test 8
lib/ndbm...........ok
lib/odbm...........ok
lib/opcode.........ok
...
Failed 1 test script out of 190, 98.42% okay.
...
gmake: *** [test] Error 1
On dejanews, I find quite some references to this problem (ipc_sysv
under irix), but no fix. I know I can get a precompiled version from
reality.sgi.com, but compiling my own (gcc, not MIPSPro cc) is better if
I want to compile modules later on, I understand.
Will I get into severe problems installing now, ipc_sysv being broken?
(Actually, I don't really know if pipes etc. will work. IPC/SYSV is just
_one_ way for interprocess communication, isn't it?) If I say away from
open2() and open3(), will it be OK?
Thanks for any inputs!
M.T. Kreutzer
m.t.kreutzer@nospam.stm.tudelft.nl
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 22:37:39 GMT
From: krubba@my-deja.com
Subject: progressive display of CGI output
Message-Id: <7qmu7i$8hq$1@nnrp1.deja.com>
Just wondering if anybody knows how to have a
cgi script feed it's output to the browser one
line at a time. I tried some buffer flushing
techniques, with little success, i.e. setting
STDOUT-autoflush(1) and calling flush() after
each line, but obviously that didn't work.
I'm guessing it has more to do with how cgi
passes its output to server which queues it up,
then serves it to the browser. Is there any
way to get around this? I noticed metacrawler
feeds it 1 line at a time (www.metacrawler.com).
Any ideas?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 02 Sep 1999 10:49:57 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: SEARCH and REPLACE
Message-Id: <APC&1'0'50775d9e'c79@igc.apc.org>
strip out the quotes /"'//g;
split the lines on whitespace perldoc -f split
print the result in the format you want
-Mike
------------------------------
Date: Thu, 02 Sep 1999 22:17:50 GMT
From: grosen@idc.ac._il_ (Guy Rosen)
Subject: Serialization
Message-Id: <37cef622.9168173@news.inter.net.il>
Hi,
Has anyone heard of, or even used, an efficient data structure
serialization module. I'm looking for something suitable for use in
the I/O between the processes of my appplcation, that can take
complete data structures and pass them from one point to another -
efficiently.
FreezeThaw doesn't count: it uses regexps. Obviously, something
C-based would be even better.
Any insight would be much appreciated!
Guy R.
-----
Guy Rosen <grosen@idc.ac._il_> (Remove underscores)
------------------------------
Date: 2 Sep 1999 21:36:12 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Simulating Carriage Returns
Message-Id: <7qmqkc$it1$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.1238107fcc50f930989f0c@nntp.hpl.hp.com>:
> > > If the number is fewer than four digits, the year will be 999 CE, which
> > > is rather a bit before the Unix Epoch. localtime() cannot produce a
> > > year before 1901 (1900 + $f[2]).
> >
> > a) What makes you think so?
>
> Testing the combinations of perl 5.005_03 and OSes I have available
> makes me think so.
No testing would allow one to arrive to "cannot" conclusion.
> > b) I think this is plain wrong with contemporary Perls on
> > not-that-buggy OSes.
>
> Your definition of 'contemporary Perls' never includes the 'stable'
> release, and 'not-that-buggy OSes' seems to mean OS/2. I'm sure you
> will let us know specifically which combination produces negatve values
> for the year. It will not be one presented to the world as 'stable'.
Stupid me. Of course it is not a function of OS to report that this
moment of time corresponds to "third day of March calends of the
second year of rule of Emperor Blafoogay". It is a function of CRTL.
So my assessment should be changed to "contemporary Perls with
not-that-buggy CRT libraries". As far as I can deduce, Solaris 7
supports 64-bit time_t (sp?), so 64-bit aware Perl on Solaris 7 should
be able to go pretty far away from 1970.
And NO, OS/2 Perl port CANNOT go far back in time. It has no y2038
issue, but by some strange reason EMX CRTL decided to follow legacy
OSes and have 32-bit time_t. It is unsigned, but 32-bit. Of course,
being based on gcc, EMX *could* make it long long.... Go figure...
Ilya
------------------------------
Date: Thu, 02 Sep 1999 21:48:54 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Simulating Carriage Returns
Message-Id: <ahCz3.559$MP6.29772@typ11.nn.bcandid.com>
In article <7qmqkc$it1$1@charm.magnus.acs.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>OSes and have 32-bit time_t. It is unsigned, but 32-bit. Of course,
>being based on gcc, EMX *could* make it long long.... Go figure...
Not if they cared about C89 conformance.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Thu, 2 Sep 1999 14:16:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Size
Message-Id: <MPG.123888f1c16db3cb989f13@nntp.hpl.hp.com>
In article <MPG.123857fa715c77729896f8@nntp1.ba.best.com> on Thu, 2 Sep
1999 10:47:13 -0700, Bill Moseley <moseley@best.com> says...
> Larry Rosler (lr@hpl.hp.com) seems to say...
> > use LWP::UserAgent;
> > Question for the knowledgeable: If I want to get a huge file in chunks
> > rather than in one swell foop, do I have to write my own socket handler
> > or is there a module that can do that?
>
> Oh, it's my lucky day!
>
> perldoc LWP::UserAgent
Thanks. It's there.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 2 Sep 1999 16:04:27 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: TSAIHBATDA: Device numbers from stat
Message-Id: <7qms9c$i4p@llama.swcp.com>
Perl has great documentation on common subject. If you're looking for
regular expression help or CGI details, there is reams of write ups on
how things work. Some of the more esoteric subjects have much leaner
documentation. So, in the spirit of the FMTYEWTK series, I present
TSAIHBATDA:
The Small Amount I Have Been Able To Deduce About:
--------------------------------------------------
stat(2), mknod(2) and device files
Let's start with the basics:
$ perl -v
... This is perl, version 5.005_03 built for i386-linux ...
$ perldoc -q device
No documentation for perl FAQ keyword `device' found
$ perldoc -q special
No documentation for perl FAQ keyword `special' found
$ perldoc -q mknod
No documentation for perl FAQ keyword `mknod' found
Ok, so as expected there are not many FAQ's about device special files
and how to create them. The first question we need to ask is
"How do I tell if a file is a device special file?"
Since we've read Stephen's, we know that the stat(2) function call will
return information about the inode. So let's check out the perldoc on
the built in function stat:
$ perldoc -f stat
...
Returns a 13-element list giving the status info for a file ...
Here are the meaning of the fields: ...
6 rdev the device identifier (special files only) ...
and that is it about device special files. The File::stat module sounds
promising, so I checked it out:
$ perldoc File::stat
...
This module's default exports override the core stat() and
lstat() functions, replacing them with versions that
return "File::stat" objects. This object has methods that
return the similarly named structure field name from the
stat(2) function; namely, dev, ino, mode, nlink, uid, gid,
rdev, size, atime, mtime, ctime, blksize, and blocks. ...
So we know that it has a function named rdev that will return in
the same format as the st_rdev field in the struct stat as documented
in the stat(2) man page. Great! We're on our way now.
$ man 2 stat
...
struct stat
{ ...
mode_t st_mode; /* protection */ ...
dev_t st_rdev; /* device type (if inode device) */
... };
If we were programming in C we would have macros that do some of the
work for us based on the mode field of the structure. We can query it
with S_ISCHR(m) and S_ISBLK(m) to tell if it is a character or block
special device, respectively. Good. Since File::stat doesn't define
these POSIX macros, we can use the constants of 0060000 and 0020000.
Ugly and non-portable, but workable, or use the two of the file test
operators: -b for block special and -c for character special. This
is separate from the stat call, however, and could introduce race
conditions.
However, there is still nothing on how to decode the st_rdev member into
major and minor numbers. I was resourceful and checked the mknod(2)
man page for more info:
$ man 2 mknod
...
If the file type is S_IFCHR or S_IFBLK then dev specifies
the major and minor numbers of the newly created device
special file; otherwise it is ignored. ...
Uhm, ok we knew that. How do we pack them into this single dev_t? I
tracked down <sys/types.h>, where dev_t is defined as a typedef
to __dev_t. That was found in <bits/types.h> to be a __u_quad_t.
Great.
Next resource -- the New Testament of Kernighan and Ritchie, chapter 8
page 180 defined the stat function and structure. The only information
they give is that the dev_t type is defined in <sys/types.h>. Thanks guys!
_Linux Kernel Internals_ doesn't have any details, either. I don't
have my copy of _Advanced Programming in the Unix Environment_ on hand.
Finally, on page 47 of _Linux Device Drivers_ I found a tantalizing
hint:
... The major and minor numbers are paired in a single data
type that is then used to identify a particular device. The
combined device number (the major and minor numbers concatenated
together) ... the minor numbers are restricted to the range 0-255.
So, by deduction I can assume that the minor numbers occupy the bottom
eight bits of the device number and the remaining top bits are the
major number. And it seems to work, too!
I suggest the following patches for perlfunc:
*** /usr/lib/perl5/5.00503/pod/perlfunc.pod Mon Apr 12 20:13:59 1999
- --- perlfunc.pod Wed Sep 1 21:32:33 1999
***************
*** 3992,3997 ****
- --- 3992,4003 ----
(The epoch was at 00:00 January 1, 1970 GMT.)
+ The C<rdev> field is composed of the major and minor device numbers, each
+ represented as eight bit values:
+
+ my $rdev = (stat($filename))[6];
+ my ($major, $minor) = ($rdev >> 8, $rdev & 0xFF);
+
If stat is passed the special filehandle consisting of an underline, no
stat is done, but the current contents of the stat structure from the
last stat or filetest are returned. Example:
***************
*** 4009,4014 ****
- --- 4015,4021 ----
$mode = (stat($filename))[2];
printf "Permissions are %04o\n", $mode & 07777;
+ More information on the C<mode> field may be found in stat(2).
In scalar context, C<stat()> returns a boolean value indicating success
or failure, and, if successful, sets the information associated with
- --
o hudson@swcp.com tbhudso@cs.sandia.gov O___|
/|\ http://www.swcp.com/~hudson/ H 505.275.37.77 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.284.24.32 \ \/\_\
0 U \_ |
Version: 2.6.3i
Charset: noconv
Comment: http://www.swcp.com/~hudson/ for public key
iQCVAwUBN83yqQ/y1CinxqX5AQHCVgP+I1u1OHRaHabryZ6qRyIhD4yV4jogwhRW
xx7oweynzzZlS9LZ0jEtU1bBhYG0jUQCCdjcx/IiALlnTbSnJ8iOjbmwNBUxVWqD
ks6AbMomJ5CoZqanqULazbEN1L/MkfTHjmmytaePPFlOs6Qr8DDroITVZMkHvxLx
opdGL6XAWEY=
=wbgH
-----END PGP SIGNATURE-----
------------------------------
Date: Thu, 02 Sep 1999 22:15:56 GMT
From: sbrkic@my-deja.com
Subject: Re: using the exec command.
Message-Id: <7qmsuj$7n5$1@nnrp1.deja.com>
In article <5wlz3.127$D16.7485@nsw.nnrp.telstra.net>,
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
> In article <FHEoIp.GM9@news.boeing.com>,
> ced@bcstec.ca.boeing.com (Charles DeRykus) writes:
>
> $user = '; rm -rf /;';
>
> > exec 'echo "unsubscribe nacs-announce" | /usr/lib/sendmail -f \
> > $user\@nacs.net majrdomo\@nacs.net';
> > die "exec failed: $!";
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | For heaven's sake, don't TRY to
be
> Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to
be
> NSW, Australia | cynical.
>
I tried this and now everything on my system is deleted!? Did I miss
something?? How can I recover files?
Help me!
Slav Brkic
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
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 705
*************************************