[10565] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4157 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 5 13:07:57 1998

Date: Thu, 5 Nov 98 10:00:33 -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: 4157

Today's topics:
    Re: ActivePerl (b 506) & IIS4 cgi keeps browser waiting <rootbeer@teleport.com>
    Re: Array problems for a newbie <rootbeer@teleport.com>
    Re: Array problems for newbie <Allan@due.net>
        Basic question mxk164@psu.edu
    Re: Can a Perl program effect the parent process?? (David Cantrell)
        Can someone please help me I installed redhat 5.1 with  smithj@statenislandonline.com
    Re: Can someone please help me I installed redhat 5.1 w <barnett@houston.Geco-Prakla.slb.com>
    Re: Can someone please help me I installed redhat 5.1 w <r28629@email.sps.mot.com>
    Re: Can someone please help me I installed redhat 5.1 w <rootbeer@teleport.com>
    Re: FAQ: Do they exist? (James Peregrino)
    Re: File Locking and Flushing <zenin@bawdycaste.org>
    Re: Having problems with a long script <rootbeer@teleport.com>
        Help on $^0... <rwilliamson@uno.gers.com>
    Re: Help on $^0... <barnett@houston.Geco-Prakla.slb.com>
    Re: Help on $^0... <rootbeer@teleport.com>
    Re: Help on a Webmail.... <rootbeer@teleport.com>
    Re: HELP: perl script fails on setuid binary <rootbeer@teleport.com>
    Re: HELP: perl script fails on setuid binary (Robert S. Campbell)
    Re: Heterogeneous Data Structures: possible? If so, how (Patrick Timmins)
    Re: images in perl (Sean McAfee)
    Re: images in perl <Tony.Curtis+usenet@vcpc.univie.ac.at>
        indenting perl elsif clauses in emacs tbhanson@startribune.com
        Isolating Perl regex calls for use in C programs <masereeuw@rulxha.leidenuniv.nl>
    Re: Isolating Perl regex calls for use in C programs (Brand Hilton)
        More help on $^0... <rwilliamson@uno.gers.com>
    Re: More help on $^0... (Andre L.)
    Re: Not to start a language war but.. <faassen@vet.uu.nl>
    Re: Not to start a language war but.. <garry@sage.att.com>
    Re: Not to start a language war but.. <jdporter@min.net>
    Re: Not to start a language war but.. <jdporter@min.net>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 05 Nov 1998 17:21:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: ActivePerl (b 506) & IIS4 cgi keeps browser waiting!!
Message-Id: <Pine.GSO.4.02A.9811050920010.3759-100000@user2.teleport.com>

On Wed, 4 Nov 1998, firmanf wrote:

> The page's contents have been generated completely, but the browser's
> status bar shows that it's still waiting for some more text (e.g. "80%
> of 12k"), even though there is NONE!!

If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol.

Hope this helps!

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



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

Date: Thu, 05 Nov 1998 17:12:20 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Array problems for a newbie
Message-Id: <Pine.GSO.4.02A.9811050909360.3759-100000@user2.teleport.com>

On Wed, 4 Nov 1998, Tim Hicks wrote:

> I am currently reading through 'Learning Perl' for Unix (despite
> running Win95, which was a mistake!) and trying to do the exercises at
> the end of chapters.  Can anyone tell me what is wrong with this
> solution to chapter 6, question 1.  It is supposed to have someone
> enter a list of words, and then print out those words in reverse
> order.  The problem is, it doesn't print the last word that has been
> entered.  Here is the code.
> 
> #!/usr/bin/perl -w
> print "Enter your word list followed by 'control' Z\n";
> while (<>) {
> push (@array, $_);
> }

I suspect that your system is not giving the last line of input to Perl.
See whether installing Linux makes the problem go away. :-)

It may be that you should put the control-Z on a new line, rather than
just after the last item. Does that make a difference? Good luck!

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



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

Date: Thu, 5 Nov 1998 10:40:50 -0500
From: "AmD" <Allan@due.net>
Subject: Re: Array problems for newbie
Message-Id: <71sglo$e9l$1@camel21.mindspring.com>


Tim Hicks wrote in message ...
>(Apologies if this message has appeared twice, it didn't seem to show up
the
>first time I tried to send.)
>
>Hi all,
>
>I am currently reading through 'Learning Perl' for Unix (despite running
>Win95, which was a mistake!) and trying to do the exercises at the end of
>chapters.  Can anyone tell me what is wrong with this solution to chapter
6,
>question 1.  It is supposed to have someone enter a list of words, and then
>print out those words in reverse order.  The problem is, it doesn't print
>the last word that has been entered.  Here is the code.
>

I have never really understood why but if you are working in a windoze world
and reading data in from the prompt you have to send a newline to STDOUT
before printing anything else.  I think it must flush a buffer but anyway
just always:

print "\n";

before printing anything else and you will get the results you expect.

HTH

AmD

--------------
#!/usr/bin/perl -w
print "Enter your word list followed by 'control' Z\n";
while (<>) {
push (@array, $_);
}
@arrayr = reverse (@array);
print "\n";
print @arrayr;






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

Date: Thu, 05 Nov 1998 14:48:24 GMT
From: mxk164@psu.edu
Subject: Basic question
Message-Id: <71sdro$8e1$1@nnrp1.dejanews.com>

Could anyone help me out with a basic configuation question?
I'm trying to get some Perl and CGI scripts to work, but I don't
believe they are set as executable, and thus are not running
when I attempt to load them from my browser. (my browser just
prompts me with a download box when I try to load the .pl or .cgi
files.
  A few notes: I am using Windows NT, the server is capable of
running these, and I don't need help with the script itself..just
help with configuring it to run.  I believe this has something to
do with setting up a /bin directory and assigning permissions to the
directory or files, but I have never attempted something of this
nature.  Any and all help is  greatly appreciated.
                - Michael

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 05 Nov 1998 17:49:03 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Can a Perl program effect the parent process??
Message-Id: <3642e410.104130862@thunder>

On Thu, 22 Oct 1998 22:31:46 GMT, drgreer@qtiworld.com (Darren Greer)
enlightened us thusly:

>The subject explains it all....but here is my situation.  I have a
>perl program that I want to set the DISPLAY env variable.
>Unfortunatley from what I understand on a *nix system, a child process
>(ie perl program) can not effect the parent process?)  Is there anyway
>to do this.

Not on Unix.  Please read the FAQ.

On Win32 systems, I'd bet that it's possible, although I haven't
tried.  It would involve some really disgusting messing around in the
DOS PSPs.

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Thu, 05 Nov 1998 16:00:51 GMT
From: smithj@statenislandonline.com
Subject: Can someone please help me I installed redhat 5.1 with apcahe. Each time I try to access my test.cgi script and I get the following error:
Message-Id: <71si3k$f8s$1@nnrp1.dejanews.com>

Can someone please help me I installed redhat 5.1 with apcahe.	Each time I
try to access my test.cgi script and I get the following error:

[Thu Nov  5 10:53:15 1998] access to /home/httpd/cgi-bin/test.cgi failed for
127.0.0.1, reason: Premature end of script headers

Please send me back any help to smithj@statenislandonline.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 05 Nov 1998 11:14:09 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: smithj@statenislandonline.com
Subject: Re: Can someone please help me I installed redhat 5.1 with apcahe. Each time I try to access my test.cgi script and I get the following error:
Message-Id: <3641DCE1.B21B042A@houston.Geco-Prakla.slb.com>

[courtesy cc to cited author, as requested]

smithj@statenislandonline.com wrote:
> 
> Can someone please help me I installed redhat 5.1 with apcahe.  Each time I
> try to access my test.cgi script and I get the following error:
> 
> [Thu Nov  5 10:53:15 1998] access to /home/httpd/cgi-bin/test.cgi failed for
> 127.0.0.1, reason: Premature end of script headers
This is not really a perl specific question.  You could get a similar
error, no matter what programming language you choose to create cgi
scripts in.

A newsgroup like:
comp.infosystems.www.authoring.html
comp.infosystems.www.authoring.cgi

(and there are others in that same vein....) might be of assistance.

That being said, the short answer is that you (just like the error
message says) didn't create a valid header.

Short example:
#!/usr/local/bin/perl -w
#
print "Content-type: text/html\n\n";
print <<EOF;
<HTML>
<BODY>
<P>This is some html'ized text</P>
</BODY>
</HTML>
EOF
__END__


Make special note:
There are 2, yes 2, \n characters after the content-type.  Otherwise,
you will get 'premature end of script headers'.

Doing a search of dejanews (which you obviously are familiar with) will
result in some other resources for dealing with cgi scripts.  Search for
'idiot's guide', and you should find several helpful answers from Tom
Phoenix that contain many links to things you will want to bookmark,
read, and be enlightened by.

> 
> Please send me back any help to smithj@statenislandonline.com
Only because you asked politely, and didn't munge your email address.

Generally, post to newsgroup, read reply on newsgroup.

> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

Cheers,
Dave

-- 
Dave Barnett	Software Support Engineer	(281) 596-1434


Don't sweat the petty things, and don't pet the sweaty things.


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

Date: Thu, 05 Nov 1998 11:20:41 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Can someone please help me I installed redhat 5.1 with apcahe. Each time I try to access my test.cgi script and I get the following error:
Message-Id: <3641DE69.F1ABEC34@email.sps.mot.com>

smithj@statenislandonline.com wrote:
> 
> Can someone please help me I installed redhat 5.1 with apcahe.  Each time I
> try to access my test.cgi script and I get the following error:

No, this is a Perl newsgrp.

In any case, you have posted the longest subject line I have seen on any
newsgroup. Well done.

-tk


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

Date: Thu, 05 Nov 1998 17:55:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Can someone please help me I installed redhat 5.1 with apcahe. Each time I try to access my test.cgi script and I get the following error:
Message-Id: <Pine.GSO.4.02A.9811050955180.3759-100000@user2.teleport.com>

On Thu, 5 Nov 1998 smithj@statenislandonline.com wrote:

> 127.0.0.1, reason: Premature end of script headers

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

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



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

Date: Thu, 5 Nov 1998 10:26:30 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: FAQ: Do they exist?
Message-Id: <1di0n6c.6n7dg41np8n40N@dcepf5.harvard.edu>

You're standing on it!  Do a search on "fork win32 perl" in deja-news to
see the discussions.  You'll need to check the "past" database, instead
of the "recent".

-James
<ljkbrost@my-dejanews.com> wrote:

> 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


-- 
 James Peregrino                                 (617)496-6288 (v)
 Manager of Comp. Services                       (617)495-5685 (f)
 Harvard Div. Cont. Ed.
 james_peregrino@harvard.edu


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

Date: 05 Nov 1998 14:03:14 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: File Locking and Flushing
Message-Id: <910274560.15540@thrush.omix.com>

Bill Moseley <moseley@best.com> wrote:
	>snip<
: When I close the file I:
:     flock($fh,LOCK_UN);
:     close $fh;

	Just close(), don't unlock.

: 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.

: Like so many others, I'm new to all this:  Is setting $| = 1 before my print 
: enough to force flushing the buffer to the file,

	Only if the handle to your file is currently selected.  By default,
	STDOUT is selected so setting $| would have no effect on your output
	file.

: or do I need to be more specific like:
:     use IO::Handle;
:     open(FH, ">myfile");
:     FH->autoflush(1);
: And if so, what's the difference, 

	FH->autoflush(1) is the same as:

	{ my $oldFH = select FH; $|++; select $oldFH; }

: and why so many ways to set nonbuffered output?

	So many?  Two that I know of.  autoflush() is just cleaner to use
	then the code I showed above for most cases, however it does require
	you to load a thousand or so lines of code (IO::Handle and friends)
	to get that "cleanness".

: What if I just don't call flock($fl,LOCK_UN) at all.  Would the close then 
: flush, and then close and unlock?

	Yep.  Forget LOCK_UN exists unless you need to be locking and
	unlocking a filehandle many times in the life of a program (read:
	not very often).

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Thu, 05 Nov 1998 17:25:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Having problems with a long script
Message-Id: <Pine.GSO.4.02A.9811050924580.3759-100000@user2.teleport.com>

On 4 Nov 1998, Kris (Menace Publishing & Manufacture) wrote:

> Having problems with a very long script -- getting the error message it
> generates tells me it's due to "Premature end of script headers". 

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

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



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

Date: Thu, 5 Nov 1998 06:29:35 -0800
From: "Rusty Williamson" <rwilliamson@uno.gers.com>
Subject: Help on $^0...
Message-Id: <_Ai02.94$DA6.19787@news.connectnet.com>

Why doesn't print "$^0"; work?  Why do I have to use print eval "$^O";?

Rusty






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

Date: Thu, 05 Nov 1998 11:05:14 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Rusty Williamson <rwilliamson@uno.gers.com>
Subject: Re: Help on $^0...
Message-Id: <3641DACA.706DA57@houston.Geco-Prakla.slb.com>

[courtesy cc to cited author]

Rusty Williamson wrote:
> 
> Why doesn't print "$^0"; work?  Why do I have to use print eval "$^O";?
In what way doesn't it work?  What does it print?  What do you expect it
to print?
What OS are you running?  Do you get an error message?

A little more information than 'it doesn't work' would be helpful.

perl 5.005_02 on solaris 2.5.1 prints 'solaris' for me, using either
method, although perl warns about an unquoted string using the second
method.

> 
> Rusty

Dave

-- 
Dave Barnett	Software Support Engineer	(281) 596-1434


If you make it idiot proof, they'll just make a better idiot.


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

Date: Thu, 05 Nov 1998 17:52:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help on $^0...
Message-Id: <Pine.GSO.4.02A.9811050950520.3759-100000@user2.teleport.com>

On Thu, 5 Nov 1998, Rusty Williamson wrote:

> Why doesn't print "$^0"; work?  Why do I have to use print eval
> "$^O";?

I don't think you want the eval there. But maybe your problem has to do
with the fact that zero is not the letter O. Hope this helps!

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



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

Date: Thu, 05 Nov 1998 17:48:05 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help on a Webmail....
Message-Id: <Pine.GSO.4.02A.9811050945090.3759-100000@user2.teleport.com>

On Thu, 5 Nov 1998, Rodrigo Garcia Marques wrote:

> I need to read messages from a popper/sendmail server running in a
> linux 2.0.35 machine.

There is at least one module on CPAN which could help you to do this.

> 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.

Maybe your program isn't really running set-id. Check the $> variable to
be sure. 

> Another guy told me that the pop3d deamon, will, hinself, authenticate
> the user and retrieve his messages for me.

Yes; your POP client shouldn't need to be set-id. Having the proper
password is all that it should need. 

Hope this helps!

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



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

Date: Thu, 05 Nov 1998 17:06:47 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <Pine.GSO.4.02A.9811050905060.3759-100000@user2.teleport.com>

On Thu, 5 Nov 1998, Dave Barnett wrote:

> 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 "");

It's good to use a full path, but doing that won't actually help with the
insecure $PATH problem at hand. But perlsec will tell you what to do.
Cheers!

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



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

Date: 5 Nov 1998 17:35:24 GMT
From: rsc@snipe.scd.ucar.edu (Robert S. Campbell)
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <71snks$2l0$1@ncar.ucar.edu>


Well, I got the PATH fixed with:

$ENV{'PATH'} = '/bin:/usr/bin';
$path = $ENV{'PATH'};

However, now it gives me:
Insecure dependency in piped open while running setuid at /usr/local/bin/k1580 line 207.

and, of course, as I mentioned, the piped open is:
open (STDOUT, "|lp -d $printer") unless ($printer eq "");

I went ahead and change "lpr -P" to "lp -d" since lpr was just a link anyway.
However, since lp is setuid root under Solaris 2.6, it appears that perl
doesn't like piping and open to something that's setuid.  
The pipe example in perlsec(1) mentions: 
         open(FOO,"echo $arg|");     # Not OK, but...
         open(FOO,"-|")
             or exec 'echo', $arg;   # OK

So how does that translate to what I'm doing?


Thanks,
Bob Campbell			Unix System Administrator
Scientific Computing Division	National Center for Atmospheric Research
rsc@ucar.edu			(303) 497-1815


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

Date: Thu, 05 Nov 1998 16:04:26 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
To: ajohnson@gatewest.net
Subject: Re: Heterogeneous Data Structures: possible? If so, how?
Message-Id: <71siaa$fb7$1@nnrp1.dejanews.com>

In article <71rimk$85c$1@nnrp1.dejanews.com>,
  ptimmins@netserv.unmc.edu (Patrick Timmins) wrote:

> but you can't have the array case and the hash case together. eg:
>
> $FireWall_Rule[7]{'install'}[0] = "first item"
>    and
> $FireWall_Rule[7]{'service'}{'telnet'} = "Inside Only";

That's not right ... you can ... I was getting errors because I didn't
have the semicolon at the end of the first line ... always actually
*read* the errors that are returned, I guess, or never post after 1:00 am
(I've gotta stop learning in public like this)

So something like this is perfectly fine and safe, and wouldn't
be a problem for use strict (refs) :

$show{'flintstones'}{'lead actor'} = "Fred";
$show{'jetsons'}[0] = "George";

But using string assignment in combination with an array or hash
assignment should probably not be done (and *cannot* be done, if you
'use strict (refs)'), as duplicate items in one of your arrays or
duplicate values in one of your hashes will result in data clobbering :

$show{'flintstones'} = "cartoon";
$show{'jetsons'} = "cartoon";
$show{'flintstones'}{'lead actor'} = "Fred";
$show{'jetsons'}{'lead actor'} = "George";

print "$show{'flintstones'}{'lead actor'}\n";

will print "George"

Patrick Timmins
$monger{Omaha}[0] ... and beginning to see the error of my (former) ways

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 05 Nov 1998 16:19:57 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: images in perl
Message-Id: <Nek02.5278$fS.17051219@news.itd.umich.edu>

In article <36417ec1.64984032@news.online.no>,
Tore Aursand <tore@forumnett.no> wrote:
>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");

Or, even better:

print qq|<IMG SRC="image.gif">\n|;

(Or variants thereof.)

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: 05 Nov 1998 17:25:04 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: images in perl
Message-Id: <83r9vi3y5b.fsf@vcpc.univie.ac.at>

Re: images in perl, Sean
<mcafee@waits.facilities.med.umich.edu> said:

Sean> In article <36417ec1.64984032@news.online.no>, Tore
Sean> Aursand <tore@forumnett.no> wrote:
>> 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");

Sean> Or, even better:

Sean> print qq|<IMG SRC="image.gif">\n|;

Or even better still

    use CGI;

    print img({src => 'image.gif', alt => '...'});

But wasn't the original question about server-side
production of GIFs for insertion into an IMG cell?

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: Thu, 05 Nov 1998 17:18:46 GMT
From: tbhanson@startribune.com
Subject: indenting perl elsif clauses in emacs
Message-Id: <71smlm$mnc$1@nnrp1.dejanews.com>

Hmmm, can anyone explain how to get emacs in perl mode to indent elsif clauses
like this:

  if (x) {
    a;
  } elsif (y) {
    b;
  } else {
    c;
  }

as opposed to something like this (which I'm now getting):

  if (x) {
      a;
    } elsif (y) {
             b;
      } else {
            c;
         }

I'd be grateful!

--Tim Hanson

p.s. I tried asking this in an emacs group, but got no bites.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 05 Nov 1998 16:37:02 +0100
From: Pieter Masereeuw <masereeuw@rulxha.leidenuniv.nl>
Subject: Isolating Perl regex calls for use in C programs
Message-Id: <3641C61E.781B4406@rulxha.leidenuniv.nl>

Dear All,

I would like to use Perl regular expressions in my C application.

I would like to do this more or less with the Posix approach:
 . compile pattern (regcomp())
 . do the matching (regexec())
 . on error: call regerror()
 . free stuff (regfree())

I would like to avoid the strategy as defined in the perlembed
document; also, spawning perl as a subprocess is too expensive.
Finally, I know of the splash library - it does not seem to have Perl
regular expressions - it just has the code by Henri Spencer.

Taking out the source of regcomp.[ch] and regexec.[ch] seems to
be the only approach, but then I will have to deal with calls to
other parts of Perl, esp. when errors occur.

Has some already done this? Any pointers in the right direction
will be greatly appreciated.

Pieter Masereeuw
Institute for Dutch Lexicology


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

Date: 5 Nov 1998 16:21:13 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Isolating Perl regex calls for use in C programs
Message-Id: <71sj9p$1c2@mercury.adc.com>

In article <3641C61E.781B4406@rulxha.leidenuniv.nl>,
Pieter Masereeuw  <masereeuw@rulxha.leidenuniv.nl> wrote:
>Dear All,
>
>I would like to use Perl regular expressions in my C application.

There's a C library called pcre (Perl Compatible Regular Expressions)
by Philip Hazel.  You can find it at:

  ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/

I haven't used it myself... I write VERY little C these days... but
have heard good things about it.

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Thu, 5 Nov 1998 07:15:51 -0800
From: "Rusty Williamson" <rwilliamson@uno.gers.com>
Subject: More help on $^0...
Message-Id: <mgj02.95$DA6.19951@news.connectnet.com>


In addition, I can't seem to test $^0:

if ( $^0 eq "MSWin32" ) {
 ...
}

or assign it:

oS=$^0;

What I'm I doing wrong?

Thanks,
Rusty




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

Date: Thu, 05 Nov 1998 12:51:51 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: More help on $^0...
Message-Id: <alecler-0511981251510001@dialup-693.hip.cam.org>

In article <mgj02.95$DA6.19951@news.connectnet.com>, "Rusty Williamson"
<rwilliamson@uno.gers.com> wrote:

> In addition, I can't seem to test $^0:
> 
> if ( $^0 eq "MSWin32" ) {
> ...
> }

Check if $^O contains "win":

   if ($^O =~ /win/i) {  }


> or assign it:
> 
> oS=$^0;

You're assigning to a bareword...
 
HTH,
Andre


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

Date: Thu, 05 Nov 1998 09:23:01 +0100
From: Martijn Faassen <faassen@vet.uu.nl>
Subject: Re: Not to start a language war but..
Message-Id: <36416065.70DBABFC@vet.uu.nl>



Alastair wrote:
> 
> Hoon Yoon <hyoon@bigfoot.com> wrote:
> >How do I get rid of this thread only from Netscape Discussion? I do not
> >want to see old articles anymore clogging up my window. Just every other
> >discussion is about this and it's comming down to a slugging match.
> >Sigh...
> 
> I had this problem in Netscape too, a long time ago. I switched news readers.

I haven't used Netscape until recently, but it seems to be possible to
do
a right click in windows, and then it has an option 'ignore thread' (key
K). Looks like it has killfiles now (in 4.5.).

Martijn


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

Date: Thu, 05 Nov 1998 10:08:50 -0500
From: "Garrett G. Hodgson" <garry@sage.att.com>
Subject: Re: Not to start a language war but..
Message-Id: <3641BF82.A4C02904@sage.att.com>

Tom Christiansen wrote:

> :My point is that Perl is
> :not very good at handling data because it can't handle arbitrary structures
> :very well.
> :Don't get me wrong: it handles them, all you have to do is work with it.
> 
> I dunno.  I write things like
> 
>     $tv_show{"Flintstones"}{"kids"}[0]{"age"}++

ouch.  i think this may be key to this discussion,
the difference between abstracting out the mechanisms,
as in class hierarchies and exceptions, vs. constructing
the same behavior via primitive operations.

> Or even the classic linked-list traversal:
> 
>     for ($node = $head; $node; $node = $node->{LINK}) {
>         printf "I am %d.\n", $node->{VALUE};
>     }

i guess when i think data structures, i'm thinking more about higher
level constructs like those in the Gang of Four design patterns book.
something like the Visitor pattern, f'rinstance.

-- 
Garry Hodgson			and when they offer
garry@sage.att.com		golden apples
Software Innovation Services	are you sure you'll refuse?
AT&T Labs			heaven help the fool.


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

Date: Thu, 05 Nov 1998 12:10:33 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3641DC09.78F90E4E@min.net>

John Edstrom wrote:
> Circular refs are also used to build character.

Circular refs are very much like the next sentence.
They can also be rather like the previous sentence.

John Porter


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

Date: Thu, 05 Nov 1998 12:25:02 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3641DF6E.67E29EF2@min.net>

Garrett G. Hodgson wrote:
> 
> Tom Christiansen wrote:
> > I dunno.  I write things like
> >     $tv_show{"Flintstones"}{"kids"}[0]{"age"}++
> 
> ouch.  i think this may be key to this discussion,
> the difference between abstracting out the mechanisms,
> as in class hierarchies and exceptions, vs. constructing
> the same behavior via primitive operations.

Any decent language (e.g. Python and Perl) lets you do both/either.


> > Or even the classic linked-list traversal:
> >
> >     for ($node = $head; $node; $node = $node->{LINK}) {
> >         printf "I am %d.\n", $node->{VALUE};
> >     }
> 
> i guess when i think data structures, i'm thinking more about higher
> level constructs like those in the Gang of Four design patterns book.
> something like the Visitor pattern, f'rinstance.

That's all well and good, considering you didn't ask the question
to which Tom C was responding.

wtanksle@cx930311-b.ocnsd1.sdca.home.com (William Tanksley) wrote:
> My point is that Perl is not very good at handling data because
> it can't handle arbitrary structures very well.

And by "arbitrary data structures" he apparently meant:

> any data structure you want.  Classes, tuples, hashes, you name it.
> Even functions...

And of course, this what most people mean when they say "data structures".
Perl is quite capable of handling these things.

As for "higher level constructs", like Patterns, Perl is more than
adequate (if not entirely ideal) as an implementation language.

John Porter


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

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

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