[6959] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 584 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 7 03:17:56 1997

Date: Sat, 7 Jun 97 00:00:29 -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           Sat, 7 Jun 1997     Volume: 8 Number: 584

Today's topics:
     Re: any editor for perl? (Bob Apthorpe)
     Re: any editor for perl? (Paul)
     Arrays of file handles? <andrew@squiz.co.nz>
     Re: Arrays of file handles? (Michael Fuhr)
     Re: call perl script from c program? (ma)
     Re: Case Conversion <rootbeer@teleport.com>
     Re: Case Conversion (Tad McClellan)
     Re: Comparing large files. <rootbeer@teleport.com>
     Re: Comparing large files. (Abigail)
     Re: CORBA Perl mapping? <balin@earthlink.net>
     Count lines in file:which is fastest? (P.M.Wong )
     Re: delete lines directly from file <david.s.patterson@boeing.com>
     Re: File glob works as root, but fails as regular user  <dglaser@intercall.net>
     Re: filehandle problem <rootbeer@teleport.com>
     Re: filehandle problem (Abigail)
     HELP Requested <gregr@spiritone.com>
     Re: help! CGI ignorant! (Abigail)
     Re: How to administer Windows NT Server via Perl <los94@neosoft.com>
     NT 4.0 non blocking serial IO or # characters in input  <jack@picksys.com>
     Re: Open and print HTML file insside CGI script <andrew@squiz.co.nz>
     Re: Perl Patterns for CGI <rootbeer@teleport.com>
     Re: Perl Patterns for CGI (Abigail)
     Perl:Error using sysopen,why? (P.M.Wong )
     Problem compiling OraPerl (2build4) on HP-UX 10.01 (Zoran Cvetkovic)
     Re: simple question about running system programs from  (Andrew M. Langmead)
     Re: use of quotes in here doc tag (Chipmunk)
     Re: use of quotes in here doc tag (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 07 Jun 97 01:08:32 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: any editor for perl?
Message-Id: <5nacai$lr1@news.jump.net>

In article <gerlachEB9C3G.G81@netcom.com>,
   gerlach@netcom.com (Matthew H. Gerlach) wrote:
>>Dont waste your time on vi.  
>
>I'm old fashioned in that I believe 10 fingers is more effecient editing
>than one hand with a mouse.  I work with a bunch of people who gui type
>of editors, and I'm always amazed how long it takes them to navigate
>through all the "intuative" menus and stuff.
>
>In the end, enjoy the fact there are choices; find the one you like that
>serves your specific needs.  For me, my needs are best met with vi.

I'm surprised that nvi hasn't received any mention, considering its support 
for perl and tcl as macro languages. Also, if you use a Mac (for whatever 
reason) BBEdit is a fantastic editor. Or as their marketing people so 
concisely put it: "BBEdit Doesn't Suck".

Vi isn't a particularly good editor for those whose brains haven't been 
previously damaged by its interface. Emacs suffers from the same problem and 
comparing the two is mostly pointless. I don't particularly like vi, but 1) I 
was forced to use it a long time ago when there weren't any alternatives 
(well, none that my CS department was willing to investigate), 2) given a host 
of crappy unix editors, I stick with the devil I know, 3) I could never get 
the hang of emacs (Ctrl-Esc-Esc-Backspace-Toilet_Seat...), and 4) I trust vi 
to simply mangle my text on a wrong keystroke, not wipe my filesystem, 
refinance my house, make large political contributions on behalf of dead 
relatives, drive while intoxicated or consort with demons, all of which (I 
suspect) emacs could perform with an accidental Meta-Meta-Keystroke.

Your mileage may vary,

Bob


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

Date: Sat, 07 Jun 1997 01:46:38 GMT
From: paul@flexsol.co.nz (Paul)
Subject: Re: any editor for perl?
Message-Id: <5nai7t$r69$1@newsource.ihug.co.nz>


>
>I'm surprised that nvi hasn't received any mention, considering its support 
>for perl and tcl as macro languages. Also, if you use a Mac (for whatever 
>reason) BBEdit is a fantastic editor. Or as their marketing people so 
>concisely put it: "BBEdit Doesn't Suck".
>

Is NVI available for Win95 and if so where does one get it



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

Date: Sat, 07 Jun 1997 18:18:59 +1200
From: "Andrew McNaughton" <andrew@squiz.co.nz>
Subject: Arrays of file handles?
Message-Id: <andrew-0706971818590001@banjo.actrix.gen.nz>


I've got a set of configuration files to manage.  I want to run over a set
of them and append some new details.

I'd like to be able to keep the file handles open and append to them in
random order as appropriate.

How do I do this?

I can make an array of scalars, but apparently not of file handles.  I
suppose I could kludge something together using eval to reference the names
of file handles, but this seems clumsy, and I figure there should be another
way.

Any suggestions?

Andrew McNaughton


Check out the newsroom: http://www.newsroom.co.nz
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 
      S                       GRAPHICS
       Q                     HTML
        U                   CGI            Andrew McNaughton
         i                JAVA            Andrew@SQUiZ.co.nz
          Z              VRML         http://www.squiz.co.nz

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


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

Date: 7 Jun 1997 00:50:27 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Arrays of file handles?
Message-Id: <5nb0bj$atu@flatland.dimensional.com>

"Andrew McNaughton" <andrew@squiz.co.nz> writes:

> I can make an array of scalars, but apparently not of file handles.  I
> suppose I could kludge something together using eval to reference the names
> of file handles, but this seems clumsy, and I figure there should be another
> way.

See the Perl FAQ:

    http://www.perl.com/perl/faq/

You'll have to look around a bit, but the answer is there.

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: 7 Jun 1997 04:20:19 GMT
From: ma@maths.uwa.edu.au (ma)
Subject: Re: call perl script from c program?
Message-Id: <ma-0706971221090001@mac89.maths.uwa.edu.au>

> > I have two cgi programs, one written in c, another in perl.  Now, the C
> > program needs to use a subroutine in the perl script.  Is it possible to
> > call the perl script in the c program?    
> 
>       Type 'perldoc perlembed' at your prompt for instruction.
> 
============================

Be very grateful if you could tell me which platform and which compiler I
should use in order to get the above instruction.

Thanks in advance.

-- 
======================
ma@maths.uwa.edu.au
This article reflects my personal opinion only.
======================


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

Date: Fri, 6 Jun 1997 19:29:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Dipti V. Sonak" <dsonak@us.oracle.com>
Subject: Re: Case Conversion
Message-Id: <Pine.GSO.3.96.970606192316.6604D-100000@kelly.teleport.com>

On Fri, 6 Jun 1997, Dipti V. Sonak wrote:

> I have a mixed case string and I want to reverse the case of the
> characters in the string. 

This is homework, isn't it? You would never need this in the real world,
so far as I can see.

Here's a method which should work even with accented characters, if
they're supported on your system.

    $new = join '', map { &revcase($_) } split //, $old;
    sub revcase { 
	my $ch = shift; 
	return uc($ch) if $ch eq lc($ch);
	lc($ch);
    }

Hope this helps!	

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Fri, 6 Jun 1997 23:28:16 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Case Conversion
Message-Id: <01oan5.suf.ln@localhost>

Dipti V. Sonak (dsonak@us.oracle.com) wrote:
: I have a mixed case string and I want to reverse the case of the
: characters in the string. 

: For example : 

: Input String : pErL
: Output String : PeRl

: What is the best way to do this ? 


tr/a-zA-Z/A-Za-z/;


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Fri, 6 Jun 1997 19:21:27 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter Kennis <pkennis@inetnow.net>
Subject: Re: Comparing large files.
Message-Id: <Pine.GSO.3.96.970606192101.6604B-100000@kelly.teleport.com>

On Fri, 6 Jun 1997, Peter Kennis wrote:

> Two files containing 30.000 or more lines, I would like to 
> find all lines from file1 that do not exist in file2.
> I know there are a lot of ways to do this but I'd like to find 
> one that is not to CPU intensive....
> Both files are sorted alike so record 1 from file 1 should also 
> be record 1 in file 2

You might be able to use the Unix diff utility. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Sat, 7 Jun 1997 04:40:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Comparing large files.
Message-Id: <EBE2BJ.9E6@nonexistent.com>

Tom Phoenix (rootbeer@teleport.com) wrote on 1376 September 1993 in
<URL: news:Pine.GSO.3.96.970606192101.6604B-100000@kelly.teleport.com>:
++ On Fri, 6 Jun 1997, Peter Kennis wrote:
++ 
++ > Two files containing 30.000 or more lines, I would like to 
++ > find all lines from file1 that do not exist in file2.
++ > I know there are a lot of ways to do this but I'd like to find 
++ > one that is not to CPU intensive....
++ > Both files are sorted alike so record 1 from file 1 should also 
++ > be record 1 in file 2
++ 
++ You might be able to use the Unix diff utility. Hope this helps!


Maybe, but maybe not.

Anyway, since both files are sorted, we can solve this problem
in O (k (n + m)) time, with k the maximum length of a line,
and n and m the file lengths in lines.


Here's an (untested) algorithm:

open FILE1, "file1" or die "Yikes: $!";
open FILE2, "file2" or die "Yikes: $!";
open OUT,  " > out" or die "Yikes: $!";

my $line1 = <FILE1>;
my $line2 = <FILE2>;

while (defined $line1 && defined $line2) {
    $line1 lt $line2 and do {
        # $line1 cannot appear in file2.
        print OUT $line1;
        $line1 = <FILE1>;
        next;
    };
    $line1 gt $line2 and do {
        # $line2 cannot match anything in file1.
        $line2 = <FILE2>;
        next;
    };
    # Must be equal
    $line1 = <FILE1>;
    # Bonus points: - Why are we not reading from file2 at this point?
    #               - Under which condition(s) can we read from file2?
}
print OUT $line1, <FILE1> if defined $line1;

close OUT; close FILE2; close FILE1;


Extra bonus point: Define an appropriate loop invariant.


Abigail, still wondering what the Perl aspect of the question was.
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: Fri, 06 Jun 1997 23:58:19 -0400
From: "John D. Lewis" <balin@earthlink.net>
Subject: Re: CORBA Perl mapping?
Message-Id: <3398DC5B.4494@earthlink.net>

Wil Evers wrote:
> 
> Yiu Pang <robpang@cs.Stanford.EDU> wrote in article
> <5n7js0$ir5$1@Radon.Stanford.EDU>...
> 
> > I am currently looking for CORBA Perl mapping and I have found one done
> by
> > Bart Schuller.  His is quite good.
> 
> Where can I find it?  We have quite a bit of Perl stuff over here that
> could benefit from connecting to Corba.
> 
> Do you know of any Perl stub compiler for it?
> 
> Thanks in advance,
> 
> - Wil

Take a look at http://www.lunatech.com/cope/ and
http://www.lunatech.com/cope/topics/hp-corba-perl.html. There isn't a
name easily accessible on the first page, but the second URL (listed on
the first) is labeled "Earlier work by Evan Kirshenbaum of HP"

Hope this helps,
John


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

Date: 7 Jun 1997 02:52:02 GMT
From: s11976@ctsc.hkbc.hk (P.M.Wong )
Subject: Count lines in file:which is fastest?
Message-Id: <5naici$auo$1@power42t.hkbu.edu.hk>

I've found that there are quite a few ways to get the no  of lines
in a text file, such as:
1. from the Perl FAQ
  $nl = 0;
   open (FH, $filespec);
   while (sysread FH, $buffer, 4096) {
    $nl += ($buffer =~ tr/\n//);
    }
    close FH
2. Simply get the scalar quantity from the array,
   @lines = <FH>;
   $nl = @lines;
3. Count it myself
  $nl = 0;
  while (<FH>) {
   $nl++:
   }
   
 Say my file is fairly long, (though each line is just one 8char. field)
 , i 'm interested to know which of the above evaluates no. of lines
 fastest?
 BTW, for method 1, how does the parameter 4096 depends on (i.e. any formula
 to calculate the best no. ) the no. of bytes in  my file so that
 i could get the fastest  response back?

--
        __
   / \_/  )             __   Pui Ming WONG (E-mail: pm@hkbu.edu.hk) 
  /      ( -------------  }  System Support Programmer, 
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University 
   \_/ \__)                  224 Waterloo Road, Hong Kong  


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

Date: Thu, 5 Jun 1997 23:40:12 GMT
From: "David S. Patterson" <david.s.patterson@boeing.com>
Subject: Re: delete lines directly from file
Message-Id: <33974E5C.ABD@boeing.com>

Pui Ming WONG wrote:
> 
> I would like to know if the way to delete a line from an
> OPENed file.
> 

Ditto what everyone else said.  Note that if you absolutely
must modify the original file, you could:

a) Edit it in memory, close it, delete it, reopen it and 
   re-write to it from memory;

b) Open it as a random access file (possibly even with a
   block size of 1) and null out the data to be deleted.
   (This seems like a very ugly solution, but possible).
-- 
"Error:  Keyboard not attached.  Press any key to continue..."

     David S. Patterson, Sr. Software Engineer
     Production Illustration Systems  (206) 865-3176
     david.s.patterson@boeing.com   Mail Stop: 7J80


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

Date: Sat, 07 Jun 1997 01:15:03 -0400
From: David Glaser <dglaser@intercall.net>
Subject: Re: File glob works as root, but fails as regular user (?)
Message-Id: <3398EE55.42C89134@intercall.net>

Tom Phoenix wrote:

> On Wed, 4 Jun 1997, David Glaser wrote:
>
> > The file glob for "*.secret" works perfect when I'm su to root,
> and I
> > can print the filenames returned, etc...,
> > but if I'm my normal non-root user I get a message:
> >
> > sh:  /dev/null: permission denied
>
> That globbing is normally implemented by calling the csh (for
> technical
> reasons). Maybe you don't have csh, so your perl is calling /bin/sh
> instead? Maybe something is misconfigured on your system, so perl
> can't
> call that program the way it likes?
>
> Try this command, which (I hope) will tell us more about your
> system. It's
> okay if some of these aren't found. If your ls won't accept the L
> argument, try leaving it off.
>
>     ls -lL /bin/sh /bin/csh /bin/tcsh /dev/null
>
> Also, use this one, which should tell us lots about how perl
> _thinks_ your
> system is configured.
>
>     perl -V
>
> Good luck!
>
> -- Tom Phoenix        http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
> Randal Schwartz Case:     http://www.lightlink.com/fors/

Here's the command output you asked for, Tom.
Thanks for looking at this.

   ls -lL /bin/sh /bin/csh /bin/tcsh /dev/null
-rwxr-xr-x   1 root     bin        234756 Apr 27  1996 /bin/csh*
-rwxr-xr-x   1 root     bin        279176 Sep 10  1996 /bin/sh*
-rwxr-xr-x   1 root     bin        234756 Apr 27  1996 /bin/tcsh*
crw-r--r--   1 root     sys        1,   3 Oct 23  1996 /dev/null

 perl -V
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=linux, osver=2.0.0, archname=i586-linux
    uname='linux darkstar 2.0.0 #1 mon jun 10 21:32:38 cdt 1996 i586 '
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.7.2
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=4, usemymalloc=n, randbits=31
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    libc=/usr/lib/libc.so, so=so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

@INC: /usr/lib/perl5/i586-linux/5.003 /usr/lib/perl5
/usr/lib/perl5/site_perl/i586-linux /usr/lib/perl5/site_perl .



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

Date: Fri, 6 Jun 1997 19:22:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mauroidis Giannis <maurog@csi.forth.gr>
Subject: Re: filehandle problem
Message-Id: <Pine.GSO.3.96.970606192154.6604C-100000@kelly.teleport.com>

On Sat, 7 Jun 1997, Mauroidis Giannis wrote:

> Is there any way i can return a filehandle from a child process tou
> its father so that the father can access it like <$filehandle> ??
> I tried to pipe it to the father but didn't work..

You can't send filehandles from one process to another, as far as I know.
Sorry!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Sat, 7 Jun 1997 04:49:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: filehandle problem
Message-Id: <EBE2qz.AJH@nonexistent.com>

Tom Phoenix (rootbeer@teleport.com) wrote on 1376 September 1993 in
<URL: news:Pine.GSO.3.96.970606192154.6604C-100000@kelly.teleport.com>:
++ On Sat, 7 Jun 1997, Mauroidis Giannis wrote:
++ 
++ > Is there any way i can return a filehandle from a child process tou
++ > its father so that the father can access it like <$filehandle> ??
++ > I tried to pipe it to the father but didn't work..
++ 
++ You can't send filehandles from one process to another, as far as I know.
++ Sorry!

p 348 of the Camel disagrees.

    It's probably the safest to assume broken System V semantics for
    signals and to stick with simple TCP and UDP socket operations; for
    example, don't try to pass open file descriptors over a local UDP
    datagram socket if you want your code to stand a chance of being
    portable. (Yes, you can really do that on some machines -- see BSD
    in the Glossary.) [1]

I'm not going to say this is the method to go, but always when I
see "can't", I think "Oh yeah?". Of course, the camel might be
wrong.


[1] Look it up, it's fun.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: Fri, 06 Jun 1997 19:33:24 -0700
From: Greg Robbins <gregr@spiritone.com>
Subject: HELP Requested
Message-Id: <3398C874.5F46@spiritone.com>

Greetings All,
I need help in locating Perl 4.0/5.0 for a Windows 3.11 machine. I have
found locations on the Web with Perl files but none were clear in which
files I needed and which files were for Win 3.11. I would appreciate any
help in finding out which files I need and where they are located.

Greg Robbins


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

Date: Sat, 7 Jun 1997 05:24:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: help! CGI ignorant!
Message-Id: <EBE4Cw.EHJ@nonexistent.com>

Sam Fulton (hogsauce@wwa.com) wrote on 1375 September 1993 in
<URL: news:33981C91.5F9A@wwa.com>:
++ howdy.
++ 
++ I'm doing web design for an advertising company, and one of their clients
++ wants a deal 
++ whereby in order for a person visiting their site to get to certain
++ places, they must first fill out 
++ a form for submission.  This form will ask for such info as e-mail addys,
++ and stuff like that.

Please do your customer a favour and learn a little about the net.
CGI questions have their own newsgroup: comp.infosystems.www.authoring.cgi.

And please do the people who might answer your question a favour
and stick to lines < 74 characters. (Yeah, yeah, yeah, it works
in Nutsexploder, but people answering your question use a real
newsreader.)



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: Fri, 06 Jun 1997 23:02:34 -0500
From: los94 <los94@neosoft.com>
Subject: Re: How to administer Windows NT Server via Perl
Message-Id: <3398DD5A.A04@neosoft.com>

Spiro Angeli wrote:
> 
> Hello,
> 
> I am looking for some literate material and/or software that can teach
> me how to administer the NT Server such as add users, create
> directory, share, security, modify/add/delete registry entry, and
> several other features.
> 
> If any has some info or knows a book that talks about this topic could
> please let me know. It has been a nightmare for me to look for these
> info.
> 
I am also in search of this info.  I wrote a mini-script to create a
bunch of directories at once, but do not know how to set permissions. 
Please help!  Thanks in advance.....

Larry


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

Date: 6 Jun 1997 20:49:00 -0700
From: Jack Roth <jack@picksys.com>
Subject: NT 4.0 non blocking serial IO or # characters in input buffer
Message-Id: <3398DAC0.6CC@picksys.com>

I have two system talking through a serial port.
I need to either do a non-blocking sysread or confirm there
are characters in the input buffer waiting to be read before
the sysread is actually performed.

Anyone have any ideas?

jack@picksys.com


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

Date: Sat, 07 Jun 1997 18:55:01 +1200
From: "Andrew McNaughton" <andrew@squiz.co.nz>
Subject: Re: Open and print HTML file insside CGI script
Message-Id: <andrew-0706971855010001@banjo.actrix.gen.nz>

In article <338d9825.1132556@saluki-news.siu.edu>, ddutta@siu.edu (Deepak
Dutta) wrote:

>for each $filein (@filein) {
>  print $filein;
>}

Nope.  That should be foreach with no space, and can be more simply written
by making implicit use of $_

foreach (@filein) {print};



Andrew McNaughton



--
Check out the newsroom:  http://www.newsroom.co.nz
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
Andrew McNaughton         |       I tried to make it idiot proof,
Andrew@squiz.co.nz        |       but they just developed a  
http://www.squiz.co.nz    |       better idiot

 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .


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

Date: Fri, 6 Jun 1997 19:19:16 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Iles <thuja@internauts.ca>
Subject: Re: Perl Patterns for CGI
Message-Id: <Pine.GSO.3.96.970606191219.6604A-100000@kelly.teleport.com>

On Fri, 6 Jun 1997, Michael Iles wrote:

> CGI requires an interesting model as all output must be
> buffered until after any processing that might fail.

I think you mean that your CGI script shouldn't start producing output
that might become, after further processing, invalid. Or, in other words,
it should decides what it's going to say before it starts to say it.

> Do any of the modules explicitly support buffering a page
> in memory before displaying it?

Not that I've seen, but you can certainly save up their output, as you've
been doing. 

I usually write the script to figure everything out first, then generate
the page. That works for me. :-)

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Sat, 7 Jun 1997 05:09:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Patterns for CGI
Message-Id: <EBE3nz.Cun@nonexistent.com>

Michael Iles (thuja@internauts.ca) wrote on 1375 September 1993 in
<URL: news:339868B0.4B58@internauts.ca>:
++ (I've probably lost most of my hoped-for readership by mentioning the
++ three hated letters...)
++ 
++ I've been working in Perl for a while and am just starting to get into
++ CGI programming. CGI requires an interesting model as all output must be
++ buffered until after any processing that might fail.

Unless they changed something about the protocol behind my back, it
doesn't. Do you have a reference to back up your claim?

Ever heard for instance about nph- cgi-programs? Where the server
promises the program not to buffer any output?

++ It seems to me that the obvious 'pattern' one would employ is to buffer
++ all the output until the end, in case an error requires an error screen
++ to be displayed.

Well, it's obvious you should generate any output before knowing
what to send, but that doesn't mean CGI tells you to buffer all
output.

++ So, my question is this: is this a common approach? Are there
++ alternatives? Do any of the modules explicitly support buffering a page
++ in memory before displaying it?

Normally, you don't want to buffer. For two reasons: 1) it eats 
up your resources, 2) the reader has to wait longer for output.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'


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

Date: 7 Jun 1997 02:38:11 GMT
From: s11976@ctsc.hkbc.hk (P.M.Wong )
Subject: Perl:Error using sysopen,why?
Message-Id: <5nahij$abm$1@power42t.hkbu.edu.hk>

I would like to try out the filelocking as suggested by the Perl FAQ,
so i put the following statements in a perl script.
#!/usr/local/bin/perl
use Fcntl;
sysopen(FH, "filespec", O_RDWR|O_CREAT, 0644);
flock(FH,2)
 ...
 ... etc
But when i run it, it complaint:
Undefined subroutine &main::sysopen
What have i left out in my script

Note: i use AIX 3.2 and Perl5
--
        __
   / \_/  )             __   Pui Ming WONG (E-mail: pm@hkbu.edu.hk) 
  /      ( -------------  }  System Support Programmer, 
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University 
   \_/ \__)                  224 Waterloo Road, Hong Kong  


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

Date: 6 Jun 1997 21:34:18 GMT
From: zcvetkov@gpu1.srv.ualberta.ca (Zoran Cvetkovic)
Subject: Problem compiling OraPerl (2build4) on HP-UX 10.01
Message-Id: <5n9voq$104q$1@pulp.ucs.ualberta.ca>
Keywords: oraperl

We are trying to compile the OraPerl 2build4 using:
	- Perl 4.0.37, and
	- ORACLE 7.3

and there are couple of files missing, which used to be there in ORACLE 7.2, and they are: libocic.a & libora.a .

Trying to compile this without those 2 files, I get a compilation error 
along the lines of:

 - - - - - - - - -
$ make oraperl                                                                  
        cc -g -o oraperl /usr/local/bin/perl-4.036/uperl.o oracle.o orafns.o get
cursor.o colons.o debug.o strtoul.o usersub.o dbug/dbug.o                       
\                                                                               
              -lm `cat /u01/home/oracle/product/7.2.2/rdbms/lib/sysliblist` ./zo
ran/libocic.a /u01/home/oracle/product/7.2.2/lib/osntab.o  /u01/home/oracle/prod
uct/7.2.2/lib/libsqlnet.a  ./zoran/libora.a   /u01/home/oracle/product/7.2.2/lib
/libpls.a  -L/u01/home/oracle/product/7.2.2/lib -lsqlnet -lnlsrtl -lcv6 -lcore -
lnlsrtl -lcv6 -lcore  -lcurses -ltermlib `. /usr/local/bin/perl-4.036/config.sh;
 echo $libs`                                                                    
/bin/ld: Unsatisfied symbols:                                                   
   lxmcpcx (code)                                                               
   lxhcrenv (code)                                                              
   lxlsaved (code)                                                              
 ...
   lmxegks (code)                                                               
   lmsaip (code)                                                                
   debug (data)                                                                 
*** Error code 1                                                                

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

On the other hand, if I use those two files from ORACLE 7.2 in the new 7.3,
I can get the oraperl executable (even though it does not turn out quite right), and running the test on it (make test), I get the following:

$ make test                                                                     
sh: oraperl: cannot execute                                                     
*** Error code 1                                                                
                                                                                
Stop.                                                                           
$ chmod 755 oraperl                                                             
$ make test                                                                     
    1: |   malloc: got ora_debug 34 bytes at 4001eb48                           
    2: <userinit                                                                
    3: >ora_version                                                             
                                                                                
This is Oraperl, version 2, patch level 4.                                      
                                                                                
Debugging is available, including the -D flag.                                  
Default fetch row cache size is 5.                                              
Empty bind values are replaced by a space.                                      
                                                                                
Perl is copyright by Larry Wall; type oraperl -v for details.                   
Additions for oraperl: Copyright 1991, 1992, 1993, Kevin Stock.                 
                                                                                
Oraperl may be distributed under the same conditions as Perl.                   
                                                                                
    4: <ora_version                                                             
Testing oraperl, please wait ...                                                
    1: |   malloc: got ora_debug 34 bytes at 40023248                           
    2: <userinit                                                                
    3: >ora_login                                                               
    4: |   entry: ora_login("A", "scott", "tiger")                              
    5: |   >ora_getlda                                                          
    6: |   |   entry: ora_getlda(void)                                          
    7: |   |   >ora_getcursor                                                   
    8: |   |   |   entry: ora_getcursor(void)                                   
    9: |   |   |   malloc: got a cursor at 0x4002d188                           
   10: |   |   |   malloc: got a csr at 0x40018088                              
   11: |   |   |   exit: returning 0x4002d188                                   
   12: |   |   <ora_getcursor                                                   
   13: |   |   malloc: got hda at 0x4002d808                                    
   14: |   |   exit: returning 0x4002d188                                       
   15: |   <ora_getlda                                                          
   16: |   >set_sid                                                             
   17: |   |   entry: set_sid(A)                                                
   18: |   |   info: setting ORACLE_SID to A                                    
   19: |   <set_sid                                                             
/lib/dld.sl: Unresolved symbol: lxlinit (code)  from ../oraperl                 
sh: 14115 abort                                                                 
*** Error code 134                                                              
                                                                                
 - - - - - -

This unresolved symbol (lxlinit) is one of the items that did not make it in the compilation, as it was listed among numerous others above.
What worries me here, is that this error comes from the /lib directory, 
which would have to do something with the OS, and not necessarily with ORACLE.?

I would really appreciate some input here.

Has anyone made it compiling this at all on HPUX?

thanks.
Zoran.
( Zoran.Cvetkovic@aecd.gov.ab.ca )

	


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

Date: Fri, 6 Jun 1997 21:26:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: simple question about running system programs from with perl.
Message-Id: <EBDI83.Jx1@world.std.com>

Buxx <buxx@buxx.com> writes:

>later perl releases have their own grep

The perl "grep" function isn't the same thing as the unix command
"grep". The perl "grep" function (Which is in releases of perl that
most consider ancient.) takes a list and returns a second list of the
elements of the first list return a true value. The unix command grep
returns the lines of a file which match an regular expression.

-- 
Andrew Langmead


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

Date: 6 Jun 1997 23:56:54 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: use of quotes in here doc tag
Message-Id: <5na846$kco$1@dartvax.dartmouth.edu>

In article <5n9gk4$5t3$1@fddinewz.oit.unc.edu>
sextw@ils.unc.edu (Will Sexton) writes:

> For example:
> 
>         $blah = "blah";
> 
>         print <<'EOF';
>         blah
>         $blah
> EOF
> ;

You don't need that semicolon on the last line.  :-)

Your observation about the quotes is absolutely correct, though.  <<
with single quotes treats the here document as a single-quoted string,
<< with double quotes or no quotes treats the here document as a
double-quoted string, and << with backticks treats the here document as
a list of shell commands.

Chipmunk


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

Date: Fri, 6 Jun 1997 23:22:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: use of quotes in here doc tag
Message-Id: <fmnan5.suf.ln@localhost>

Will Sexton (sextw@ils.unc.edu) wrote:
: I posted a question a few days ago about using here documents.  I got a 
: lot of responses, for which I am grateful, but many of them include what 
: I think is a misconception.  Namely, quotation marks around a the 
: opening tag of the here-doc do not adversely affect the compilation of 
: the program.  



Many said it is somehow bad on the _compilation_, not in its execution?

Adversely how?


: Rather, they force perl to treat the string in the 
: here-doc as it would any string enclosed in quotes.  


That behaviour is documented in the perlvar man page. 

-----------------------
A line-oriented form of quoting is based on the shell "here-doc" syntax.
Following a C<E<lt>E<lt>> you specify a string to terminate the quoted material,
and all lines following the current line down to the terminating string
are the value of the item.  The terminating string may be either an
identifier (a word), or some quoted text.  If quoted, the type of
quotes you use determines the treatment of the text, just as in regular
quoting.  An unquoted identifier works like double quotes.  There must
-----------------------

[snip]

: Whereas:

: 	$blah = "blah";

: 	print <<"EOF";
: 	blah
: 	$blah
: EOF
: ;

: Prints

: 	blah
: 	blah

so does:

--------------
        $blah = "blah";

        print <<EOF;
        blah
        $blah
EOF
--------------

just like it says...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

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

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