[17856] in Perl-Users-Digest
Perl-Users Digest, Issue: 16 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 8 11:25:41 2001
Date: Mon, 8 Jan 2001 08:25:14 -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: <978971114-v10-i16@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 8 Jan 2001 Volume: 10 Number: 16
Today's topics:
Re: Nice list of locally installed modules <julien.quint@imag.fr>
Re: open MAIL - code won't work <a.v.a@home.nl>
Re: open MAIL - code won't work <philipp.landolt@swisscom.com>
Re: open MAIL - code won't work <a.v.a@home.nl>
Re: open MAIL - code won't work (Colin Watson)
Re: opening a file, NOT a filehandle <bart.lateur@skynet.be>
Re: opening a file, NOT a filehandle <tjudd01@hotmail.com>
Re: Perl PATH problems <nomail@please.not>
Problem connecting to POP3 server <don@lclcan.com>
Re: Problem connecting to POP3 server (Garry Williams)
Re: Problem connecting to POP3 server <don@lclcan.com>
Re: reading multi-line records <mischief@motion.net>
Redirect with PERL? <lp@rolmail.net>
Re: Redirect with PERL? nobull@mail.com
Re: Redirect with PERL? <flavell@mail.cern.ch>
Re: Redirect with PERL? <nomail@please.not>
Re: Redirect with PERL? <nomail@please.not>
Re: Redirect with PERL? <fty@mediapulse.com>
Re: Redirect with PERL? <tony_curtis32@yahoo.com>
Re: Redirect with PERL? (Rafael Garcia-Suarez)
Re: Redirect with PERL? (Mark Jason Dominus)
Re: Remote Controll other windows software by Perl <olthoff@multiboard.com>
Re: Reposting - Pattern match in an array of strings (Anno Siegel)
send on a socket returns "operation not supported" but <geoff-at-farmline-dot-com@127.0.0.1>
Re: Shall use a reference instead? <iltzu@sci.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 08 Jan 2001 15:43:45 +0100
From: Julien Quint <julien.quint@imag.fr>
Subject: Re: Nice list of locally installed modules
Message-Id: <khv66jqf6ji.fsf@imag.fr>
"Mark Hamlin" <mark.c.hamlin@bt.com> writes:
> What is the best way to get Perl to report a list of installed modules. My
> current method is to use the Unix Find command to report the contents of
> site_perl, which is usefull, but I am really after something that will be
> more usefull in specification documentation.
perldoc perlmodlib gives the list of modules that are part of the Perl module
library and perldoc perllocal gives the list of modules that were installed
from the CPAN (through 'make install').
--
Julien
------------------------------
Date: Mon, 08 Jan 2001 11:15:16 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: open MAIL - code won't work
Message-Id: <3A59A2CB.D82FD0C5@home.nl>
Phil wrote:
> hello,
>
> I've tried to send me an E-Mail in that I'll open a filehandle (look below),
> but I've already get the 500 Internal Server Error. Without this code the
> script works well.
>
> open MAIL, " | mail philipp.landolt@swisscom.com";
> print MAIL "Attentation: New Fault reportet";
> close MAIL;
>
try it with philipp.landolt\@swisscom.com
>
> This solution is described from Randal L. Schwartz in this way (german
> edition from "first steps in Perl")
>
> Please support me and suggest a version which work.
>
> regards Phil
------------------------------
Date: Mon, 8 Jan 2001 14:05:54 +0100
From: "Phil" <philipp.landolt@swisscom.com>
Subject: Re: open MAIL - code won't work
Message-Id: <93cdvh$13h$1@exnews.swisscom.com>
Thanks,
the 500 Internal Server Error is disappeared and the script runs without an
error, but I'm afraid.
I didn't receive any E-Mails. The E-Mail-adress is correct and the server is
able to send Mails.
Do somebody knows a solution? (maybe the E-Mail-adress is interpretet in a
wrong way with philipp.landolt\@swisscom.com ???)
regards
Phil
"AvA" <a.v.a@home.nl> schrieb im Newsbeitrag
news:3A59A2CB.D82FD0C5@home.nl...
> Phil wrote:
>
> > hello,
> >
> > I've tried to send me an E-Mail in that I'll open a filehandle (look
below),
> > but I've already get the 500 Internal Server Error. Without this code
the
> > script works well.
> >
> > open MAIL, " | mail philipp.landolt@swisscom.com";
> > print MAIL "Attentation: New Fault reportet";
> > close MAIL;
> >
>
> try it with philipp.landolt\@swisscom.com
>
> >
> > This solution is described from Randal L. Schwartz in this way (german
> > edition from "first steps in Perl")
> >
> > Please support me and suggest a version which work.
> >
> > regards Phil
>
------------------------------
Date: Mon, 08 Jan 2001 14:25:05 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: open MAIL - code won't work
Message-Id: <3A59CF46.594CE89A@home.nl>
Phil wrote:
> Thanks,
>
> the 500 Internal Server Error is disappeared and the script runs without an
> error, but I'm afraid.
>
> I didn't receive any E-Mails. The E-Mail-adress is correct and the server is
> able to send Mails.
> Do somebody knows a solution? (maybe the E-Mail-adress is interpretet in a
> wrong way with philipp.landolt\@swisscom.com ???)
>
no the email should be forwarded...i tried it and it worked fine.
maybe it just delayed.
wait a while.
AvA
irc.chatjunkies.org #perl
------------------------------
Date: 8 Jan 2001 14:53:47 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: open MAIL - code won't work
Message-Id: <93ck9r$ea3$1@riva.ucam.org>
Phil <philipp.landolt@swisscom.com> wrote:
>the 500 Internal Server Error is disappeared and the script runs without an
>error, but I'm afraid.
>
>I didn't receive any E-Mails. The E-Mail-adress is correct and the server is
>able to send Mails.
>Do somebody knows a solution? (maybe the E-Mail-adress is interpretet in a
>wrong way with philipp.landolt\@swisscom.com ???)
Since you didn't check for any errors, then of course you'll have
difficulty working out what they are. Had you used (a) Perl's in-built
warnings and (b) a die() if the open() failed, you wouldn't be having
this problem.
Reading 'perldoc -f open', it says:
If the filename begins with `'|'', the filename is interpreted as a
command to which output is to be piped [...]
In your code, the filename begins with a space, then a '|', so it
doesn't behave the way you want; it tries to open a file named ' | mail
philipp.landolt@swisscom.com', which doesn't exist, for reading. open()
returned false, but it was unchecked, so Perl continued. 'perl -w' would
then have warned you on the next line that you were trying to print on a
closed filehandle (and, by the way, think of "500 Internal Server Error"
as code for "go and look in the server error log to see what Perl told
you by way of errors").
Corrected version follows (and using single quotes so that you don't
have to use \@):
#! /usr/bin/perl -w
open MAIL, '| mail philipp.landolt@swisscom.com'
or die "error opening pipe to mail: $!";
print MAIL "Attention: New Fault reported\n";
close MAIL or die "error closing pipe to mail: $!";
The moral of the story is: always check for errors, or else Perl will
usually just continue happily on and you'll get a more confusing error
later on.
--
Colin Watson [cjw44@flatline.org.uk]
"And after the fire there came a still small voice ..."
------------------------------
Date: Mon, 08 Jan 2001 11:28:02 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: opening a file, NOT a filehandle
Message-Id: <n29j5togvccavgd3lrmigf5389o6o9rv0r@4ax.com>
2obvious@my-deja.com wrote:
>I'm trying to write a script that opens an .rps
>file, but "open" in the perl sense doesn't refer to what I'm trying to
>do.
system('start', 'demo.rps');
--
Bart.
------------------------------
Date: Mon, 08 Jan 2001 03:02:09 -0900
From: Tim Judd <tjudd01@hotmail.com>
Subject: Re: opening a file, NOT a filehandle
Message-Id: <B67EDE2F.5A24%tjudd01@hotmail.com>
On 8 Jan 2001 09:26:24 GMT ebohlman@omsdev.com (Eric Bohlman) wrote:
You may be able to use `` backticks to run the program. Using backticks
while not capturing the return value may work for you. I'd recommend Eric's
suggestion below though. My Win32 box died, and i returned it to the store
I bought it from. I never knew about the start program, but if it's as cool
as Eric's saying it is, it may be your ticket.
FYI, the syntax to use `` are as follows: (sorry if I'm posting
redundantly)
@array = `external_prog`; # A multi-line text output from "external_prog"
# will populate @array
$scalar = `external_prog`; # A single-line (or multi) text output
# will populate $scalar. $scalar will have
# embedded \n's for each new line. This is how
# I remember it. you may want to check locally.
--T
>
> 2obvious@my-deja.com wrote:
> > I'm a Windows 98 user. I have this text-to-speech conversion software
> > called ReadPlease. When text files are saved with the .rps extension,
> > double clicking on opens ReadPlease and also automatically begins
> > reading the file. I'm trying to write a script that opens an .rps
> > file, but "open" in the perl sense doesn't refer to what I'm trying to
> > do.
>
> > I've attempted using the system() method and investigated all modules
> > with "Win32" in them, but I haven't had any success.
>
> Try using system() to call the Win32 'start' command, as in:
>
> system ('start myfile.rps');
>
> start is a very small program that basically passes its arguments to the
> Win32 API ShellExecute function, which looks up the associated application
> for the file's type, starts that application in a new process, and then
> returns.
>
>
------------------------------
Date: Mon, 08 Jan 2001 12:56:32 GMT
From: "Olav" <nomail@please.not>
Subject: Re: Perl PATH problems
Message-Id: <4Oi66.8301$k03.479173@news01.chello.no>
You will need to add the complete path to your perl.exe program in the start
of your script:
Something like
#!c:/perl/5.6.0/bin/MSWin32-x86/perl.exe
will do.
Olav
<sugaking@my-deja.com> wrote in message news:935v7c$mu6$1@nnrp1.deja.com...
> I installed Perl here on my win2k machine. I know during
> installation it adds Perl to the path, and it did. After a shutdown I
> come back to play with perl and I get:
>
> C:\>perl
> 'perl' is not recognized as an internal or external command,
> operable program or batch file.
>
> Any solutions or cause to this? Thanks, appreciate any help.
>
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Mon, 08 Jan 2001 10:34:26 -0500
From: Don <don@lclcan.com>
Subject: Problem connecting to POP3 server
Message-Id: <3A59DE02.AED6CABD@lclcan.com>
When I tried the --> telnet localhost 110
I get --> +OK POP3 localhost v7.64 server ready
This tells me that my POP3 server is called --> localhost and is
running.
In my perl script, I tried:
========================================
use Net::POP3;
my $webfile = Net::POP3->new('localhost', Port => 110, Timeout => 60)
or die "cannot open mail server";
exit;
========================================
I get the message that it could not connect to the server.
Why???
Thanks,
Don
------------------------------
Date: Mon, 08 Jan 2001 15:46:46 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Problem connecting to POP3 server
Message-Id: <Ghl66.3775$UQ5.18609@eagle.america.net>
On Mon, 08 Jan 2001 10:34:26 -0500, Don <don@lclcan.com> wrote:
>When I tried the --> telnet localhost 110
>
>I get --> +OK POP3 localhost v7.64 server ready
>
>This tells me that my POP3 server is called --> localhost and is
>running.
>
>In my perl script, I tried:
>
>========================================
>use Net::POP3;
>
>my $webfile = Net::POP3->new('localhost', Port => 110, Timeout => 60)
> or die "cannot open mail server";
>
>exit;
>========================================
>
>I get the message that it could not connect to the server.
>
>Why???
How would you expect anyone here to know when you don't copy/paste the
error message or the code. That stuff you typed doesn't compile.
--
Garry Williams
------------------------------
Date: Mon, 08 Jan 2001 10:56:17 -0500
From: Don <don@lclcan.com>
Subject: Re: Problem connecting to POP3 server
Message-Id: <3A59E320.68981539@lclcan.com>
Garry Williams wrote:
> On Mon, 08 Jan 2001 10:34:26 -0500, Don <don@lclcan.com> wrote:
> >When I tried the --> telnet localhost 110
> >
> >I get --> +OK POP3 localhost v7.64 server ready
> >
> >This tells me that my POP3 server is called --> localhost and is
> >running.
> >
> >In my perl script, I tried:
> >
> >========================================
> >use Net::POP3;
> >
> >my $webfile = Net::POP3->new('localhost', Port => 110, Timeout => 60)
> > or die "cannot open mail server";
> >
> >exit;
> >========================================
> >
> >I get the message that it could not connect to the server.
> >
> >Why???
>
> How would you expect anyone here to know when you don't copy/paste the
> error message or the code. That stuff you typed doesn't compile.
>
> --
> Garry Williams
I don't know what you're asking me but the entire Perl script is between
the ==== lines and my error message is that it dores not connect to the
POP3 server but dies with "cannot open mail server" which is also part of
my Perl script.
I forgot to include the first line but it does compile:
#!/usr/bin/perl -w
------------------------------
Date: Mon, 8 Jan 2001 09:22:53 -0600
From: Chris Stith <mischief@motion.net>
Subject: Re: reading multi-line records
Message-Id: <Pine.LNX.4.21.0101080910030.9466-100000@velma.motion.net>
On Sat, 30 Dec 2000, Roger Hinson wrote:
> Hi Chris,
>
> I used your code below to do break a file I have into records which
> I'll later play with, but when I print it to a file, it doesn't enter
> the last record. Here is what I modified your code to:
Simple oversight on my part. Try using a test for EOF as well as the
test for a new top-of-template.
>
> #!e:/perl -w
>
> # This scripts cleans up the
> # output of the log file
> #
> # 12/28/00 Roger Hinson
> #
>
> use strict;
> use Fcntl;
>
> # Open the daily log
> my $INFILE="e:/roger/perl/12242000.log";
>
> # Open the temporary processing file
> my $TMPFILE="e:/roger/perl/12242000.tmp";
>
> # Open the final output file
> # my $OUTFILE="e:/roger/perl/1224done.log"; # Not using this yet
>
> open "INFILE", "$INFILE" or die "Could not open '$INFILE' $!";
> open "TMPFILE", ">$TMPFILE" or die "Could not open '$TMPFILE' $!";
>
> my $template = '';
>
> while (<INFILE>) {
> if ( /Template/ ) { ### or whatever regex assures you it's a new
> record...
> ### process the existing record when you
> see a new one
if( (/Template/) || eof(INFILE) ) {
>
> if ( $template ) { ### only process if the record has a value,
> such as after
> ### we see the first start - we need to see
> the second
> ### start to process the first
>
> print TMPFILE "Current template is ($template)\n"; ###
> process the record
> $template = ''; ### reset the record, because we're
> starting a new one
> }
>
> }
>
> $template .= $_; ### add the current line to the record. In the case
> of a new
> ### record, we've already cleared the old one
> above.
> }
>
> close ("INFILE");
> close ("TMPFILE");
>
> I use the variable template to hold each record. However, the last
> record starting with "Template" never gets printed to the out file..
> Could you explain why and what I might do to fix it? I'm very new to
> Perl so if it's in the docs, you can just point me there...
>
> Thanks,
>
> Roger
>
>
>
> Chris Stith wrote:
>
[snip]
The rest of the script looks to work. I just overlooked giving
you a method to find the end of the last record. The eof()
function should be able to do that, since you can't very well
have a record that goes past the end of the file, can you? ;)
Chris
------------------------------
Date: Mon, 08 Jan 2001 13:12:16 +0100
From: Lukas Pirhofer <lp@rolmail.net>
Subject: Redirect with PERL?
Message-Id: <3A59AEA0.12493DFD@rolmail.net>
How can i make a redirect to another URL? I would like to redirect the
Browser from one to another url.
Thanx
Luky
------------------------------
Date: 08 Jan 2001 12:31:04 +0000
From: nobull@mail.com
Subject: Re: Redirect with PERL?
Message-Id: <u9hf3a4453.fsf@wcl-l.bham.ac.uk>
Lukas Pirhofer <lp@rolmail.net> writes:
> Subject: Redirect with PERL?
It's "Perl" not "PERL"!
> How can i make a redirect to another URL? I would like to redirect the
> Browser from one to another url.
Is this a Perl CGI script? If so the basic machanism is the same as
for a CGI script written in any other language - see language
independant documentation on CGI for details. You may also want to
see documentation on HTTP to gain a better understanding of the
underlying HTTP mechanisms.
Specifically in Perl you'll probably want to use the CGI module that
provides a neat Perl interface to the CGI API. For an example of how
to do produce a redirection HTTP response using the CGI module see
err... examples of doing redirection in the CGI module documentation.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 8 Jan 2001 14:10:33 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Redirect with PERL?
Message-Id: <Pine.LNX.4.30.0101081407060.19489-100000@lxplus003.cern.ch>
On 8 Jan 2001 nobull@mail.com wrote:
> Is this a Perl CGI script? If so the basic machanism is the same as
> for a CGI script written in any other language - see language
> independant documentation on CGI for details.
Agreed.
> You may also want to
> see documentation on HTTP to gain a better understanding of the
> underlying HTTP mechanisms.
This is true: however, a CGI script issues its response according to
the CGI specification - the HTTP specification is only indirectly
involved. And, in fact, one of the two specified kinds of Location:
CGI response don't involve an HTTP Location: response at all.
cheers
------------------------------
Date: Mon, 08 Jan 2001 13:31:43 GMT
From: "Olav" <nomail@please.not>
Subject: Re: Redirect with PERL?
Message-Id: <3jj66.8305$k03.480023@news01.chello.no>
"Lukas Pirhofer" <lp@rolmail.net> wrote in message
news:3A59AEA0.12493DFD@rolmail.net...
> How can i make a redirect to another URL? I would like to redirect the
> Browser from one to another url.
print "location: http://www.yahoo.com/\n\n";
Olav
>
> Thanx
> Luky
>
------------------------------
Date: Mon, 08 Jan 2001 13:31:54 GMT
From: "Olav" <nomail@please.not>
Subject: Re: Redirect with PERL?
Message-Id: <ejj66.8306$k03.479990@news01.chello.no>
"Lukas Pirhofer" <lp@rolmail.net> wrote in message
news:3A59AEA0.12493DFD@rolmail.net...
> How can i make a redirect to another URL? I would like to redirect the
> Browser from one to another url.
print "location: http://www.yahoo.com/\n\n";
Olav
>
> Thanx
> Luky
>
------------------------------
Date: Mon, 08 Jan 2001 15:07:22 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: Redirect with PERL?
Message-Id: <JIk66.208601$DG3.5011526@news2.giganews.com>
"Lukas Pirhofer" <lp@rolmail.net> wrote in message
news:3A59AEA0.12493DFD@rolmail.net...
> How can i make a redirect to another URL? I would like to redirect the
> Browser from one to another url.
use CGI qw(:standard);
print redirect("www.othersite.com");
------------------------------
Date: 08 Jan 2001 09:23:27 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Redirect with PERL?
Message-Id: <87puhy2hlc.fsf@limey.hpcc.uh.edu>
>> On Mon, 08 Jan 2001 15:07:22 GMT,
>> "Jay Flaherty" <fty@mediapulse.com> said:
> "Lukas Pirhofer" <lp@rolmail.net> wrote in message
> news:3A59AEA0.12493DFD@rolmail.net...
>> How can i make a redirect to another URL? I would like
>> to redirect the Browser from one to another url.
> use CGI qw(:standard);
> print redirect("www.othersite.com");
print redirect('http://www.some.where.else/');
You redirect to a URL not to a hostname.
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Mon, 08 Jan 2001 15:27:54 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Redirect with PERL?
Message-Id: <slrn95jn43.538.rgarciasuarez@rafael.kazibao.net>
Jay Flaherty wrote in comp.lang.perl.misc:
> "Lukas Pirhofer" <lp@rolmail.net> wrote in message
> news:3A59AEA0.12493DFD@rolmail.net...
> > How can i make a redirect to another URL? I would like to redirect the
> > Browser from one to another url.
>
> use CGI qw(:standard);
> print redirect("www.othersite.com");
"www.othersite.com" is not an URL. You meant:
print redirect("http://www.othersite.com/foo/bar/quux.html");
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 08 Jan 2001 16:00:08 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Redirect with PERL?
Message-Id: <3a59e407.471c$3d9@news.op.net>
In article <3A59AEA0.12493DFD@rolmail.net>,
Lukas Pirhofer <lp@rolmail.net> wrote:
>How can i make a redirect to another URL? I would like to redirect the
>Browser from one to another url.
Try this:
print "Location: http://www.perl.com\n\n";
exit;
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Mon, 8 Jan 2001 09:09:29 -0500
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: Remote Controll other windows software by Perl
Message-Id: <93chmq$2ge$1@panther.uwo.ca>
Win32::OLE
"Mösl Roland" <founder@pege.org> wrote in message
news:3a55b42b$1$9846@SSP1NO25.highway.telekom.at...
> I would like to
>
> open Paint Shop Pro
> open some picture.jpg
> Save as some_picture_print.jpg
> resize, width=600
> Save as PARAMETER2.jpg
> resize, height=80
> Save as PARAMETER2_dir.jpg
>
> I had once under Windows 3.1 a script
> which converted several hundred pictures
> from a POV video into other format.
>
> So there should be something like this
> for Win 98 also where I can remote controll
> with Perl other Windows software.
>
> Is there any modul for this task?
>
> --
> Mösl Roland founder@pege.org
> http://www.pege.org clear targets for a confused civilization
> http://www.BeingFound.com web design starts at the search engine
>
>
>
>
>
------------------------------
Date: 8 Jan 2001 12:30:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reposting - Pattern match in an array of strings
Message-Id: <93cbt2$ess$1@mamenchi.zrz.TU-Berlin.DE>
Doug Perham <dperham@wgate.com> wrote in comp.lang.perl.misc:
>Rocky Raccoon <rrocky@bigfoot.com> writes:
>
>> If I have an array of strings, say
>> @x = ("Hello\n", "World\n", "Hello to\n", "World");
>>
>> I want to search for the string "Hello World".
>> I should get found for @x[0], @x[1], but not found for @[2] , @[3]
>> (because World doesn't follow to immediately).
>>
>> What's the best way to do it ?
>> chomp each line,
>
>no need to chomp (otherwise you'd be eliminating the white space you
>need in your pattern match)
>
>> ... concatenate everything
>
>yes, that sounds reasonable.
Only if we assume that every string in the array contains exactly one
newline at the end. Otherwise concatenation will lose information (the
length of the original strings is lost). This can lead to false
positives, for instance with "Hell\no World\n".
Anno
------------------------------
Date: Mon, 8 Jan 2001 14:58:21 -0000
From: "Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1>
Subject: send on a socket returns "operation not supported" but recv works?
Message-Id: <93ckg4$nop$1@soap.pipex.net>
Programming using unix sockets, it's my first attempt at building a server
for perl.
I have a C client which is connect()ing and send()ing data to the socket
correctly - and the perl script is recv()ing that data fine - however when
it tries to send back a confirmation that the data is ok it fails with
"operation not supported".
Code is below, any comments appreciated.
Geoff
socket(Server, PF_UNIX, SOCK_STREAM, 0) || die "socket failed: $!";
unlink ($name);
print "set up socket\n";
bind (Server, $uaddr) || die "bind failed: $!";
print "bound socket\n";
listen (Server, SOMAXCONN) || die "listen failed: $!";
print "listening\n";
my $inbuff;
my $mpid;
$diedpid=0;
while (accept(Client,Server) || $diedpid!=0)
{
# now we start the repeating loop...
if ($diedpid) {
$diedpid=0;
next;
}
# if the accept returned because of a caught sigchld then continue
if (!defined($mpid=fork)) {
shutdown Server, 2;
do_exit ("Fork failed", __LINE__);
}
if ($mpid) {
next;
}
# if we're the parent, just go back to the accept loop
my $ret;
my $yval;
$yval="y";
$ret=recv Client, $inbuff, 255, 0;
print "received $inbuff\n";
$ret=send Client, $yval, 1, 0;
if (!defined($ret)) {
print "failed to send response to client - $!\n";
do_exit(1);
}
------------------------------
Date: 8 Jan 2001 12:17:58 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Shall use a reference instead?
Message-Id: <978955589.18700@itz.pp.sci.fi>
In article <qOd66.21282$7f3.1508149@bgtnsc07-news.ops.worldnet.att.net>, Michael Mayo wrote:
>
>In Perl (unlike C++), there is no difference between an object and a reference
>to an object. The reference to the object *is* the object.
Actually, you're wrong. A reference is a reference, and an object is
a blessed "thingy". It's just that there's usually little reason to
access the object directly, so all you'll see in the code is the ref.
Still, it is possible to have direct access to a blessed variable, and
it's possible to get bitten by it if you go around blessing thingies
that belong to some other part of code. BTDT.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
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 16
*************************************