[6370] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 992 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 22 13:17:50 1997

Date: Sat, 22 Feb 97 10:00:18 -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           Sat, 22 Feb 1997     Volume: 7 Number: 992

Today's topics:
     @DynaLoader::ISA ERROR message under win32 <achterom@worldaccess.nl>
     Appending to the start of a File? (Guy Saner)
     Re: Appending to the start of a File? (M.J.T. Guy)
     Re: ATTN: EMX Perl users (Perl 5.003_05 for OS/2, Win*  (Steffen Heinrich)
     CGI.pm and perl to C compiler again <drunyan@micron.net>
     Re: dbmopen() dbmclose() using CGI variables (I R A Aggie)
     e5 <alp0@nettuno.it>
     Re: File Locking NOT using flock <tchrist@mox.perl.com>
     Re: for god sake <tchrist@mox.perl.com>
     Re: How do I get a form feed into a document? <jlguru@cris.com>
     Re: How do I get a form feed into a document? <jander@jander.com>
     Re: installing PERL on UNIX through WIN95 sy <rootbeer@teleport.com>
     MIME on Usenet (was: Re: `DATE` function for NT/95) (Tad McClellan)
     Re: Perl array passing (Tad McClellan)
     Re: Perl array passing <rootbeer@teleport.com>
     Re: Perl Mail Client? (Kevin Johnson)
     Re: Perl Software (I R A Aggie)
     Re: piping data through unix command (Neil S. Briscoe)
     Re: really really Simple Question <jander@jander.com>
     Re: Setuid scripts and $0 - Arg! <rootbeer@teleport.com>
     Splitting over multiple lines? (Chris Murray)
     Re: Splitting over multiple lines? (Tad McClellan)
     t1 <alp0@nettuno.it>
     The Disappearing DOS box and cmd32.exe (Gregory Goodwin)
     Re: The Disappearing DOS box and cmd32.exe (Steffen Heinrich)
     Re: The Disappearing DOS box and cmd32.exe (Nathan V. Patwardhan)
     Re: Uploading cgi script (with perl?) (Raul Almquist)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Sat, 22 Feb 1997 16:42:33 +0100
From: Rene Vendrig <achterom@worldaccess.nl>
Subject: @DynaLoader::ISA ERROR message under win32
Message-Id: <330F13E9.2121@worldaccess.nl>

Hello, i'm using perl win32 5.003 (beta) with Win95 and WebSite and the
following errormessage
was generated by perl

Can't locate package AutoLoader for @DynaLoader::ISA at printdatasup.pl
line 3.

what does it mean and what is a possible solution.

The script is as follows:

#!/usr/bin/perl

use SDBM_File;

#dbmopen(%data,$ARGV[0], 0666);
#print $data{$ARGV[1]};

dbmopen(%data,'c:\\website\\period1', 0666);
print $data{'konijn@disney.com'};


period1 is a dbm-file containing user information that have to be
printed in an html-document generated by another perl-script.

with regards,

------->  Rene Vendrig      '                  '
Zuidoostbeemster 0299 430391     Student Interaction Design
rvendrig@xs4all.nl               HKU,Art Media & Technologie
                                 Hilversum 035 3646483
       press ESC to continue...                    <----------


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

Date: Sat, 22 Feb 1997 12:01:39 GMT
From: gs@iscon.demon.co.uk (Guy Saner)
Subject: Appending to the start of a File?
Message-Id: <330edefc.9457033@news.demon.co.uk>
Keywords: *

Hi

I'm trying to get a routine working that opens a text file and appends a line
to the start of it. I would also like it to remove the last line from it as
well. The number of lines in the file will, therefore, be kept constant.
I know I could read it all into an array and then UNSHIFT and POP, but
can you think of a better way to do it.

Thanks
Guy


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

Date: 22 Feb 1997 13:26:27 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Appending to the start of a File?
Message-Id: <5ems63$cvr@lyra.csx.cam.ac.uk>

Guy Saner <gs@iscon.demon.co.uk> wrote:
>
>I'm trying to get a routine working that opens a text file and appends a line
>to the start of it. I would also like it to remove the last line from it as
>well. The number of lines in the file will, therefore, be kept constant.
>I know I could read it all into an array and then UNSHIFT and POP, but
>can you think of a better way to do it.

  perl -pi.bak -e 'BEGIN { $x="line to add\n" }; ($x,$_)=($_,$x)' myfile


Mike Guy


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

Date: Sat, 22 Feb 1997 15:08:09 GMT
From: s581009@tfh-berlin.de (Steffen Heinrich)
Subject: Re: ATTN: EMX Perl users (Perl 5.003_05 for OS/2, Win* and DOS)
Message-Id: <5en26g$e8r@sun04.tfh-berlin.de>

__felbel@csn.net__ (Fred Elbel) wrote:
 ...
>Thanks for the post - it prompted me to review my install. Referring
>to ActiveWare Perl 5.03 for Windows95 (Win32) (Build 302 - Dec. 13,
 ...
>Their command shell is named /Perl/bin/Cmd32.exe
 ...
>So after editing my registry (correctly, this time), pipes and
>redirection now work.  
Are you working with Win95 or NT?

Thank you for that information! After changing the command string of
my .pl-association to

E:\PERL\PERL5\bin\cmd32.exe "Perl.exe %1 %2 %3 %4"

on Win95 I am finally abel to get perl to search it's path by simply
writing "script1.pl script2.pl" onto the Run... - line in the
Startmenue and all modules will be found.
Still, this does _not_ work inside the dos box and I did not figure
out how to execute a piped command like

nsgmls hubdoc.sgm | perl sgmlspl.pl skel.pl > out.pl

since the execution of batch-files seems to be restricted to the
16bit-shell (command.com aka DOS-Box).
Looks like there is no way to do it in a single step in Win95. Any
suggestions anybody?
          Cheers, Steffen




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

Date: Fri, 21 Feb 1997 12:53:37 -0700
From: David Runyan <drunyan@micron.net>
Subject: CGI.pm and perl to C compiler again
Message-Id: <330DFD41.5E8D@micron.net>

I'm trying to use Malcom Beattie's Alpha 3 compiler to create a binary
executable on Solaris 2.5 from a perl script which contains reference
to CGI.pm.  Followed Malcom's suggestion of using the -u switch to
include the CGI module [ Re: Using CGI.pm with the perl to C compiler,
to Alan Gutierrez, 1997/01/13 ] with these commands:

    perl -OM=C,-uCGI,-ofoo.c foo.pl
    perl cc_harness -O2 -ofoo foo.c

This produced 10 of these warnings:

    foo.c:3278: warning: initialization from incompatible pointer type

Running foo caused these errors:

   Undefined subroutine CGI::read_from _cmdline at /.../CGI.pm
   line 499, <ERR> chunk 28.
   Bad free() ignored, <ERR> chunk 28.
   Bad free() ignored, <ERR> chunk 28.
      <same error repeated 200+ times>
   Segmentation Fault (core dump)

Has anyone been successful at compiling perl to C with CGI.pm?
Any idea what I may be missing?


Please also reply via email.  Haven't had time to be as faithful to
this news group as I would like.

dave runyan
drunyan@micron.net


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

Date: Fri, 21 Feb 1997 09:30:55 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: dbmopen() dbmclose() using CGI variables
Message-Id: <fl_aggie-ya02408000R2102970930550001@news.fsu.edu>

In article <5eik4v$p43$2@csnews.cs.colorado.edu>,
        Tom Christiansen <tchrist@mox.perl.com> writes:
+ > And get thee to the CGI newsgroup.  Your question is unrelated
+ > to Perl.

In article <5ek1lc$18n$2@gunnar.aladdin.net>, pdcawley@aladdin.net (Piers
Cawley) wrote:
+ Strange, looks to me at least like it's related to perl.

Superficially, yes.

+ The guy has a
+ problem with a perl script that won't work in a particular environment
+ and, whilst it may well be a problem that is covered in the references
+ you supply doesn't really deserve this censure.

Well, when someone says:

+  If I run the script from the command line and substitute the 
+  data from the form with locally defined data, the script works.

it's a CGI problem, not a Perl problem. There are groups *dedicated*
to these questions. It needs to be asked there, since that's where
the question is more likely to be answered.

+ He provided source, an
+ approriate subject line and didn't beg, which is pretty remarkable for
+ a CGI related query...

Which is why he didn't get ignored...

James

-- 
Consulting Minster for Consultants, DNRC

To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Sat, 22 Feb 1997 17:58:40 +0100
From: "Dott. Luca Postpischl" <alp0@nettuno.it>
Subject: e5
Message-Id: <330F25B2.6B36@nettuno.it>

--


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

Date: 22 Feb 1997 15:21:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: File Locking NOT using flock
Message-Id: <5en2su$rl2$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, "Matthew Enger" <menger@mindless.com> writes:
:	I am new to perl and I want to lock files with out using flock. 

**WHY NOT**? 

    "I'd like to open a file without using open()."
    "I'd like to close a file without using close()."
    "I'd like to unlink a file without using unlink()."

:I have
:writen two subs but there is something wrong with them. Can anyone help?
:sub set_lock{
:  local($filename) = @_;
:  While(-f $filename.lock){select(undef,undef,undef,0.1);}

wrong case on while.

:  open($filename.lock,">$filename.lock");

This is doomed.  You have a race condition because you 
do not have an atomic operation here.  It's a very bad
idea, as is busy-wait.

:sub del_lock{
:  ($filename) = @_;
:  close($filename.lock);

That's not doing what you think it's doing.

:  unselect($filename.lock);

That's not a function.

Why aren't you running with -w?  

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


There is no problem so small that it can't be blamed on Datakit --Andrew Hume


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

Date: 22 Feb 1997 13:15:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: for god sake
Message-Id: <5emri6$p2q$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, nvp@shore.net (Nathan V. Patwardhan) writes:
:Totally.  :-)  You should be looking at http://www.activeware.com for
:the Perl 5.003_07 NTPerl port (both in Intel binaries and source).

Well, for now.  It's possible that 5.004 will compile under Windoze.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    Because . doesn't match \n.  [\0-\377] is the most efficient way to match
    everything currently.  Maybe \e should match everything.  And \E would
    of course match nothing.   :-) --Larry Wall in <9847@jpl-devvax.JPL.NASA.GOV>


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

Date: Sat, 22 Feb 1997 08:45:49 -0700
From: "Jerry L. Gubka" <jlguru@cris.com>
To: Chris Plachta <stats9@mail.idt.net>
Subject: Re: How do I get a form feed into a document?
Message-Id: <330F14AD.6F95@cris.com>

Chris Plachta wrote:
> 
> Does anyone know how I print a formfeed character (new page) into a
> text document using perl?  I am writing out text reports and I want
> to put new page indicators in it so my printer recognizes it.  I am
> running Perl 5 on a Linux machine, using nenscript to print my text
> files.
> Thanks.
> 
> Chris

I believe, though I haven't tried it w/ perl, that you can use an editor
that allows entry of extended ASCII characters and embed the formfeed
character (ascii 12) in a print string. This works w/ every other
programming language I use (VB 4.0, C++, Pascal, Fortran). 

In my programming editor, I accomplish that by holding down alt and
pressing the 1 and 2 keys on the numeric key pad. 

Live long, and prosper
Jerry L. Gubka


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

Date: 22 Feb 1997 13:01:23 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: How do I get a form feed into a document?
Message-Id: <lo8gra8b.fsf@jander.com>

> Chris Plachta (stats9@mail.idt.net) wrote:
> : Does anyone know how I print a formfeed character (new page) into a
> : text document using perl?  I am writing out text reports and I want
> : to put new page indicators in it so my printer recognizes it.  I am
> : running Perl 5 on a Linux machine, using nenscript to print my text
> : files.  

print "\f";

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Sat, 22 Feb 1997 09:25:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Hayes, Dianne" <dianne.hayes@systecinc.com>
Subject: Re: installing PERL on UNIX through WIN95 sy
Message-Id: <Pine.GSO.3.95q.970222091942.25885K-100000@kelly.teleport.com>

On Fri, 21 Feb 1997, Hayes, Dianne wrote:

> I run on a WIN95 system and access files on the UNIX box that I work with   
> through a Windows-based FTP program (and also through Telnet).  I have a   
> CD-ROM with perl on it (packaged with the book _UNIX Programming Tools_   
> by Eric Foster-Johnson; don't worry Randal -- I also have the llama book,   
> but it didn't have a disk with it), but I'm not sure how I go about   
> installing it on this UNIX box that is not at my site.
> 
> Can I install this across my FTP connection?

You might be able to, but it would probably be a _lot_ of work to do so. 
It's much easier to compile it on the target machine directly, and it's
much more likely to work, especially if you're not root on that system.

In most cases, you (as a user, instead of as root) can configure perl with
a command like this one, but see the docs which come with the source, too.

    ./Configure -ders -Dprefix=$HOME/bin

Once it's configured, use the command 'make test' to build it. If all
tests pass, use 'make install' to put it into your personal bin directory
(or wherever you specified on the command above). 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, 22 Feb 1997 08:12:46 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: MIME on Usenet (was: Re: `DATE` function for NT/95)
Message-Id: <usume5.vq.ln@localhost>


[ emailed, posted ]


Paul A. Denton (padenton@metronet.com) wrote:
: It seems to me that this thread primarily concerned and involved
: James E. Colyer and Nathan V. Patwardhan.  I wonder why Tad McClellan
: allowed his testosterone levels to overwhelm him via private E-mail. 
                                                   ^^^^^^^^^^^^^^^^^^

>From the FAQ posted regularly to the news.announce.newusers newsgroup,
with Subject "Rules for posting to Usenet":

----------------------
It is generally considered rude to post private e-mail correspondence
without the permission of the author of that mail.  Furthermore, under
copyright statutes, the author of the e-mail possesses a copyright on
mail that he or she wrote; posting it to the net or mailing it on to
others without permission of the author is likely a violation of that
copyright as well as being rude.
----------------------

So, you are rude (or maybe only clueless as to proper behavior on Usenet?)


: His missive is at the end of my reply:

: Tad:
: How refreshing to receive this type of reply to an attempt to help
: someone out with a problem.  How wonderful to know that there are people
: like you with such serious emotional/personal problems that would take
: the time to generate garbage such as this.


So, I guess this is your way of saying that MIME _is_ appropriate 
on Usenet?

Or that Usenet _is_ mail?

If so, please enlighten me as to your views (or at least _one_
reason why you have such views).

Persuade me with a presentation of the facts regarding the use of
MIME on Usenet.

See, I'm still unclear as to why you do not agree with my views.


: I would appear that it is YOU who should control the 'MIME crap' because
: in your 'reply' you are 'MIME-ing' (ie, mimicking) the other
: self-centered, self-serving, egotistical ass-holes in the world.  It
: would  seem to me that your reply is possibly comensurate with your
: success at SGML Consulting.  What caliber of people could possibly use
                               ^^^^^^^^^^^^^^^^^^^^^^
: the services of a 'Tag and Document Consulting' service?


People with a large Clue Inventory. 

I'm doing just fine.

Thank you for your concern though.



>From the FAQ posted regularly to the news.announce.newusers newsgroup,
with Subject "A Primer on How to Work With the Usenet Community":

----------------------
  Please remember that people all over the world are reading your words.  Do
  not attack people if you cannot persuade them with your presentation of
  the facts.  Screaming, cursing, and abusing others only serves to make
  people think less of you and less willing to help you when you need it.

  If you are upset at something or someone, wait until you have had a
  chance to calm down and think about it.  A cup of (decaf!) coffee or
  a good night's sleep works wonders on your perspective.  Hasty words
  create more problems than they solve.  Try not to say anything to
  others you would not say to them in person in a room full of people.
----------------------


Ad hominem attacks reveal something of your level of intellect.

No need to get all testy. Just respond with a reason or two as to
_why_ you thing my request was out of line.


Now it's beginning to look like cluelessness, rather than rudeness...


: Now, in keeping with your request, since '> MIME is for _mail_.' enjoy
: yourself.

: Oh, and by the way, go fuck-off 


Oops! Swinging back toward rudeness again.



: and go to hell


If I should end up there, then we will have the opportunity to meet.



: Paul

: Tad McClellan wrote:
:  
:  In article <330D65C3.765D@metronet.com> you wrote:
:  : This is a multi-part message in MIME format.
:  Please knock it off with the MIME crap.
:  MIME is for _mail_.
:  Usenet is not mail...
:  
:  : --------------6DF358695DA9
:  : Content-Type: text/plain; charset=us-ascii
:  : Content-Transfer-Encoding: 7bit
:  
:  : Nathan,
:    ^^^^^^


Now back to cluelessness again. Giving an answer to someone who
didn't ask the question. Those darn attributions are so hard to
figure out, aren't they?


:  Nathan didn't ask the question.
:  
:  JColyer asked the question...
:  
:  : If I understand you correctly, this was a problem I ran into.
:  : Try this attachement, 'ctime.pl'
:  
:  : Paul Dentn
:  : Nathan V. Patwardhan wrote:
:  : >
:  : > JColyer@PrioritySearch.com wrote:
:      ^^^^^^^


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


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

Date: Sat, 22 Feb 1997 08:17:43 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl array passing
Message-Id: <76vme5.vq.ln@localhost>

S_Stefanis@msn.com wrote:
: Could someone post a clear example of passing an entire array
:  into a subroutine for a rookie?


--------------
#! /usr/bin/perl -w

@ra = qw(one two three four five);

&rasub(@ra);


sub rasub {
   my(@arg_ra) = @_;

   foreach (@arg_ra) {print "$_\n"}
}
--------------

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


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

Date: Sat, 22 Feb 1997 09:54:31 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: S_Stefanis@msn.com
Subject: Re: Perl array passing
Message-Id: <Pine.GSO.3.95q.970222095242.25885M-100000@kelly.teleport.com>

On Sat, 22 Feb 1997 S_Stefanis@msn.com wrote:

> Could someone post a clear example of passing an entire array
>  into a subroutine for a rookie?

Do you want to pass the array as a single object? Those examples are in
perlref(1). 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: 22 Feb 1997 08:39:02 -0700
From: kjj@primenet.com (Kevin Johnson)
Subject: Re: Perl Mail Client?
Message-Id: <5en3um$iuc@nnrp1.news.primenet.com>

On 20 Feb 1997 22:50:09 -0500, Mark Frost <mfrost@atlas.horizsys.com> wrote:
>I was wondering if anyone has written a perl mail client.
>
>Since I see so many nifty libraries to assist in such an endeavor (MIME,
>Mail Tools, and even PerlTk) I was thinking that someone must have made
>such a beast.

I have one report of a person attempting to write an MUA using my
Mail::Folder module. He was writing one with a mailx-ish interface. I
haven't followed up with him in awhile, so I don't know what the current
status is on it. He might be waiting for me to complete a few feature
requests and for me to make opening a folder much faster than it
currently is.

It's funny that you should mention perltk. In the next release of
Mail::Folder, I will be providing a script in the examples directory
that is a reasonably full-featured x-windows MUA using perltk and
Mail::Folder (and friends). It started out as a way for me to exercise
the design of Mail::Folder, but the task ended up be so enjoyable that I
just kept on going.

I'm currently using it on a daily basis. It uses a LOT of memory (HINT:
more than the xemacs that I'm running :-O). I will be trying to track
this problem down, but I'm currently focusing on getting all the normal
MUA things implemented in it.

I'm expecting to put out the next version of Mail::Folder in a few weeks.

-- 
thx,
kjj@pobox.com   http://www.pobox.com/~kjj/


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

Date: Fri, 21 Feb 1997 09:33:22 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Perl Software
Message-Id: <fl_aggie-ya02408000R2102970933220001@news.fsu.edu>

In article <330DD1FD.15CC@ns.sympatico.ca>, aw.leblanc@ns.sympatico.ca wrote:

+ Hi, 
+         I am looking for the Perl software package on-line. Does anybody know
+ where I could find the software for me to download.

<url:http://www.perl.com/perl/>

James

-- 
Consulting Minster for Consultants, DNRC

To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 22 Feb 1997 15:12:05 GMT
From: neilb@zetnet.co.uk (Neil S. Briscoe)
Subject: Re: piping data through unix command
Message-Id: <memo.970222151038.4311A@zetnet.co.uk>

In article <330D9BB7.6F9F@mucsun.sps.mot.com>, klausf@mucsun.sps.mot.com
(Klaus Foerster) wrote:

> Hi folks,
>
> I'd like to send data through a unix command.
>
> I imagine it like this
>
>
> - perl program starts and forks.
>   -> now there are two perl processes
>   - Process 1 should generate data and send it to a unix command
>      (e.g. sort, its just an example I know that perl can sort as well)
>   - Process 2 should read the output of this unix command
>
> So process 1 generates data for a unix program.
> and finishes afterwards.
> process 2 will read all the data and postprocess it.
>
> Does anyone have a small example?
>
> Thanx in advance.


I think you're imagining it from the wrong end.  Trying to dovetail a Unix
process in the middle looking from the process one end is difficult.  If
you make the parent perl process be the one that processes the output from
the unix command, then its doable.

The little script below, tested working ;-) relies on the following
features, which may be obvious but I'll iterate them because their vital
to how this works.

Every Unix process starts off with fd0 open as STDIN, fd1 open as STDOUT
and fd2 open as STDERR.

Any open() statement (or other command that opens FILEHANDLES) will grab
the lowest fd's available.

#!/usr/local/bin/perl

close(STDIN);
close(STDOUT);

# Now fd's 0 and 1 are available for use.

pipe(STDIN, STDOUT);

# Now you have a PIPE using fd0 and fd1, fork away

if ($child=fork()) {
        # Child process will generate the output, closes one end of pipe
        # The following works because STDOUT is using its normal
        # fd which happens to be writing to a PIPE.  The sort inherits
        # this fd.
	close(STDIN);
	open(SORT, "| sort");
	# Send unsorted data to sort.
	print SORT "cat\n";
	print SORT "mat\n";
	print SORT "bat\n";
	close(SORT);
	# After the close, sort sorts the data and chucks the output to
	# STDOUT which, remember, just happens to be writing to a pipe
	exit;
}
close(STDOUT); # Parent closes its end of pipe.
open(STDOUT, "> sorted"); # Attach this back to a terminal if you want
while(<STDIN>) { # Read in the contents of the pipe.
	print; # Chuck the output into the file.
}
exit;

If you run this, you'll find that the file called "sorted" contains the
three elements in sorted order.

Regards
Neil


 


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

Date: 22 Feb 1997 12:59:17 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: really really Simple Question
Message-Id: <ohdcrabu.fsf@jander.com>

ewise@uvic.ca (Evan Wise) writes:

> Howdy, this is a little problem I am having with a PERL script I am doing right 
> now. It is a little matter of just not matching the correct text and it is 
> driving me up the wall. There probably exists a really simple solution to this 
> that I am just blind to it after staring at this too long.
> 
> here is the line that I am trying to search and replace :
> 
> <!--- e3 ---><TD bgcolor = 00,00,00><image border = 0 src = blacksq.gif></TD>
> 
> I am trying to replace the blacksq.gif (not always blacksq.gif can be other 
>  .gif files...) with some other text.  I just cant get the proper replace 
> line.....!
> 
> I am also looking to try and match the blacksq.gif (again not always 
> blacksq.gif) and put it into a variable. All my attempts have failed thus far.

================================================================================
#!/usr/bin/perl -w

$_ = '<!--- e3 ---><TD bgcolor = 00,00,00><image border = 0 src = blacksq.gif></TD>';

($gif) = /(\w+\.gif)\b/;

print $gif, "\n";

my $another = 'another.gif';

s/(\w+\.gif)\b/$another/;

print  "$_\n";
================================================================================

Produces:

================================================================================
blacksq.gif
<!--- e3 ---><TD bgcolor = 00,00,00><image border = 0 src = another.gif></TD>
================================================================================

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Sat, 22 Feb 1997 09:36:22 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Schoenfeld <chris@ixlabs.com>
Subject: Re: Setuid scripts and $0 - Arg!
Message-Id: <Pine.GSO.3.95q.970222092758.25885L-100000@kelly.teleport.com>

On Fri, 21 Feb 1997, Chris Schoenfeld wrote:

> I have a program which is executed by sendmail, and needs to be setuid.
> It also needs to know it's scriptname.

Ah, but on Unix systems there's no guarantee that you can find out the
name of your script. In fact, it may have changed since your script
started executing! 

> Unfortunately, $0 gets boned (/dev/fd4?? - what does it think it's a
> floppy drive?) when running setuid on Solaris, 

(/dev/fd/4, perhaps?) The 'fd' is not "floppy drive" but "file descriptor" 
or some such. That's how Solaris (and some other modern systems) eliminate
a security hole which plagues setuid scripts on some systems. (On others,
the setuid bits are simply ignored, although Perl can be compiled to
safely enable them.) 

> This is a big time bug - it would seem like $0 should be false or
> undefined if Perl can't figure out it's scriptname.

It's easy to make a quick check which is likely to be right. Use -f $0 to
see whether it's a file or not. Of course, that still doesn't tell you
what your script's name is. Oh, well! 

-- 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, 21 Feb 1997 23:03:41 GMT
From: cpmurray@digitaldrive.com (Chris Murray)
Subject: Splitting over multiple lines?
Message-Id: <330e299c.265228@news.worldlink.ca>

Howdy Perl-folk!

I have a question regarding parsing input over multiple lines.

I have a file with information delimited with percentage signs.  All
the records are short except  for the last one which spans multiple
lines, but is still terminated with the % sign

Example below:

record1a%record1b%record1c%record1d%record1e
record1e more stuff and lots of lines and on and on.....
and on.....
and on... a variable amount of lines%
record2a%record2b%record2c%record2d%record2e
record2e more stuff and lots of lines and on and on.....
and on.....
and on... a variable amount of lines%
record3a%record3b and on like so


Usually I would while (<INPUT>) the file, and split on the % signs
line by line (if it were contained on one line).  

 while (<INPUT>) {       
 
                # Split the data in the flat text file .
                # Split on the character % (percentage sign)
 
 
                ($course_code, $course_title, $curriculum_code,
                 $curriculum_name, $source_name, $learning_name,
$duration, $costs) = split(/%/);
}


However, in this case with the last record spanning multiple lines, I
am not sure what the procedure is for reading the information into a
variable up until the terminating %.  I could make the terminating
character a double %% indicating the end of the record, if that would
help denote "This record line is done, parse the next one".

Thus I am stuck on how to read information into a variable from a
record that spans multiple lines.

Any thoughts from the Perl gurus?

I am running with perl version 5.003 under solaris 2.4
Thanks for your time. 



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

Date: Sat, 22 Feb 1997 10:41:53 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Splitting over multiple lines?
Message-Id: <hk7ne5.df1.ln@localhost>

Chris Murray (cpmurray@digitaldrive.com) wrote:
: Howdy Perl-folk!

: I have a question regarding parsing input over multiple lines.

: I have a file with information delimited with percentage signs.  All
: the records are short except  for the last one which spans multiple
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think you mean to say "all the _fields_ within a record are short..." ?


: lines, but is still terminated with the % sign

: Example below:

: record1a%record1b%record1c%record1d%record1e
: record1e more stuff and lots of lines and on and on.....
: and on.....
: and on... a variable amount of lines%
: record2a%record2b%record2c%record2d%record2e
: record2e more stuff and lots of lines and on and on.....
: and on.....
: and on... a variable amount of lines%
: record3a%record3b and on like so


: Usually I would while (<INPUT>) the file, and split on the % signs
: line by line (if it were contained on one line).  

:  while (<INPUT>) {       
:  
:                 # Split the data in the flat text file .
:                 # Split on the character % (percentage sign)
:  
:  
:                 ($course_code, $course_title, $curriculum_code,
:                  $curriculum_name, $source_name, $learning_name,
: $duration, $costs) = split(/%/);
: }


: However, in this case with the last record spanning multiple lines, I
: am not sure what the procedure is for reading the information into a
: variable up until the terminating %.  


You don't really _need_ to "_read_ up to terminating %" you just need
to get "up to terminating %" into a variable. You can do it by reading
a line at a time and concatinating onto the string until you get to
the end of the record.


: I could make the terminating
: character a double %% indicating the end of the record, if that would
: help denote "This record line is done, parse the next one".

This would help _a lot_, because now you can get perl to chunk it into
a record at a time for you:


--------
$/='%%';  # set the 'input record separator' (man perlvar)

while ($record = <>) {
  # do stuff to record
}
--------


: Thus I am stuck on how to read information into a variable from a
: record that spans multiple lines.

: Any thoughts from the Perl gurus?


The exalted level of guru is not required to answer this question.

A lowly Intermediate Perl Programmer (such as myself) who has read
and reread the free documentation that is included with the perl
distribution, would know how to do this  ;-)


: I am running with perl version 5.003 under solaris 2.4
: Thanks for your time. 


You're welcome. Hope it helps!


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


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

Date: Sat, 22 Feb 1997 17:57:59 +0100
From: "Dott. Luca Postpischl" <alp0@nettuno.it>
Subject: t1
Message-Id: <330F2589.1509@nettuno.it>

--


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

Date: Sat, 22 Feb 1997 14:06:34 GMT
From: gm-goodwin@worldnet.dot.att.dot.net (Gregory Goodwin)
Subject: The Disappearing DOS box and cmd32.exe
Message-Id: <330efa43.3839414@netnews2.worldnet.att.net>

I've installed Perl5 on Win95 and associated .pl files with perl.exe.
The problem though is that the DOS box disappears too fast to read.  I
can add a sleep command, but that only works if the script has no
errors.  I would like the box to stay up so that I can read the
compile errors.

The included text file Win95.txt refers vaguely to a problem with
command.com and states that cmd32.exe is included as a shell wrapper.
How do I use this shell wrapper?  So for it doesn't seem to do
anything.

I've tried adding the path to cmd32.exe to the PERL5/WIN95SHELL line
in the registry.  It made no change.

Whether cmd32.exe is listed in the registery or not, whether it's in
the recycle bin or not, the scripts run the same.

What am I missing?

TIA
Greg




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

Date: Sat, 22 Feb 1997 15:21:04 GMT
From: s581009@tfh-berlin.de (Steffen Heinrich)
Subject: Re: The Disappearing DOS box and cmd32.exe
Message-Id: <5en2un$ehe@sun04.tfh-berlin.de>

gm-goodwin@worldnet.dot.att.dot.net (Gregory Goodwin) wrote:
 ...
>The included text file Win95.txt refers vaguely to a problem with
>command.com and states that cmd32.exe is included as a shell wrapper.
>How do I use this shell wrapper?  So for it doesn't seem to do
>anything.
 ....
>Whether cmd32.exe is listed in the registery or not, whether it's in
>the recycle bin or not, the scripts run the same.
 ...

I just posted answer to another article in the same group 
(see "Fred Elbel, 20.02.97 21:34"):
 ...
Thank you for that information! After changing the command string of
my .pl-association to

E:\PERL\PERL5\bin\cmd32.exe "Perl.exe %1 %2 %3 %4"

on Win95 I am finally abel to get perl to search it's path by simply
writing "script1.pl script2.pl" onto the Run... - line in the
Startmenue and all modules will be found.
Still, this does _not_ work inside the dos box and I did not figure
out how to execute a piped command like

nsgmls hubdoc.sgm | perl sgmlspl.pl skel.pl > out.pl

since the execution of batch-files seems to be restricted to the
16bit-shell (command.com aka DOS-Box).
Looks like there is no way to do it in a single step in Win95. Any
suggestions anybody?
          Cheers, Steffen

Hope that will help a little further. I'm a newbie to perl and win95
and I just can't imagine that Windows does not support *BASIC*
DOS-facilities!!
Steffen





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

Date: 22 Feb 1997 15:22:09 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: The Disappearing DOS box and cmd32.exe
Message-Id: <5en2v1$lbi@fridge-nf0.shore.net>

Gregory Goodwin (gm-goodwin@worldnet.dot.att.dot.net) wrote:
: I've installed Perl5 on Win95 and associated .pl files with perl.exe.
: The problem though is that the DOS box disappears too fast to read.  I
: can add a sleep command, but that only works if the script has no
: errors.  I would like the box to stay up so that I can read the
: compile errors.

Are you using perl -c <scriptname> from the command-line?  This should
tell you if you have any errors without running your Perl script to find
out.  HTH!


--
Nathan V. Patwardhan
nvp@shore.net
"What is your favorite color?
Blue ... I mean yellow ... aieeeee!
	--From the Holy Grail"


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

Date: 22 Feb 1997 04:09:38 GMT
From: strider@shadowmac.org (Raul Almquist)
Subject: Re: Uploading cgi script (with perl?)
Message-Id: <5elri2$5dc$2@blackice.winternet.com>

Jeff Carnahan (tails@hooked.net) wrote:
: >: 	We are trying to set a service on our Web service where any
: >: user can access a form through which he/she can upload a file to the
: >: 
: >: 	So my question is if there is anywhere any script that could
: >: do this job? Or if there is any function in the Perl libraries that
: >: could do or, at least help us in this direction?
: >
: >  You will need to use a perl module like CGI_Lite.pm and a basic script 
: >that you can find inside the module as a working example.
: 
: You could also stop by my Free Scripts Archive at:
: 
: 	http://www.terminalp.com/scripts/
: 
: to pick up a free upload script... =)

  Unfortunately, I have come to the determinization that none of the 
modules that scripts like yours, really deals with all the aspects of file 
uploading...  uploading requires more than any existing pm's provide, as 
they only provide a very limited and primitive upload functionality...  
sad to say.

  I have also come to the conclusion that people and sites NEEDING www 
file uploading capability, also need to have a file_upload.pm module 
available to deal with all the aspects of real file uploading instead of 
what is currently available...  absolutely none of the existing file 
upload cgi's or pm/cgi combinations deal with anything other than the most 
basic of upload functionality...  such a limitation as present upload 
implimentations are like Apple's infamous statement about no one ever 
wanting or needing any modems faster than 9600 baud...  long groan.

  So lots of luck, I know that after many months I have had a few that 
looked like they would provide proper functionality, but none provide 
complete functionality.


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 992
*************************************

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