[16242] in Perl-Users-Digest
Perl-Users Digest, Issue: 3654 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 13 14:16:27 2000
Date: Thu, 13 Jul 2000 11:15:32 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963512131-v9-i3654@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 13 Jul 2000 Volume: 9 Number: 3654
Today's topics:
Re: PRINTing " "" " <russ_jones@rac.ray.com>
Re: PRINTing " "" " <uri@sysarch.com>
Re: PRINTing " "" " <juex@deja.com>
problems compiling sybperl 2.12 cdotger@my-deja.com
Re: Problems running the perl debugger (M.J.T. Guy)
Re: Reading a line into variables: Question kiran_mamidi@my-deja.com
Re: reg expression not working. WHY??? <care227@attglobal.net>
Re: sending files to a printer in Win32? (Arek P)
Shortcut for non-defined variables (James Weisberg)
Re: String length? (Craig Berry)
telephone answering machine <sfox@earthlighttechnologies.com>
Re: using %ENV with CGI <dwilgaREMOVE@mtholyoke.edu>
Re: Whelp (Nobody)
Re: WHERE TO FIND NET::FTP MODULE? <gerard@NOSPAMlanois.com>
Re: Why $|++ instead of $|=1 ? (M.J.T. Guy)
Re: Why $|++ instead of $|=1 ? (M.J.T. Guy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 13 Jul 2000 10:07:49 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: PRINTing " "" "
Message-Id: <396DDB45.F49ABCB4@rac.ray.com>
Uri Guttman wrote:
> >>>>> "DS" == Drew Simonis <care227@attglobal.net> writes:
> DS> deno wrote:
> >>
> >> Does anyone know how to make PRINT print an embedded " symbol?
> >> I have lines which contain " which must be printed out.
> DS> print "$company \"some_text\" more text"; #escape the "
> please don't ever show that style of escaping quotes. i hate seeing it.
>
> one solution is to use single quotes around the internal text. i have
> mentioned this to some newbies and they were floored! DUH! if all you
> are doing is highlighting something, then internal single quotes look fine.
Using apostrophes as quotes may "look fine" but it's not correct
usage. It's like putting a motor on a canoe. Just because you can do
something, that doesn't make it right.
print qq($company "some_text" more text);
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Thu, 13 Jul 2000 15:38:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: PRINTing " "" "
Message-Id: <x7em4yjb12.fsf@home.sysarch.com>
>>>>> "RJ" == Russ Jones <russ_jones@rac.ray.com> writes:
RJ> Uri Guttman wrote:
>> >>>>> "DS" == Drew Simonis <care227@attglobal.net> writes:
DS> deno wrote:
>> >>
>> >> Does anyone know how to make PRINT print an embedded " symbol?
>> >> I have lines which contain " which must be printed out.
DS> print "$company \"some_text\" more text"; #escape the "
>> please don't ever show that style of escaping quotes. i hate seeing it.
>>
>> one solution is to use single quotes around the internal text. i have
>> mentioned this to some newbies and they were floored! DUH! if all you
>> are doing is highlighting something, then internal single quotes look fine.
RJ> Using apostrophes as quotes may "look fine" but it's not correct
RJ> usage. It's like putting a motor on a canoe. Just because you can do
RJ> something, that doesn't make it right.
i never said anything about english usage. most often internal quotes
are use to highlight some text and is not quoted spoken words. in that
case single quotes are perfectly fine. you see this type of thing often:
print "command '$cmd' is not legal\n" ;
are you saying that has to have internal double quotes?
RJ> print qq($company "some_text" more text);
BFD. that was mentioned a number of times. my point is that you don't
have to use (or teach to newbies) qq for something as simple as
highlighting some text. if you MUST have internal double quotes, then qq
or here docs are the way. in any case, escaped quotes are ugly and should
never be needed.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 13 Jul 2000 10:11:43 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: PRINTing " "" "
Message-Id: <396df84f$1@news.microsoft.com>
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7em4yjb12.fsf@home.sysarch.com...
> >>>>> "RJ" == Russ Jones <russ_jones@rac.ray.com> writes:
> RJ> Using apostrophes as quotes may "look fine" but it's not correct
> RJ> usage. It's like putting a motor on a canoe. Just because you can do
> RJ> something, that doesn't make it right.
>
> i never said anything about english usage. most often internal quotes
> are use to highlight some text and is not quoted spoken words. in that
> case single quotes are perfectly fine. you see this type of thing often:
>
> print "command '$cmd' is not legal\n" ;
>
> are you saying that has to have internal double quotes?
Probably not. But for
print "Der Befehl \"$cmd\" ist nicht erlaubt.\n"
you need double quotes because single quotes are used for nested citations
only (see Duden: Die deutsche Rechtschreibung, page 23, rule 11)
BTW: the leading double quotes should be aligned with the bottom instead of
with the top of the line, but we got used to that Americanism already.
jue
------------------------------
Date: Thu, 13 Jul 2000 16:42:58 GMT
From: cdotger@my-deja.com
Subject: problems compiling sybperl 2.12
Message-Id: <8kkrid$lkc$1@nnrp1.deja.com>
I am trying to compile Sybperl Version 2.12 on a Digital Unix box
running 4.0F and Sybase 11.9.2.1 EBF 8742... I am getting the following
error during the "Perl Makefile.pl" command:
Missing $ on loop variable at ./config.pl line 127...
This is source code downloaded from www.perl.com. I looked at the
offending line and "to me" it looks fine.
Any suggestions?
TIA,
-Carl Dotger
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Jul 2000 15:53:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problems running the perl debugger
Message-Id: <8kkol1$d6g$1@pegasus.csx.cam.ac.uk>
Joe Brenner <doom@kzsu.stanford.edu> wrote:
>
>Thanks, though maybe I didn't make it clear that I can run
>run the script under the debugger with a
>
> perl -d script.pl
>
>without any trouble, the (main) problem is that the debugger won't
>run at all if the first line of the script tries to turn on
>taint mode (with the -T flag). I was also having some odd
>problems running the debugger from under emacs, but that
>seems to come and go.
Whenever you get an error from Perl which you don't understand
(or even if you think you do understand), look it up in perldiag.
In this case, you'd have found
Too late for "-T" option
(X) The #! line (or local equivalent) in a Perl script
contains the -T option, but Perl was not invoked with -T
in its command line. This is an error because, by the
time Perl discovers a -T in a script, it's too late to
properly taint everything from the environment. So Perl
gives up.
If the Perl script is being executed as a command using
the #! mechanism (or its local equivalent), this error
can usually be fixed by editing the #! line so that the
-T option is a part of Perl's first argument: e.g.
change `perl -n -T' to `perl -T -n'.
If the Perl script is being executed as `perl
scriptname', then the -T option must appear on the
command line: `perl -T scriptname'.
which explains what is going on, and what to do about it.
Mike Guy
------------------------------
Date: Thu, 13 Jul 2000 17:14:02 GMT
From: kiran_mamidi@my-deja.com
Subject: Re: Reading a line into variables: Question
Message-Id: <8kktc7$n54$1@nnrp1.deja.com>
Hi guys,
Thanks for all those who replied for my question.
@fields = split is working great for my script.
Thanks so much for your help and time.
Kiran
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 11:19:06 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: reg expression not working. WHY???
Message-Id: <396DDDEA.1621E3D@attglobal.net>
Pasquale wrote:
>
> Thanks, but it still is not working.
What is hapening instead?
> Do I really need to use CGI.pm to
> get this to work? I'm not too familiar with linking to that module.
It is very easy:
use CGI;
> The variables you suggested to be printed are
> printing OK.
So what you are saying is that, for example, print $address, "\n";
outputs 3434 Joyce Rd.
and print $cells[3], "\n"; outputs 3434 Joyce Rd. but doing
a comparision of these identical terms fails?
Have you tried changing the conditional to read:
if ("$address" eq "$cells[3]")
I seem to recall reading that double quotes will force stringification
of the terms, which may be helpfull since you are doing a string
comparision. But then again, I may be wrong. I don't see any mention
in perlop of that behaviour.
------------------------------
Date: Thu, 13 Jul 2000 11:41:26 EDT
From: Arek@nospam.pietruszewski.com (Arek P)
Subject: Re: sending files to a printer in Win32?
Message-Id: <8kknv6$pj8$1@earth.superlink.net>
On Thu, 13 Jul 2000 14:33:11 GMT, djones@excalib.com wrote:
This may not help You much because I do not know what kind of files
You need to print, but I actually use OLE to print MS Office documents
on NT box. It does require (I think) that Your network printer is the
default printer for that particular app (word, excel, ect). I will
dump this example of printing word document, taken directly from
ActiveState documentation, it works pretty well for me...
#not my code
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
my $Word = Win32::OLE->new('Word.Application', 'Quit');
# $Word->{'Visible'} = 1; # if you want to see what's going on
$Word->Documents->Open("C:\\DOCUMENTS\\test.doc")
|| die("Unable to open document ", Win32::OLE->LastError());
$Word->ActiveDocument->PrintOut({
Background => 0,
Append => 0,
Range => wdPrintAllDocument,
Item => wdPrintDocumentContent,
Copies => 1,
PageType => wdPrintAllPages,
});
# clean up required !!
Like I said on the beginning, this may not be what U are looking for,
and may be there is a better way (there always is..) ..but U can give
this a shot if You need to. There is a some overhead with opening MS
apps of course, so be careful....
>I've been programming perl for years on UNIX and have just recently been
>asked to write a bunch of code for Win98 and NT. One problem I've run
>into over and over again that I'm not sure how to send files to a
>network printer on Windows. Is this even possible and if so how would I
>go about doing this?
>
>-david
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 16:28:40 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: Shortcut for non-defined variables
Message-Id: <Y6mb5.1710$IZ1.13486@iad-read.news.verio.net>
Here's an extremely simple Perl question. Is there a shorthand for
the statement:
$val = (defined $val) ? $val : -1;
To me, this looks ugly. The || operator is fine for making
statements like:
$val ||= -1;
but $val will be set to -1 if $val is 0, which is not what I want
to do. Have I missed something? I'm surprised there is no way to do
the equivalent of:
$val def= -1;
where $val is set to -1 if $val is not defined.
--
World's Greatest Living Poster
------------------------------
Date: Thu, 13 Jul 2000 18:02:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: String length?
Message-Id: <sms11e6qnd629@corp.supernews.com>
Jim Kauzlarich (o1technospam@skyenet.nospam.net) wrote:
: So, with a little last minute re-vamping, here is my creation: (though
: without the do loop, and the extra if/then evaluation it feels un-Perl. The
: little bit I know.)
Nicely horrid. One tweak (unless the extra warning was intentional, of
course):
: if ( @_[$count] ne "" ) {
s/\@/\$/
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Thu, 13 Jul 2000 10:38:48 -0500
From: "Cheeby" <sfox@earthlighttechnologies.com>
Subject: telephone answering machine
Message-Id: <8kknnf$q5i$1@jair.pressenter.com>
Has anyone out there tried to make a simple voice mail/answering machine in
Perl? I can't find a good program for my Linux box and thought I'd take a
crack at it. So I'm wide open to suggestions.
Thanks,
Cheeby
------------------------------
Date: Thu, 13 Jul 2000 17:19:26 GMT
From: Dan Wilga <dwilgaREMOVE@mtholyoke.edu>
Subject: Re: using %ENV with CGI
Message-Id: <dwilgaREMOVE-AFA52B.13192913072000@news.mtholyoke.edu>
In article <8kj8al$ovj$1@mail.pl.unisys.com>, "Trent Mankelow"
<trent.mankelow@unisys.com> wrote:
> I'm sourcing it by simply typing "source setup.csh" at the moment, and then
> restarting the server afterwards, by typing "/etc/init.d/httpd stop"
> followed by "/etc/init.d/httpd start".
That's your problem. You can't expect the environment of the process starting
the web server to be inherited by the server or its children (at least not
with Apache.)
What works for me is to do this within my Perl code:
BEGIN {
push( @INC, "/home/peri/nikau/lib" );
}
I can then use any modules stored in that directory. Of course, this may not
work for all OSes.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: 13 Jul 2000 15:47:41 GMT
From: nobody@contract.Sun.COM (Nobody)
Subject: Re: Whelp
Message-Id: <8kkoat$rlm$1@eastnews1.east.sun.com>
In article <cjdb5.367369$k22.1586732@flipper>, Ecco <ecco64@chello.nl> wrote:
>K, I know it's a JAVA trick, and I know it's also possible to use HTML and
>JAVA in Perl, but HOW??? Does anyone have any concrete examples of the
>JAVA-script to pop-up a new browser-windows? I suck at Java even more than I
>do at Perl right now... And how exactly do you use it in a Perl-script??? As
>you probably noticed when I said "Newbie" I sure as hell mean "Newbie"...
>
>
Java != Javascript.
Anita
------------------------------
Date: Thu, 13 Jul 2000 09:47:08 -0700
From: Gerard Lanois <gerard@NOSPAMlanois.com>
Subject: Re: WHERE TO FIND NET::FTP MODULE?
Message-Id: <396DF28C.7D6B3092@NOSPAMlanois.com>
lova wrote:
>
> Where Can I get the Net::FTP module from as it is not one of the
> standard Perl 5 module.
Net::FTP is included in the libnet bundle. Search for libnet. You
want libnet-1.0703. Not to be confused with Bundle-libnet-1.00.
You might find this discussion thread to be helpful in understanding
why you had trouble finding the Net::FTP module:
http://x70.deja.com/viewthread.xp?AN=641528963
-Gerard
http://www.lanois.com/perl/
------------------------------
Date: 13 Jul 2000 15:18:26 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Why $|++ instead of $|=1 ?
Message-Id: <8kkmk2$bfh$1@pegasus.csx.cam.ac.uk>
Abigail <abigail@delanet.com> wrote:
>
>That's what local is for. Your subs will fail to do the right thing
>if $| happens to be -1. Or imagine that some_sub has a fatal error in
>it, which is caught by an eval{}. Your entire $| ++ and $| -- will be
>hosed.
Nope. $| is magical, and can only ever take values 0 or 1. Which
means the subroutine is nonsense for other reasons.
And that also shows that $|++ is exactly the same as $|=1, so entirely
respectable if a little eccentric.
But $|-- is a very different kettle of fish.
Mike Guy
------------------------------
Date: 13 Jul 2000 15:30:56 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Why $|++ instead of $|=1 ?
Message-Id: <8kknbg$c2e$1@pegasus.csx.cam.ac.uk>
Wyzelli <wyzelli@yahoo.com> wrote:
>
>As I have demonstrated previously, whilst calling $|++ repeatedly leaves
>the state of $| 'high' (or 'unbuffered' if you wish, since any non zero
>value = unbuffered), calling $|-- repeatedly can in certain
>circumstances cause $| to switch between a zero and non-zero value which
>can lead to misleading results.
It's not "in certain circumstances" - it's in *all* circumstances.
$| is magical and can only take values 0 or 1. An attempt to set
any nonzero value sets it to 1.
Mike Guy
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3654
**************************************