[7507] in Perl-Users-Digest
Perl-Users Digest, Issue: 1133 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 6 16:07:15 1997
Date: Mon, 6 Oct 97 13:00:32 -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 Mon, 6 Oct 1997 Volume: 8 Number: 1133
Today's topics:
[Q - newbie] Sockets and bi-directional communication <greg_wright@smsinc.com>
Re: [Q - newbie] Sockets and bi-directional communicati <greg_wright@smsinc.com>
Re: [Q - newbie] Sockets and bi-directional communicati (Piotr Piatkowski)
Re: Cannot compile perl 5.004.03 under NEXTSTEP 3.3 (Jason Gloudon)
Coverting Flatfile *to* Excel (Timothy Lux)
file splitting (Darrell A. Schulte)
Re: file splitting (Tad McClellan)
Re: file splitting (Darrell A. Schulte)
ftp from perl app? (Milagro)
gethostbyaddr fails - Could it be I don't know what to <jerryp.usenet@SPAMconnected.demon.co.uk>
Re: gethostbyaddr fails - Could it be I don't know what (Shishir Gundavaram)
Re: gethostbyaddr fails - Could it be I don't know what <rra@stanford.edu>
Re: how to write to two or more file with one command ? (Greg Bacon)
Re: Loop variables changing? (Greg Bacon)
Re: Loop variables changing? (Andrew M. Langmead)
Mail::Send module assistance request <strannik@strannik.com>
Re: Newbie CGI question (brian d foy)
Re: Perl & C++ Routines <sriram@weblogic.com>
PERL AIX UPLOAD Large Files <plpower@landsend.com>
Perl vs. Java (Chan)
Re: Perl vs. Java <sriram@weblogic.com>
problems with use !! <alcr@intershop.de>
Re: problems with use !! <kimball@stsci.edu>
Re: problems with use !! <rra@stanford.edu>
Re: PROOF: VB FASTER THAN PERL, C, C++ (John C. Randolph)
Re: Q : Files using question (Jason Gloudon)
Re: Q : Files using question (Bart Lateur)
Quoting "{" (Woody Jin)
Re: Quoting "{" <rra@stanford.edu>
single quote in scalar identifier? (Ken Irving)
Re: single quote in scalar identifier? (Tom Grydeland)
Socket and Command Line Arguments (Woody Jin)
USENIX Conference on Domain-Specific Languages (DSL) - (Jackson Dodd)
RE: XPUSHi <sriram@weblogic.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Oct 1997 16:07:39 GMT
From: "J. Gregory Wright" <greg_wright@smsinc.com>
Subject: [Q - newbie] Sockets and bi-directional communication
Message-Id: <01bcd272$7d3596e0$990d10ac@gregw-pc.cmsinc.com>
O/S: HP-UX 10.20
Perl: 5.004
I'm attempting to write a simple IP socket-based server, which should
accept a connection from a client, take input from the client and then
send a response back to the client. I've been working from the 2nd ed.
"Programming Perl" book and digging around in various FAQs, man
pages and the like, with no success.
For the client, I took the first sample client from PP, and replaced:
while ($line = <SOCK>){
print $line;
}
with the following code (assuming I get only one line of response):
print SOCK "What time is it?\n";
if( defined( $line = <SOCK> ) )
{
print $line;
}
For the server, I took the first sample server from PP, and inserted
if( defined( $line = <Client> ) )
{
chomp( $line );
logmsg "Received $line from client";
}
prior to the "print Client..." statement.
My experience with socket programs in 'C' indicates that this should
work, but both the client and the server hang (and I never see the output
from the 'logmsg "Received..." line in the server).
Now one thing I have noticed from digging around in the newsgroup is
that most folks seem to be using the IO::Socket library, instead of the
"use Sockets". Did I miss something?
Any assistance in this area would be appreciated... I'm sorely confused.
--
Gregory Wright
Credit Management Solutions, Inc.
greg_wright@cmsinc.com
------------------------------
Date: 6 Oct 1997 17:07:02 GMT
From: "J. Gregory Wright" <greg_wright@smsinc.com>
Subject: Re: [Q - newbie] Sockets and bi-directional communication
Message-Id: <01bcd27a$d1ac3be0$990d10ac@gregw-pc.cmsinc.com>
J. Gregory Wright <greg_wright@smsinc.com> wrote in article
<01bcd272$7d3596e0$990d10ac@gregw-pc.cmsinc.com>...
[ snip ]
> My experience with socket programs in 'C' indicates that this should
> work, but both the client and the server hang (and I never see the output
> from the 'logmsg "Received..." line in the server).
Also, a telnet to the server process "works". Meaning, if I telnet to the
server's port, and type in a string, then the server prints out the string
and sends back the canned "..the time is..." message and closes the
connection. So I am assuming the problem is with the client?
------------------------------
Date: 6 Oct 1997 19:38:59 +0200
From: kompas@galaxy.uci.agh.edu.pl (Piotr Piatkowski)
Subject: Re: [Q - newbie] Sockets and bi-directional communication
Message-Id: <61b7nj$qls$1@galaxy.uci.agh.edu.pl>
J. Gregory Wright <greg_wright@smsinc.com> wrote:
: J. Gregory Wright <greg_wright@smsinc.com> wrote in article
: <01bcd272$7d3596e0$990d10ac@gregw-pc.cmsinc.com>...
: [ snip ]
: > My experience with socket programs in 'C' indicates that this should
: > work, but both the client and the server hang (and I never see the output
: > from the 'logmsg "Received..." line in the server).
: Also, a telnet to the server process "works". Meaning, if I telnet to the
: server's port, and type in a string, then the server prints out the string
: and sends back the canned "..the time is..." message and closes the
: connection. So I am assuming the problem is with the client?
Yes, you forgot $|=1 :-)
--
Piotr Pi1tkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND
------------------------------
Date: 6 Oct 1997 17:53:15 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Cannot compile perl 5.004.03 under NEXTSTEP 3.3
Message-Id: <61b8ib$f57$2@daily.bbnplanet.com>
Gerben_Wierda@RnA.nl wrote:
: When compiling perl 5.004.03 under NEXTSTEP I get:
: `sh cflags libperl.a toke.o` toke.c
: CCCMD = cc -DPERL_CORE -c -DUSE_NEXT_CTYPE -arch m68k -arch i386
: -arch hppa -arch sparc -I/usr/local/include -O
: cc: Internal compiler error: program cc1obj got fatal signal 11
This is a gcc bug. Try a newer version of gcc.
Jason gloudon
------------------------------
Date: Fri, 03 Oct 1997 20:07:35 GMT
From: tim@pbisweb.com (Timothy Lux)
Subject: Coverting Flatfile *to* Excel
Message-Id: <613j85$gtv@news.gvsu.edu>
Keywords: excel database spreadsheet convert
Hi:
Ive read the posts on how to get an Excel document into a flatfile database
(simple way is to save it as a comma-delimited text file within Excel)... but
I need to go the other way. I have a flatfile database where the 'admin' user
can choose to convert the data to an Excel document. I can get the data to any
format I need, but is the solution to:
1 - convert the data to comma delimited
2 - open Excel
3 - open the file
I don't want the user to have to do anything special... is there a way to open
Excel and the file all from PERL? Or would the solution be to send the comma
delimited file via email, and hope they know how to do it from that point on?
Thanks in advance--
Tim
------------------------------
Date: Mon, 06 Oct 1997 11:25:55 -0600
From: dschulte@facstaff.wisc.edu (Darrell A. Schulte)
Subject: file splitting
Message-Id: <dschulte-0610971125550001@news71.news.wisc.edu>
Anyone invent this yet? I'm looking for a perl script to run through a
text file and spit out new files based on a string (xyz123) it sees in the
file.
===from:
===date:
===subject:
===message:
xyz123
===from:
===date:
===subject:
===message:
xyz123
===from:
===date:
===subject:
===message:
xyz123
if the file name for this is, junk, then I'd like to see three distinct
files called, junk.1, junk.2 and junk.3 show up containing their
respective information (the data which precedes the string).
I realize that this involves an autoincrement(++) on string xyz123, but
I'm not sure how to grab the data before it and send it on its way...
Any help is appreciated, thank you.
Darrell
_____________________________________________________________________
Darrell A. Schulte - dschulte@facstaff.wisc.edu (Associate IPC)
WCER - The Why Files http://whyfiles.news.wisc.edu - NISE
University of Wisconsin-Madison - ONPA
102A Bascom Hall, 500 Lincoln Drive - Madison WI 53706 (608) 265-8551
------------------------------
Date: Mon, 6 Oct 1997 12:58:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: file splitting
Message-Id: <0s8b16.hh.ln@localhost>
Darrell A. Schulte (dschulte@facstaff.wisc.edu) wrote:
: Anyone invent this yet? I'm looking for a perl script to run through a
: text file and spit out new files based on a string (xyz123) it sees in the
: file.
: ===from:
: ===date:
: ===subject:
: ===message:
: xyz123
: ===from:
: ===date:
: ===subject:
: ===message:
: xyz123
: ===from:
: ===date:
: ===subject:
: ===message:
: xyz123
: if the file name for this is, junk, then I'd like to see three distinct
: files called, junk.1, junk.2 and junk.3 show up containing their
: respective information (the data which precedes the string).
: I realize that this involves an autoincrement(++) on string xyz123, but
: I'm not sure how to grab the data before it and send it on its way...
: Any help is appreciated, thank you.
This should get you started (UNTESTED):
$/ = "xyz123\n"; # set "input record separator" to get a record at a time
$num = 1; # filename extension
while (<>) {
open(OUT, ">$ARGV.$num") || die "could not open '$ARGV.$num' $!";
print OUT;
$num++;
}
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 06 Oct 1997 13:36:04 -0600
From: dschulte@facstaff.wisc.edu (Darrell A. Schulte)
Subject: Re: file splitting
Message-Id: <dschulte-0610971336040001@news71.news.wisc.edu>
In article <0s8b16.hh.ln@localhost>, tadmc@flash.net (Tad McClellan) wrote:
<snip!>
>
> This should get you started (UNTESTED):
>
>
> $/ = "xyz123\n"; # set "input record separator" to get a record at a time
> $num = 1; # filename extension
> while (<>) {
> open(OUT, ">$ARGV.$num") || die "could not open '$ARGV.$num' $!";
> print OUT;
> $num++;
> }
Tad,
It worked like a charm. Thanks a lot!
Darrell
_____________________________________________________________________
Darrell A. Schulte - dschulte@facstaff.wisc.edu (Associate IPC)
WCER - The Why Files http://whyfiles.news.wisc.edu - NISE
University of Wisconsin-Madison - ONPA
102A Bascom Hall, 500 Lincoln Drive - Madison WI 53706 (608) 265-8551
------------------------------
Date: Mon, 06 Oct 1997 11:45:31 -0500
From: milagro@beanfield.war (Milagro)
Subject: ftp from perl app?
Message-Id: <milagro-ya02408000R0610971145310001@news.erols.com>
Hi all,
I've written a script that formats some text files. The files need to be
ftp'd to another server. I am new to perl and tried to just put the ftp
command in backticks but had no success. (ie `ftp myserver.com`)
Anyone know how I go about doing this or does anyone know of some
pre-written scripts that do this already? Thanks very much. Please email as
well as post if you can. I don't have newsgroup access at work where this
problem is occuring.
Thanks.
Mike
mshavel@erols.com
------------------------------
Date: Mon, 6 Oct 1997 19:28:18 +0100
From: Jerry Pank <jerryp.usenet@SPAMconnected.demon.co.uk>
Subject: gethostbyaddr fails - Could it be I don't know what to put in ADDRTYPE ?
Message-Id: <6QXxBCAC3SO0Ewev@connected.demon.co.uk>
Hi.
I can't seen to get gethostbyaddr to return a value
Blue Camel gives syntax as:
gethostbyaddr ADDR, ADDRTYPE
But I can't find any reference to what ADDRTYPE should contain.
Not surprisingly, the code below returns nothing : (
#!/bin/perl5
# get my IP number
$num = $ENV{'REMOTE_ADDR'};
# find out what they call me
$name = gethostbyaddr ($num,AF_INET);
#Print HTTP header for a plain text listing.
print "Content-type: text/plain\n\n";
print "My IP number is $num\n";
print "I am not a number I am $name\n";
This fails running on my ISP's Perl 5.001 - Soon to be upgraded :o)
-- Jerry Pank
This post in every-way totally reflects the views of my employer...
I am he.
jerryp(dot)usenet(at)connected(dot)demon(dot)co(dot)uk
------------------------------
Date: 6 Oct 1997 19:28:47 GMT
From: shishir@ruby.ora.com (Shishir Gundavaram)
Subject: Re: gethostbyaddr fails - Could it be I don't know what to put in ADDRTYPE ?
Message-Id: <61be5f$fua$1@amber.ora.com>
Jerry Pank (jerryp.usenet@SPAMconnected.demon.co.uk) wrote:
: Hi.
:
: I can't seen to get gethostbyaddr to return a value
:
: Blue Camel gives syntax as:
:
: gethostbyaddr ADDR, ADDRTYPE
:
:
: #!/bin/perl5
use Socket;
: # get my IP number
: $num = $ENV{'REMOTE_ADDR'};
: # find out what they call me
$packed_address = inet_aton ($num);
: $name = gethostbyaddr ($num,AF_INET);
$name = gethostbyaddr ($packed_address, AF_INET);
: #Print HTTP header for a plain text listing.
: print "Content-type: text/plain\n\n";
: print "My IP number is $num\n";
: print "I am not a number I am $name\n";
--Shishir
------------------------------
Date: 06 Oct 1997 12:21:43 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: gethostbyaddr fails - Could it be I don't know what to put in ADDRTYPE ?
Message-Id: <m3pvpig0jc.fsf@windlord.Stanford.EDU>
Jerry Pank <jerryp.usenet@SPAMconnected.demon.co.uk> writes:
> I can't seen to get gethostbyaddr to return a value
> Blue Camel gives syntax as:
> gethostbyaddr ADDR, ADDRTYPE
> But I can't find any reference to what ADDRTYPE should contain. Not
> surprisingly, the code below returns nothing : (
It should pretty much always be AF_INET, which is a constant that's loaded
when you do a use Socket.
windlord:~> perl -MSocket -e 'print AF_INET, "\n"'
2
Keep in mind also that gethostbyaddr() wants a *packed* address, so you'll
need to use sockaddr_in() or some similar function (Perl 5.002 and later)
or the magic pack() line from man perlipc (Perl 5.001 and earlier). With
a recent version of Perl, perldoc Socket will give you lots of useful
information on how to do this.
--
#!/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: 6 Oct 1997 14:48:30 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Frederic Corne <frederic.corne@erli.fr>
Subject: Re: how to write to two or more file with one command ?
Message-Id: <61atnu$n3h$1@info.uah.edu>
[Posted and mailed]
In article <uvhzb473y.fsf@erli.fr>,
Frederic Corne <frederic.corne@erli.fr> writes:
: I have a big script which send all its output to stdout. I known how to
: redirect stdout to a file with
: open(SAVEOUT, ">&STDOUT");
: open(STDOUT, "> /foo/bar")|| die "Can't redirect stdout";
:
: This works but I have to use 'tail -f ' to see what happens ...
:
: Now I wish to print to stdout AND to a file without duplicate all the print
: commands of the script. I can use 'tee' but ...
:
: How can I do this ?
Use a tied filehandle! :-)
Tee.pm:
package Tee;
use IO::File;
use Carp;
sub TIEHANDLE {
my $self = {};
my $class = shift;
my $file = shift;
unless ($self->{'other'} = IO::File->new("> $file")) {
croak "Failed open >$file: $!";
}
bless $self, $class;
}
sub PRINT {
my $self = shift;
## this chicanery avoids infinite recursion
open FOO, ">&STDOUT" or croak "Can't dup STDOUT: $!";
print FOO @_;
close FOO;
print { $self->{'other'} } @_;
}
sub DESTROY {
my $self = shift;
$self->{'other'} = undef;
}
1;
try:
#! /usr/bin/perl -w
require Tee;
tie *STDOUT, 'Tee', 'test-file';
print "hello\n";
print "testing", " one ", " two ", "\n";
untie *STDOUT;
Read the perltie(1) manpage for more details.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 6 Oct 1997 15:03:46 GMT
From: gbacon@adtran.com (Greg Bacon)
To: jerryb@jmeo.nl (Jerry Britton)
Subject: Re: Loop variables changing?
Message-Id: <61auki$n3h$2@info.uah.edu>
[Posted and mailed]
In article <61aqq6$8r2$1@news2.xs4all.nl>,
jerryb@jmeo.nl (Jerry Britton) writes:
: In the following fragment:
:
: foreach $line (@result) {
: if (/^Reply from/) {
: print "found Reply from in ", $line, "\n";
: last;
: }
: }
:
: print $line;
:
: ..if I get the found message, the value of the variable $line printed
: after the loop is not the same as printed in the "found" message. In fact, it
: points to the next element of the array @result"
If the above fragment is not a bad paste, then your problem is in your
conditional. It should be
if ($line =~ /^Reply from/) {
If a match operator isn't bound to a variable, it defaults to using $_.
What are you doing with $line and $_ before your foreach loop?
Otherwise....
>From perlsyn:
The foreach loop iterates over a normal list value and
sets the variable VAR to be each element of the list in
turn. If the variable is preceded with the keyword my,
then it is lexically scoped, and is therefore visible only
within the loop. Otherwise, the variable is implicitly
local to the loop and regains its former value upon
exiting the loop. If the variable was previously declared
with my, it uses that variable instead of the global one,
but it's still localized to the loop. (Note that a
lexically scoped variable can cause problems with you have
subroutine or format declarations.)
Two questions: what version of perl do you have and what are you doing
with $line before the foreach loop? FWIW, I ran this test case under
5.004_03
#! /usr/bin/perl -w
my @array = qw( 1 2 3 4 5 6 );
my $var;
foreach $var (@array) {
if ($var == 3) {
print "found 3 at $var\n";
last;
}
}
print $var, "\n"; ## line 12
and got this output:
found 3 at 3
Use of uninitialized value at ./try line 12.
This output is consistent with the above documentation. However, if I
change it to
#! /usr/bin/perl -w
my @array = qw( 1 2 3 4 5 6 );
my $var;
$var = 'before';
foreach $var (@array) {
if ($var == 3) {
print "found 3 at $var\n";
last;
}
}
print $var, "\n";
then I get this output:
found 3 at 3
before
: If I change the above to:
:
: foreach (@result) {
: if (/^Reply from/) {
: $line = $_;
: print "found Reply from in ", $line, "\n";
: last;
: }
: }
:
: print $line;
:
: ..the second line printed shows the same value for $line as the first line
: printed.
This is expected because $line's value isn't local to the foreach loop
in this code fragment.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Mon, 6 Oct 1997 18:04:10 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Loop variables changing?
Message-Id: <EHn66y.8Fr@world.std.com>
jerryb@jmeo.nl (Jerry Britton) writes:
>In the following fragment:
> foreach $line (@result) {
[stuff deleted]
>print $line;
>..if I get the found message, the value of the variable $line printed
>after the loop is not the same as printed in the "found" message. In fact, it
>points to the next element of the array @result"
foreach loops do an implicit local() on the loop variable. What you
should see is the original value of $line restored after the loop.
almost as if you said:
{
local($line);
foreach $line (@result) {
}
} # end of dynamic scoped $line. the old value gets restored.
>If I change the above to:
> foreach (@result) {
> if (/^Reply from/) {
> $line = $_;
You'd also see the same effect if you said:
foreach $currentline (@result) {
if(/^Reply from/) {
$line = $currentline;
The loop iterator, $currentline gets saved/restored, but $line, some
variable that has nothing to do with the loop has nothing special done
to it.
--
Andrew Langmead
------------------------------
Date: Mon, 6 Oct 1997 11:59:23 -0700
From: John Simmons <strannik@strannik.com>
Subject: Mail::Send module assistance request
Message-Id: <Pine.BSF.3.96.971006115116.22556A-100000@shell3.ba.best.com>
Hello,
The pod documentation isn't clear to me on one point;
Is it possible, using Mail::Send, to set a "From:" attribution?
I note that two of the options are:
$msg->set($header, @values);
$msg->add($header, @values);
But I'm not sure how this is actually used. Any examples or pointers to
documentation more detailed than the pod would be greatly appreciated.
Thanks,
John
------------------------------
Date: Mon, 06 Oct 1997 12:40:59 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Newbie CGI question
Message-Id: <comdog-ya02408000R0610971240590001@news.panix.com>
In article <3438C05E.5A2F48E1@iaehv.nl>, dbeerman@detron.nl wrote:
>David Barr wrote:
>
>> Would someone please send me a code fragment that shows me the basic
>> basic
>> read and write capabilities of perl when receiving from and sending to
>> a
>> web client. Also, I'm not certain of the interaction between the web
>> client, the web server, and the actual script, so hints there would
>> also be
>> helpful.
[snip]
>Next, the parsing in my Perl is done scripts by a routine
>written by Matt Wright ( http://xxxxxxxxxxxxxxxxx/ ):
[address hidden to protect the innocent.]
no need to post buggy and broken code. if you can't do it correctly
yourself, use the CGI.pm module [1].
[1]
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Mon, 06 Oct 1997 12:13:02 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: miran.sepic4@mss.tel.hr
Subject: Re: Perl & C++ Routines
Message-Id: <3439383E.9958524B@weblogic.com>
<<
I have a routine in C++ which encodes and decodes the input.
Is it possible to use it in a CGI/Perl script?
>>
Yes.
Take a look at SWIG ("http://www.cs.utah.edu/~beazley"). Or,
take a look at XS (described in the perl documentation, perlxs,
perlxstut and perlguts).
I prefer the former.
Or, if time is not too critical, simply fork the C++ program from
a Perl script. That's the simplest option.
- Sriram
________________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Mon, 06 Oct 1997 13:39:41 -0500
From: Patricia Powers <plpower@landsend.com>
Subject: PERL AIX UPLOAD Large Files
Message-Id: <3439306D.15A2@landsend.com>
I'm having a problem with the following bit of code:
if ($baction eq 'Load Object') {
open (UPLOAD, "> $rootpath$filename.$objext")||die "Error $!";
print UPLOAD <$filepath>;
#&PrintVariables;
close UPLOAD;
}
It works with files up to around 30k but larger files won't upload.
Running on an AIX box and accessing through Oracle's Web server 2.1. I
do see an error 'server close socket during multipart read(client
aborted?). All this same code works and has worked for a long time on a
Sun Unix box.
HELLLLPPPPP!!! reply to newsgroup or jmoran@baraboo.com
------------------------------
Date: 6 Oct 1997 16:37:05 GMT
From: hc@toraix1.torolab.ibm.com (Chan)
Subject: Perl vs. Java
Message-Id: <61b43h$i84$1@tornews.torolab.ibm.com>
Hi,
I was wondering if Perl5 supports multiple inheritance.
How about polymorphism and overloading?
I'm doing some minor research on the comparison of
OO languages and I was wondering how Perl5 compares
to Java
thx for any info,
Regards,
Henry
hc@ca.ibm.com
------------------------------
Date: Mon, 06 Oct 1997 12:09:47 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
Subject: Re: Perl vs. Java
Message-Id: <3439377B.792EF531@weblogic.com>
Henry Chan wrote:
<<I was wondering if Perl5 supports multiple inheritance.
How about polymorphism and overloading?
I'm doing some minor research on the comparison of
OO languages and I was wondering how Perl5 compares
to Java
>>
Yes, yes, yes to your questions.
Now my question. I'm curious as to whether you will say one
has it and another doesn't, and therefore one is better than another.
Java has multiple interface inheritance, and no multiple
implementation inheritance. Though I miss the latter once in a while,
I have had enuf problems using it in my C++ days (I do Java for
a living, and Java/Perl for fun), so if it is going to make
the language complex, I can very well do without MI.
-Sriram
- Sriram
_______________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Mon, 06 Oct 1997 19:27:58 +0200
From: "A.L.Chalapathirao" <alcr@intershop.de>
Subject: problems with use !!
Message-Id: <34391F9E.DBFB0B80@intershop.de>
I use a perl (CGI) script that contains
use "AdminLib::Print::Main", qw( AttachmentList );
The inclusion of the above statement is resulting in "document contains
no data" error mesg. When I comment the above statement it works fine.
All the libraries are properly located.
What could be the problem. Please help me !!
------------------------------
Date: Mon, 06 Oct 1997 14:41:43 -0400
From: Tim Kimball <kimball@stsci.edu>
Subject: Re: problems with use !!
Message-Id: <343930E7.B57F02BB@stsci.edu>
A.L.Chalapathirao wrote:
>
> I use a perl (CGI) script that contains
>
> use "AdminLib::Print::Main", qw( AttachmentList );
>
> The inclusion of the above statement is resulting in "document contains
> no data" error mesg. When I comment the above statement it works fine.
Take out the comma & unquote the library name:
use AdminLib::Print::Main qw( AttachmentList );
& see if that works.
-- tdk
------------------------------
Date: 06 Oct 1997 12:17:57 -0700
From: Russ Allbery <rra@stanford.edu>
To: alcr@intershop.de
Subject: Re: problems with use !!
Message-Id: <m3u3eug0pm.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
A L Chalapathirao <alcr@intershop.de> writes:
> use "AdminLib::Print::Main", qw( AttachmentList );
> The inclusion of the above statement is resulting in "document contains
> no data" error mesg. When I comment the above statement it works fine.
Did you happen to mean:
use AdminLib::Print::Main qw(AttachmentList);
instead? You've got a bit too much punctuation. The "document contains
no data" error message generally indicates that your script is failing
before it prints out the document header, and you should check your web
server error logs for the exact errors.
--
#!/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: 6 Oct 1997 14:57:42 GMT
From: jcr.remove@this.phrase.idiom.com (John C. Randolph)
Subject: Re: PROOF: VB FASTER THAN PERL, C, C++
Message-Id: <61au96$9tm$1@news.idiom.com>
In <i4k416.t21.ln@localhost> Tad McClellan wrote:
-> SpamProofSeal@none.com (SpamProofSeal@none.com) wrote:
->
->
-> Posting anonymously does significant harm to your credibility...
Come on, Tad! You don't think that Bill Gates has the balls to post under
his *own* name, do you? It looks like about his technical level...
-jcr
--
John C. Randolph (408) 358-6732 NeXT mail preferred.
Chief Technology Officer, WARPnet Incorporated.
@"Hey, %s! You're a NAZI, and you can't spell!"
------------------------------
Date: 6 Oct 1997 17:40:42 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Q : Files using question
Message-Id: <61b7qq$f57$1@daily.bbnplanet.com>
Efi Ivanir (ivanir@ilx334.iil.intel.com) wrote:
: Hi
: When I read file with :
: open(FILE,what-ever) ;
: while(<FILE>) {
: }
: Can I , In the middle of the while loop, go back one line ? Or maybe
: can I reset the while loop identifier so he re-read the file ?
redo will let you restart the current iteration of the loop without reading
a new line. See man perlsyn for an example.
Jason Gloudon
------------------------------
Date: Mon, 06 Oct 1997 19:53:31 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Q : Files using question
Message-Id: <343a410c.1161553@news.tornado.be>
Efi Ivanir <ivanir@ilx334.iil.intel.com> wrote:
>When I read file with :
>
>open(FILE,what-ever) ;
>while(<FILE>) { ... }
>
>Can I , In the middle of the while loop, go back one line ? Or maybe
>can I reset the while loop identifier so he re-read the file ?
If you keep the "file pointer" for a few lines, you can reset it. See
PERLFUNC.POD, keywords seek and tell.
But you might just as well store the previously read few lines.
HTH,
Bart.
------------------------------
Date: Mon, 06 Oct 1997 18:51:10 GMT
From: wjin@cs.uh.edu (Woody Jin)
Subject: Quoting "{"
Message-Id: <61bc63$lvp$1@Masala.CC.UH.EDU>
I think that quoting braces should be OK.
For example, I can run a test program,
print "Hello {\n".
But then I have a program which gives me syntax error in
the following case:
$IdStr = "$IdStr{"; # line 689
....
syntax error at wnserv.pl line 704, near "}"
Execution of wnserv.pl aborted due to compilation errors.
I am using perl 5.00_3
If I put backslash before {, the program works perfectly.
Should I always put backslash before braces when I quote
them ?
--
Woody
------------------------------
Date: 06 Oct 1997 12:24:13 -0700
From: Russ Allbery <rra@stanford.edu>
To: wjin@cs.uh.edu (Woody Jin)
Subject: Re: Quoting "{"
Message-Id: <m3n2kmg0f6.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Woody Jin <wjin@cs.uh.edu> writes:
> But then I have a program which gives me syntax error in the following
> case:
> $IdStr = "$IdStr{"; # line 689
The problem is that it thinks that this is part of a hash reference. It's
expecting something like $IdStr{something} and getting confused. This is
arguably a bug, but as a general rule you have to disambiguate if you put
anything after a variable name that looks like it may be part of the
variable reference.
In this case, either of:
$IdStr = "$IdStr\{";
$IdStr = "${IdStr}{";
would work. In general, you don't have to quote {; this is a special case
because it immediately follows a variable.
--
#!/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: Mon, 06 Oct 1997 19:29:34 GMT
From: systech@polarnet.com (Ken Irving)
Subject: single quote in scalar identifier?
Message-Id: <a67cd$a1d22.1d7@PolarNet>
Perusing some perl library scripts, including ftp.pl, I've
seen some lines such as:
$ftp'ftpbufsize = 4096;
but I haven't found any reference to this usage. By the
context, it looks like these are parameters, i.e.,
constants, which may perhaps be changed via the command-line.
I've searched the Camel book, grepped and awked my perl dox
and library directories, but am left still wondering about
this. Is this perhaps a deprecated syntax? Or maybe it is
just a convention, and ' is an allowed character in a name?
Perplexed,
Ken
------------------------------
Date: 6 Oct 1997 19:37:12 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: single quote in scalar identifier?
Message-Id: <slrn63iff8.59q.Tom.Grydeland@mitra.phys.uit.no>
On Mon, 06 Oct 1997 19:29:34 GMT,
Ken Irving <systech@polarnet.com> wrote:
> Perusing some perl library scripts, including ftp.pl, I've
> seen some lines such as:
> $ftp'ftpbufsize = 4096;
> but I haven't found any reference to this usage. By the
> context, it looks like these are parameters, i.e.,
> constants, which may perhaps be changed via the command-line.
The single-quote is the old (and deprecated) package delimiter. The new
delimiter is :: (two colons). The following are identical:
$ftp'ftpbufsize
$ftp::ftpbufsize
> I've searched the Camel book, grepped and awked my perl dox
> and library directories, but am left still wondering about
> this. Is this perhaps a deprecated syntax? Or maybe it is
> just a convention, and ' is an allowed character in a name?
The above, combined with the following snippet from perltrap should
answer your question:
+ Deprecation
Double-colon is now a valid package separator in a variable name. Thus
these behave differently in perl4 vs. perl5, because the packages don't
exist.
$a=1;$b=2;$c=3;$var=4;
print "$a::$b::$c ";
print "$var::abc::xyz\n";
# perl4 prints: 1::2::3 4::abc::xyz
# perl5 prints: 3
Given that :: is now the preferred package delimiter, it is debatable
whether this should be classed as a bug or not. (The older package
delimiter, ' ,is used here)
$x = 10 ;
print "x=${'x}\n" ;
# perl4 prints: x=10
# perl5 prints: Can't find string terminator "'" anywhere
# before EOF
Also see precedence traps, for parsing $:.
> Perplexed,
Nah, you're just a new programmer being taught old tricks. :-)
> Ken
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Mon, 06 Oct 1997 18:39:58 GMT
From: wjin@cs.uh.edu (Woody Jin)
Subject: Socket and Command Line Arguments
Message-Id: <61bbh1$log$1@Masala.CC.UH.EDU>
I have a client program which uses socket and it shows
some strange behavior.
The client program has:
.. stuff for setting up socket
while <SOCK> {
do something
}
When there is no argument, it works fine.
When I add arguments like "-port 4300",
it complains, "Can't open -port: no such file or directory",
"Can't open 4300: no such file or directory".
So, I flushed out the command line arguments using
"shift" (in this "-port 4300" example, I used shift twice)
in the beginning of the program, but just after processing
the arguments, then it works fine.
So, my question is, "What is the relationship b/w
SOCK and command line arguments ?
Thanks.
--
Woody
------------------------------
Date: Mon, 6 Oct 1997 16:40:37 GMT
From: jackson@usenix.org (Jackson Dodd)
Subject: USENIX Conference on Domain-Specific Languages (DSL) - Conf Program
Message-Id: <EHn2Bp.J03@usenix.org>
Keywords: USENIX, conference, domain-specific languages
USENIX Conference on Domain-Specific Languages (DSL 97)
October 15-17, 1997
Santa Barbara, California
Sponsored by USENIX, the Advanced Computing Systems Association
In cooperation with ACM SIGPLAN and SIGSOFT
**********************************************
Discount Registration Deadline Extended
**********************************************
Due to problems with US Postal delivery, most DSL registration
brochures were delivered late. As a result, USENIX is offering
the pre-registration savings fee to all attendees.
The Doubletree Resort is also extending their discounted room rate
of $135 as long as there are rooms available in our room block.
Complete conference information is available at:
http://www.usenix.org/events/dsl97/
Or call the Conference Office at 714-588-8649
**********************************************
If you work with or are interested in domain-specific languages
and need the latest information, mark your calendar now and plan
to attend this workshop.
USENIX's Conference on Domain-Specific Languages offers the latest
research during two and one-half days of refereed paper presentations,
invited talks by noted experts, Birds-of-a-Feather sessions, and
opportunities to meet your peers and share solutions.
You will learn about the newest research during these refereed
paper sessions:
--Domain-Specific Language Design
--Experience Reports
--Compiler Infrastructure for Domain-Specific Languages
--Logic and Semantics
--Case Studies and Surveys
--Abstract Syntax Trees
--Embedded Languages and Abstract Data Types
=============================================================
FOR DETAILED PROGRAM AND REGISTRATION INFORMATION:
* See the DSL homepage: http://www.usenix.org/events/dsl97/
* Send email to: info@usenix.org. In the body of your message
state "send dsl97 conferences"
* Call the USENIX Conference Office at 714-588-8649
* Send a fax to 714-588-9706
=============================================================
The USENIX Association brings together the community of engineers,
system administrators, scientists, and technicians working on the
cutting edge of computing. Its technical conferences are the essential
meeting grounds for the presentation and discussion of the most
advanced information on new developments in all aspects of advanced
computing systems.
------------------------------
Date: Mon, 06 Oct 1997 12:27:10 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: aas@sn.no
Subject: RE: XPUSHi
Message-Id: <34393B8E.FA7E59DF@weblogic.com>
<< Gisle Aas wrote:
I can't get XPUSHi (or PUSHi/PUSHn) to work in the PPCODE section of
an XSUB. The compiler gives the following error message:
>>
Ah. The Perl guts documentation is wrong. You should only use XPUSHs.
Unless you are writing new opcodes yourself, you should not be using
XPUSHi etc.
Every node in the parse tree that represents an opcode
contains a special scalar called a "target", to avoid having to
create new scalars every time it is called. These opcodes
use XPUSHi etc. to push this special scalar on the stack (XPUSHi
uses a macro called PUSHTARG for this reason).
Of course, your code has no such thing, so all these macros
fail.
SO you have no option but to say:
XPUSHs (sv2mortal(newSViv(...)))
- Sriram
_______________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
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 1133
**************************************