[6312] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 934 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 12 14:17:41 1997

Date: Wed, 12 Feb 97 11:00:26 -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           Wed, 12 Feb 1997     Volume: 7 Number: 934

Today's topics:
     Autoresponder  for first-time posters? <pb@ecce-terram.de>
     Re: CGI Script (Mike Stok)
     Re: Crypt Funtion <rootbeer@teleport.com>
     Dynamic loading problem on SunOS 4.1.4 <norm@atlas.berkshire.net>
     first PERL program <senthil@ti.com>
     Help with a single process multithreaded server. (Jonathan Lieberman)
     HELP: getting timestamps of files... (Bruno Boettcher)
     Re: HELP: variable interpretation?? really_eliot@dg-rtp.dg.com_but_mangled_to_stop_junk_email
     Re: How to tell if Perl is run in debug mode <rootbeer@teleport.com>
     Re: How To (Jonathan Peterson)
     Re: Locking mechanism (Tad McClellan)
     Re: non programmer...on 'if'.. <nick@mail.g440.com>
     Re: order of FREETMPS and LEAVE <sriram@sirius.com>
     Parseing path from uploaded file <jrush@world.std.com>
     Re: Pattern matching and regular expression (Dave Thomas)
     Re: Pattern matching and regular expression <tchrist@mox.perl.com>
     Re: perl ulimit -c 0 ? (David K. Drum)
     Re: perl ulimit -c 0 ? <tchrist@mox.perl.com>
     Problems with Co-Processes (Mark E. Klamerus)
     Re: read and write +> at the same time - HOW? <tchrist@mox.perl.com>
     Re: read and write +> at the same time - HOW? <rootbeer@teleport.com>
     running prog from within perl script <igandham@prestel.net>
     Re: running prog from within perl script (Nathan V. Patwardhan)
     Script runs inside debugger but crashes "outside" <kin@sampras.isi.com>
     Re: Script runs inside debugger but crashes "outside" (Nathan V. Patwardhan)
     Seg Fault in "malloc": Dynodump with Perl on Solaris 2. (Eric C. Weaver)
     simulating csh '<<' (Daniel Efron)
     Student Position: Learning for Agents and Multi-Agent S (Steve Lawrence)
     Subscribe <morgile@morgile.com>
     UnRead Camels Wanted (was " Re: ANNOUNCEMENT: Perl docu <nelson@cae.ca>
     what does this line do? (Raymond Cheung)
     Re: what does this line do? (Tim  Smith)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 12 Feb 1997 16:37:32 +0100
From: =?ISO-8859-1?Q?=22Peter=A0Br=FClls=22?= <pb@ecce-terram.de>
Subject: Autoresponder  for first-time posters?
Message-Id: <5dsns6$pid@news.Informatik.Uni-Oldenburg.DE>


Hi!

I remember getting an introductory E-Mail about this newsgroup the
first time I posted. I assume that it had been send by a perlscript
which keeps track of who posted for the first time.


I wrote something similiar for the German language Star Trek group to
point newusers to the FAQs, but it's very unpolished. I dropped the
project because of some flames, but plan to start anew by proposing a
RfD for such a autoresponding scheme. However, I'd rather use existing
and proven software instead of doubling the efforts and repeating the
mistakes of others.


Peter





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

Date: 12 Feb 1997 15:10:30 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: CGI Script
Message-Id: <5dsmh6$1pm@news-central.tiac.net>

In article <01bc188f$8059f3e0$308c53c6@rockhead.camalott.com>,
Darrell LaRock <rockhead@camalott.com> wrote:
>Does Anyone have a CGI script I can use to send the output of a form into a
>file on my system.  (unix based).

If you're using perl 5 on your system then the CGI modules might help, to
steal a little documentation:

  SAVING THE STATE OF THE FORM TO A FILE:

      $query->save(FILEHANDLE)

  This will write the current state of the form to the provided
filehandle.
  You can read it back in by providing a filehandle to the new() method.
  Note that the filehandle can be a file, a pipe, or whatever!

  The format of the saved file is:

          NAME1=VALUE1
          NAME1=VALUE1'
          NAME2=VALUE2
          NAME3=VALUE3
          =

  Both name and value are URL escaped.  Multi-valued CGI parameters are
  represented as repeated names.  A session record is delimited by a single =
  symbol.  You can write out multiple records and read them back in with
  several calls to new. [...]

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Wed, 12 Feb 1997 10:33:47 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jack <jss@mailzone.com>
Subject: Re: Crypt Funtion
Message-Id: <Pine.GSO.3.95q.970212103233.16205E-100000@julie.teleport.com>

On Wed, 12 Feb 1997, Jack wrote:

> when I run it on my provider's server (an NT server, btw), it chokes
> on the crypt command!  

Sounds as if the version of Perl on that server doesn't support crypt. You
might be able to get a more recent version that does. 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/



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

Date: 12 Feb 1997 13:07:23 -0500
From: Norman Walsh <norm@atlas.berkshire.net>
Subject: Dynamic loading problem on SunOS 4.1.4
Message-Id: <1eg1z1hp9g.fsf@atlas.berkshire.net>

Hello World,

I'm trying to build perl5.003 on a SunOS 4.1.4 machine.  Everything
seems fine until I run make test; all the tests that involve dynamic
loading fail with:

  dlopen: stub interception failed

Sysadmins for the machine in question don't have any clues.  Do you?
Any help would be appreciated.

--norm



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

Date: Wed, 12 Feb 1997 11:36:30 -0600
From: Senthil Velayudham <senthil@ti.com>
Subject: first PERL program
Message-Id: <3301FF9E.5A3E@ti.com>

Perl Gurus,

I am just about to create my first PERL program. I need your tips/help
from all of you. 

I have a form with two list boxes. One listbox for region and another
for year. If the user chooses a region and a year, my Perl program
should be kicked off and a HTML file should be posted when the user hits
the "SUBMIT" button. Its quite obvious that, if the user chooses a
different Region and a different year, my program should bring up a
totally different URL.

Please send replies to my email at "senthil@ti.com"

Best Regards,

Senthil


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

Date: Tue, 11 Feb 1997 22:42:31 GMT
From: lie6@midway.uchicago.edu (Jonathan Lieberman)
Subject: Help with a single process multithreaded server.
Message-Id: <E5Gn2v.92H@midway.uchicago.edu>
Keywords: perl multi thread multithread server eventserver eventserver.pm

I have run in to a performance issue serving streaming content from a
cgi. In short the current solution is a long lived cgi (one per
listener) that that spews out basically identical data to all the
clients. This works pretty well up to a point. However when you have
many listeners about (more than 70) it starts to take a toll on the
machine.

What I'd like to do is have a server that sits on some port (1234
etc.) and handles the requests and the reply so that a single process
will simply divide its time among all the listeners and send out the
data to each of them in sequence. Of course this has to be nonblocking
so that any one request (or broadcast) doesn't keep everybody else
waiting...

The closest example to what I want to do is cached (part of the harvest
distribution). It is a non forking multithreaded server that is
extremely fast at many answering simultanious requests. (Of course it
is much more than that...)

http://harvest.transarc.com/afs/transarc.com/public/trg/Harvest/httpd_accel.html

Ideally I'd like to do this in perl (since I know perl, the existing
cgi is in perl, and there is lots of string manipulation) I haven't
done any socket work in perl. After spending some time looking for
existing code the most promising, but somewhat overwhelming is
EventServer.pm.

http://www.osf.org/www/perl/mod/EventServer.pm.html

If anybody has any sample perl code, or advice on why this is a bad
idea, or on why it has to be done in C, etc, I'd appreciate any help.

Thanks, Jonathan
-- 
______________________________________________________________________________
Jonathan Lieberman                Hell hath no fury like a bureaucrat scorned.
lie6@midway.uchicago.edu                        -- Milton Friedman



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

Date: 12 Feb 1997 17:43:39 GMT
From: bboett@yoda.u-strasbg.fr (Bruno Boettcher)
Subject: HELP: getting timestamps of files...
Message-Id: <5dsvgb$no8@news.u-strasbg.fr>

it is surely a obvious and easy problem, but i didn't found the solution
for myself...

i have a script that parses html files, making an index of them, now i
would like to include the creation date of the file into this index....

it is an automatic script (means it starts with :
#!/usr/bin/perl -n
)

and further on i try to get the stamp:
 
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,
 $blocks) = stat($ARGV);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(($ctime));

but when i display $mday/$mon/$year i get completely wrong results...
BTW when making localtime(time) i get nearly the right date: the month
shown is januaryi, does the month-count start with 0??

i don't know if the stat call is made right, but on the other hand i do not
know how to get the filehandle of the actual file in such a
wrapped-script...
-- 
ciao
bboett@erm1.u-strasbg.fr 

==============================================================


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

Date: 12 Feb 1997 11:12:38 -0500
From: really_eliot@dg-rtp.dg.com_but_mangled_to_stop_junk_email
Subject: Re: HELP: variable interpretation??
Message-Id: <bvzpxat349.fsf@remus.i-have-a-misconfigured-system-so-shoot-me>

mike@stok.co.uk (Mike Stok) writes:

> >
> >First,  I have defined $water as a normal variable.
> >
> >I have a second variable, $unknown  that is set to the text name   water
> >
> >
> >I want to use $unknown to get the value in the $water variable.
> >
> >Obviously print "$$unknown"; will not work since $$ is the special
> >variable for giving the process number of the Perl running my script.
> >
> >Can anyone point me in the right direction?  I've searched my O'Reilly
> >books, but haven't ferreted out the answer...
> 
> Try it!  Running the debugger using
> 
>   perl -de 1
> 
>   DB<1> $unknown = 'water'
> 
>   DB<2> $water = 'wet'
> 
>   DB<3> print $$unknown
> wet

This is what you get in perl5; in perl4 you get no output from the print.
The following works in perl4:

  DB<11> print eval ( '$' . "$unknown" )
wet


To have $$ be interpreted as the PID, it must be separated from what follows
it, e.g.


  DB<8> print $$ . "unknown"
17818unknown

Topher Eliot                           Data General Unix Core Development
(919) 248-6371                                        eliot at dg-rtp.dg.com
Obviously, I speak for myself, not for DG.
Visit misc.consumers.house archive at http://www.geocities.com/Heartland/7400
"I like to get the chicks messy."  
	-- Peter, age 4, on why he likes the barnyard-scene cereal bowl.


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

Date: Wed, 12 Feb 1997 09:48:47 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: How to tell if Perl is run in debug mode
Message-Id: <Pine.GSO.3.95q.970212093557.16205A-100000@julie.teleport.com>

On 12 Feb 1997, Ilya Zakharevich wrote, quoting me:

> > I believe you're looking for the $^P variable, documented in 
> > perlvar. Hope this helps!
> 
> Interesting!!! Note that this variable is not mentioned in
> perl5db.pl. Probably this chunk of docs is another remnant from
> perl4. 

I think you're right; the documentation's suggestion about clearing $^P
seems to be mistaken. Nevertheless, $^P does initially reflect the
debugging state, until somebody sets it to another value. Would you like
to fix the docs, if you haven't already fixed perl5db.pl?  :-)  Thanks! 

-- 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: 12 Feb 1997 15:03:04 GMT
From: jon@amxdigital.com (Jonathan Peterson)
Subject: Re: How To
Message-Id: <jon-1202971500000001@amx11.amxdigital.com>

In article <3301CD89.3704@pilot.msu.edu>, Jason Hotra
<hotraja1@pilot.msu.edu> wrote:

> I don't know what I'm doing wrong, but every time I reference a form in
> HTML to a perl script, it gives me an error. So when I specify the
> entire URL (including http://), it just outputs the whole stinkin
> script.  What am I doing wrong?
> 
> Jason

This is a server configuration error, not a perl error. I would ask your
sysadmin in the first place (or check local system specific documentation
first, then ask your sysadmin), and try a server-related newsgroup if all
else fails.

Jon.
------------------
Opinions expressed above are not necessarily those of AMXdigital ltd.
Jonathan Peterson || jon@amxdigital.com || (+44) 0171 613 5300

"You wouldn't believe the things I've seen with your eyes."


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

Date: Wed, 12 Feb 1997 08:20:01 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Locking mechanism
Message-Id: <hijsd5.r71.ln@localhost>

Bob Coret (b.coret@myself.com) wrote:
: I have a question regarding locking mechanisms. I am building a system
: which uses a flatfile database. Users can add/edit/remove records. Of
: course testing it at home shows no problems. But what will happen if a
                                                   ^^^^^^^^^^^^^^^^
: couple of people simultaneously try to add/edit and remove record...

Bad stuff.


: How will Unic and Perl react, 

They will do what they are told to do.

Better tell them to not let simultaneous checkouts for writing  ;-)


: are there standard locking mechanism, or

Yep. Pull up the helpful perlfunc man page and search for 'flock'.


: must I write these locking mechanism myself, obvious question: how? Are
: there any good examples on the web?? 

: Would breaking up de database in
: files of say 100 records do the speed any good?

While you are in the helpful perlfunc man page, you might also want
to look at dbmopen(), dbmclose(), tie(), etc...


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


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

Date: Wed, 12 Feb 1997 12:16:28 -0500
From: Nick Bauman <nick@mail.g440.com>
To: Zlatko Ivanagic <zivanag@jagor.srce.hr>
Subject: Re: non programmer...on 'if'..
Message-Id: <3301FA4F.1D94@mail.g440.com>

Zlatko Ivanagic wrote:
> 
> how would i define output of a perl script in cgi bin (html doc)
> that would include picture (gif)
> chosen depending on html form radio button state (yes/no type)
> ???
> 
> thankyou
> zlatko
> ps. please email
> 
> --
> -----------------------------

Unless you need to build a gif file on the fly (like with
Boutell/Steins's fabulous GD.pm), you simply reference the gif file you
want to display in the html you output from the program.

like so,

 ...

if ($FORM{'radio_gif'} =~ /whatever/i) {

    print "Content-type: text/html\n\n";
    print <<EOF;
    <IMG SRC="/whatever.gif">
    EOF

} else {

    other stuff here...

}

 ...

Or better yet, use CGI::* or CGI.pm. The calls are completly different,
but are a little more flexible and dynamic that reinventing the wheel
like I did above with %FORM.

-Nick


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

Date: 12 Feb 1997 17:46:10 GMT
From: "Sriram Srinivasan." <sriram@sirius.com>
Subject: Re: order of FREETMPS and LEAVE
Message-Id: <01bc190c$4807bd60$21f586cd@sriramppp.sirius.com>



Ilya Zakharevich <ilya@math.ohio-state.edu> wrote in article
<5ds2p1$phu$4@mathserv.mps.ohio-state.edu>...
> 
> If you had 10 ENTER's, you cancel them by 10 LEAVE's. If you feel like
> freeing temporaries, you intersperse them with FREETMPS in whatever
> order you find relevant. Somewhere in this equation SAVETMPS may enter
> too ;-) - their effect is forgotten when the enclosing LEAVE is
> performed.

I agree that you can free temporaries whenever you want to,
and as many times as you want to.
My objection was that you should do so *before* you invoke 
LEAVE, not after. I also understand that you can invoke LEAVE
as many times as you have done ENTER, but that isn't the point. 
You have to call FREETMPS before LEAVE. 

Consider the tmps_stack shown below:

        +--------+
        |        |   <-  Temporaries allocated after SAVETMPS
        +--------+   <---- tmps_floor #2
        |        |
        +--------+   <---- tmps_floor #1
        |        |
        +--------+

Two SAVETMPS have been made, so tmps_floor currently 
has the value tmps_floor #2 (Stack grows upwards).

Now, you say LEAVE. 
tmps_floor gets the value tmps_floor #1.

Then you say FREETMPS.
It not only deallocates all temporaries above tmps_floor #2, 
it also deallocates temporaries above tmps_floor #1. But the latter
set comprises temporaries allocated in the current scope.
Seems fishy to me.

-Sriram




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

Date: Wed, 12 Feb 1997 16:18:52 GMT
From: James B Rush <jrush@world.std.com>
Subject: Parseing path from uploaded file
Message-Id: <Pine.SGI.3.93.970212111806.24026C-100000@world.std.com>

Does anyone know how to parse the path from an uploaded dos file.  I don't
have a problem when the upload comes from a UNIX box, but when the files
comes from dos I get "C:\somename.ext" 

Jay Rush jrush@world.std.com




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

Date: 12 Feb 1997 15:14:08 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Pattern matching and regular expression
Message-Id: <slrn5g3ncp.b57.dave@fast.thomases.com>

On Wed, 12 Feb 1997 01:46:00 -0800, Fred Adorno <fadorno@mail.gte.net> wrote:
> Gentlemen,
> 
> I like to be able to find every word that begins with a character and
> ends with that same character in my dictionary using perl.  I can do it
> using vi, ed and shell scripting but I can't seem to get it to work with
> perl.  Any suggestions?
> 
> This is how it works with the editors:
> 
> ^\(.\).*\1$

No need to escape the '()'s with Perl:

  perl -ne 'print if /(.).*\1$/'
  
works a treat

Dave

-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 12 Feb 1997 16:36:38 GMT
From: Tom Chrisiansen <tchrist@mox.perl.com>
Subject: Re: Pattern matching and regular expression
Message-Id: <5dsrim$sb8$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, fadorno@mail.gte.net writes:
:I like to be able to find every word that begins with a character and
:ends with that same character in my dictionary using perl.  I can do it
:using vi, ed and shell scripting but I can't seem to get it to work with
:perl.  Any suggestions?
:
:This is how it works with the editors:
:
:^\(.\).*\1$

Did you read the perlre(1) man page?  How about
the copious example in perlop(1)?  Should be obvious
once you've done that.

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


Emacs is a fine programming language, but I still prefer perl. -me


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

Date: 12 Feb 1997 10:04:40 -0600
From: david@news.more.net (David K. Drum)
Subject: Re: perl ulimit -c 0 ?
Message-Id: <5dspmo$44c@news.more.net>

Steve Gailey <steveg@metrosol.demon.co.uk> wrote:
> I have a perl script which is a wrapper for an application. Unfortunatly
> the application is quite buggy and keeps dropping core leaving large
> (10MB) core files around the place.

> Is there a way to set the ulimit from perl which will carry forward to
> the program I run with exec()? I tried `ulimit -c 0` prior to the exec,
> but of course this had no effect.

I use the following on my Solaris 2.5 systems:

# no core files!
require 'sys/syscall.ph';
$RLIMIT_CORE = 4;
$rlimit = pack ("I2", 0, 0);
syscall (&SYS_setrlimit, $RLIMIT_CORE, $rlimit);

Regards,

David
-- 
"That man has a rare gift for obfuscation." -- ST:DS9 * "It's hard to be
bored when you're as stupid as a line." -- Vernor Vinge * "Reality has a
tendency to be so uncomfortably real." -- Neil Peart * "[The building was] of
no particular style of architecture except to use as much lumber as possible."


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

Date: 12 Feb 1997 18:11:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl ulimit -c 0 ?
Message-Id: <5dt13l$162$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Steve Gailey <steveg@metrosol.demon.co.uk> writes:
:I have a perl script which is a wrapper for an application. Unfortunatly
:the application is quite buggy and keeps dropping core leaving large
:(10MB) core files around the place.
:
:Is there a way to set the ulimit from perl which will carry forward to
:the program I run with exec()? I tried `ulimit -c 0` prior to the exec,
:but of course this had no effect.


% grep -ni limit /CPAN/CPAN.html
719:supports the BSD functions getrusage(), getrlimit(), setrlimit(),
1495:text-delimited databases.  <BR><A
2574:time.  You can bypass that limit with the FileCache module, which is

You have to do a setrlimit() call.  Try 

    http://www.perl.com/cpan_mod?module=BSD::Resource

Or something very close to that.

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


    "You can only measure the size of your head from the inside." --Larry Wall


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

Date: Wed, 12 Feb 1997 18:33:11 GMT
From: klamerus@mail.id.net (Mark E. Klamerus)
Subject: Problems with Co-Processes
Message-Id: <33020bf1.21430936@news.id.net>

Help,

I've used ksh scripts to "drive" co-processes in the past, in fact I
still have a few of them around.  I know I can do a similar thing in
Expect (which I don't want to use), and want to re-code them in perl.

I've done a bit of perl, but never found a good way to do this.

I've read books ("Webmaster's Handbook, the llama book, etc.) which
describin usig an open on the "-|" in a child process via fork/exec,
but this won't help.  I need to open a process to a database and
execute a large number of commands (i.e. interact) to it based on the
results I get back.  Since the open,command,command,...,close must all
occur in a sigle database session I seem to be stuck.

Is there a way (regardless of potential deadlock conditions) to
"drive" a co-process?  Can anyone provide any examples?

thanks, especially for e-mail
Mar


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

Date: 12 Feb 1997 15:03:14 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: read and write +> at the same time - HOW?
Message-Id: <5dsm3i$qhc$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    "Michael Avila" <lnussat.mavila@eds.com> writes:
:I cannot find any examples of how to read and write to a file at the same
:time.  I have the open as follows:
:
:open (IDDBFILE, "+>../../../company/carclub/reports/iddb") || die "Error:
:$!";

that's the wrong way.  you want +< not +> there.

:
:I'd sure appreciate any help.  I've looked at 2 PERL books I have and they
:do not have any examples asside from how to code the open statement.  I
:also searched the web and did not find any good information.

$RECSIZE = 220; # pick a record size
$recno   = 37;  # pick a record to update
open(FH, "+<somewhere") || die "can't update somewhere: $!";
seek(FH, $recno * $RECSIZE, 0);
read(FH, $record, $RECSIZE) == $RECSIZE || die "can't read record $recno: $!";
# munge the record
seek(FH, $recno * $RECSIZE, 0);
print FH $record;

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


    "His super power is to turn into a scotch terrier."


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

Date: Wed, 12 Feb 1997 10:37:58 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Avila <lnussat.mavila@eds.com>
Subject: Re: read and write +> at the same time - HOW?
Message-Id: <Pine.GSO.3.95q.970212103658.16205G-100000@julie.teleport.com>

On 11 Feb 1997, Michael Avila wrote:

> I cannot find any examples of how to read and write to a file at the
> same time. 

Well, I think you could use the methods in Randal's fourth Web Techniques
column, which (among other things) explains how to use flock() to avoid
problems when multiple processes need to modify one file. Hope this helps!

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 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: Wed, 12 Feb 1997 16:10:35 +0000
From: Iqbal Gandham <igandham@prestel.net>
Subject: running prog from within perl script
Message-Id: <3301EB7B.13DD@prestel.net>

Hi

I have a program called pngen
the oupt from this is password: encryptpass

I need to runthis program from another perl script. How do
I do this . I want to store the values to a string.

Thanks in advance

Iqbal


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

Date: 12 Feb 1997 16:28:13 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: running prog from within perl script
Message-Id: <5dsr2t$cfg@fridge-nf0.shore.net>

Iqbal Gandham (igandham@prestel.net) wrote:

: I need to runthis program from another perl script. How do
: I do this . I want to store the values to a string.

Sounds like you need the FAQ!  This question has been asked very
regularly, so you should refer to: http://www.perl.com/perl -> follow the
links to documentation/faq.  OR you could check out http://www.dejanews.com
and query for: comp.lang.perl.misc program from perl script, which gives
253 matches.  I suspect you'll find the answer there.

HTH!

--
Nathan V. Patwardhan
nvp@shore.net
"Lane, this is pure snow!
Do you have any idea what
the street value of this mountain is?"
	--Charles Demar from _Better Off Dead_


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

Date: 12 Feb 1997 09:47:54 -0800
From: Kin Cho <kin@sampras.isi.com>
Subject: Script runs inside debugger but crashes "outside"
Message-Id: <nwohdp9ar9.fsf@sampras.isi.com>

I'm using perl 5.001 on SunOS 4.1.3.

This script works inside or outside the debugger on NT (also 5.001).

Because of the complexity of my script, I'd like to find a way
to turn on some kind of line number tracing without invoking
the debugger.

Any ideas?

-kin



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

Date: 12 Feb 1997 18:06:23 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Script runs inside debugger but crashes "outside"
Message-Id: <5dt0qv$im1@fridge-nf0.shore.net>

Kin Cho (kin@sampras.isi.com) wrote:

: This script works inside or outside the debugger on NT (also 5.001).

I just checked my crystal ball, and it says that it doesn't know.  Please
show us some code, because you don't seem to have posted any - your problems 
could be anywhere... my mirror on the wall suggests that you return all 
compiler warnings and error messages.

--
Nathan V. Patwardhan
nvp@shore.net
"Lane, this is pure snow!
Do you have any idea what
the street value of this mountain is?"
	--Charles Demar from _Better Off Dead_


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

Date: 12 Feb 1997 17:53:55 GMT
From: weav@a.crl.com (Eric C. Weaver)
Subject: Seg Fault in "malloc": Dynodump with Perl on Solaris 2.5
Message-Id: <weav-1202970953320001@a103019.sfo3.as.crl.com>


Has anyone out there met with success using Dynodump with Perl under Solaris?

I'm having particular trouble with modules loaded (such as CGI or
Sys::Hostname).  The executable seems to seg-fault in malloc, under both
the "standard" malloc and the Perl-supplied malloc (though I'm never sure
whether I've REALLY gotten the Perl-supplied one to go away...).

Any useful bits would be deeply appreciated.  Please e-mail if you can.

-- 
Eric C. Weaver
Chief Eng.   KFJC  89.7   Foothill College   Los Altos Hills CA 94022


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

Date: Wed, 12 Feb 1997 12:20:26 -0600
From: defron@tc.umn.edu (Daniel Efron)
Subject: simulating csh '<<'
Message-Id: <defron-ya023480001202971220260001@newsstand.tc.umn.edu>

I have a csh script:

#! /bin/csh
cat << *EOF* > bar1
This is stuff for file 1.
blah blah
*EOF*
cat << *EOF* > bar2
This is stuff for file 2.
123456
nah nah nah
*EOF*
cat << *EOF* > bar3
This is stuff for file 3.
foo foo foo
*EOF*

This is essentially a self-expanding archive. I want to create a self-
expanding archive in Perl. I've scanned the FAQ and other documentation,
but I've missed the easy way of doing this. I'm doing this on MacPerl
so I need Perl 4 tips that don't involve escaping out to the shell.

--
Daniel Efron
defron@tc.umn.edu


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

Date: 12 Feb 1997 18:38:06 GMT
From: lawrence@purgatory.nj.nec.com (Steve Lawrence)
Subject: Student Position: Learning for Agents and Multi-Agent Systems
Message-Id: <slrn5g43hk.vom.lawrence@purgatory.nj.nec.com>

The NEC Research Institute in Princeton, NJ has an immediate opening
for a student research position in the area of learning for agents and
multi-agent systems.

Candidates must have experience in research and be able to effectively
communicate research results. Ideal candidates will have knowledge of
one or more machine learning techniques (e.g. neural networks,
decision trees, rule based systems, and nearest neighbor techniques),
and be proficient in the software implementation of algorithms.

NEC Research provides an outstanding research environment with many
recognized experts and excellent resources including several
multiprocessor machines.

Interested applicants should apply by email, mail or fax including
their resumes and any specific interests in learning for agents and
multi-agent systems to:

Dr. C. Lee Giles
NEC Research Institute
4 Independence Way
Princeton NJ 08540

Phone: (609) 951 2642
Fax: (609) 951 2482
Email: giles@research.nj.nec.com

-- 
Steve Lawrence <*> http://www.neci.nj.nec.com/homepages/lawrence


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

Date: Wed, 12 Feb 1997 16:12:12 GMT
From: Ofer Avnery <morgile@morgile.com>
Subject: Subscribe
Message-Id: <3301EBDC.27D8@morgile.com>

Is there a mailing list available for perl subjects?

	regards, Ofer Avnery
	ofer@morgile.com


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

Date: Mon, 10 Feb 1997 10:11:07 -0500
From: Nelson Asinowski <nelson@cae.ca>
Subject: UnRead Camels Wanted (was " Re: ANNOUNCEMENT: Perl documentation and FAQ discontinued)
Message-Id: <32FF3A8B.9F7@cae.ca>

Michael Fuhr wrote:
>> Say, could we recall all the unread Camels and have a
> weenie-roast to celebrate?
Dont't burn them Camels. Send them all to me.  We have several people
who are camel less and CAN and WILL read them.  

PS ( Also have you smelt burning camel hair anyways).
-- 
Nelson Asinowski           nelson@cae.ca
CAE Electronics Ltd.       Montreal,Canada


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

Date: 12 Feb 1997 17:57:03 GMT
From: ycheung@Bayou.UH.EDU (Raymond Cheung)
Subject: what does this line do?
Message-Id: <5dt09f$1m2@Masala.CC.UH.EDU>


I don't understand this line:

$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

it appears in a cgi script. Could someone explain it?
Thanks.

--
 +-------------------------------------------------------------------------+
 |  Raymond Cheung 	(University of Houston, Computer Science Dept)     |
 |  E-mail address:                   totoro@hk.linkage.net		   |
 |				      ycheung@bayou.uh.edu		   |
 |				      ycheung@cs.uh.edu			   |
 |  Home page:		       	      http://www.cs.uh.edu/~ycheung	   |
 +-------------------------------------------------------------------------+


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

Date: 12 Feb 1997 11:45:17 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: what does this line do?
Message-Id: <5dt33t$1s7@web.azstarnet.com>

In article <5dt09f$1m2@Masala.CC.UH.EDU>,
Raymond Cheung <ycheung@Bayou.UH.EDU> wrote:
>
>I don't understand this line:
>
>$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>


#!/usr/bin/perl -w

use strict;

my $value='%7Efoo%2F';		# for example...

print $value, "\n";		# before the substitution

$value =~ s/				# a normal substitution
	    %				# starts with a '%'
	    (				# remember this next pattern as $1
	    [a-fA-F0-9][a-fA-F0-9]	# matches a 2-digit hex value, eg 7E
	    )/				# stop remembering
	    pack("C", hex($1))		# replace the above with the
					#   unsigned character-sized decimal
					#   value of the hex number remembered
					#   as $1
	    /egx;			# e = evaluate, g = global (many
					#   times in one string)


print $value, "\n";		# after the substitution

__END__


This is probably used to unescape a URL.  Like the CGI::unescape() subroutine.

Hope this helps.  Check the perlfunc(1) manpage for the hex() and pack()
functions.  Check the perlre(1) manpage for info on the /e and /g
modifiers.

Tim Smith
StarNet Staff



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

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

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