[7625] in Perl-Users-Digest
Perl-Users Digest, Issue: 1251 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 30 18:14:51 1997
Date: Thu, 30 Oct 97 15:00:42 -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, 30 Oct 1997 Volume: 8 Number: 1251
Today's topics:
"die" function won't print in CGI!?!! <mani@geoplex.com>
Re: "die" function won't print in CGI!?!! <vandevegt@lucent.com>
Re: $1000/wk Donating Sperm (Nigel Reed)
Re: Adding names to a list :-( <raven@lp-llc.com>
Re: Adding names to a list :-( <raven@lp-llc.com>
Re: ANNOUNCE: IndexMaker 2.0: an index.html maker from (Jason Gloudon)
Re: CGI script results to email? (Faust Gertz)
Copying to the clip board <lach@lach.net>
Re: Debugger eats $! (Ilya Zakharevich)
File globbing 5.004.01/2 on Win32 (Chris Searle)
Re: File Locking <VikR@aol.com>
Re: Help want to create a Perl script executable for Wi (Faust Gertz)
Re: How best to do local Perl library? (Faust Gertz)
Re: How do I do multiple require's in different package (Honza Pazdziora)
Re: if (0<= $hun < 250) doesn't compile (Juergen Heinzl)
Re: if (0<= $hun < 250) doesn't compile (Honza Pazdziora)
Re: if (0<= $hun < 250) doesn't compile <dagon@halcyon.com>
Re: if (0<= $hun < 250) doesn't compile (Matthew Cravit)
Re: if (0<= $hun < 250) doesn't compile <cmargoli@world.northgrum.com>
Re: if (0<= $hun < 250) doesn't compile <gennari@slac.stanford.edu>
Re: Interesting PERL command - need help (Jason Gloudon)
Perl "Here" document and formatting tabs <prl2@lehigh.edu>
Re: Perl failing tests on AIX (Richard Svatos)
Perl Script to tell if browser supports 128-bit encrypt <eturner@ids.net>
Re: perl5/nt4.0/iis (Parillo)
Redirector <dolezal@mailhost.mrms.navy.mil>
s/$x/$y/eg; problem <dhoffman@fzi.de>
Re: WinNT Excel Help! dsstevensAT@ingrDOT.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Oct 1997 13:44:39 -0800
From: Mani Prasad Kancherla <mani@geoplex.com>
Subject: "die" function won't print in CGI!?!!
Message-Id: <3458FFC6.81A77413@geoplex.com>
Hi All!
Please take a look at the following code:
--------------------------------------------------------------------------------------
#!/usr/bin/perl -w
use CGI(":standard");
$err_str = start_html("Error").h1("Error:")."Can't find form:
$!".end_html;
print header;
die $err_str unless (param("form") eq "trouble_report");
start_html("blah blah"); print "Some stuff"; end_html;
--------------------------------------------------------------------------------------
When the value of "form" is "trouble_report" everything is fine.
Otherwise,
Netscape complains "Document has no data". But when I try this program
from
the command line I get what is expected in both cases (i.e. when "form"
=
"trouble_report" or even otherwise).
Is there something wrong with what I'm doing?
Thanks in advance,
mani
------------------------------
Date: Thu, 30 Oct 1997 16:23:42 -0600
From: "James M. VandeVegt" <vandevegt@lucent.com>
Subject: Re: "die" function won't print in CGI!?!!
Message-Id: <345908EE.41FE75F1@lucent.com>
Mani Prasad Kancherla wrote:
> Hi All!
>
> Please take a look at the following code:
> ---------------------------------------------
> ----------------------------------------
>
> #!/usr/bin/perl -w
> use CGI(":standard");
>
> $err_str = start_html("Error").h1("Error:")."Can't find form:
> $!".end_html;
>
> print header;
> die $err_str unless (param("form") eq "trouble_report");
> start_html("blah blah"); print "Some stuff"; end_html;
> ------------------------------------------------------
> -------------------------------
>
> Is there something wrong with what I'm doing?
die sends output to STDERR. In CGI, STDERR will be routed to your HTTPD
server's error file. STDOUT is piped to the client.
I find it very useful to have a window doing 'tail -f errorlog' while
CGI coding/testing.
------------------------------
Date: 30 Oct 1997 20:50:27 GMT
From: nigelr@convex.hp.com (Nigel Reed)
Subject: Re: $1000/wk Donating Sperm
Message-Id: <63aruj$kad$1@news.rsn.hp.com>
I donate sperm to my wife on a regular bases, but she never pays
me though...and it never did improve my perl programming.
B1FF (BITNET@QZ.LITTLE-NECK.NY.US) wrote:
> In article <291097170021@louis.com>, <chico@louis.com> wrote:
> > visit http://281.252.551.602/index.html for more detailed information on how you can partake in the sperm donor program.
> >
> >
> WOW. ID LOVE 2 B A SPURM DONOR! THEN PURL COULD PROCESZ MY DNA
> 4 THE D00D GENUM PROJECT, THAT WOULD B C00L!!1!
> ==========>>>>> B!FF!!!!!!!!!!!!!!!!!!!!!!!!<<<<<<<============
> ======
------------------------------
Date: Thu, 30 Oct 1997 14:45:29 -0800
From: Matt McLaughlin <raven@lp-llc.com>
Subject: Re: Adding names to a list :-(
Message-Id: <34590E08.5BDD58CE@lp-llc.com>
Thanks. I figured it out.
The problem was I was trying to add email addresses. My script was
reading the @ as an array.
Man, Stupid Mistake on my part.
fixed it!
Thanks again.
Dave Schenet wrote:
> You could try looking through your webserver's error log, since
> most servers will log STDERR from cgi scripts there.
>
> I don't think it'll matter, but you don't need to escape the /
> in your print statements, either.
>
> (more comments in code below)
>
> : At one time this script was almost a full blown program - God (or
> : Larry), it was a masterpiece! Now it's down to a pretty simple
> script
> : about 15 lines of code that don't work.
>
> : #!/usr/bin/perl
>
> : $LIST="/usr/local/lib/httpd/cgi-bin/raven/ooops/list";
>
> : read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> : @pairs = split(/&/, $buffer);
> : foreach $pair (@pairs) {
> : ($name, $value) = split(/=/, $pair);
> : $FORM{$name}=$value;
> : }
>
> : # STOLEN FROM Matt Wright
> : if ($FORM{'you'} =~ /.*\@.*\..*/) {
> : $you = "$FORM{'you'}";
>
> : open (LIST, ">>$LIST")|| print "Content-type: text\/html\n\n can't
> open
> : list to append";
> : print LIST "$you";
> : close(LIST);
>
> How about:
>
> Above everything else in the code:
> print "Content-type: text/html\n\n";
>
> You only need to do it once, and it looks like you'll providfe html
> output in every situation.
>
> if (open(LIST, ">>$LIST")) {
> print LIST "$you";
> close (LIST);
> } else { print "can't open $LIST to append"; }
>
> [snip rest]
>
> Hmm, could it be possible that perl is dying on the "print LIST"
> statement if it couldn't append to the file?
>
> Also, you might wanna turn off buffering on STDOUT. $|=1; does the
> trick.
>
> --
> +-
> --------------------------------+-----------------------------------+
> |Dave Schenet <shodan at erols com>| Erols Internet Services, INC.
> |
> |Junior UNIX Developer | Springfield, VA.
> |
> +
> ---------------------------------+-----------------------------------+
>
> | Can't reply by mail? I'm blocking 67 netblocks from sending me mail.
> |
> | I have zero-tolerance for SPAM. One strike and I stop listening. . .
> |
> +
> ---------------------------------------------------------------------+
------------------------------
Date: Thu, 30 Oct 1997 14:47:03 -0800
From: Matt McLaughlin <raven@lp-llc.com>
Subject: Re: Adding names to a list :-(
Message-Id: <34590E66.1BF4D427@lp-llc.com>
Thanks. I'll use that. I always have plenty of bugs!
Robert Hughes wrote:
> Another trick I find very useful for debugging is the snipet below,
> especially if you do not have access to the web server logs.
>
> Placed at the very top of the script you get compile errors output to
> the web
> browser since the proper headers are always output.
>
> BEGIN {
> $|=1;
> print "Content-type: text/plain\n\n";
> }
>
> Dave Schenet wrote:
>
> > You could try looking through your webserver's error log, since
> > most servers will log STDERR from cgi scripts there.
> >
>
> [snip]
------------------------------
Date: 30 Oct 1997 21:40:48 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: ANNOUNCE: IndexMaker 2.0: an index.html maker from PDF, HTML and other files
Message-Id: <63aut0$qae$1@daily.bbnplanet.com>
Dennis M. Parrott (dparrott@ford.com) wrote:
: Jason Gloudon wrote:
: >
: Personally, I wish people who wrote tools to process PDF files
: would *always* post here as I have a very short list of NGs
: I follow with any regularity.
: --
This might be an issue for the moderator of comp.lang.perl.announce.
If everyone simply posted their announcements here then perhaps
comp.lang.perl.announce is unneccesary ?
Of course one might wonder why it was created to begin with ?
BTW : these are the groups that the message was posted to.
Newsgroups: comp.text.pdf,comp.lang.postscript,comp.lang.perl.misc,
comp.infosystems.www.authoring.misc
announce is not one of them.
Jason Gloudon
------------------------------
Date: Thu, 30 Oct 1997 20:22:33 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: CGI script results to email?
Message-Id: <345fe776.1982682@news.wwa.com>
On 30 Oct 97 09:43:10 GMT, neil@pacifier.com (Neil Anuskiewicz) wrote:
>I am new to perl right now, so this may seem like a very simple issue.
I suggest learning perl before trying to use perl to do CGI scripting.
If you haven't already, I suggest you purchase _Learning Perl_ by
Randal Schwartz and Tom Christiansen. There is plenty of information
in the *last* chapter of the book on the CGI.pm module. If you are
looking for a less unix-centric and more cross-platform book, you can
try Eric Johnson's _Cross-Platform Perl_, which also has a *later*
chapter on the CGI.pm module. If you have the money, perhaps you
should get both. :-) I did.
>I need to write a cgi script that creates a form on our web site that
>someone can fill out, submit, and then the results sent in an email. The
>email goes to several people so it must retain an easily readable
>format:
>
>question?
>
>answer...
Besides looking at the FAQ (http://language.perl.com/faq/index.html),
you might want to look at _CGI Programming Techniques in Perl_
(http://www.eff.org/%7Eerict/Scripts/Book/Mis/appendix_a.html), Nick
Kew's 'CGI Programming FAQ'
(http://www.webthing.com/page.cgi/cgifaq), and 'CGI.pm - a Perl5 CGI
Library'
(http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html).
other CPAN modules which have already done the work for you
(http://www.perl.com/CPAN-local/CPAN.html), and Randal Schwartz's _Web
Techniques_ (http://www.stonehenge.com/merlyn/WebTechniques/) and
_Unix Review_ (http://www.stonehenge.com/merlyn/UnixReview/) articles.
>Easy to read question/answer format. At any rate, does anyone have some
>guidance on how to accomplish this task or point me in the right
>direction?
You already have *a lot* to read. :-) But, if you would like to see
a pretty secure script which uses Lincoln Stein's CGI modules and does
something similar to what you desire, look at Robert Seymour's
simple, safe, and generic CGI back end mail script named
'rjsemail.cgi' at
ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/scripts/infoserv/WWW/rjsemail.cgi
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"You cannot solve the problem with the same kind of thinking that has
created the problem." - Albert Einstein
------------------------------
Date: Thu, 30 Oct 1997 16:40:35 -0600
From: Lachlan Dunlop <lach@lach.net>
Subject: Copying to the clip board
Message-Id: <34590CE3.E86511B7@lach.net>
Hello Group,
I am using perl & CGI. My goal is to have a link on a form, so that
when you "click" the link. It first copies the link text, or value into
the clipboard, then goes to the desired link, where it can be pasted in.
I am trying to get away from:
copy the text
clink the link
paste the text
Thanks
Lach
------------------------------
Date: 30 Oct 1997 22:09:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger eats $!
Message-Id: <63b0jc$k4h$1@agate.berkeley.edu>
In article <63aneo$isk@fiinix.metronet.com>,
Tye McQueen <tyde@medtrodnet.cdom> wrote:
> Why does the command:
>
> DB<1> warn "Simple warning!\n"
>
> produce the over-kill output of:
>
> Simple warning!
> eval '($@, $!, $,, $/, $\\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
> warn "Simple warning!\\n";
>
> ;' called at /usr/local/lib/perl5.004/lib/perl5db.pl line 1153
> DB::eval called at /usr/local/lib/perl5.004/lib/perl5db.pl line 1062
> DB::DB called at -e line 1
>
> Are there cases where this is actually desirable? (This is Perl5.004_01
> under HP/UX and Windows NT, at least.) I realize it is desirable for
> debugging modules, but can we avoid this in the debugger's eval code?
Feel free to read the fine docs.
>
> I think this goes to the problem I wasted some time debugging.
> The debugger eats the value of $!. My XS-base module goes to the
> trouble of setting $! to sensible values. It is very handy to
> go along in the debugger using my routines like so:
>
> DB<7> p RegOpenKey(HKEY_LOCAL_MACHINE,"SomeDumbKey",$hKey)
> 0
> DB<8> p "Reason for failure is NOT: $!."
> Reason for failure is NOT:
> DB<9>
>
> without having to resort to:
>
> DB<9> RegOpenKey(HKEY_LOCAL_MACHINE,"SomeDumbKey",$hKey) or print "$!\n"
> The system cannot find the file specified
>
> just so I know why the call failed.
>
> Having `warn' output less cluttered is not important to me
> compared to having $! preserved across debugger input lines.
Debugger's command lines are evaluated in separate environments, so
that they do not pollute the control flow of the debugged script.
Now, when you read the docs and know about the system of `O'ptions,
feel free to implement an option to switch this off. I think the
function to look into is DB::save or somesuch.
Ilya
------------------------------
Date: Thu, 30 Oct 1997 21:35:03 GMT
From: chris_ns@searle1.demon.co.uk (Chris Searle)
Subject: File globbing 5.004.01/2 on Win32
Message-Id: <3458fc25.5258361@news.demon.co.uk>
I have a slight problem that I haven't seen in the FAQ (probably
shortsighted). I have tried both building the source using MS VC++ 5
and also using the binaries from:
CPAN/ports/win32/Standard/x86/perl5.00402-bindist04-bc.tar.gz
with the same results.
test.pl contains
while (<>) {
print;
}
Simple enough.
perl test.pl filename.ext
cats filename.ext to STDOUT, no surprises.
However, if I use anything that requires globbing by the shell, then I
get e.g.
perl test.pl *.bat
Can't open *.bat: No such file or directory
Perlglob *.bat correctly listed the BAT files in the DIR.
Perl is in C:\perl and no LIBPATH or LIB5PATH are set. PATH does
include c:\perl\bin.
Used to work fine with NTPerl 5.001 :(
Any ideas, or even the correct FAQ pointer?
Thanks again.
perl -V gives:
Summary of my perl5 (5.0 patchlevel 4 subversion 02) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32
uname=''
hint=recommended, useposix=true, d_sigaction=undef
bincompat3=undef useperlio=undef d_sfio=undef
Compiler:
cc='cl', optimize='-O', gccversion=
cppflags='-DWIN32'
ccflags ='-MD -DWIN32'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=n, randbits=15
Linker and Libraries:
ld='link', ldflags ='-nologo -subsystem:windows'
libpth=e:\progra~1\devstu~1\vc\lib
libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.li
b advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock32.
lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
libc=msvcrt.lib, so=dll
useshrplib=undef, libperl=undef
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags='', lddlflags='-dll'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under MSWin32
Compiled at Aug 9 1997 21:42:37
@INC:
C:\perl\lib\site
C:\perl\lib
c:\perl\lib
c:\perl\lib\site
c:\perl\lib\site
.
for the binaries and for the source build:
Summary of my perl5 (5.0 patchlevel 4 subversion 01) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32
uname=''
hint=recommended, useposix=true, d_sigaction=
bincompat3= useperlio= d_sfio=
Compiler:
cc='cl.exe', optimize='-O', gccversion=
cppflags='-DWIN32'
ccflags ='-MD -DWIN32'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=n, randbits=15
Linker and Libraries:
ld='link', ldflags ='-nologo -subsystem:windows'
libpth=e:\Program Files\DevStudio\VC\lib
libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.l
ib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock3
2.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
libc=msvcrt.lib, so=dll
useshrplib=, libperl=
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=, ccdlflags=' '
cccdlflags='', lddlflags='-dll'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under MSWin32
Compiled at Oct 28 1997 18:43:23
@INC:
C:\oldperl\lib
c:\perl\lib
c:\perl\lib\site
c:\perl\lib\site
.
------------------------------
Date: Thu, 30 Oct 1997 14:22:46 -0800
From: Vik Rubenfeld <VikR@aol.com>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: File Locking
Message-Id: <345908B4.A1342BA3@aol.com>
I'm revising my code - flock makes things very easy to do.
Question - what happens if...
- I open a file for appending, e.g.
open(OUTPUT,">>$FileName")
- Call Flock on the file
- My flock is blocked because the file is already flocked by somebody else
- Somebody else appends to the end of the file
- I get access to the file and write to it
... will I be correctly appending to the end of the file?
Thanks in advance.
- Vik
------------------------------
Date: Thu, 30 Oct 1997 20:47:45 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Help want to create a Perl script executable for Win95
Message-Id: <345af14b.2107911@news.wwa.com>
On Thu, 30 Oct 1997 12:00:13 -0500, hobo@alumni.stanford.org (Licensed
User) wrote:
>Can anyone help me create a perl script executable for win95... I've seen
>Malcolm Beattie's directory on www.perl.com but I didn't see anything
>regarding a Windows solution.... Is there anyone out there who can help
>me... or direct me to a link that can help me?
>
>thanks
>Stan
The Mercury Systems web site (Mercury Systems web site) claims to have
some shareware called 'Perl2Exe'.
:Perl2Exe is a command line program for converting perl scripts to exe files.
:This allows you to create stand alone programs in perl that do not require
:the perl interpreter. You can ship the exe file without having to ship your
:perl source code.
:
:Usage:
:"perl2exe myscript"
:
:This will convert myscript.pl to myscript.exe
:
:Requires Windows 95 or NT.
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: Thu, 30 Oct 1997 21:00:57 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: How best to do local Perl library?
Message-Id: <345bf2d9.2506337@news.wwa.com>
On Thu, 30 Oct 1997 11:04:05 -0600, Greg Sinclair
<g_sinclair@fujitsu-fnc.com> wrote:
>I have a need to install a few perl modules and have run into a problem.
>My sysadmin won't give me permission to install them in the global
>perl library where all the existing modules are installed.
Get a new system administrator. :-) Did you try asking the system
administrator to install the module for you?
>How can I create a local perl library in my home space
>(/home/user/..???)
>that I can easily acces with just one '-I' option?
>
>I currently have DateCalc install in the following location:
> /home/user/perl/lib/DateCalc.
>
>To reference in a script I have to do:
> /perl -I/home/user/perl/lib/DateCalc-3.0/blib/arch
> -I/home/user/perl/lib/DateCalc-3.0/blib/lib
>
>This does not seem right to be. It seems like an awful lot of '-I's
>if there are many modules install.
>
>Can anybody help a library/module newbie?
The FAQ
(ftp://ftp.digital.com/pub/plan/perl/CPAN/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_kep_my_own_module_libr)
can!
:How do I keep my own module/library directory?
:
:When you build modules, use the PREFIX option when generating Makefiles:
:
: perl Makefile.PL PREFIX=/u/mydir/perl
:
:then either set the PERL5LIB environment variable before you run scripts that use the modules/libraries (see the perlrun manpage)
:or say
:
: use lib '/u/mydir/perl';
:
:See Perl's the lib manpage for more information.
Often the module's README also gives hints as to how to install the
module locally.
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: Thu, 30 Oct 1997 20:39:40 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How do I do multiple require's in different packages
Message-Id: <adelton.878243980@aisa.fi.muni.cz>
Chris Sherman <sherman@unx.sas.com> writes:
> I have a file full of constants I want my all my different packages
> to see.
>
> The problem is that if I do a
> require constants;
> in the main package, I can't do another "require constants;" anywhere
> else. (Require only let's you load a file once).
[...]
> In package foo, it didn't see the constants.
>
> Any ideas???
Use use. It's not a typo ;-) According to perlfunc it's equivalent to
BEGIN { require Module; import Module LIST; }
and even if the require will only take place once (because of %INC),
the import will occure in all you packages. Also, it's compile time
thing, so it should be faster.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 30 Oct 1997 20:42:08 GMT
From: juergen@unicorn.noris.de (Juergen Heinzl)
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <slrn65hsj8.4b.juergen@unicorn.noris.de>
In article <3458E336.167E@slac.stanford.edu>, l. trindle gennari wrote:
>Hi gang-
>
>I have a section of a script that's giving me the blues. Here 'tis:
>
>if (0 <= $hun < 250) {
step 1.) if (0 <= $hun && $hun < 250) {
}
step 2.) visit you local bookstore.
Sorry, Juergen
--
\ Real name : Juergen Heinzl \ no flames /
\ EMail Private : unicorn@noris.de \ send money instead /
\ Phone Private : +49 0911-4501186 \ /
------------------------------
Date: Thu, 30 Oct 1997 20:36:53 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <adelton.878243813@aisa.fi.muni.cz>
"l. trindle gennari" <gennari@slac.stanford.edu> writes:
> Hi gang-
>
> I have a section of a script that's giving me the blues. Here 'tis:
>
> if (0 <= $hun < 250) {
> $division = $thou."000";
> }
> elsif (250 <= $hun < 500) {
> $division = $thou."250";
> }
> elsif (500 <= $hun < 750) {
> $division = $thou."500";
> }
> else {
> $hun = $thou."750";
> }
>
> It doesn't seem to like my <=. Any clue why this doesn't work?
;-) Does it say anything about its dislike?
Anyway, I get
if (0 <= $hun < 250) {
syntax error at - line 1, near "$hun <"
so it's not <= but < that causes the unhappiness. You might consider
rewriting the script along with the template
if (0 <= $hun and $hun < 250) {
Hope this helps,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 30 Oct 1997 12:37:52 -0800
From: Mark Rafn <dagon@halcyon.com>
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <63ar70$f86$1@halcyon.com>
[posted and CC'd]
"l. trindle gennari" <gennari@slac.stanford.edu> writes:
>if (0 <= $hun < 250) {
> $division = $thou."000";
> }
>It doesn't seem to like my <=. Any clue why this doesn't work?
Yup. It likes <= just fine, but it doesn't know what to do with the
extra < after the expression 0 <= $hun. Be thankful perl is kind enough
to give you an error - C accepts this syntax, but does something you
probably don't expect [hint: it's equivalent to ((0 <= $hun) < 250)].
Actually, I don't know of _any_ programming language that handles trinary
comparison like this.
What you mean to say is:
if (0 <= $hun and $hun < 250) {
...
Good luck!
--
Mark Rafn dagon@halcyon.com <http://www.halcyon.com/dagon/> !G
------------------------------
Date: 30 Oct 1997 12:59:23 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <63asfb$cdc$1@shell3.ba.best.com>
In article <3458E336.167E@slac.stanford.edu>,
l. trindle gennari <gennari@slac.stanford.edu> wrote:
>Hi gang-
>
>I have a section of a script that's giving me the blues. Here 'tis:
>
>if (0 <= $hun < 250) {
> $division = $thou."000";
> }
[Snip]
You cannot use more than one comparison operator in this fashion.
The proper way to do this is with code like:
if ((0 <= $hun) and ($hun < 250) {
$division = $thou."000";
}
...
Or, you could always define your own subroutine like this:
sub range ($$$) {
($_[0] <= $_[1]) and ($_[1] < $_[2]);
}
if (range 0, $hun, 250) {
$division = $thou."000";
}
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Thu, 30 Oct 1997 20:56:03 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <3458F463.4373@world.northgrum.com>
l. trindle gennari wrote:
> I have a section of a script that's giving me the blues. Here 'tis:
>
> if (0 <= $hun < 250) {
> $division = $thou."000";
> }
> elsif (250 <= $hun < 500) {
> $division = $thou."250";
> }
> elsif (500 <= $hun < 750) {
> $division = $thou."500";
> }
> else {
> $hun = $thou."750";
> }
>
> It doesn't seem to like my <=. Any clue why this doesn't work?
Using <= is okay, but you can't do two comparisons like that.
You can do multiple comparisons in one expression if you
use 'and' or 'or':
if (0 <= $hun and $hun < 250)
--
Charles G. Margolin DSSD Internal Information Services
cmargoli@world.northgrum.com Northrop Grumman Corp. 0624/23
margolin@acm.org Hawthorne, California 90250-3277
------------------------------
Date: Thu, 30 Oct 1997 14:20:07 -0800
From: "l. trindle gennari" <gennari@slac.stanford.edu>
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <34590817.2781@slac.stanford.edu>
Thanx everyone for your answers! There are no more Perl books left for
me to buy, and I couldn't find this particular case in any of them.
Guess the pieces are all there, but without experience, ya just don't
know to combine them.
What it finally took was
if ((0 <= $hun) && ($hun < 250)) {
}
ltg
Juergen Heinzl wrote:
>
> In article <3458E336.167E@slac.stanford.edu>, l. trindle gennari wrote:
> >Hi gang-
> >
> >I have a section of a script that's giving me the blues. Here 'tis:
> >
> >if (0 <= $hun < 250) {
>
> step 1.) if (0 <= $hun && $hun < 250) {
> }
>
> step 2.) visit you local bookstore.
>
> Sorry, Juergen
>
> --
> \ Real name : Juergen Heinzl \ no flames /
> \ EMail Private : unicorn@noris.de \ send money instead /
> \ Phone Private : +49 0911-4501186 \ /
------------------------------
Date: 30 Oct 1997 21:53:01 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Interesting PERL command - need help
Message-Id: <63avjt$qae$2@daily.bbnplanet.com>
Russ Allbery (rra@stanford.edu) wrote:
: Jason Gloudon <jgloudon@bbn.remove.com> writes:
: > and to check whether or not the child process is actually created by
: > adding this as well:
: > local $SIG{PIPE} = sub { die "spooler pipe broke" };
: Be aware that currently Perl has problems with its signal handling and
: this could well cause a core dump depending on how things collided with
: each other and where in the code stream the signal came.
: About the only safe thing to do with signals right now, unfortunately, is
: to ignore them. This is a high priority to be fixed in future versions of
: Perl.
Hrmm. Sounds like we may need some warnings in the manpage in the interim ?
Future Versions of 5.004_xx ?
Jason Gloudon
------------------------------
Date: 30 Oct 1997 21:58:37 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Perl "Here" document and formatting tabs
Message-Id: <01bce57e$f9c1d100$3e03b480@mm.CC.lehigh.EDU>
I am using the Perl "Here" document to jump into sqlpus for Oracle and do a
quick "blah:"
system <<"!";
sqlplus $uname/$upass
blah;
blah;
exit
!
However, I want to format this with tabs, as it it part of a sub. Like
this:
system <<"!";
sqlplus $uname/$upass
blah;
blah;
exit
!
Of course Perl chokes on the tab in front of the terminating string at the
end of the "Here" document and doesn't know where to end it. In Korn Shell
a '-' before the declared terminting string would allow the tab, like this:
system <<-!
sqlplus $uname/$upass
blah;
blah;
exit
!
Suggestions?
PS, where could I include the "bit bucket" in the perl "Here" document to
discard any errors generated by sqlplus?
------------------------------
Date: 30 Oct 1997 20:39:22 GMT
From: svatosr@iastate.edu (Richard Svatos)
Subject: Re: Perl failing tests on AIX
Message-Id: <63ar9q$qf6$1@news.iastate.edu>
I've tried installing Perl v5.004.03 and v5.004.01 on AIX 4.1.5.0
and I can't get past `make test`. Most of the tests are successful,
but 22 of them fail, almost always because of "Memory fault(coredump)".
[I also tried to install Perl v5.004.04 but couldn't un-tar it.]
I'm using gcc v2.7.2.3.
Any ideas what could be causing these problems?
Thanks!
Richard Svatos
svatosr@iastate.edu
P.S. Here is the complete list of errors that I posted last week:
>Too late for "-T" option at pragma/locale.t line 1.
> pragma/locale.t
> lib/io_taint.t
>
>Memory fault(coredump)
> lib/anydbm.t
> lib/filecopy.t (1..11 ok 1 ok 2 ok 3 ok 4 ok 5)
> lib/filehand.t
> lib/io_dup.t
> lib/io_pipe.t
> lib/io_sock.t
> lib/io_tell.t
> lib/io_udp.t
> lib/io_xs.t
> lib/ndbm.t
> lib/odbm.t
> lib/opcode.t
> lib/open2.t
> lib/open3.t
> lib/ops.t (1..2)
> lib/posix.t
> lib/safe1.t
> lib/safe2.t
> lib/sdbm.t
> lib/socket.t
--
Richard Svatos
svatosr@iastate.edu
------------------------------
Date: Thu, 30 Oct 1997 14:54:00 -0500
From: "Edwin A. Turner" <eturner@ids.net>
Subject: Perl Script to tell if browser supports 128-bit encryption
Message-Id: <3458E5D8.5750@ids.net>
I'm looking for a way to tell if someone has a perl script that can
detect wether or not a users' browser supports 128-bit encryption. I
know how to tell what broswer they are using via the http_agent
environment variable but don't know all the types that support 128-bit
encryption. Any help is greatly appreciated.
Thanks
------------------------------
Date: 30 Oct 1997 21:53:25 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: perl5/nt4.0/iis
Message-Id: <63avkl$pp7$1@news01.li.net>
Have you followed the instructions at:
http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html
especially answer 6.3.
Also, be sure to follow his link to:
http://www.microsoft.com/kb/articles/q150/6/29.htm
HTH
lparillo at suffolk dot lib dot ny dot us
Tim Hartzog (thartzog@nfinity.com) wrote:
: Hi all,
: I just tried to get Perl5 installed on an NT4.0 server running IIS 2.0 and
: can't seem to get it to work with a browser. I have configured NT to run perl
: with the .pl extension. What the heck am I missing? I got it to work on a 95
: machine running personal web server.
: Thanks in advance for any help.
: Tim
------------------------------
Date: Thu, 30 Oct 1997 20:57:19 GMT
From: Tim Dolezal <dolezal@mailhost.mrms.navy.mil>
Subject: Redirector
Message-Id: <3458F4AD.82A879EC@mailhost.mrms.navy.mil>
I am running a web proxy server called squid. When my users are NOT
using the proxy they can access web pages by typing say "novell". When
on the proxy "novell" returns an error page from the proxy that the
browser thinks is the page that was asked for.
The other groups I have queried this with have stated that I need a
redirector. I believe this can be accomplished with perl.
Can this be done? How is it invoked?
Tim Dolezal
Systems Analysist
dolezal@mailhost.mrms.navy.mil
Digital Systems Research
Phone (619)556-1760
Fax (619)556-5183
------------------------------
Date: Thu, 30 Oct 1997 23:16:43 +0100
From: Dirk Hoffmann <dhoffman@fzi.de>
Subject: s/$x/$y/eg; problem
Message-Id: <3459074B.1B4EF37@fzi.de>
Hi!
what I do:
prompt{user}: myperlscript '^sub (.*) \{' 'SUBROUTINE $1 ['
what I get:
SUBROUTINE $1 [
what I wanna get:
SUBROUTINE testname [
my perl script:
#!/tools/local/bin/perl
$x = $ARGV[0];
$y = $ARGV[1];
$z = "sub testname {";
$z =~ s/$x/$y/eg;
print "$z\n";
anyone can help me ?
In my case $x and $y MUST be command arguments !!!
Hoffi
----------------------+ _\\|//_
+--------------------------------------+
| Dirk Hoffmann G105 | (` o-o ') | eMail:
dhoffman@fzi.de |
| Klosterweg 28 +-ooO-(_)-Ooo-+ or
hoffi@joy.net |
| 76131 Karlsruhe _______________ www:
www.uni-karlsruhe.de/~uk1s |
| Tel.: 0721/6904236 hoffi@hadiko.de or
www.joy.net/home/hoffi |
+--------------------------------------------------------------------------+
------------------------------
Date: Thu, 30 Oct 1997 15:44:38 -0600
From: dsstevensAT@ingrDOT.com
To: Bill Parker <bill@penumbra.co.uk>
Subject: Re: WinNT Excel Help!
Message-Id: <3458FFC6.7AD6@ingrDOT.com>
#
# Perl to open and read existing Excel sheet in WinNT.
# DS Stevens
#
#Const xlRows = 1
#
# Reference:
# http://tigger.rdg.ac.uk/perl/Perl-Win32/oleauto.html
#
use OLE;
$application = CreateObject OLE 'Excel.Application' || die $!;
$application->{'Visible'} = 0; # 1 = true & 0 = false
$workbook = $application->Workbooks->Open('c:\\temp\\052097ws.xls');
# reference sheet named 'NJO'
# $worksheet = $workbook->Worksheets(1);
$worksheet = $workbook->Worksheets('NJO');
# print a cell value
printf ( "%s\n", $worksheet->Range("A4")->{'Value'} );
# assign a cell value to temp1
$temp1 = $worksheet->Range("A10")->{'Value'};
print $temp1;
#$workbook->{'Saved'} = 1;
$application->ActiveWorkbook->Close(0);
$application->Quit();
------------------------------
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 1251
**************************************