[10564] in Perl-Users-Digest
Perl-Users Digest, Issue: 4156 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 5 09:07:23 1998
Date: Thu, 5 Nov 98 06:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 5 Nov 1998 Volume: 8 Number: 4156
Today's topics:
Re: /libg++:2.7.2;/: nested *?+ in regexp at /mis/insta <jhi@alpha.hut.fi>
Configuration PERL <s.gontier@dl.ac.uk>
FAQ: Do they exist? ljkbrost@my-dejanews.com
Re: File Locking and Flushing (Matthew Bafford)
Help on a Webmail.... <garcia@joinnet.com.br>
Re: help with REMOTE_USER <robmoral@cisco.com>
Re: HELP: perl script fails on setuid binary <barnett@houston.Geco-Prakla.slb.com>
Re: IIS4, Perl, Object Moved <Steve_Kilbane@cegelecproj.co.uk>
Re: images in perl (Tore Aursand)
Re: Internal Server Error <perlguy@technologist.com>
libwww send var contents <9435697@mail.petech.ac.za>
Re: libwww send var contents <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Locale warning messages <jhi@alpha.hut.fi>
Re: Locale warning messages <jhi@alpha.hut.fi>
magic increment problem <sr@pc-plus.de>
Re: magic increment problem <jdf@pobox.com>
Re: magic increment problem (Karlon West)
Re: PC parallel to Solaris serial tstyles@my-dejanews.com
Perl at Webjump - lonely perler! (The Tinman)
Re: Perl at Webjump - lonely perler! <ebohlman@netcom.com>
Re: PERL is TOO flexible <perlguy@technologist.com>
perl NT network question <robmoral@cisco.com>
Re: perl2exe <trabalka@decef.elf.stuba.sk>
Re: perlcc and shared libraries tstmartin@granite.com
Re: pointer question <prauz@sprynet.com>
Re: pointer question dave@mag-sol.com
Re: post from perl to html <e.christensen@netjob.dk>
Shared libraries - how to link & load tstmartin@granite.com
re: substitutions <avitala@macs.biu.ac.il>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 05 Nov 1998 14:46:01 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: /libg++:2.7.2;/: nested *?+ in regexp at /mis/install/Update/Patchdiag-1.0.2/patchdiag.pl line 799.
Message-Id: <oeeu30eqpdi.fsf@alpha.hut.fi>
jnoviell@my-dejanews.com writes:
> Greetings,
>
> Does anyone now what this means ?
>
> /libg++:2.7.2;/: nested *?+ in regexp at
> /mis/install/Update/Patchdiag-1.0.2/patchdiag.pl line 799.
Those who know what perldiag is for, do. When they have read it
they proceed to perlre to see how to fix the problem.
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Thu, 05 Nov 1998 11:03:58 +0000
From: Sebastien Gontier <s.gontier@dl.ac.uk>
Subject: Configuration PERL
Message-Id: <3641861E.16F52CD6@dl.ac.uk>
Hi,
Does anyone had this problem configuring Perl??
"Use of uninitialized value at configpm line 403, <GLOS> chunk 530.
configpm: tmp not valid at configpm line 403
*** Error code 2 (bu21)!
What can I do? Thank you for your help.
Seb.
------------------------------
Date: Thu, 05 Nov 1998 13:34:16 GMT
From: ljkbrost@my-dejanews.com
Subject: FAQ: Do they exist?
Message-Id: <71s9go$2p4$1@nnrp1.dejanews.com>
I am looking for FAQs that deal with the Win32 modules. In particular, I am
looking for an FAQ the clearly explains the Win32::Process module and
provides a few examples, but all Win32 FAQ will help. I have looked at the
Active State FAQs and tried CPAN (could not access the file though!).
Also, I am interested in knowing why fork() cannot be implemented in Win32.
I'm sure that there has been much discussion about this issue so a pointer to
the disucssion would be helpful.
Thanks in advance,
Kyle Brost
----
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 5 Nov 1998 07:09:39 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: File Locking and Flushing
Message-Id: <MPG.10ab5f8f52b52b709896fc@news.scescape.net>
In article <<36412e99$0$29760@nntp1.ba.best.com>>, moseley@best.com
(Bill Moseley) pounded the following:
=> Hi,
=> [snip]
=> It would seem to me that I should worry about the time between the flock
=> (the unlock) and the close (which is probably when the file really gets
=> written.
Yep.
=> [snip]
=> What if I just don't call flock($fl,LOCK_UN) at all. Would the close then
=> flush, and then close and unlock?
Yep. :)
That is the prefered way to do it.
=> Thanks ever so much,
HTH
=> Bill Moseley
--Matthew
------------------------------
Date: Thu, 5 Nov 1998 10:23:21 -0300
From: Rodrigo Garcia Marques <garcia@joinnet.com.br>
Subject: Help on a Webmail....
Message-Id: <Pine.LNX.3.96.981105101708.9016A-100000@bh1.joinnet.com.br>
Hello, could anyone give me some hints in a cgi (perl) script ?
I need to read messages from a popper/sendmail server running in a linux
2.0.35 machine.
I also need to autenticate the user before him to be able to read his
messages from the server...
I've done the part of read the messages from the log file in
/var/spool/mail/<username>, setting the mod of the script to 4755, but
this mode still can't read the shadow file to get the passwords.
Another guy told me that the pop3d deamon, will, hinself, authenticate the
user and retrieve his messages for me.
Please, i need this with a little urgency, if anyone can help me !!
ps: I also speak portuguese, if you got problems with english....
Eu tambem falo portugues, se voce tem problemas com ingles....
[]'s
Rodrigo Garcia Marques <mailto:garcia@joinnet.com.br>
Joinnet - Internet Services
Suporte
E-Mail: suporte@joinnet.com.br
Telefone: 285-3292
------------------------------
Date: Thu, 05 Nov 1998 08:09:44 -0500
From: Roberto Morales <robmoral@cisco.com>
To: Brad McCready <kaarkas@bigpond.com>
Subject: Re: help with REMOTE_USER
Message-Id: <3641A398.2CF26879@cisco.com>
I don't know where you got REMOTE_USER() and REMOTE_IDENT() from, but if
you look at any reference, either online or in any book, you'll see that
you can get what you want this way:
$quaker = $ENV{REMOTE_USER};
HTH
-berto
Roberto Morales
IS-RTP/Webmaster - Cisco Systems, Inc.
robmoral@cisco.com
919-472-3930(Phone) 919-472-3700(Fax)
7025 Kit Creek Road
PO Box 14987
Research Triangle Park, NC 27709
Brad McCready wrote:
>
> hi all,
>
> i have one directory protected by basic http authentication, i want members
> after passing authentication to be able to edit a profile to be viewable by
> the general public. i wish to do this as a text file which has the username
> that they entered for authentication as a filename. i am having difficulties
> getting a perl/cgi script to read their usernames - i have tried using both
> REMOTE_USER and REMOTE_IDENT in a cgi script but cant get it working. this
> is the <i>very</i> basic cgi script that i am trying to use to test it
> out...
>
> #!/usr/local/bin/perl
>
> print "Content-type: text/html\n\n";
>
> print REMOTE_USER();
> print REMOTE_IDENT();
>
------------------------------
Date: Thu, 05 Nov 1998 07:54:10 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: "Robert S. Campbell" <rsc@snipe.scd.ucar.edu>
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <3641AE02.14EE8917@houston.Geco-Prakla.slb.com>
Robert S. Campbell wrote:
>
> I've run into a problem with a perl script that I can't seem to get around.
<snip>
> Which fails with the following error:
> Insecure $ENV{PATH} while running setuid at /usr/local/bin/k1580 line 199.
> (line 199 is the "open (STDOUT..." above)
This tells me that perl is complaining because of taint-checking. See
perldoc perlsec for details on that.
Apparently line 199 is:
open (STDOUT, "|lpr -P $printer") unless ($printer eq "");
When scripts are run setuid root (or anyone else, I think), perl
automatically turns taint-checking on.
Instead of your open, modify it to this:
open (STDOUT, "|/path/to/lpr -P $printer") unless ($printer eq "");
That is one way to fix the taint-check error. Another way (and possibly
better) is to set $ENV{PATH} to a known quantity inside your script. In
other words, force your path to only have those areas of the system you
trust, like /bin, /usr/sbin, and never '.' (current directory).
$ENV{PATH} = '/usr/bin:/bin'
>
> I'm running:
> # perl -v
> This is perl, version 5.004_04 built for sun4-solaris
>
> Is there any way around/fix to this? Is perl generating the above error?
> (I assume so, but...)
>
> I'll read any replies once I've killed the person who installed Solaris 2.6
> on this machine (note: upgrading to 2.5.1 or 2.7 is not an option).
You can kill them if you want, but I would expect you to get this error
on 2.5.1 or 2.7, also. It's a function of perl, not the OS.
> Thanks,
> Bob Campbell Unix System Administrator
> Scientific Computing Division National Center for Atmospheric Research
> rsc@ucar.edu (303) 497-1815
HTH.
Cheers,
Dave
--
Dave Barnett Software Support Engineer (281) 596-1434
I don't mind going nowhere, as long as it's an interesting path.
------------------------------
Date: 5 Nov 1998 12:07:16 GMT
From: Steve Kilbane <Steve_Kilbane@cegelecproj.co.uk>
Subject: Re: IIS4, Perl, Object Moved
Message-Id: <71s4dk$ue5$1@news.cegelecproj.co.uk>
In article <3641716D.53FA3B71@scbbs.com>, Ron Parker <sysop@scbbs.com> writes:
I think you need to clarify what you're doing, and what the problem is.
> I wrote a Perl script running on a Unix server which does http socket
> calls (using cgi-lib.pl, http-lib.pl, and Socket.pm) to pages running on
> an IIS 4.0 server.
So the browser talks to the Unix web server, the Unix server invokes
your script, and the script does an HTTP request to the NT server, right?
> Whether on Netscape or IE browser, the server
> returns "Object Moved" error message, "This document may be found
> here". And, one must click on the link to the url (the same one which
> was sent in the original socket call).
Which server? Is your script just passing the IIS response back to the Unix
server verbatim, or processing it? On first read-through, I thought you
meant that your script was supposed to produce redirection responses.
So, is IIS returning redirections, or the Unix server?
I presume that you're asking for proper files, not missing off the
trailing "/" on requests to directories, etc. :-)
steve
--
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
IIS4+Perl5 FAQ: http://www.whitecrow.demon.co.uk/steve/iis4.html
------------------------------
Date: Thu, 05 Nov 1998 10:34:32 GMT
From: tore@forumnett.no (Tore Aursand)
Subject: Re: images in perl
Message-Id: <36417ec1.64984032@news.online.no>
On 2 Nov 1998 00:06:35 GMT, root@ejv108.rh.psu.edu (Operator) wrote:
>I have a perl cgi that outputs html, but when I put image html code (<img
>src="..."> I get server 500 error. Is there a special way to do this?
If you do something like this...
print("<IMG SRC="image.gif">\n");
...it won't work, 'cause you are using " inside a print, which
should be substituted with \" (escape sequence);
print("<IMG SRC=\"image.gif\">\n");
Hope this helps!
--
Tore Aursand
ForumNett Online AS
http://www.forumnett.no/
------------------------------
Date: Thu, 5 Nov 1998 12:14:10 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Internal Server Error
Message-Id: <36419692.C5A74195@technologist.com>
AL WILLEN wrote:
>
> As of last Friday, all the PERL programs I've written have generated an
> "Internal Server Error" message being thrown back at me when the script is
> evoked.
...SNIP...
>
> I received a cryptic message from a friend of a friend of a friend who says
> (and I quote): "Al has run into the age old dos carriage return problem
> .. he needs to fix_cr the perl files before they will run properly."
>
> Does anyone know what this means? (Does he mean use CHOMP?) More
> importantly, what other things could cause an Internal Server Error?
>
> Please e-mail me suggestions to: willen@prodigy.net
> Thanks in advance for your help!
> -- Al Willen
What the "friend of a ...." means is that you probably FTP'd the files
in binary mode and not ASCII mode.
When you are FTPing Perl programs, make sure that you use ASCII mode.
If you do not, you will most likely get a CONTROL-M inserted at the end
of every line of code. This is bad since the program then fails to run.
You didn't give us enough information to help you otherwise. Last
Friday did you switch servers or anything? Where were the programs
running before and do the ones that worked Thurs, work now???
Also, I only reply to the newsgroup. If you post it here, please expect
to read the responses here. I like to share my limited knowledge with
others...
HTH,
BRent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Thu, 5 Nov 1998 14:06:26 +0200
From: "William Krige" <9435697@mail.petech.ac.za>
Subject: libwww send var contents
Message-Id: <910289453.924034@ed.petech.ac.za>
Hi
I am trying to send the contents of variables to a perl scripts on another
server via HTTP POST but the variable neames are being sent and not the
contents of the variables. How can I fix this problem
This is my code:
#!/usr/bin/perl
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
$mes = "Hi Steve, seeing if this works with variables 14:00";
$num = "5761677";
$mail = "9435697\@mail.petech.ac.za";
my $req = new HTTP::Request POST =>
'http://www.petech.co.za/cgi-bin/simple.pl';
$req->content_type('application/x-www-form-urlencoded');
$req->content('llnum=$num&email=$mail&message=$mes');
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Pass request to the user agent and get a response back
# Check the outcome of the response
if ($res->is_success) {
print "SMS message sent\n;
} else {
print "Bad luck this time\n";
}
------------------------------
Date: 05 Nov 1998 13:40:19 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: libwww send var contents
Message-Id: <83sofy48jw.fsf@vcpc.univie.ac.at>
Re: libwww send var contents, William
<9435697@mail.petech.ac.za> said:
William> #!/usr/bin/perl
... -w
William> $mes = "Hi Steve, seeing if this works with
William> variables 14:00"; $num = "5761677"; $mail =
William> "9435697\@mail.petech.ac.za";
William> my $req = new HTTP::Request POST =>
William> 'http://www.petech.co.za/cgi-bin/simple.pl';
William> $req->content_type('application/x-www-form-urlencoded');
William> $req->content('llnum=$num&email=$mail&message=$mes');
'...' does not do variable interpolation. In this case,
what you've written is what you get.
You'll also need to encode at least the space characters in
your variable values.
The URI::URL module allows you to set up correctly encoded
parameters with the query_form method.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 05 Nov 1998 14:50:09 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Locale warning messages
Message-Id: <oeer9viqp6m.fsf@alpha.hut.fi>
bhilton@tsg.adc.com (Brand Hilton) writes:
> In article <71ql3h$n31$1@ultra.sonic.net>,
> Jeff Patterson <jpat@sonic.net> wrote:
> >Ever since I installed redhat 5.1 (linux) which updated perl, everytime I
> >run a perl script I get the annoying message
> >
> >perl: warning: Setting locale failed.
> >perl: warning: Please check that your locale settings:
> > LC_ALL = (unset),
> > LANG = "EN"
> > are supported and installed on your system.
> >perl: warning: Falling back to the standard locale ("C").
> >
> >my LANG="EN" and LC_ALL is unset.
> >
> >I neither want or care about locale. I just want perl to shut about it. Any
> >clues?
>
> If you neither want nor care about locale, then you shouldn't have
> your LANG variable set to "EN". You need to find out why it's getting
> set to "EN" and fix it.
You can also read all about it in perllocale. Well, at least 5.005_02
perllocale is very thorough. Quick tips:
(1) if you really don't want or care about locale please unset LANG.
(2) you can also set the environment variable PERL_BADLANG to 1,
then Perl will keep silent about the locale problem you have.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 05 Nov 1998 15:29:17 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
To: jpat@sonic.net,decoux@moulon.inra.fr
Subject: Re: Locale warning messages
Message-Id: <oeeogqmqndd.fsf@alpha.hut.fi>
Oops. I have just been informed that I can't read :-)
One must set PERL_BADLANG to 0 to get rid of the warning messages (not 1).
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: Thu, 05 Nov 1998 11:44:41 +0100
From: Stephen Riehm <sr@pc-plus.de>
Subject: magic increment problem
Message-Id: <36418198.41C6@pc-plus.de>
Hi JAPH's,
I was astounded to find the following "magic" in perl's magical
autoincrementation. Here are a few simple strings to be incremented:
$a = "123";
$b = "file1";
$c = "1file";
$d = "my1stfile";
now we try:
$a++; $b++; $c++; $d++;
and we get:
$a: "124"
$b: "file2"
$c: "2" <--- whoa there >:-|
$d: "1" <--- whoa there >:-|
what's the deal with $c and $d - shouldn't they be "1filf" and
"my1stfilf" respectively? Essentially if there are any embedded digits,
with the exception of the end of the string, the whole string is treated
as a number, and when the first character isn't a digit it's
treated as '0'.
This effect showed itself in every version of perl I could find,
is it intended to work this way? Should this be fixed?
Thanks in advance,
Steve
// __________________________ ._ o ________________________________
\\\\ Stephen Riehm / //\. Stephen.Riehm@pc-plus.de
//// pc-plus ' \>> | Phone: +49 89 45566 148
\\ 81675 Munich, Germany \\ ` Fax: +49 89 45566 113
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2
mQCNAjWaUeoAAAEEAMSI/hFLWlcAFVSwMHdHFiSbXP+IfbDzHg1IUSjlGseTsi5o
kxDRFjvpxJUpH8S4XHbVAkyAMyysNaBI/LxuCvS66WiMINzJTxeDMJCUnzGpLcQH
h/Co2ymaw0KnjHJtBvFAptntu8wgEM712cU0LSdoD25x1faWDDlT6pxFM0BlAAUR
tChTdGVwaGVuIFJpZWhtIDxTdGVwaGVuLlJpZWhtQHBjLXBsdXMuZGU+
=+MnD
-----END PGP PUBLIC KEY BLOCK-----
------------------------------
Date: 05 Nov 1998 15:03:27 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: magic increment problem
Message-Id: <m31zni9qz4.fsf@joshua.panix.com>
Stephen Riehm <sr@pc-plus.de> writes:
> what's the deal with $c and $d - shouldn't they be "1filf" and
> "my1stfilf" respectively?
Not according to the documentation:
If, however, the variable has been used in only string contexts
since it was set, and has a value that is not the empty string
and matches the pattern /^[a-zA-Z]*[0-9]*$/, the increment is
done as a string
$ perldoc perlop
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 5 Nov 1998 13:22:19 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: magic increment problem
Message-Id: <71s8qb$ebj$1@crchh14.us.nortel.com>
Stephen Riehm (sr@pc-plus.de) wrote:
> Hi JAPH's,
> I was astounded to find the following "magic" in perl's magical
> autoincrementation. Here are a few simple strings to be incremented:
> $a = "123";
> $b = "file1";
> $c = "1file";
> $d = "my1stfile";
> now we try:
> $a++; $b++; $c++; $d++;
> and we get:
> $a: "124"
> $b: "file2"
> $c: "2" <--- whoa there >:-|
> $d: "1" <--- whoa there >:-|
> what's the deal with $c and $d - shouldn't they be "1filf" and
> "my1stfilf" respectively? Essentially if there are any embedded digits,
> with the exception of the end of the string, the whole string is treated
> as a number, and when the first character isn't a digit it's
> treated as '0'.
> This effect showed itself in every version of perl I could find,
> is it intended to work this way? Should this be fixed?
from "perldoc perlop" $c and $d above do not match the pattern
specified below that invokes the autoincrment magic:
Auto-increment and Auto-decrement
"++" and "--" work as in C. That is, if placed before a variable, they
increment or decrement the variable before returning the value, and if
placed after, increment or decrement the variable after returning the value.
The auto-increment operator has a little extra builtin magic to it. If
you increment a variable that is numeric, or that has ever been used in
a numeric context, you get a normal increment. If, however, the
variable has been used in only string contexts since it was set, and
has a value that is not null and matches the pattern
C</^[a-zA-Z]*[0-9]*$/>, the increment is done as a string, preserving each
character within its range, with carry:
print ++($foo = '99'); # prints '100'
print ++($foo = 'a0'); # prints 'a1'
print ++($foo = 'Az'); # prints 'Ba'
print ++($foo = 'zz'); # prints 'aaa'
The auto-decrement operator is not magical.
Karlon
------------------------------
Date: Thu, 05 Nov 1998 10:42:16 GMT
From: tstyles@my-dejanews.com
Subject: Re: PC parallel to Solaris serial
Message-Id: <71rve7$mm8$1@nnrp1.dejanews.com>
Hi eric,
could you please answer this question, I just have to know: Why did you post
to comp.lang.c ?
In article <71r6go$re9$1@nnrp1.dejanews.com>,
eric.wai@bcs.org.uk wrote:
> Hi,
>
> I am trying to hook up the Parallel Port on a PC with the Serial Port on a
SUN
> running Solaris 2.5.1. When the PC sends a file to the printer/parallel
port,
> it will be captured by the SUN.
>
> Signal from the Parallel Port will go thru a Parallel-to-Serial converter and
> convert to serial signal before it is fed into the ttya of the SUN box. For
> example, if I do "echo hello world > lpt1". The text will get convert to
> serial signal and pump into the Serial port of the Solaris machine.
>
> Since it is the first step of my project, I have written a simple Perl
program
> on the SUN and try to capture the signal.
>
> #!/usr/local/bin/perl5 -w
> open(COM_PORT, "< /dev/ttya") || die "cannot read from /dev/ttya\n";
> while (! (eof COM_PORT)) {
> $char = getc COM_PORT;
> print "(",ord $char,")(",$char,")\n";
> }
> close COM_PORT;
> exit;
>
> As expected, "hello world" is captured by my program. However, the PC keeps
> sending the newline character (ascii 10) to the SUN. If I keep the set
> up/program running, my SUN will end up crashed with error message
> "output_echo_char: out of blocks" appears on the console.
>
> Can anyone tell me why the PC keeps sending out the newline character after
> "hello world", and how could I stop it.
>
> Thanks in advance.
>
> Eric.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
--
Tristan Styles
Failure is not an option
It is Standard Operating Procedure
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 05 Nov 1998 21:27:12 +1100
From: an000229@anon.fun.junk.ee (The Tinman)
Subject: Perl at Webjump - lonely perler!
Message-Id: <an000229-0511982127140001@203.34.59.104>
Hi Newsgroup!
sub Justification_for_posting {
Here's the thing: I've never used this group before. I know, I know I
should
have lurked for a while here before posting. But you see I know perl fairly
well. I have some great books and everything I've written before I've
been
able to de-bug. With any other language I'm programming in I sit down with a
friend who also knows the lang and puzzle it out together. I have no perl
friends.
}
sub the_problem {
I have a perl script that looks up a keyword in a file and returns and
relevant answers. Easy right? Thats what I thought. I've posted the script
below. It works in MacPerl but I cannot get it to work on Webjump's NT
system. If anyone has the time (and has maybe used Webjump) I would
appreciate someone's help in solving this mystery.
There's a heap of HTML cut for simplicity.
The online (supposedly) working version is referenced from:
http://jacks-stories.webjump.com
}
======================================================================
#!/usr/bin/perl
$data_file = "stories.dat";
$cgi_url = "http://jacks-stories.webjump.com/cgi-bin/stories.pl";
print "Content-type: text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}." ".$value; }
else { $INPUT{$name} = $value; }
}
$search = $INPUT{"text"};
open (STORIES,"$data_file") || die "can't open data file";
@stories = <STORIES>;
close (STORIES);
foreach $line (@stories) {
($cats,$story) = split(/\|/, $line);
if ($cats =~/$search/) {
push (@matches,$line);
}
}
print ("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 3.2//EN\">\n");
print ("<HTML>\n");
print ("<HEAD>\n");
print ("\n");
print ("<TITLE>Jack Measham's Funny Stories for Fine-tuned Sermons</TITLE>\n");
print ("</HEAD>\n");
print ("<BODY bgcolor=\"#FFE000\" background=\"bg.gif\">\n");
print ("<TABLE width=400>\n");
foreach $match (@matches) {
($cats,$story) = split(/\|/, $match);
chop ($story);
print ("<TR><TD colspan=2><B>This story filed under $cats</B></TD></TR>\n");
print ("<TR><TD width=50> </TD><TD>$story<P> </TD></TR>\n");
}
print ("</TABLE>\n");
print ("</BODY>\n");
print ("</HTML>\n");
------------------------------
Date: Thu, 5 Nov 1998 12:28:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Perl at Webjump - lonely perler!
Message-Id: <ebohlmanF1y7z4.MCn@netcom.com>
The Tinman <an000229@anon.fun.junk.ee> wrote:
: I have a perl script that looks up a keyword in a file and returns and
: relevant answers. Easy right? Thats what I thought. I've posted the script
: below. It works in MacPerl but I cannot get it to work on Webjump's NT
: system. If anyone has the time (and has maybe used Webjump) I would
: appreciate someone's help in solving this mystery.
: #!/usr/bin/perl
Something's missing at the end of this line. Can you guess what it is?
HINT: putting it in will make perl give you extra help. Of course, it's
the "-w" switch. *Always* use it when you're debugging code. Some would
say that you should still always use it after you've finished debugging.
: $data_file = "stories.dat";
: $cgi_url = "http://jacks-stories.webjump.com/cgi-bin/stories.pl";
: print "Content-type: text/html\n\n";
: read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
: @pairs = split(/&/, $buffer);
: foreach $pair (@pairs) {
: ($name, $value) = split(/=/, $pair);
: $value =~ tr/+/ /;
: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
: if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}." ".$value; }
: else { $INPUT{$name} = $value; }
: }
This piece of reinvent-the-wheel code isn't very robust. Why not use
CGI.pm and get the benefit of a robust, flexible and thoroughly-tested
parameter decoding routine?
: $search = $INPUT{"text"};
: open (STORIES,"$data_file") || die "can't open data file";
If you stick "$!" into your error message, perl will tell you exactly why
it couldn't open the file. That's a very nice thing to know, and it
might be exactly what you need to know in order to solve your problem.
: @stories = <STORIES>;
: close (STORIES);
: foreach $line (@stories) {
: ($cats,$story) = split(/\|/, $line);
: if ($cats =~/$search/) {
If the search string the user entered contains regular expression
metacharacters like "." this won't work the way you want it to. Unless
the user is actually supposed to be entering a regular expression, put a
"\Q" in front of "$search" to ensure that any metacharacters will be
interpreted literally.
: push (@matches,$line);
: }
: }
: print ("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 3.2//EN\">\n");
: print ("<HTML>\n");
: print ("<HEAD>\n");
: print ("\n");
: print ("<TITLE>Jack Measham's Funny Stories for Fine-tuned Sermons</TITLE>\n");
: print ("</HEAD>\n");
: print ("<BODY bgcolor=\"#FFE000\" background=\"bg.gif\">\n");
: print ("<TABLE width=400>\n");
All the above would be much better expressed as a here-document. Among
its advantages are not having to backwhack all your quote characters.
: foreach $match (@matches) {
: ($cats,$story) = split(/\|/, $match);
: chop ($story);
chomp() is usually a better alternative to chop().
: print ("<TR><TD colspan=2><B>This story filed under $cats</B></TD></TR>\n");
: print ("<TR><TD width=50> </TD><TD>$story<P> </TD></TR>\n");
: }
: print ("</TABLE>\n");
: print ("</BODY>\n");
: print ("</HTML>\n");
I suspect that your problem is that for some reason you can't open the
stories file. The result of your die() should be in your server logs
(another reason to use cgi.pm is that it provides methods for reporting
the error to the browser rather than sticking it in the logs), and should
be informative if you follow my advice about $!.
------------------------------
Date: Thu, 5 Nov 1998 12:30:14 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: PERL is TOO flexible
Message-Id: <36419A56.393B5294@technologist.com>
Jay Rogers wrote:
>
> Brent Michalski <perlguy@technologist.com> writes:
>
> > In article <3638676E.F980FC4A@harris.com>,
> > PERL ROCKS! <emills@harris.com> wrote:
> > > "Although the Perl Slogan is There's More Than One Way to Do It, I
> > > hesitate to make 10 ways to do something. :-) "
> > > --Larry Wall in <9695@jpl-devvax.JPL.NASA.GOV>
> > >
> > >is along these lines- why make more than ONE? What did it add, Larry?
> >
> > Wow, I *HAD* to comment on this "ONE" (pun intended)
> >
> > Why on earth would you want only ONE way to do something in a
> > language?!??!
>
> Maintainability.
>
> Unfortunately, because of Perl's expressive power, code that may seem
> elegant to an implementor, can look like serial line noise to you the
> maintainer. This is why one Unix luminary has called Perl a
> write-only language.
>
> We as programmers don't tend to think about maintainability, perhaps
> because it's boring and we'd prefer someone else did it. But it's not
> unusual for a project to require more effort for maintenance than was
> necessary for implementation.
>
> In what ways can we as Perl programmers make our code more
> maintainable? Always 'use strict' and follow 'man perlstyle'.
>
> --
> Jay Rogers
> jay@rgrs.com
Sorry, I don't buy your argument.
If you have only one way to do something, and you need to do something a
little different that the ONLY way, you are screwed.
By having a choice how you want to do something, you are free to develop
that are WAY more powerful, it can be used in ways never imagined by the
people who write the language.
For example, in my latest article I presented a quick and simple
applplication for getting hockey scores. I got several e-mail from
people saying that they had taken it a step further. One person
modified the script to get football scores and it now grabs the scores
every 10 minutes on Sundays and populates a SQL database that they use
for fantasy football.
Another person automatically sends score updates to their text pager!
If the script I wrote could ONLY be used for one thing, none of these
great enhancements would have been possible.
Just because there is more than one way to do something doesn't mean
that the programmers __have__ to make the code look cryptic.
You are definitely right about using 'strict'.
I just don't buy the maintainability argument. If you are proficient in
the language, you should be able to understand what the code is trying
to accomplish.
I'll take power over prettyness ANY day.
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Thu, 05 Nov 1998 08:01:09 -0500
From: Roberto Morales <robmoral@cisco.com>
Subject: perl NT network question
Message-Id: <3641A195.64AA6C85@cisco.com>
Hi all,
I am trying to get a Perl script running under the web server account to
connect to another server on our network. If I could map a drive to the
remote server while logged in under the web server account this would
work. The problem is that (for Dilbert-Manager reasons) the web server
account does not allow interactive logons, that is it is not allowed to
interact with the desktop, so I can't login with that account and map
the drive I need.
So the question is:
Is there any way to conduct "normal" network activities (like ODBC-based
bd access and reading directories) without mapping a drive?
Can I use UNCs or connect to a network resource on the fly supplying a
valid id and pwd?
I'd appreciate any responses pinged to robmoral@cisco.com as well as to
clpm!
TIA,
-berto
Roberto Morales
IS-RTP/Webmaster - Cisco Systems, Inc.
robmoral@cisco.com
919-472-3930(Phone) 919-472-3700(Fax)
7025 Kit Creek Road
PO Box 14987
Research Triangle Park, NC 27709
------------------------------
Date: Sun, 1 Nov 1998 00:32:54 +0100
From: "Marek Trabalka" <trabalka@decef.elf.stuba.sk>
Subject: Re: perl2exe
Message-Id: <363b9df7.0@206.58.152.195>
Perl2Exe is also part of a package Per Development Kit
Beta version of 1.1 is available for free at
http://www.activestate.com
Commitman wrote in message <70nk09$fk2$1@srv4-poa.nutecnet.com.br>...
>Where may I found something like perl2exe or perl2c ???
>
>
>
------------------------------
Date: Thu, 05 Nov 1998 13:16:26 GMT
From: tstmartin@granite.com
Subject: Re: perlcc and shared libraries
Message-Id: <71s8fa$1fu$1@nnrp1.dejanews.com>
I have a very similar (I think) problem - I have a Shared library in C, and a
wrapper in C I've built following the perlxstut, but cannot figure out how to
get perl to load the shared library at run time. The wrapper seems to be
loading but perl cant resolve references to the shared libarary routines.
Solaris 2.5; perl 5.004, gcc 2.7.2.2
I believe part or all of my answer may lie in ExtUtils::Liblist, but have not
been able to decipher it. Perhaps that is where your answer lies also?
Any help appreciated. The future of perl at this company is on the line !
Thanks,
Tom St.Martin
In article <3640BCFE.62CB82D8@mistral.co.uk>,
sehughes@mistral.co.uk wrote:
> Hi all,
>
> In the perldoc for perlcc, I see:
>
> %prompt perlcc A.pm # compile into 'A.so'
>
> and sure enough, I can generate .so's from .pm's. My question is, how
> can I later make use of these shared libraries ???
>
> TIA
>
> Stuart Hughes
>
> using 5.005_51 built for i586-linux
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 05 Nov 1998 10:52:40 +0000
From: Balazs Rauznitz <prauz@sprynet.com>
Subject: Re: pointer question
Message-Id: <36418378.5843EF9@sprynet.com>
Hi,
Raj Singh wrote:
>
> When I run the following code:
>
> $a = 2;
> $b = /$a;
> print $b;
>
> This is supposed to print the value of $a b/c $b is a reference to it.
> However, my compiler outputs the error:
>
> Spurious backslash ignored at ...
(I guess "$b = /$a" just a typo and you said "$b = \$a". Taking this
into account are you sure that you're using the code you posted here. I
think it neither will give you an error message (even with -w and use
strict) nor will do what you want. You want something like this ( if 2
should be printed )( in perl 5.04 )
print $$b;
The second $ sign dereferences 'b' and the first tells it to be a
string.
Hope this helped:
Balazs
Ps: The subject really should be "Reference question", but I tend to be
picky at 5AM.
------------------------------
Date: Thu, 05 Nov 1998 12:00:26 GMT
From: dave@mag-sol.com
Subject: Re: pointer question
Message-Id: <71s40q$rv8$1@nnrp1.dejanews.com>
In article <71roqr$25k$1@cscnews.csc.calpoly.edu>,
"Raj Singh" <rsingh@polymail.calpoly.edu> wrote:
> When I run the following code:
>
> $a = 2;
> $b = /$a;
> print $b;
>
> This is supposed to print the value of $a b/c $b is a reference to it.
> However, my compiler outputs the error:
>
> Spurious backslash ignored at ...
>
> I would greatly appreciate any suggestions. I am new to the language.
Go back and reread perlref, paying particular attention to the directopn of
the slash character.
$b = \$a;
Dave...
--
dave@mag-sol.com
London Perl M[ou]ngers: <http://london.pm.org/>
[Note Changed URL]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 05 Nov 1998 14:35:57 +0100
From: Ernst <e.christensen@netjob.dk>
To: Billsterz <bill@sterzenbach.com>
Subject: Re: post from perl to html
Message-Id: <3641A9BD.4E51@netjob.dk>
Billsterz wrote:
>
> Hi,
> New perl user here.
>
> Does anyone know how to pass a variable from a cgi script to a form?
>
> Assuming the perl script opens the form_file and wants to pass $passme to a
> field in the form called "passto"
> The end result would be when the user calls the cgi, it opens an already
> prepared htm file,displays it to the user with one field that already has a
> pre-determined value in it.
>
> Any help?
>
> Thanx,
> Bill
>
> bill@sterzenbach.com
Hi
You can use the perl variable in the form, like
print "<input type=text name='NAME' value=$perlvar>";
Ernst
------------------------------
Date: Thu, 05 Nov 1998 13:22:50 GMT
From: tstmartin@granite.com
Subject: Shared libraries - how to link & load
Message-Id: <71s8r9$1us$1@nnrp1.dejanews.com>
I have a Shared library in C, and a wrapper in C I've built following the
perlxstut, but cannot figure out how to get perl to load the shared library
at run time. The wrapper seems to be loading but perl cant resolve references
to the shared libarary routines.
Solaris 2.5; perl 5.004, gcc 2.7.2.2
I believe part or all of my answer may lie in ExtUtils::Liblist, but have not
been able to decipher it. I've read the ExtUtils::Liblist manpage several
times, but havent been able to figure out exactly how to call the ext()
routine with the correct args, or what to do with the result.
Any help appreciated. The future of perl at this company is on the line !
Thanks,
Tom St.Martin
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 5 Nov 1998 13:41:47 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: re: substitutions
Message-Id: <71s323$i86$1@cnn.cc.biu.ac.il>
>I'm reading from a file that looks like this:
>
>data1
>data2
>data1
>data3
>data2
>
>Then I use this command to get rid of the all data2's
>@array =~ s/data2//;
>
>The array is left with a newline at the very end. If I can delete each
>newline before each data 2 then it should fix the problem. I thought
that
>@array =~ /s\ndata2//; would work but it didn't.
>I'm able to read the array again after I remove data2 and chomp it to
make
>it work, but I'm reading and writing from a file and it's just too
messy.
>
>Any ideas on an easier way to do this? Thanks for you help!
>
that wonderful lookahead!
@arr=("data2\n","a\n","data2\n","c\n","d\n","data2\n","f\n","data2\n","d
ata2
\n","h\n");
$arr=join("",@arr);
$arr =~ s/\ndata2(?=\n)|data2\n|\ndata2$//g;
@arr=split(/(?=\n)/,$arr);
notice that the substitution works because of the order in which Perl
processes alternations.
(this is important when alternations are not disjoint)
Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4156
**************************************