[9220] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2814 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 8 17:07:38 1998

Date: Mon, 8 Jun 98 14:00:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 8 Jun 1998     Volume: 8 Number: 2814

Today's topics:
    Re: (1 and '') vs. (1 && '') (Larry Rosler)
    Re: A Question about Quotes <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: automail (Steve Linberg)
        Capitalizing acronyms (Re: Is PERL case sensitive?) <rootbeer@teleport.com>
    Re: CODE: Win32 Registry search & replace <JKRY3025@comenius.ms.mff.cuni.cz>
    Re: Day of Week Display for User-defined date <bowlin@sirius.com>
    Re: Day of Week Display for User-defined date <upsetter@ziplink.net>
    Re: DBD install <rdschramm@earthlink.net>
        File Upload (B00rah)
    Re: Form input and file creation <rdschramm@earthlink.net>
    Re: How to install PERL with user account? <rootbeer@teleport.com>
    Re: if/then in perl/cgi scripts (Chris Hamilton)
        Looking for examples of perl working with javascript <sirron@mail.mcoe.k12.ca.us>
    Re: Looking for examples of perl working with javascrip <angst@scrye.com>
    Re: Looking for examples of perl working with javascrip <featheredfrog@geocities.com>
    Re: Lotus Notes from perl? (Jan Dubois)
    Re: Netmask and subnet comparisons in perl? <rootbeer@teleport.com>
    Re: offline mode? <tchrist@mox.perl.com>
        print <<EOT; problems <dsanders@netxchange.com>
    Re: print <<EOT; problems <tchrist@mox.perl.com>
    Re: print <<EOT; problems <bowlin@sirius.com>
    Re: print <<EOT; problems (Clinton Pierce)
    Re: print <<EOT; problems <angst@scrye.com>
    Re: print <<EOT; problems <dsanders@netxchange.com>
        problem w/ ^M in Win95 <meperkins@att.com>
    Re: Problem: With the $ENV{'blah'} variable <rootbeer@teleport.com>
    Re: Problems reading tied hash database records <rootbeer@teleport.com>
        Problems with open() mfrost@my-dejanews.com
    Re: question <upsetter@ziplink.net>
    Re: question <upsetter@ziplink.net>
    Re: Reading a file from the bottom up <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 8 Jun 1998 12:55:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: (1 and '') vs. (1 && '')
Message-Id: <MPG.fe5e18b66d73cce989684@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <6lh86e$efo$3@csnews.cs.colorado.edu>, tchrist@mox.perl.com 
says...
 ... 
> ...  Here's a
> tip: use "and" and "or" when you mean flow-control *only*--if then.
> Otherwise, use the normal operators.  They stand out better.
 ...

That is *great* advice.  I just went through lots of my code and looked 
for the opportunity to apply this tip, and was gratified by the resulting 
clarity.  In effect, you are adding visual semantics to "and" and "or" by 
using them when you mean to effect flow control rather than just 
(con|dis)junction.

Unfortunately, the sources that many of us use to learn Perl syntax and 
style don't do it this way consistently.  A case that comes to mind 
immediately is the idiom for secondary sorting (Blue Camel, p. 218):

  sub prospects {
    $money{$b} <=> $money{$a}
      or
    $height{$b} <=> $height{$a}
      or
    ...

It is *much* neater with ||, IMHO.  And `perldoc -f sort` *does* use || !  
Sigh...

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


------------------------------

Date: Mon, 08 Jun 1998 22:07:05 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: A Question about Quotes
Message-Id: <357CC2F9.48EB@comenius.ms.mff.cuni.cz>

Mark-Jason Dominus wrote:
> 
> In article <Pine.LNX.3.96.980606124212.2310A-100000@mercury.shreve.net>,
> Brian  <signal@shreve.net> wrote:
> >$statment="INSERT INTO $table VALUES ('$realname','$username')";
> >$sth = $dbh->query($statment);
> >The problem is, what if the users real name is "Larry O'Keefe", it screws
> >up because of the ' in Larrys name it gives parse errors.
> >How does one normally fix something like this?
> 
> In general, the solution is to do something like:
>         $realname =~ s/(['\\])/\\$1/g;
> or
>         $username =~ s/'/''/g;
> 
> before you interpolate these into the statement.
> 
> You can get this to happen semi-automatically if you use the
> `Interpolation' module. (<URL:http://www.plover.com/~mjd/perl/Interpolation/>)
> Then you'd write this:
> 
>         # Put this at the top of your program.
>         use Interpolation "'" => sub {$_=$_[0];s/'/''/gm;"'".$_};
> 
>         ...
> 
>         $statment="INSERT INTO $table VALUES ($'{$realname}',$'{username}')";

You forgot a $ in this statement. It should be
          $statment="INSERT INTO $table VALUES
($'{$realname}',$'{$username}')";

>         $sth = $dbh->query($statment);
> 
> $'{...} means that the string is supposed to be suitably escaped
> before it is interpolated into the $statement.
> 
> This trick was invented by Jan Krynicky.

And I have one more ;-)

If the strings enclosed into the quotes in the SQL command are
always variables, that is if you never use something like:

	$statement="INSER INTO $table VALUE ('some text with $variable', ...)";

You may change the use statement to:

	use Interpolation "'" => sub {$_=${$_[0]};s/'/''/gm;"'".$_};

and then write:

	$statment="INSERT INTO $table VALUES ($'{realname}',$'{username}')";

Looks cool, doesn't it?

The drawback is, that realname and username have to be names of
package or local (not lexical!) variables  or  references.

	{
	  my $username;
	  some code;
	  $statment="INSERT INTO $table VALUES ($'{realname}',$'{username}')";
	}

will not do what you think :-(
Youd have to write it as:

	  $statment="INSERT INTO $table VALUES
($'{realname}',$'{\$username}')";


The choice is up to you, Jenda

JFS (Just for sure): 
#!/usr/bin/perl
$package = 'Package variable';
local $local = 'Local variable';
my $lexical = 'Lexical variable';
__END__


------------------------------

Date: Mon, 08 Jun 1998 15:45:29 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: automail
Message-Id: <linberg-0806981545290001@projdirc.literacy.upenn.edu>

In article <01bd923c$c9dc6840$97a5a8c1@default>, "wolfram.oehms"
<wolfram.oehms@metronet.de> wrote:

> Is there a way to send an email out to everyone who comes to our website
> automatically without them filling out a form,etc... ?

no.

And why on earth would you think it's OK to do something so intrusive?
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


------------------------------

Date: Mon, 08 Jun 1998 20:08:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Capitalizing acronyms (Re: Is PERL case sensitive?)
Message-Id: <Pine.GSO.3.96.980608130805.29617D-100000@user2.teleport.com>

On Sat, 6 Jun 1998, REUBEN LOGSDON wrote:

> PERL is an acroynm for "Practical Extraction and Report Language".  It's
> common practice to capitalize acronyms. 

You're right, but once the acronym becomes a word (such as laser, scuba,
or zip code) the caps are dropped. Thus the FAQ turns out to be correct
once again. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Mon, 08 Jun 1998 22:30:27 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: CODE: Win32 Registry search & replace
Message-Id: <357CC873.31BA@comenius.ms.mff.cuni.cz>

Andy Lester wrote:
> 
> The following is pretty specific to my problem, but I figure some novice
> might see it and learn SOMETHING.  It's gotta beat the Nth "How do I set
> up Perl on IIS" question.
> 
> Please note that the following makes menion of Microsoft products.
> Repeatedly.  If you can't handle that, please leave now.
> 
> Here at work we've had the MS Office apps sitting on a network drive, and
> we've used 'em across the network.  Performance sucked.  Now I want it
> local.  Bummer: Installing it local doesn't change all the paths in the
> registry; they still point at the K: drive.
> 
> How to do a search & replace on the old paths to the new ones?  I could
> export the entire registry, search & replace w/a tool, and reimport it,
> but that's yucky.

Or use Registry Search & Replace, I think I got it from
http://www.winfiles.com
 
> So I wrote a little Perl program, natch.  Used _Learning Perl On Win32
> Systems_ by Schwartz, Olson & Christiansen as the jumping point.  It
> recursively walks the registry tree looking for naughty paths, and updates
> 'em when it finds one.  The code follows:
>
<snipped>
>
> xoxo,
> Andy

If you want it in a module, you may go to
http://www.fmi.cz/private/Jenda/
and get Win32::Registry2.

See function FindKey & FindValue

Hi, Jenda


------------------------------

Date: Mon, 08 Jun 1998 12:53:19 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: KC Lucchese <kcl@mindspring.com>
Subject: Re: Day of Week Display for User-defined date
Message-Id: <357C412F.6C4F9024@sirius.com>

KC Lucchese wrote:
> 
> What a witch.  Your trailer park cancel bingo again, honey?

Shame on you KC!  

-- Jim Bowlin


------------------------------

Date: 8 Jun 1998 19:58:53 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Day of Week Display for User-defined date
Message-Id: <6lhfpt$7rj@fridge.shore.net>

Tom Christiansen <tchrist@mox.perl.com> wrote:

: But you haven't read about dates in the perlfaq, so you don't
: know about the Date::Manip module from CPAN.

That module is a hog. I prefer to use Time::ParseDate and POSIX myself.

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


------------------------------

Date: Mon, 8 Jun 1998 14:36:55 -0400
From: <rdschramm@earthlink.net>
Subject: Re: DBD install
Message-Id: <6lhb68$9ma$1@bolivia.it.earthlink.net>

Your Unix box will be acting as a client to access the database remotely.
As such, it needs to have SQLNet installed on it so that it can make that
connection to Oracle.  The Oracle DBD module does not contain SQLNet, only
the code to interface with it.  In short, you need to buy Oracle for your
Unix platform to install the client.

>How do you install the DBD module on UNIX when the database resides on NT?
>
>It keeps asking for Oracle variables to be set, and complains if it can't
find
>it...





------------------------------

Date: 08 Jun 1998 19:46:48 GMT
From: b00rah@aol.com (B00rah)
Subject: File Upload
Message-Id: <1998060819464800.PAA26887@ladder03.news.aol.com>

I am looking for a simple script to Upload just one graphic at a time through a
Web Browser without using modules.  Can anyone point me in the right direction?
 How do I parse out the contents of the file and the file name from the
multipart/file encoding?


------------------------------

Date: Mon, 8 Jun 1998 14:46:09 -0400
From: <rdschramm@earthlink.net>
Subject: Re: Form input and file creation
Message-Id: <6lhbni$a9i$1@bolivia.it.earthlink.net>

Your reference to ReadParse sounds like you are using the cgi-lib.pl lib.
If you are on perl5, then stop using that and start using CGI.pm,
downloadable from CPAN.  If you are on perl4, you should upgrade (or have
your SA do it for you).

As for the specific file problem, do a little more debugging - print out the
input{domain} to a file and see what it shows, then try to create that file
specifically at the command line.

You should also put an "or die" clause on the end of you open, like:

open(MYFILE,">myfilename.txt") or die "Can't open file - $!\n";

Patrick wrote in message <357b52d6.992106@news.innova.net>...
>I'm having some trouble with a form input to a .cgi scripts written in
>Perl. The form passes a domain name to the .cgi scripts which uses
>&ReadParse(*input) to pull out as $input{domain}. The .cgi is set to
>create a file with the name of the domain. For some reason the program
>will not create this file. Elsewhere in the same script other files
>are created in the same directory, and if I simply set the variable to
>a domain name it will create that file.





------------------------------

Date: Mon, 08 Jun 1998 20:23:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to install PERL with user account?
Message-Id: <Pine.GSO.3.96.980608131958.29617G-100000@user2.teleport.com>

Maybe I've misunderstood what you were saying...

On Sun, 7 Jun 1998, Bob Trieger wrote:

> -> So, is it possible for me to install PERL to my own directory, and start =
> -> using the cool scripts?
> 
> Not unless you have administrator access.

In general, though, you _can_ install perl and modules without being a
system administrator. (You shouldn't be able to install them into
directories like /usr/bin, of course, but that's another matter.) 

But whether or not you can use them for web-based scripting depends
entirely upon the configuration of your webserver - which may or may not
be under the control of the system administrator for that machine.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 8 Jun 1998 19:29:15 GMT
From: chrish@squonk.net (Chris Hamilton)
Subject: Re: if/then in perl/cgi scripts
Message-Id: <6lhe2b$858$1@duke.squonk.net>

James A. (Jamie) Dennis (jdennis@netset.com) wrote:

: #Update 3/28/98 - added maidenname condition
:       if ( -r $FORM{'maidenname'} ){
:          print DATABASE "<h3><FONT COLOR=BLUE><A
: NAME=$FORM{'maidenname'}>$FORM{'firstname'} $FORM{'middlename'}
: $FORM{'lastname'}</font></h3>";
:       }
:         else {
:          print DATABASE "<h3><FONT COLOR=BLUE><A
: NAME=$FORM{'lastname'}>$FORM{'firstname'} $FORM{'middlename'}
: $FORM{'lastname'}</font></h3>";
:       }

-r and other similar operators are tests to be performed on files and
directories and such. Not on the status of a variable. I would use
something like:

	if(length($FORM{'maidenname'})) {
           print DATABASE "<h3><FONT COLOR=BLUE><A

May the Force be with you.

--
Chris Hamilton                 C7 F9 1E FF 4F D8 F8 87  
chrish(at)squonk.net           F8 13 5F 69 63 B5 EB A8

"You're just jealous because the 'voices' talk to me."



------------------------------

Date: Mon, 08 Jun 1998 13:19:48 -0700
From: Joseph Norris <sirron@mail.mcoe.k12.ca.us>
Subject: Looking for examples of perl working with javascript
Message-Id: <357C4764.F1F316AC@mail.mcoe.k12.ca.us>

Hello listeros,

I am looking for examples of mix of perl and javascript with the
following questions in
mind.

1.    Can I use perl to create form with javascript embedded?
2.    Can I use the javascript to check errors on form before passing
data to
        perl program?

Keep in mind that I have been writing everything in perl but would like
to add some of
the warm-fuzzies of javascript (what little I know of it) - like warning
boxes etc.

Thanks.

--
Joseph Norris (Perl/Linux/Linux)
@n=(106,117,115,116,32,97,110,111,116,104,101,114,32,112,101,114,108,32,

104,97,99,107,101,114,32,106,111,115,101,112,104,32,78,111,114,114,105,115,10);

print @c=map chr,@n;




------------------------------

Date: 8 Jun 1998 20:31:23 GMT
From: angst <angst@scrye.com>
Subject: Re: Looking for examples of perl working with javascript
Message-Id: <6lhhmr$qld$3@jelerak.scrye.com>

Joseph Norris <sirron@mail.mcoe.k12.ca.us> wrote:
: 1.    Can I use perl to create form with javascript embedded?

Try it, see what happens.

: 2.    Can I use the javascript to check errors on form before passing
: data to
:         perl program?

Try it, see what happens.

HTH!

-- 
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support


------------------------------

Date: Mon, 08 Jun 1998 16:39:42 -0400
From: "Michael D. Hofer" <featheredfrog@geocities.com>
Subject: Re: Looking for examples of perl working with javascript
Message-Id: <357C4C0E.2AAD@geocities.com>

Cool!  a chance to respond.

1. insert separate functions between <script
language='javascript'></script> tags, along with the required comments
simply by placing them in the output stream:


 .
 .
print
	whatever,
	"<script language='javascript'><!-- ",
	[more lines with your javascript go here],
        "// --> </script>",
	whatever,
 .
 .
and so on.

Triggers can just go as part of the elements:

#!/bin/perl
use strict;
use CGI qw(:all);
print
  header,
  start_html(-onLoad=>"window.status='hello, world';return true"),
  h1("hello, world!"),
  end_html;



Joseph Norris wrote:
> 
> Hello listeros,
> 
> I am looking for examples of mix of perl and javascript with the
> following questions in
> mind.
> 
> 1.    Can I use perl to create form with javascript embedded?
> 2.    Can I use the javascript to check errors on form before passing
> data to
>         perl program?
> 
> Keep in mind that I have been writing everything in perl but would like
> to add some of
> the warm-fuzzies of javascript (what little I know of it) - like warning
> boxes etc.
> 
> Thanks.
> 
> --
> Joseph Norris (Perl/Linux/Linux)
> @n=(106,117,115,116,32,97,110,111,116,104,101,114,32,112,101,114,108,32,
> 
> 104,97,99,107,101,114,32,106,111,115,101,112,104,32,78,111,114,114,105,115,10);
> 
> print @c=map chr,@n;

-- 
Cian ua'Lochan /mka/ Michael D. Hofer
No Unsolicited Commercial Email: $500.00/Item for proofreading!
I'm not a medievalist - I just play one on weekends!
http://www.geocities.com/SoHo/Lofts/9800/


------------------------------

Date: Mon, 08 Jun 1998 22:18:11 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Lotus Notes from perl?
Message-Id: <358045d2.8025670@news2.ibm.net>

[mailed & posted]

murple@erols.com wrote:

>Andrew Gruskin <agruskin@melbpc.org.au> scribbled:
>: Using Win32::OLE you can drive Notes.  I have Perl scripts creating Notes
>: documents and then sending (emaiing) them.
>
>I'm using perl scripts on a Linux box, however. It's not possible to use
>Win32::OLE from Linux, is it?

No, it's not. I know that Jon Orwant <orwant@media.mit.edu> (editor and
publisher of "The Perl Journal") has a Notes module using the C++ API that is
almost alpha status. And Martin Brech <Martin.Brech@erl11.siemens.de> just
started a project to implement a Notes::Session module using just the C API,
because that provides access to more functionality. But he has just started 2
weeks ago or something.

You might want one of these guys directly, if you are willing to work with
alpha level software.

-Jan


------------------------------

Date: Mon, 08 Jun 1998 20:18:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Netmask and subnet comparisons in perl?
Message-Id: <Pine.GSO.3.96.980608131801.29617F-100000@user2.teleport.com>

On 7 Jun 1998, David Richards wrote:

> IOW, given that I have a route to the subnet 10.0.2.2/28, I want to be
> able to have the program decide whether the address 10.0.2.195 is in the
> range already defined by the subnet, so I can avoid extra redundant
> rules in the generated filters. 
> 
> 
> This seems like something that would belong under Net::Inet, but there
> seems to be little subnet 'math' anwhere in CPAN. 

Be sure to submit your module to CPAN when you've finished it! :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 8 Jun 1998 18:56:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: offline mode?
Message-Id: <6lhc4i$jgq$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    kahuna@panix.com writes:
:Of course, the answer to my non-existent question is that tcp acts
:the same under either language.  As could a CGI under either
:language.

Don't you mean "a TCP acts the same"?  

--tom
-- 
Unix never says `please.'  -- Rob Pike


------------------------------

Date: Mon, 08 Jun 1998 19:20:36 GMT
From: "David Sanders" <dsanders@netxchange.com>
Subject: print <<EOT; problems
Message-Id: <8QWe1.308$Aj.4968397@iagnews.iagnet.net>

For the life of me, I can't figure out what is going on here.  I'm
running Perl for Win32, and am trying to get the following code to
work:

require "cgi-lib.pl";

MAIN:
{
   print &PrintHeader;
   print &HtmlTop("testing");
   print <<EOT;
      testing
      EOT
   print &HtmlBot;
}

My web browser gives me:
"Can't find string terminator "EOT" anywhere before EOF at <path>."

What is going on???  I have been driving myself CRAZY all day trying
to figure this one out.  In all my books of code, they all use this
same format for print <<MARKER; text  MARKER.  What am I doing wrong??

Thanks in advance,
Dave Sanders





------------------------------

Date: 8 Jun 1998 19:26:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: print <<EOT; problems
Message-Id: <6lhdto$kcg$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "David Sanders" <dsanders@netxchange.com> writes:
:For the life of me, I can't figure out what is going on here.  I'm
:running Perl for Win32, and am trying to get the following code to

Strike 1.

:work:
:
:require "cgi-lib.pl";

Strike 2.

:
:MAIN:
:{
:   print &PrintHeader;
:   print &HtmlTop("testing");
:   print <<EOT;
:      testing
:      EOT

Strike 3.  You're out.

:   print &HtmlBot;
:}
:
:My web browser gives me:
:"Can't find string terminator "EOT" anywhere before EOF at <path>."

This is described in the standard perldata manpage shipped with
every installation of Perl.  It's on your system.  Just look it up.
It's quite clear.

--tom
-- 
 "Unix has its weak points, but its file system is not one of them." -Chris Torek


------------------------------

Date: Mon, 08 Jun 1998 12:49:06 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: David Sanders <dsanders@netxchange.com>
Subject: Re: print <<EOT; problems
Message-Id: <357C4032.F744F365@sirius.com>

David Sanders wrote:
> 
> For the life of me, I can't figure out what is going on here.  I'm
> running Perl for Win32, and am trying to get the following code to
> work:
> 
> require "cgi-lib.pl";
> 
> MAIN:
> {
>    print &PrintHeader;
>    print &HtmlTop("testing");
>    print <<EOT;
>       testing
>       EOT
>    print &HtmlBot;
> }
> 
> My web browser gives me:
> "Can't find string terminator "EOT" anywhere before EOF at <path>."
> 
> What is going on???  I have been driving myself CRAZY all day trying
> to figure this one out.  In all my books of code, they all use this
> same format for print <<MARKER; text  MARKER.  What am I doing wrong??
> 
> Thanks in advance,
> Dave Sanders

Get rid of all whitespace before "EOT".

    print <<EOT;
        testing
EOT

HTH - Jim Bowlin


------------------------------

Date: 8 Jun 1998 19:50:39 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
To: "David Sanders" <dsanders@netxchange.com>
Subject: Re: print <<EOT; problems
Message-Id: <6lhfaf$h2a7@eccws1.dearborn.ford.com>

In article <8QWe1.308$Aj.4968397@iagnews.iagnet.net>,
	"David Sanders" <dsanders@netxchange.com> writes:
>For the life of me, I can't figure out what is going on here.  I'm
>running Perl for Win32, and am trying to get the following code to
>work:
>
>require "cgi-lib.pl";
>
>MAIN:
>{
>   print &PrintHeader;
>   print &HtmlTop("testing");
>   print <<EOT;
>      testing
>      EOT
>   print &HtmlBot;
>}
>
>My web browser gives me:
>"Can't find string terminator "EOT" anywhere before EOF at <path>."
>
>What is going on???  I have been driving myself CRAZY all day trying
>to figure this one out.  In all my books of code, they all use this
>same format for print <<MARKER; text  MARKER.  What am I doing wrong??

Try moving the EOT against the left margin (column 0):

	print <<EOT;
	testing
EOT

-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



------------------------------

Date: 8 Jun 1998 20:08:23 GMT
From: angst <angst@scrye.com>
Subject: Re: print <<EOT; problems
Message-Id: <6lhgbn$qld$1@jelerak.scrye.com>

David Sanders <dsanders@netxchange.com> wrote:
: MAIN:
: {
:    print &PrintHeader;
:    print &HtmlTop("testing");
:    print <<EOT;
:       testing
:       EOT
:    print &HtmlBot;
: }

: My web browser gives me:
: "Can't find string terminator "EOT" anywhere before EOF at <path>."

: What is going on???  I have been driving myself CRAZY all day trying
: to figure this one out.  In all my books of code, they all use this
: same format for print <<MARKER; text  MARKER.  What am I doing wrong??

Please read the newsgroup before posting...this question was answered
just yesterday.  The string terminator must be the only thing on its
line.  This means no leading whitespace.  So, don't indent the terminator.

-- 
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support


------------------------------

Date: Mon, 08 Jun 1998 20:44:42 GMT
From: "David Sanders" <dsanders@netxchange.com>
Subject: Re: print <<EOT; problems
Message-Id: <_2Ye1.317$Aj.5018163@iagnews.iagnet.net>


angst wrote in message <6lhgbn$qld$1@jelerak.scrye.com>...
>Please read the newsgroup before posting...this question was answered
>just yesterday.

I try to always read previous ng posts to see if my questions have
already been asked.  I didn't find this one.

>The string terminator must be the only thing on its
>line.  This means no leading whitespace.  So, don't indent the
>terminator.

Thank you.

Dave





------------------------------

Date: Mon, 08 Jun 1998 15:48:37 -0400
From: "Mark E. Perkins" <meperkins@att.com>
Subject: problem w/ ^M in Win95
Message-Id: <357C4015.B1E2CA16@att.com>


--------------3DB39F6A5F4C8A923AEE6633
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I have some Mac text files that need conversion to DOS text files
(Mac uses ^M as end of line char). The following simple script works
fine on a Unix Perl (5.003_01), but not on my installation of
Gurusamy Sarathy's Windows Perl (5.004_02).

while (<>) {
    s/\015/\015\012/g;
    print ;
}

All instances of ^M get stripped out, but are not replaced. If the s///
is replaced with

    s/a/a/g

the ^M are all stripped, even though they shouldn't get touched.

What am I missing?

Thanks
Mark Perkins
meperkins@att.com


--------------3DB39F6A5F4C8A923AEE6633
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<TT>I have some Mac text files that need conversion to DOS text files</TT>
<BR><TT>(Mac uses ^M as end of line char). The following simple script
works</TT>
<BR><TT>fine on a Unix Perl (5.003_01), but not on my installation of</TT>
<BR><TT>Gurusamy Sarathy's Windows Perl (5.004_02).</TT><TT></TT>

<P><TT>while (&lt;>) {</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; s/\015/\015\012/g;</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; print ;</TT>
<BR><TT>}</TT><TT></TT>

<P><TT>All instances of ^M get stripped out, but are not replaced. If the
s///</TT>
<BR><TT>is replaced with</TT><TT></TT>

<P><TT>&nbsp;&nbsp;&nbsp; s/a/a/g</TT><TT></TT>

<P><TT>the ^M are all stripped, even though they shouldn't get touched.</TT><TT></TT>

<P><TT>What am I missing?</TT><TT></TT>

<P><TT>Thanks</TT>
<BR><TT>Mark Perkins</TT>
<BR><TT>meperkins@att.com</TT>
<BR><TT></TT>&nbsp;</HTML>

--------------3DB39F6A5F4C8A923AEE6633--



------------------------------

Date: Mon, 08 Jun 1998 20:04:06 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Problem: With the $ENV{'blah'} variable
Message-Id: <Pine.GSO.3.96.980608130223.29617C-100000@user2.teleport.com>

On Sat, 6 Jun 1998, David Wasserstrum wrote:

> I have this odd feeling that my Windows Apache server is not setting the
> environmental variables before calling perl.exe.  I'm not quite sure how
> to fix that though... 

But, of course, the problem has now passed beyond the realm of Perl; if
your server isn't doing what it's supposed to, that's a server problem. 
In this case, you may be able to fix it by installing Linux, though. :-) 

Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Mon, 08 Jun 1998 19:29:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Problems reading tied hash database records
Message-Id: <Pine.GSO.3.96.980608122447.29617B-100000@user2.teleport.com>

On Sat, 6 Jun 1998, Ron Richey wrote:

[ Two screenfuls snipped ]

> Anyway, what happens, is that when I use the
> 
> 	foreach $rec_key (keys %items)
> 
> method (commented out in the code snippet below) to loop through the
> database, I am able to parse through all 1118 records successfully. 
> However, when I use the
> 
> 	while(($rec_key, $rec_value) = each %items) 
> 
> method, I get an "Out of memory!" error and Perl aborts after processing
> only 596 records. 

[ Another four screenfuls snipped ]

You may have found a bug in Perl. Then again, maybe not. If you can cut
your program down to six or eight lines which show this behavior, I'm sure
that someone can take a look at it and let you know. But most of us are
too lazy to read more than that - I know I am! :-)

If there was vital information in the six screenfuls I snipped, I wouldn't
know. I'm not trying to be rude here, but the time I'll spend on a
particular message is typically a constant - so long messages don't get a
detailed reading. I think that's the same for nearly everyone else around
c.l.p.misc. But cut things down to a short example, and someone will
almost always be willing to help. Good luck! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Mon, 08 Jun 1998 19:59:53 GMT
From: mfrost@my-dejanews.com
Subject: Problems with open()
Message-Id: <6lhfrp$q8k$1@nnrp1.dejanews.com>

I thought I understood open() pretty well, but I guess I must not.
I'm trying to use open() to run a program and watch the output.

I've got the following small example of my problem:

  #!/usr/bin/perl

  $foober="wackawacka";

  ($return_val = open FOOZLE, "$foober | ") or die "open didn't work: $!\n";
  print "\$return_val is $return_val\n";
  while (<FOOZLE>) {
      print $_;
  }

Of course, there is no program called "wackawacka" to run, but this still
seems to work.	According the the blue camel book, open() is supposed to
return a non-zero value upon success and "undefined" otherwise.  No matter
what program I tell open() to run, I still get a non-zero return value.  It
acts the same whether I run "ls" or "wackawacka".  It will never run the
die() routine.

I see this behavior on both a win32 (perl 5.003) platform and under Solaris
2.6 (perl 5.004_04) so I figure this is my misunderstanding of open is
supposed to work.

What am I doing wrong?

Thanks

-mark

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


------------------------------

Date: 8 Jun 1998 19:52:07 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: question
Message-Id: <6lhfd7$65e@fridge.shore.net>

wolfram.oehms <wolfram.oehms@metronet.de> wrote:
: Is there a way to send an email out to everyone who comes to our website
: automatically without them filling out a form,etc... ?

That's a real good way to insure that nobody ever returns to your website,
but fortunately, there's no easy way to do it.

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


------------------------------

Date: 8 Jun 1998 19:52:23 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: question
Message-Id: <6lhfdn$7rj@fridge.shore.net>

wolfram.oehms <wolfram.oehms@metronet.de> wrote:
: Is there a way to send an email out to everyone who comes to our website
: automatically without them filling out a form,etc... ?

That's a real good way to insure that nobody ever returns to your website,
but fortunately, there's no easy way to do it.

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


------------------------------

Date: Mon, 08 Jun 1998 19:22:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Reading a file from the bottom up
Message-Id: <Pine.GSO.3.96.980608122204.29617z-100000@user2.teleport.com>

On Sat, 6 Jun 1998, REUBEN LOGSDON wrote:

> open(F,"<file");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Thanks.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

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 2814
**************************************

home help back first fref pref prev next nref lref last post