[7330] in Perl-Users-Digest
Perl-Users Digest, Issue: 955 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 1 00:17:55 1997
Date: Sun, 31 Aug 97 21:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 31 Aug 1997 Volume: 8 Number: 955
Today's topics:
$$$ FREE CASH GRANTS $$$$$$$$$ grants@ForYou.com
5.004 for Win32 (COWBYS)
Anyone else seeing this core dump in perl5.004_03 on so lvirden@cas.org
Re: changing dir of parent shell <rra@stanford.edu>
lwp library on Win32? <agt@igs.net>
Matt Wright's Counter on Windows NT (Thomas Dauria)
Re: Pattern matching problem with \n (Tad McClellan)
Re: Pattern matching problem with \n <rootbeer@teleport.com>
Re: Pattern Matching <fawcett@nynexst.com.spam-me-not>
Re: perl extension in tcl lvirden@cas.org
Re: Randal and Intel, Was: Scrambling using tr <stuartc@ind.tansu.com.au>
Re: Reference problem <fawcett@nynexst.com.spam-me-not>
Re: SSH and Perl <parthiv@IDT.NET>
Re: stand-alone perle apps? <rootbeer@teleport.com>
Re: stat a Socket <w.stanton@auckland.ac.nz>
Re: stat a Socket <w.stanton@auckland.ac.nz>
Uploading WORD doc (PERL CODE ERROR) <drosenth@com1.med.usf.edu>
Re: When to use "use strict" <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Aug 1997 09:58:49
From: grants@ForYou.com
Subject: $$$ FREE CASH GRANTS $$$$$$$$$
Message-Id: <81f7cd$101c2.21a@NEWS>
CASH GRANTS CASH GRANTS CASH GRANTS
Foundations all over the United States GIVE CASH GRANTS.
ANYONE can apply for a Grant from 18 years and up...
This money HAS to be given away, WHY not to YOU?
Grants from $500.00 to $50,000.00 possible, in some instances.
Grants don't have to be paid back.
Grants can be ideal for people who are or were bankrupt
or just have bad credit.
Get the money you need to start that business, you have always wanted.
To get your list of FOUNDATIONS that give grants, AND instructions
on how to apply.
Send a check or money order for ONLY $7.00 to:
TO RECEIVE BY US MAIL ENCLOSE A STAMPED, SELF ADDRESSED, #10 ENVELOPE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
B.C.S.
39 GURLEY ROAD #201
EDISON, NJ 08817
Att: GRANT INFO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Include your E-MAIL ADDRESS for faster service.
------------------------------
Date: 1 Sep 1997 01:45:05 GMT
From: cowbys@aol.com (COWBYS)
Subject: 5.004 for Win32
Message-Id: <19970901014500.VAA24895@ladder02.news.aol.com>
i caught a message in comp.lang.perl.announce the other day from someone
who stated they were providing the compiled version of Perl 5.004 for Win
32 for those of us who are "compiler ignorant",
does anyone know whereI can download this already compiled version ?
any advice appreciated, please reply to davef@aasp.net
------------------------------
Date: 29 Aug 1997 13:51:23 GMT
From: lvirden@cas.org
Subject: Anyone else seeing this core dump in perl5.004_03 on solaris 2.5.1 [Was: Re: Compiling perl5.004.01 on solaris 2.5.1
Message-Id: <5u6k4r$fq1$1@cas.org>
I am seeing peculiar behavior in perl ever since installing the
latest version.
$ perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.29)
ReadLine support enabled
cpan> r
Segmentation Fault(coredump)
lwv26awm (9515) $ dbx $(whence perl) core
Reading symbolic information for perl
core file header read successfully
Reading symbolic information for rtld /usr/lib/ld.so.1
Reading symbolic information for libsocket.so.1
Reading symbolic information for libnsl.so.1
Reading symbolic information for libdl.so.1
Reading symbolic information for libm.so.1
Reading symbolic information for libc.so.1
Reading symbolic information for libintl.so.1
Reading symbolic information for libmp.so.1
Reading symbolic information for libw.so.1
Reading symbolic information for IO.so
Reading symbolic information for Fcntl.so
Reading symbolic information for Opcode.so
Reading symbolic information for Gnu.so
program terminated by signal SEGV (no mapping at the fault address)
(dbx 1) where
=>[1] free(0x55555555, 0x4040804, 0x4040000, 0x170f0000, 0x0, 0x0), at 0x25544
[2] xfree(0x273c18, 0x1, 0x74, 0xf0400, 0x22c008, 0x273c18), at 0xef5e25bc
[3] XS_Term__ReadLine__Gnu__XS_rl_readline(0x4, 0x1, 0xf05c4, 0xf0274, 0x273c18, 0x475508), at 0xef5241b8
[4] Perl_pp_entersub(0xea400, 0xf0000, 0x0, 0xf0000, 0x0, 0xf0400), at 0x7f1f4
[5] Perl_runops(0xf0000, 0x31c948, 0xf0400, 0x40000, 0xe8760, 0xefffe368), at 0x78ee4
[6] perl_run(0xf0400, 0xf0400, 0xf0400, 0xf0000, 0x0, 0xf0808), at 0x20db8
[7] main(0x0, 0xefffe71c, 0xefa70, 0xe2c00, 0x1, 0x0), at 0x1e2bc
(dbx 2)
Summary of my perl5 (5.0 patchlevel 4 subversion 3) configuration:
Platform:
osname=solaris, osvers=2.5.1, archname=sun4-solaris
uname='sunos lwv26awm 5.5.1 generic_103640-08 sun4m sparc sunw,sparcstation-4 '
hint=previous, useposix=true, d_sigaction=define
bincompat3=n useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-fast -xO5 -xdepend', gccversion=
cppflags='-DDEBUGGING -I/projects/gnu/sparc-sun-solaris2.5.1/include'
ccflags ='-DDEBUGGING -I/projects/gnu/sparc-sun-solaris2.5.1/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, randbits=15
Linker and Libraries:
ld='cc', ldflags ='-L/usr/ccs/lib -L/projects/gnu/sparc-sun-solaris2.5.1/lib -L/cas/X11/sun4/lib -L/ldata2/lib -L/projects/sprs_lwv/sol2/lib -L/projects/sprs_lwv/lib -R/usr/ccs/lib:/projects/gnu/sparc-sun-solaris2.5.1/lib:/cas/X11/sun4/lib:/ldata2/lib:/projects/sprs_lwv/sol2/lib:/projects/sprs_lwv/lib'
libpth=/usr/lib /usr/ccs/lib /projects/gnu/sparc-sun-solaris2.5.1/lib /cas/X11/sun4/lib /ldata2/lib /projects/sprs_lwv/sol2/lib /projects/sprs_lwv/lib
libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-G -L/usr/ccs/lib -L/projects/gnu/sparc-sun-solaris2.5.1/lib -L/cas/X11/sun4/lib -L/ldata2/lib -L/projects/sprs_lwv/sol2/lib -L/projects/sprs_lwv/lib-R/usr/ccs/lib:/projects/gnu/sparc-sun-solaris2.5.1/lib:/cas/X11/sun4/lib:/ldata2/lib:/projects/sprs_lwv/sol2/lib:/projects/sprs_lwv/lib -L/projects/sprs_lwv/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under solaris
Compiled at Aug 25 1997 09:00:49
%ENV:
PERL5LIB="/home/lwv26/lib/perl5/:/projects/sprs_lwv/lib/perl5/:"
PERLDOC="-t"
PERLLIB="/home/lwv26/lib/perl:/projects/sprs_lwv/lib/perl:"
@INC:
/home/lwv26/lib/perl5/
/projects/sprs_lwv/lib/perl5//sun4-solaris
/projects/sprs_lwv/lib/perl5/
/ldata2/lib/perl5/sun4-solaris/5.004
/ldata2/lib/perl5
/ldata2/lib/perl5/site_perl/sun4-solaris
/ldata2/lib/perl5/site_perl
.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: 31 Aug 1997 15:43:08 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: changing dir of parent shell
Message-Id: <m3u3g6m0sj.fsf@windlord.Stanford.EDU>
Les Schaffer <godzilla@futuris.net> writes:
> yes, that answer is more detailed. its also SUBSTANTIALLY what i posted
> in my originally query; viz, i had already been sourcing a bash
> script. In fact, after some prompting from elsewhere, i wrapped a call
> to my perl script in a source'd bash script -- which seems ugly.
It is. It's incredibly ugly. You don't have to do that if you're willing
to make the user eval the output of your command. resize on Solaris boxes
has precisely the same sort of problem as you're trying to solve, and the
recommendation is to do:
eval `resize`
which works fairly well but has a somewhat ugly syntax.
> can i get my perl script to change the directory of the parent (bash)
> shell, THAT DOES NOT INCLUDE SOURCING A BASH SHELL SCRIPT (WRAPPER)?
Without doing an eval or a source, in general, no.
> * If you have SOLVED this problem, please let me know.
> - i get the feeling now maybe no-one has. is it WORTH solving?
This is what you're running into: child processes cannot affect their
parent's environment under Unix, which includes both environment variables
and the current directory. If one thinks about this for a moment, it
becomes apparent that this is, at least in part, a security measure. In
Unix, child processes are often started by parent processes with more
priviledges, may be chrooted, and may be otherwise more restricted than
the parent. You wouldn't want a random user program to be able to modify
the environment of init, for example.
That's the first part of the problem, and the way Unix has dealt with that
is to force the parent to actively seek out and accept modifications from
the child. The second part of the problem you run into is that there is
no standard way to do this. The only way for most shells to do it is to
somehow succeed in outputting shell commands and feeding them back into
the shell in a way that it will execute them, either with source or eval.
> * If there is a way to modify bash and/or perl so that the parent
> * environment CAN be influenced by a child process at certain times, let
> * me know.
> - requires IPC stuff? for example, xemacs can send a URL to
> - netscape. (yes, i know they are not parent and child, but they ARE
> - processes)
I'm not quite sure how Netscape does this; there are a few possibilities.
One way would be to use SysV IPC, and another would be to create a Unix
domain socket somewhere and let other processes write to it. Either of
these solutions could, in theory, be implemented in bash, but it would
require nontrivial work. No modifications would be needed to Perl, since
a Perl script is already capable of writing to shared memory or a Unix
domain socket.
> * Is there another working environment besides the shell where parent
> * and child processes are more easily in communication?
> - (x)emacs shell environment with some lisp coding?
If you're writing both the parent and the child, it's fairly trivial to
keep them in communication. The standard way is to open an pipe before
forking (using the Perl pipe command is one way) and use it for
communications.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 31 Aug 1997 21:43:56 -0400
From: Internet Yellow Pages <agt@igs.net>
Subject: lwp library on Win32?
Message-Id: <340A1DDC.DBFEBADA@igs.net>
Has anyone installed Perl on a Windows based system, using the WWW perl
library?
I understand I need to support MIME on my system. I'm not sure on how
to go about it, and need to process URL documents in my program...
Thanx
------------------------------
Date: 1 Sep 1997 02:47:43 GMT
From: tdauria@bu.edu (Thomas Dauria)
Subject: Matt Wright's Counter on Windows NT
Message-Id: <5udacf$dbk$1@news1.bu.edu>
Has anyone got this counter to work on Windows NT. I set
it up and the perl script increments the counter.txt file
no problem. I never get the count on my web page however.
I think the problem is with fly.exe but I am unsure.
Any suggestions or pointers to sites with help?
Thanks in advance
tdauria@acs.bu.edu
------------------------------
Date: Sun, 31 Aug 1997 16:49:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Pattern matching problem with \n
Message-Id: <9tocu5.6si.ln@localhost>
Ha_Ha_X (spam-yourself@127.0.0.1) wrote:
: I'm writing a script that takes a series of strings, scans them for
: '\n', '\t', and '\\\\' (two backslashes), and replaces each of them
: with physical newlines, tab characters, and backslashes respectively.
: In other words, I'm trying to read strings in and process C-style
: escape sequences in those strings.
: The natural way to solve this would be with pattern matching, using
: something like this:
: $somestring =~ s/\n/"\n"/g ; # replace '\n' with newline
^ ^
This replacement has three characters in it. You don't need the
double quotes. The replacement part is already "double quoteish"
(it acts as if it was already in double quotes)
: $somestring =~ s/\t/<tab>/g ; # replace '\t' with tab
: $somestring =~ s/\\/\/g ; # replace double backslash with
: # single backslash
: where <tab> is a physical tab character. Of course, the backslash has
: special meanings in pattern matching strings, and that's my problem. I
: can't come up with a substitution that does what I want it to.
$somestring =~ s/\\n/\n/g ; # replace '\n' with newline
$somestring =~ s/\\t/\t/g ; # replace '\t' with tab
$somestring =~ s/\\\\/\\/g ; # replace double backslash with
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 31 Aug 1997 15:48:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Pattern matching problem with \n
Message-Id: <Pine.GSO.3.96.970831153739.29875G-100000@julie.teleport.com>
On Sun, 31 Aug 1997, Ha_Ha_X wrote:
> From: Ha_Ha_X <spam-yourself@127.0.0.1>
Please don't do that.
> I'm writing a script that takes a series of strings, scans them for
> '\n', '\t', and '\\\\' (two backslashes), and replaces each of them
> with physical newlines, tab characters, and backslashes respectively.
> In other words, I'm trying to read strings in and process C-style
> escape sequences in those strings.
>
> The natural way to solve this would be with pattern matching, using
> something like this:
>
> $somestring =~ s/\n/"\n"/g ; # replace '\n' with newline
> $somestring =~ s/\t/<tab>/g ; # replace '\t' with tab
> $somestring =~ s/\\/\/g ; # replace double backslash with
> # single backslash
No, those won't work. You don't have the right characters there, and (more
importantly) you want to do the transformation in parallel. (Imagine doing
this transformation on the sequence backslash-backslash-n and you'll see
what I mean.)
{
my %map;
BEGIN {
%map = (
n => "\n",
t => "\t",
'\\'=> "\\",
) }
$somestring =~ s#\\([nt\\])#$map{$1}#g;
}
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 31 Aug 1997 18:45:34 -0400
From: Tom Fawcett <fawcett@nynexst.com.spam-me-not>
Subject: Re: Pattern Matching
Message-Id: <8jvi0mm0oh.fsf@nynexst.com.spam-me-not>
Joseph Essas <joseph@tcs9000.com> writes:
> I need to find the first place in a string where certain string is not
> included. For example:
> $string="abcdeabce";
> I need to find the first place where there is: a..something that not
> 'bcd'..e
Negative lookahead expressions should be able to do this:
use English;
$_ = "abcdeabce";
while (/a(?!bcd).+?e/g) {
print "Matched $MATCH \n";
}
Check "man perlre" for more info.
-Tom
------------------------------
Date: 1 Sep 1997 03:23:52 GMT
From: lvirden@cas.org
Subject: Re: perl extension in tcl
Message-Id: <5udcg8$ohj$1@cas.org>
According to Bryan Miller <millerb@fc.hp.com>:
:lvirden@cas.org wrote:
:
:[ snippy-snip ]
:
:: Another way of expressing this is
:
:: has anyone tried embedding a perl interpreter into a tcl extension or
:: in some way (perhaps using SWIG, etc.) tried to make available
:: (as Tcl commands), the perl interpreter.
:
:It might be easier to glue tcl into Perl using the Tcl library.
:I have been playing around with gluing the Tcl and Expect libraries
:into Perl. Unfortunately it hasn't been quite that easy although
:the Tcl_Eval bit seems to be falling into place.
You could just go to CPAN and pick up Malcom Beattie's
packages to glue either tcl or Tk/Tcl into Perl.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: 01 Sep 1997 12:25:38 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: Randal and Intel, Was: Scrambling using tr
Message-Id: <yeopvqtkbx9.fsf@kudu.ind.tansu.com.au>
Sorry if I allowed myself to be misunderstood in my last posting. If
suggesting to an Intel employee that he gets his organisation to stop
persecuting Randal Schwartz counts as intended-to-be-personally-insulting
comment and guilt-by-association then I apologise. I stand by the assertion
that the Perl community would benefit should this persecution cease. Or else
we can change the Intel logo from "Intel Inside" to "Intel Put Randal Inside".
I didn't consider my posting to be an attack on Justin or other Intel
employees; again I apologise if it has been seen in this light.
Much more reasoned advice on this subject came from Jeffrey Kegler; pointing
people to information on the site at <URL:http://www.rahul.net/jeffrey/ovs/>.
Here you can read and sign an open letter to Intel signed by luminaries
(Larry Wall, Richard Stallman, John Ousterhout etc) and lots of other Internet
users. At the moment there have been 1300 signers; including 1 brave Intel
employee; a former Intel employee and someone who mentions that he is an Intel
stockholder. I encourage all readers of the newsgroup to do this.
If you want to change a lowercase string with the alphabetic-complement like
Justin does; I suggest:
#! /usr/local/bin/perl -w
$_="Intel Put Randal Inside";
$ZTOA=join('',reverse(('A'..'Z')));
eval "tr/a-z/$ZTOA/";
print "$_\n";
Cheers,
Stuart Cooper.
stuartc@ind.tansu.com.au
------------------------------
Date: 31 Aug 1997 18:57:38 -0400
From: Tom Fawcett <fawcett@nynexst.com.spam-me-not>
Subject: Re: Reference problem
Message-Id: <8ju3g6m04d.fsf@nynexst.com.spam-me-not>
Morten Simonsen <mortensi@idt.ntnu.no> writes:
> I have made this testprogram:
> --------------------------------------------------
> #!/usr/local/bin/perl
>
> $string1 = 'Hi';
> $string2 = \$string1;
>
> $string3 = join(":",\$string1,$string2);
> ($string4,$string5) = split(/:/,$string3);
> print "STRING2: $$string2 \tADDRESS: $string2\n";
> print "STRING4: $$string4 \tADDRESS: $string4\n";
> print "STRING5: $$string5 \tADDRESS: $string5\n";
> -------------------------------------------------
>
> Can someone explain why I get this output:
>
> -------------------------------------------------
> STRING2: Hi ADDRESS: SCALAR(0x1002c690)
> STRING4: ADDRESS: SCALAR(0x1002c690)
> STRING5: ADDRESS: SCALAR(0x1002c690)
> -------------------------------------------------
>
> Please don't tell me I can't put a reference into a string,
> and then dereference it later....
Sorry, but you can't put a reference into a string and then dereference it
later. Not the way you're doing it, anyway.
If you're storing something fairly simple, check out pack() and unpack().
For more complex applications, check out the module Data::Dumper which is
designed to put structures into strings. It doesn't preserve pointer
equality, though.
-Tom
------------------------------
Date: 1 Sep 1997 00:04:08 GMT
From: Parthiv Shah <parthiv@IDT.NET>
Subject: Re: SSH and Perl
Message-Id: <5ud0po$d3d@nnrp2.farm.idt.net>
In comp.security.unix jjune@midway.uchicago.edu wrote:
> Hi!
> I am currently trying to write a perl script that will utilize ssh and scp
> to
> 1) Copy files to many different servers automatically;
> 2) Execute commands on many different servers automatically;
> Basically I need to be able to execute the same command on multiple
> servers... for example... I will need to scp a file (a tar file) to 30
> different servers... and execute a command to untar the file on all 30
> servers.
> I think I can set up the ssh with RSA to ssh in and out of all the servers
> without passwords... so i'm in the process of writing a perl script which
> will basically read in the server ips and do a system call on them...
> turning out to be MUCH more tricky then I had anticipated... has anyone
> seen any script that does this?... Or better yet... can anyone offer any
> pointers or advice on how to go about writing something like this?
> thanks for your help!
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
Why use ssh and perl? only scp will do the job.
setup a user on the other side as a trusted user for scp and run scp
command with proper parameters via cronjob.
Parthiv
--
parthiv@netadmin.net Network Administrator
http://www.netadmin.net
------------------------------
Date: Sun, 31 Aug 1997 15:35:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Mark E. Crane" <mecran01@homer.louisville.edu>
Subject: Re: stand-alone perle apps?
Message-Id: <Pine.GSO.3.96.970831152531.29875F-100000@julie.teleport.com>
On 31 Aug 1997, Mark E. Crane wrote:
> I'm burning 400 images on a cd rom for use by faculty at our school.
Cool!
> The end product will be running on windows 3.1.
Too bad. :-)
> Can someone tell me if it is possible to put a Perl-based crawler and
> search engine on the cd-rom that will look through the images (actually,
> the html that accompanies each image) and let users search for stuff by
> topic/keyword?
I don't see why not.
> How tough would this be to do?
Somewhere between medium and hard. :-)
> Would I have to have some sort of standalone server burned on the disk
> that would run cgi scripts?
That would be one way to do it. And since such a server could serve more
than one client at a time, it would be a good way to share the images
among many machines at once (although the performance will be poor if many
users are requesting images off of the same CD). But you should not assume
that you'll be able to run the server on a certain port, since any
particular port may already be in use already. (Anybody who wants to serve
images, though, should pick a port and stick to it.)
Of course, users shouldn't have to use a particular browser; if they
already have a favorite one, they should be able to use it. In fact, they
should be able to browse the images from the server even if they're so
lucky that they don't have to run Windows! :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 01 Sep 1997 11:34:07 +1300
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Re: stat a Socket
Message-Id: <wkn2lyc78g.fsf@auckland.ac.nz>
Tom Phoenix <rootbeer@teleport.com> writes:
>
> On 29 Aug 1997 w.stanton@auckland.ac.nz wrote:
>
> > It is very important to me to be able to test if there is any data
> > available on a socket without blocking.
>
> You may want the four-argument form of select. Hope this helps!
Well, yes it does. But I cannot make it work!
Does this code....
sub isReadyToRead {
my $self = shift;
my $rin = '' ;
vec($rin, fileno($self->{SOCK}), 1) = 1;
select($rin, undef, undef, 0);
return $rin;
}
return non zero if the socket is ready to read? (On my Win95 it
allways returns non-zero).
>
> --
> Tom Phoenix http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com PGP Skribu al mi per Esperanto!
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
------------------------------
Date: 01 Sep 1997 15:30:19 +1300
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: Re: stat a Socket
Message-Id: <wkg1rprcjo.fsf@auckland.ac.nz>
Worik Macky Stanton <w.stanton@auckland.ac.nz> writes:
Noise on the news!
My fingers did the talking faster than my brain did the thinking
> > You may want the four-argument form of select. Hope this helps!
>
> Well, yes it does. But I cannot make it work!
>
> Does this code....
No it does not. I was suspicious of Win95 specific failure of select/4
> sub isReadyToRead {
> my $self = shift;
> my $rin = '' ;
> vec($rin, fileno($self->{SOCK}), 1) = 1;
my $r = $rin;
> select($rin, undef, undef, 0);
return $rin eq $r;
> }
Ouch!
------------------------------
Date: Sun, 31 Aug 1997 22:36:15 -0400
From: Danny Rosenthal <drosenth@com1.med.usf.edu>
Subject: Uploading WORD doc (PERL CODE ERROR)
Message-Id: <Pine.GSO.3.96.970831223334.2414A-100000@com1>
I am writing a program to post MS Word documents on the web. I know how to
use the multi-part file upload in Perl, but my posted files are screwed up
when I post Word files.
I assume the error lies in the fact that Word docs are not just Text. What
am I missing? Do I need to do some type of file translation for the word
file? With binmode? How should I be processing the word file differently?
Thank you in advance,
Daniel
------------------------------
Date: Sun, 31 Aug 1997 15:24:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Scott Wimer <scottw@cgibuilder.com>
Subject: Re: When to use "use strict"
Message-Id: <Pine.GSO.3.96.970831150328.29875E-100000@julie.teleport.com>
On Fri, 29 Aug 1997, Scott Wimer wrote about the (alleged :-) performance
penalty associated with 'use strict'.
> As to the performance penalty, I've never noticed it, but I know that
> perl has to perform N+X tasks slower than it performs N tasks.
Ah, but what proof is there that 'use strict' makes Perl perform N+X
tasks? :-) Here's my contention:
If your script is compatible with 'use strict',
removing the 'use strict' line won't make it faster.
Let's look at the 'use strict refs' pragma. That tells Perl to complain if
it sees that you're using a soft reference. Now, whether that pragma is on
or not, Perl has to check (at runtime) whether the value being used as a
reference is a true ("hard") reference. If your code is compliant, Perl
will always see the hard reference and go on. The pragma makes no
difference in the speed!
A similar case can be made for the other two strictures. With 'use
strict vars', Perl knows to complain if it has to generate a new symbol
table entry at compile time, which it won't have to do in a compliant
program. With 'use strict subs', Perl knows to complain rather than to
compile an unknown bareword as a string, which it won't have to do in a
compliant program.
In sum, I claim that removing 'use strict' will speed your code _only_ to
the extent that Perl can skip the few opcodes needed to execute the line
which says 'use strict'. So, it seems, there's the value of X. :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 955
*************************************