[7687] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1313 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 13 16:07:33 1997

Date: Thu, 13 Nov 97 13:00:29 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 13 Nov 1997     Volume: 8 Number: 1313

Today's topics:
     Re: !Best HW/SW config for Perl <djb@16straight.com>
     Re: [Q]: Arbitrary sort on field names (brian d foy)
     Re: Adding SYSWRITE method to TIEHANDLE. <ghowland@hotlava.com>
     ANNOUNCEMENT: 3-Day Perl5 class in Birmingham Alabama (Perl)
     Re: Block comments in Perl? <usenet-tag@qz.little-neck.ny.us>
     Bulkin' up <raven@lp-llc.com>
     Re: child-process workaround for taint-mode glob? <jbc@west.net>
     Embedded Perl: SvNOK fails for SVt_PVNV <nygard@knmi.nl>
     Extracting ASCII records from BINARY files??? (Dan LeGate)
     Re: gawk2perl (similar to a2p) does it exist? <awkfaq@locutus.ofB.ORG>
     how to learn perl <founder@pege.org>
     Re: HTML Forms and Data Storage <djb@16straight.com>
     Re: HTML Forms and Data Storage <raven@lp-llc.com>
     I am  having trouble reading in a variable from a file <gregc@rdcircuits.com>
     ISO: an aid to identifying differences lvirden@cas.org
     Re: ISO: an aid to identifying differences <ken@bitsko.slc.ut.us>
     Make the browser to never stop loading <ron@globes.co.il>
     Re: Make the browser to never stop loading <djb@16straight.com>
     Multi-dimensional hash for DB? (HMahaffey)
     Re: OS/2: Core dumped on s/// Bug? (Ilya Zakharevich)
     perl and setuid in unix <canadasl@bp.com>
     perl5.004_04 installation problem on Ultrix <Peter.DeGersem@esat.kuleuven.ac.be>
     precedence question <prl2@lehigh.edu>
     Re: precedence question <prl2@lehigh.edu>
     Re: precedence question (Mike Stok)
     Re: problem with Telnet module <barnett@houston.Geco-Prakla.slb.com>
     Re: problem with Telnet module <tim@hcirisc.cs.binghamton.edu>
     process handling ()
     Re: Q: Precise Timestamps in Perl? <ghowland@hotlava.com>
     Re: questions! <billg@networkapparel.com>
     Re: readline <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
     Re: Tk/Motif/Embedded Perl question (Brian Wheeler)
     Re: What data is being returned from a form? <billg@networkapparel.com>
     Y2000 Issues in PERL CGI scripts? <kurt.stype@bani.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 13 Nov 1997 13:38:18 -0500
From: Dan Birchall <djb@16straight.com>
Subject: Re: !Best HW/SW config for Perl
Message-Id: <346B491A.63DE@16straight.com>

> I am interested in hearing people's thoughts on what is the
> best hardware/software configuration for using perl and
> internet.  Tell me what works for you.

Since Perl's "native" platform appears to be UNIX, I'd
suggest going with a UNIX system.  As far as which hardware
and which version of UNIX are best for you... that's a far
more subjective question, and you'll have to evaluate your
own needs.

If you don't want to spend a lot of money, you can get a
very capable server by purchasing a used '486DX2-66 (costs
probably $200), putting Linux or FreeBSD (both are free)
on it, along with the Apache webserver (free) and PERL 5.00x
(also free; 5.004 is current, I think).

If price were no object, I'd personally get a high-end 
multi-processor Silicon Graphics system with IRIX 6.4, a gig
of RAM, and a half-terabyte or so of disk, running Netscape
Enterprise Server, etc, and again PERL 5.00x (free). :)

-Dan

-- 
Dan Birchall - Internet Sysadmin - 16 Straight Communications
520 Fellowship Road, Suite A-112, Mount Laurel, NJ 08054-3400
Print design, web design and hosting... from a single source!
djb@16straight.com - http://www.16straight.com - 609.231.7887


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

Date: Thu, 13 Nov 1997 12:34:34 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: [Q]: Arbitrary sort on field names
Message-Id: <comdog-ya02408000R1311971234340001@news.panix.com>

In article <346B12F5.A2470F6B@itis.com>, Prince Mystery <mystery@itis.com> wrote:

>@fieldnames = ("name", "address1", "address2", "city", "state");
>
>If I give the user the option to list a variable amount of field names,
>and end up with an array similar (but smaller) to the one above, how do
>I sort so that they will always appear in some semblance to the order
>implied by the @fieldnames array?  (i.e. an array of ("city","name")
>would be sorted to ("name", "city")).

why waste time sorting?  go through @fieldnames and if that field
is defined by the user, add it to some list (or whatever you need to 
do), then get on with your life.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 11 Nov 1997 13:45:20 +0100
From: Gary Howland <ghowland@hotlava.com>
To: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Adding SYSWRITE method to TIEHANDLE.
Message-Id: <34685360.6BD5@hotlava.com>

Lloyd Zusman wrote:
> 
> I chose "SYSWRITE" instead of "WRITE" for the name of this method
> because this leaves the possibility open for a "WRITE" method to be
> created some time in the future to be used with the 'write' command
> during TIEHANDLE processing.  Of course, I'm perfectly happy if we use
> "WRITE" instead of "SYSWRITE" for the name of the method I added if
> there are no plans for the eventual TIEHANDLE-ing of 'write'.

The 'write' command doesn't do what I think you think it does - it is
instead used for writing out a formatted record.  I think you are
looking for 'print', not write. and 'PRINT' is already available for use
with tied filehandles.

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: Thu, 13 Nov 97 14:20:48 CST (-0600)
From: perl@cis.uab.edu (Perl)
Subject: ANNOUNCEMENT: 3-Day Perl5 class in Birmingham Alabama
Message-Id: <879452448.358@138.26.65.78>


Perl Programming

Learn the full range of capabilities provided by programming
in the Perl language (Version 5) from basics to advanced features
that include pattern-matching, object-oriented techniques, socket
programming and network applications including CGI. Instruction
includes hands-on exercises and sample applications written by 
the instructor that include a working file viewer, ASCII art 
animation packages, and Web server. Two textbooks are provided.
Prerequisite: C programming experience.

Course number: CO1 8000 07A
Dates: December 10-12
Time: 9:00 0 4:00 pm
Location: UAB Campus, Campbell Hall Room 154
Cost: $675
1.8 CEU's 
To register call (205) 934-8263




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

Date: 13 Nov 1997 20:28:47 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Block comments in Perl?
Message-Id: <eli$9711121650@qz.little-neck.ny.us>

Jim Turner  <turnerj@cliffy.lmtas.lmco.com> wrote:
> 	I just have to add my 2 cents worth also:
> 
> Try this:
> 
> 
> 	goto RESUME;
> Type anything you want here, this will
> all be commented out.
> RESUME:

Okay, I'll try that.

$ perl -we 'print "foo" ;
	goto RESUME;
	 
	Type anything you want here, this will
	all be commented out.
	 
	RESUME:
	 
	print "bar\n";'
Unquoted string "here" may clash with future reserved word at -e line 4.
syntax error at -e line 7, near "RESUME:"
Execution of -e aborted due to compilation errors.

Doesn't seem to work too well.

Elijah
------
and this is so bad -w is not needed to show the problem


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

Date: Thu, 13 Nov 1997 12:43:12 -0800
From: Matt McLaughlin <raven@lp-llc.com>
Subject: Bulkin' up
Message-Id: <346B665F.C7521FDF@lp-llc.com>

Ive got a little subroutine I wrote to send to my email list, which now
numbers around 1000 recipients.

It works great, though it is extremely slow. I tried to move the open
MAIL command to before the foreach loop begins but that just sends one
very long email to the first name on the list.

Isnt there a way to send the mail in BULK form?
- I would prefer that only the recipients address appear in the To: area

oh, and I dont want to use majordomo

heres the code Im using right now:


open (LIST, "$LIST") || &error; @list=<LIST>; $number=0; print STDERR
"@list\n";

foreach  (@list){
$you = $_;
chomp($you);

open(MAIL,"|$mailprog -t");# Open The Mail Program
print MAIL "To: $you\n"; #recipient
#   etc...
close (MAIL)




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

Date: Thu, 13 Nov 1997 11:49:25 -0800
From: John Callender <jbc@west.net>
Subject: Re: child-process workaround for taint-mode glob?
Message-Id: <346B59C5.CA7C4E43@west.net>

John Callender wrote:

> #!/usr/local/bin/perl -T
> 
>           # add error processing as above
>            $pid = open(KID_TO_READ, "-|");
>            if ($pid) {   # parent
>                while (<KID_TO_READ>) {
>                    # do something interesting
>                    push @stuff; # seemed interesting to me...
>                }
>                close(KID_TO_READ) || warn "kid exited $?";
> 
>            } else {      # child
>                ($EUID, $EGID) = ($UID, $GID);
>                 $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
>                exec('ls', '-1', '../????/??????.html')
>                    || die "can't exec program: $!";
>                # NOTREACHED
>            }
> 
> print "@stuff";

Thanks for the help. As it turns out, I figured out a less clever, but
more efficient (for me, at least), solution. I just needed to use the
File::KGlob module, which does globbing just fine, even when running
under -T in 5.004. Since this allowed me to use my existing script, just
substituting a few lines, it worked out much better for me than the
proverbial wheel-reinvention, either via readdir approaches or the
child-process workaround mentioned in the perlsec manpage.

Specifics of what I did, for anyone else as clueless as me who has to
deal with this particular problem:

1) I read Greg Bacon's helpful E-mail, suggesting in passing that I look
at the File::Find module.
2) Browsed Jan Orwant's very helpful intro to CPAN, at 
http://www.perl.com/CPAN-local/CPAN.html
3) Downloaded the File::KGlob module (since my provider's Perl
installation didn't include it), and untarred it into a ~/lib directory.
4) Added the following at the top of my scripts:

use lib '/u1/j/jbc/lib'; # my local lib directory
use File::KGlob;

5) Replaced all lines of the form:

@files = <../????/??????.html>;

with lines of the form:

@files =  &File::KGlob::glob('../????/??????.html');

And it actually worked! I love it when that happens...

Thanks again.

--
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: 13 Nov 1997 18:19:13 GMT
From: "carl Nygard" <nygard@knmi.nl>
Subject: Embedded Perl: SvNOK fails for SVt_PVNV
Message-Id: <01bcf060$8c7166a0$d9131791@btpab2.knmi.nl>


I'm trying to translate an SV* to a double.  I check the SV* with SvNOK(sv)
but it fails.  Ok, but I happen
to know that it is a floating point number, Data::Dumper confirms.  When I
check it with SvTYPE(sv), I get
in return the SVt_PVNV.  What is it??  It's not in the docs, not in the
FAQ, not in the perlguts, not in
the Camel book, or the Adv. Perl Prgmg Panther book.  I can only conclude
from looking at the sv.h
file that I don't know enough about Perl internals to string together the
proper macros.

Does anyone know what SVt_PVNV (and SVt_PVIV, SVt_PVPV) means?  How do I
translate this thing
to a double (or int, or whatever)?

Thanks...


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

Date: Thu, 13 Nov 1997 20:34:08 GMT
From: dlegate@rsa.csuhayward.edu (Dan LeGate)
Subject: Extracting ASCII records from BINARY files???
Message-Id: <346b63c7.90408733@news.calstate.edu>

Question from a new Perl programmer.  I know how to extract records
from a file where each record is on a different line (terminated by
\n) and all characters are standard ASCII.  But now I'm facing a
situation where I need to extract ASCII records out of the middle of
binary (non-standard) characters, in LONG lines of text.

For example:

^@^A^EWelcome^@\241\241^@^@7^@7^@^@^^@^B^EPayments due^@\241\241^@
^@^A^DThursday, Feb 15. at 6:00
pm.^@\241\241^@^@7^@7^@^@^^@^B^EGoodbye^@\241\241^@

All those ^@ types of characters are actually just one character, but
display this way in emacs.  I would need to extract "Welcome",
"Payments Due", "Thursday, Feb 15. at 6:00 pm.", and "Goodbye" from
this garbled mess.  Keep in mind all of this is on one line.  There
are only a few \n line breaks in the file and then the data continues
in a messy order like this.

I've noticed that each "record" is preceded by either a ^E or a ^D and
ends with ^@\241\241 each time.  But I'm lost as to how to tell perl
"get the text between those delimeters only".

Can anyone help me out here?

Dan

PS - Please CC a copy of your reply to my email address.


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

Date: Thu, 13 Nov 1997 17:04:05 +0000
From: Russell Schulz <awkfaq@locutus.ofB.ORG>
Subject: Re: gawk2perl (similar to a2p) does it exist?
Message-Id: <19971113.170405.6q2.rnr.w164w@locutus.ofB.ORG>

  [ I wonder if this will get me a `welcome, you newbie' message ]

Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal) writes:

> I've noticed similar deficiencies of a2p.

please direct any new ones to me, so I can include them in the
comp.lang.awk FAQ (section 6.8)

  <ftp://rtfm.mit.edu/pub/usenet/comp.lang.awk/faq>
  <http://www.faqs.org/faqs/computer-lang/awk/faq/>

> Is this tool still maintained? Who is in charge of it? It would
> be very helpful to have an enhanced functionality of a2p that
> covers (n|g)awk syntax.

again, if someone IS maintaining it outside the perl project, please
let me know.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Thu, 13 Nov 1997 12:33:04 +0100
From: "Mosl Roland" <founder@pege.org>
Subject: how to learn perl
Message-Id: <64fhpi$cd9$2@orudios.magnet.at>

I am with computers since 1976 and worked as
a professional programmer 1980 to 1991.

Now I want to learn Perl.
I need no beginers book,
I need a book to convert my knowledge
in Assembler, Basci, Pascal, C into Perl.

What books would You recommend me?

Chevalier Mvsl Roland   founder@pege.org
http://pege.org - clear targets for a confused civilization
get 2mb free homepage -> http://yi.com/yimmi.php?yimmi=Pege
Callback ohne Anmeldegeb|hren und 5%
f|r die Sonnenenergie -> http://pege.org/utelco/




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

Date: Thu, 13 Nov 1997 13:34:17 -0500
From: Dan Birchall <djb@16straight.com>
To: Thomas George <tgeorge@twnetwork.com>
Subject: Re: HTML Forms and Data Storage
Message-Id: <346B4829.6231@16straight.com>

Thomas George wrote:
> 
> Does anyone have a simple script for storing/appending 
> data from web-based forms in an ascii file?
> 
> It doesn't seem like it would be difficult, but I have 
> not yet had the time to learn the perl coding for such 
> a task.

Well, after parsing the data as usual, do something like:

open (FILE, ">>file");
print FILE $FORM{'value1'},"\n";
close FILE;

You've just added a line to your file with the value of
the one field in your form.

If you've got a bunch of fields and you'd like that in a
CSV (Comma-Separated-Value) file that you could easily read
into most databases, you could use:

open (FILE, ">>file");
print FILE "\"",$FORM{'value1'},"\",";
print FILE "\"",$FORM{'value2'},"\",";
print FILE "\"",$FORM{'value3'},"\",";
print FILE "\"",$FORM{'value4'},"\",";
print FILE "\"",$FORM{'value5'},"\"\n";
close FILE;

This way you get lines that look like:

"value1","value2","value3","value4","value5"

Hope that'll get you started.

-Dan

-- 
Dan Birchall - Internet Sysadmin - 16 Straight Communications
520 Fellowship Road, Suite A-112, Mount Laurel, NJ 08054-3400
Print design, web design and hosting... from a single source!
djb@16straight.com - http://www.16straight.com - 609.231.7887


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

Date: Thu, 13 Nov 1997 12:52:30 -0800
From: Matt McLaughlin <raven@lp-llc.com>
To: Thomas George <tgeorge@twnetwork.com>
Subject: Re: HTML Forms and Data Storage
Message-Id: <346B688E.3E79EE97@lp-llc.com>

It's very easy, but depends on what kind of permissions you have to your
server, meaning you might not be able to allow "WRITE" access to web
users.  At least this has been my experience, though might not be true
in all cases.

A way around this is to create the form and have it email the fields to
you.  Users will not be able to tell this is happening.  For all they
know they are connecting to some huge database.

Hope that helps.


Thomas George wrote:

> Does anyone have a simple script for storing/appending data from
> web-based forms in an ascii file?
>
> It doesn't seem like it would be difficult, but I have not yet had the
>
> time to learn the perl coding for such a task.
>
> Any assistance would be greatly appreciated.
>
> --
> Thomas George





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

Date: Thu, 13 Nov 1997 12:40:40 -0500
From: Gregory Czechowicz <gregc@rdcircuits.com>
Subject: I am  having trouble reading in a variable from a file
Message-Id: <346B3B98.876BF4C3@rdcircuits.com>

Can somone let me know a good script that will do this  using
cgi-lib.pl

I just want to add a number that a user submits on a form to a number
that i have stored on my server via a text file.


Please email me at gregc@rdcircuits.com



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

Date: 13 Nov 1997 19:22:44 GMT
From: lvirden@cas.org
Subject: ISO: an aid to identifying differences
Message-Id: <64fk24$90v$1@srv38s4u.cas.org>



A co-worker stopped by this pm asking if I was aware of any programs
which would spit out the specific characters of difference when comparing
two items.  Actually, in his case, he was wanting to process a file of
the form


line1a
line1b
line2a
line2b
:
:
linena
linenb

where the output would be the specific characters of difference between lines
[1-n]a and [1-n]b.

The diff would not need to identify from which of the two lines the
characters came.  And it would only need to be in terms of characters in one
line that are not present in the other - i.e.

abcdiffxyz
abcxyz

would result in an output line of
$ cat diff.out
diff
$

I know that something could be written.  However, 'diff' like perl tools
seem like a natural.  and in fact, doing a search on "+diff +perl" on
AltaVista does produce over a thousand hits.  I am working my way
thru them, but so far, the hits don't seem relevant to what
I am seeking.

Does anyone have a pointer to a specific tool that might be a useful
basis of evolution?
-- 
Larry W. Virden                 INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.


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

Date: 13 Nov 1997 14:01:41 -0600
From: Ken MacLeod <ken@bitsko.slc.ut.us>
Subject: Re: ISO: an aid to identifying differences
Message-Id: <m3hg9go95m.fsf@biff.bitsko.slc.ut.us>

lvirden@cas.org writes:

> A co-worker stopped by this pm asking if I was aware of any programs
> which would spit out the specific characters of difference when comparing
> two items.  Actually, in his case, he was wanting to process a file of
> the form

Emacs' `ediff' will do that, if you're not looking for a batch mode program.

-- 
  Ken MacLeod
  ken@bitsko.slc.ut.us


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

Date: Thu, 13 Nov 1997 20:17:24 +0200
From: Ron Faur <ron@globes.co.il>
Subject: Make the browser to never stop loading
Message-Id: <346B4434.2A88@globes.co.il>

I'm trying to make a perl script that outputs an html page that never
stops to load.
Is this possible in Perl? If it is, how can i do it?

Thanks.


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

Date: Thu, 13 Nov 1997 13:41:26 -0500
From: Dan Birchall <djb@16straight.com>
To: ron@globes.co.il
Subject: Re: Make the browser to never stop loading
Message-Id: <346B49D6.6956@16straight.com>

Ron Faur wrote:
> 
> I'm trying to make a perl script that outputs an html 
> page that never stops to load.
> Is this possible in Perl? If it is, how can i do it?

I've tried doing this.  The problem with simply 
continually appending to a file is that sooner or later
the browser is going to give up and stop waiting. :)

The one way I managed to do it, once (which I then broke
and haven't gotten working again yet) was to have the
script create a page with a META REFRESH header (see your
friendly HTML authoring guide for information on that one!),
start *another* script which ran in the background and 
actually did the appending, and redirect the user to the
newly created page.  The other script did all its appending,
then modified the page, removing the META REFRESH.

While all the appending was going on, the user's browser (if
it were a fairly recent model) would be periodically directed
to a newer (more-appended) version of the page.  Once it was
done and the header was removed, the page would just sit 
there for them to stare at as long as they wanted.

-Dan (there's gotta be a better way ;)

 .

-- 
Dan Birchall - Internet Sysadmin - 16 Straight Communications
520 Fellowship Road, Suite A-112, Mount Laurel, NJ 08054-3400
Print design, web design and hosting... from a single source!
djb@16straight.com - http://www.16straight.com - 609.231.7887


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

Date: 13 Nov 1997 18:11:46 GMT
From: hmahaffey@aol.com (HMahaffey)
Subject: Multi-dimensional hash for DB?
Message-Id: <19971113181100.NAA18848@ladder01.news.aol.com>

I'm using the DBM package that is built in to Perl 5.004.  A script like this
 works beautifully:
      dbmopen(%db, "db", 0622);
      $db{$tag} += 1;
      $caller_data = $db{$tag};
      dbmclose(%db);
Everytime you run the script, you get a higher number.  Cool.

Ok, now let's try to add a "column" by doing this:
       dbmopen(%db, "db", 0622);
       $db{$tag}{"VERSION"} += 1;
       $db{$tag}{"TYPE"} = "foo";
       $caller_data.....
       $dbmclose(%db);

If this is in a function that is called over and over, everthing works.  But
 once the script exits, and is called again, $db{$tag}{"VERSION"} is undefined!
  When I type out the database file, I see what looks like an address
 ("HASH(0x401975ac)) where you see the value if the array is
 single-dimensional.

Sorry if this is an old issue, but I couldn't find anyone using the DBM with
 multi-dimensional array in any of my books (I seem to have them ALL).  One
 implemented one by using column delimiters to parse through.  Yuck!

I'm in a bit of a panic to get this implemented soon, so any help would be
 appreciated!

Thanks,
:)hal mahaffey
hmahaffey@aol.com


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

Date: 13 Nov 1997 19:09:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: OS/2: Core dumped on s/// Bug?
Message-Id: <64fj9f$bjd$1@agate.berkeley.edu>

In article <346AEDFB.57CB@bigfoot.com>, Koos Pol  <koos_pol@bigfoot.com> wrote:
> > Known bug of jumbo RE patch v1 (this is what OS/2 binary was shipped
> > with).  Does not happen with my copy of 5.004_53 + v5 (but probably v2
> > or somesuch should be OK).

> I don't know what jumbo RE is, neither the addendum +5. Do you say I
> just reinstall the latest binaries from your CPAN area?

Any non-latest binary on CPAN is too old to have this bug.  Basing on
your bug report you already have the latest distributed binary.

One can always recompile any distribution AS IS (5.004_04 and 5.004_53
are the current ones), or, if one want features in the jumbo patches,
v5 has no known bugs and should be compilable with 5.004_53.  But
since these features were not documented with the binary distribution,
one would hardly miss what is in jumbo-RE (except
speedups/bug-corrections).

Ilya


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

Date: 13 Nov 1997 20:29:09 GMT
From: "Susan L. Canaday" <canadasl@bp.com>
Subject: perl and setuid in unix
Message-Id: <01bcf072$c7a74f20$00540180@amclvw27311.clv.am.bp.com>

I am working on a user interface for a 3-d party tool.  The tool is written
in perl & csh.
When I try to call the perl scripts I get an error, "insecure dependency in
mkdir
while running setuid".
I do a setuid() in a c program to change to a specific userid that the 3-d
party
tool requires.   Then use execl() to exec a shell script that sets up the
environment for 
that new user, then it calls the 3-d party programs.  The one perl program
I'm testing 
with just creates some directories.
If I call a different shell script (instead of the perl script) I do not
see the error.
I looked at perl's documentation.  It sounds like perl does some additional
checking for a setuid condition.  I know unix has a kernel variable that
can be set
to enable or disable its own checking.  I assume if I can run a shell
script instead
of the perl script and not see the error, that unix's kernel variable
(which as I 
understand it prevents shell scripts from running setuid) must not be set.
Does anyone have experience with this sort of thing.
I've verified that I do need to setuid since the 3-d party tool assumes
that you're
logged in as this one user and all its programs are written with that
assumption
incorporated in many different ways.
I just want to be able to run the perl script without this checking
interfering.
Do I need to look at the kernel variable?  What's it called?
How are the kernel variable and the checking perl does related to
eachother?
Thanks, Susan




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

Date: Thu, 13 Nov 1997 18:14:26 +0100
From: Peter De Gersem <Peter.DeGersem@esat.kuleuven.ac.be>
Subject: perl5.004_04 installation problem on Ultrix
Message-Id: <346B3572.CA051DA@esat.kuleuven.ac.be>

Hi,

I'm installing perl5.004_04 on our department computer system, the
alpha-dec_osf and sun4-solaris versions compiled without problems, but
while installing the risc-ultrix version make reported the following
error:

  ./miniperl -Ilib pod/pod2html.PL
  Can't locate object method "fileparse_set_fstype" via package "ultrix"
at 
    lib/File/Basename.pm line 250.
  BEGIN failed--compilation aborted at pod/pod2html.PL line 4.
  *** Error code 2

  Stop.

This is the output of ./myconfig (I didn't change the default values of
Configure, except the compiler and the installation directories)

  Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
    Platform:
      osname=ultrix, osvers=4.4, archname=RISC-ultrix
      uname='ultrix claus 4.4 0 risc '
      hint=recommended, useposix=true, d_sigaction=define
      bincompat3=y useperlio=undef d_sfio=undef
    Compiler:
      cc='gcc', optimize='-O3 -s', gccversion=2.7.2.3
      cppflags=''
      ccflags =''
      stdchar='char', d_stdstdio=define, usevfork=false
      voidflags=15, castflags=0, d_casti32=define, d_castneg=define
      intsize=4, alignbytes=8, usemymalloc=y, prototype=define
    Linker and Libraries:
      ld='ld', ldflags =''
      libpth=/lib /usr/lib
      libs=-ldbm -lm -lc
      libc=/usr/lib/libc.a, so=so
      useshrplib=false, libperl=libperl.a
    Dynamic Linking:
      dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef, ccdlflags=''
      cccdlflags='', lddlflags=''

I also ran "make minitest", and it failed on a few test, giving similar
error-messages as before (Can't locate object method "..." via package
"..." at "...").

Does anyone of you have an idea what the problem could be and how to
solve it?

Thanks a lot,
Peter
-- 
Peter De Gersem (K.U.Leuven-ESAT/SISTA)
Peter.DeGersem@esat.kuleuven.ac.be
http://www.esat.kuleuven.ac.be/~degersem/


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

Date: 13 Nov 1997 19:15:47 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: precedence question
Message-Id: <01bcf068$8aa40000$3e03b480@mm>

The following causes the help routine to execute no matter what:

&help if ( $arg{uname} =~ /^?|-?$/ );

Why?


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

Date: 13 Nov 1997 19:24:59 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: precedence question
Message-Id: <01bcf069$d471ee80$3e03b480@mm>


Phil R Lawrence <prl2@lehigh.edu> wrote in article
<01bcf068$8aa40000$3e03b480@mm>...
> The following causes the help routine to execute no matter what:
> 
> &help if ( $arg{uname} =~ /^?|-?$/ );
> 
> Why?
>
I forgot that the ? was a quantifier and needed to be backslash escaped. 
Still, I wonder exactly what the expression was matching, since there was
no atom that the quantofier was following.
 


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

Date: 13 Nov 1997 20:28:38 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: precedence question
Message-Id: <64fntm$dr8@news-central.tiac.net>

In article <01bcf069$d471ee80$3e03b480@mm>,
Phil R Lawrence <prl2@lehigh.edu> wrote:
>
>Phil R Lawrence <prl2@lehigh.edu> wrote in article
><01bcf068$8aa40000$3e03b480@mm>...
>> The following causes the help routine to execute no matter what:
>> 
>> &help if ( $arg{uname} =~ /^?|-?$/ );
>> 
>> Why?
>>
>I forgot that the ? was a quantifier and needed to be backslash escaped. 
>Still, I wonder exactly what the expression was matching, since there was
>no atom that the quantofier was following.

  /^?|-?$/

has a second part which is -?$ which will match against 0 or 1 -
characters before the end of the string, so it will match anything - even
undef gets turned into a string with an end.  You're selecting between one
of ^? and -?$.  The perlre man page includes this paragraph: 

       You can specify a series of alternatives for a pattern
       using "|" to separate them, so that fee|fie|foe will match
       any of "fee", "fie", or "foe" in the target string (as
       would f(e|i|o)e).  Note that the first alternative
       includes everything from the last pattern delimiter ("(",
       "[", or the beginning of the pattern) up to the first "|",
       and the last alternative contains everything from the last
       "|" to the next pattern delimiter.  For this reason, it's
       common practice to include alternatives in parentheses, to
       minimize confusion about where they start and end.  Note
       however that "|" is interpreted as a literal with square
       brackets, so if you write [fee|fie|foe] you're really only
       matching [feio|].

You might have meant

  &help if $arg{'uname'} eq '?' or $arg{'uname'} eq '-?';

or

  &help if $arg{'uname'} =~ /^-?\?$/;

maybe.

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@colltech.com                  |            Collective Technologies (work)


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

Date: Thu, 13 Nov 1997 12:19:08 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: problem with Telnet module
Message-Id: <346B449C.75A7@houston.Geco-Prakla.slb.com>

Tim,

Try 'use lib "Directory_where_Net_is"'.

My personal libraries are in:
/auto/home_app03s/barnett/lib, so I enter:
use "/auto/home_app03s/barnett/lib"; in my scripts, and all is fine.

Under that lib directory, I have the Dave subdirectory, with several
perl modules. (referred to as Dave::LOG in the script).

HTH.

--

"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 13 Nov 1997 13:52:08 -0500
From: Tim Gray <tim@hcirisc.cs.binghamton.edu>
Subject: Re: problem with Telnet module
Message-Id: <t067pwsk2v.fsf@hcirisc.cs.binghamton.edu>

I am still having this problem and thought I would give an update as
to other solutions suggested so far to reduce redundancy.

> Hi there,
> 	I am trying to use the Telnet.pm module on a system where I
> don't have root and therefore can't actually install the module
> properly.  So I put the module in the same directory as my script.  I
> have tried to 'use' it several ways but none work.
> 
> use Net::Telnet		#no shock there since it isn't in $PERL5LIB/Net
> use Telnet;
> use Telnet ();

I tried 
unshift @INC, ".";
and
unshift @INC, "/u0/users/7/consp07/bin";

"/u0/users/7/consp07/bin" being the directory where I put Telnet.pm

and recently upon a suggestion from Dave Barnett I tried

use lib "/u0/users/7/consp07/bin";

which actually gave me errors with Socket.pm since I have the latest
Socket.pm in that directory as well, but it conflicted with the one
refered to by Dynaloader so I had to get rid of it.  And now I am back
to the original error.

> 
> No matter what it "can't locate object method new vie package Telnet".
> 
> The code snippet that instantiates the Telnet object looks like this
> 
> $popbox = new Telnet (Host => "mail.binghamton.edu",
>                    Port => 110);
> 
> Any suggestions?  Thanks.


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

Date: 13 Nov 1997 18:24:38 GMT
From: mathias@linux.ek79.uni-koeln.de ()
Subject: process handling
Message-Id: <64fgl6$5d6@news.rrz.Uni-Koeln.DE>


Hi,

The goal is to get $N values from the output
of several runs of a  program, RERC. 
This program needs a few parameters, including 
$niter, which is defined at (4) as variable for 
convenience.

This RERC program is available to me only as binary,
and has the nasty tendency to start going in circles
in some random circumstances, so it has to be
killed and started anew. This is where Perl
comes in.

After setting a maximum duration (based on a
"stable" parameter setting) after which it is decided 
the programm has to be stopped (6,7,8),
the "instable" RERC is launched (12,13).

If the process is still around after the time
is up, it is killed (21-25). The funny part
here is that (20) and (23) show no trace of
the process, while (21) does. So it is attempted
to kill something which doesn't exist anymore.

Can you spot the snag ?  I have tried,
and I can't   :-(

Thank you in advance for your emailed answer.

Sincerely

Mathias


  1 #!/usr/bin/perl
  2	
  3 $N = 1;
  4 $niter = 2000;
  5 $i = 1;
  6 $started = time();
  7 system("RERC m1990.dat m1990.dat $niter 8 4 1 0.0001 5 > /dev/null");
  8 $wait    = 3*(time() - $started);
  9 
 10 while ($i <= $N)
 11 {
 12    if ( system("RERC m1994.dat m1994.dat $niter 8 4 1 0.0001 5 > temp &") )
 13       {die "something went wrong";}
 14    $pid = getpid();
 15    $click=time();
 16    while((time()-$click)<= $wait)
 17    {
 18      # just wait
 19    }
 20    `ps>qwe`;
 21    if ($pid == getpid()) 
 22    {
 23       `ps>qweqwe`;
 24       system("kill -9 $pid & ");
 25       print $pid . " killed\n";
 26    }
 27    else 
 28    {
 29      print $pid . " concluded\n";
 30      open(TEMP,"temp");
 31      while($line = <TEMP>) 
 32      {
 33        if ($line =~ /NS/) 
 34        {
 35           @NS = split("=", $line);
 36           last;
 37        }
 38      }
 39    }
 40    $sum += $NS[1];
 41    ++$i;
 42 }
 43 
 44 
 45 $mean = $sum/$N;
 46 print "\n";
 47 printf("%f\n",$mean);
 48 
 49 
 50 
 51 sub getpid {
 52 foreach (`ps`) 
 53    {
 54       if (/RERC/) 
 55       {
 56         @fields = split(' ');
 57         last;
 58       }
 59    }
 60    $fields[0];
 61 }
 62 



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

Date: Tue, 11 Nov 1997 12:12:47 +0100
From: Gary Howland <ghowland@hotlava.com>
To: lbudney@fore.com
Subject: Re: Q: Precise Timestamps in Perl?
Message-Id: <34683DAF.78BE@hotlava.com>

lbudney@fore.com wrote:
> 
> Hi everyone,
> 
> Sorry if this is a FAQ--I've checked the FAQs and man pages without
> result already.
> 
> I want to generate unique filenames using timestamps and PIDs, but
> the time() function in Perl returns a 1-second timestamp.  That is
> too granular in general.  Is there a way in Perl to generate a
> millisecond or microsecond timestamp?
> 
> With gcc, I would simply access the member time_t.tm_usec to get a
> microsecond timestamp.  Is there a Perl-ish analogue?

On Solaris you can do something like this to get better accuracy:

sub hires_time {
        my $x = "\0" x 8;
        syscall(191, 0, $x) && croak "clock_gettime() system call failed
($!)";
        unpack("L L", $x);
}

You'll have to pay me if you want a different platform ... :-)

Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: Thu, 13 Nov 1997 11:52:24 -0500
From: Bill Guindon <billg@networkapparel.com>
Subject: Re: questions!
Message-Id: <346B3048.217AADFF@networkapparel.com>

tmrideo@istar.ca wrote:

> >Secondly where is the best online tutorial for perl.

> Hmm, don't know an answer for this one, haven't seen one yet.  But if

> you do find one, send it my way. :)

I'm also new to perl (little over a month now), but have had the luck (and
help of others) to find the proverbial "Perl Tutorial GOLDMINE!" at:

http://reference.perl.com/query.cgi?tutorials+index

On there, you'll find links to MANY online tutorials, with DETAILED
descriptions.
IMHO, the link to the "Perl Short Course", is a very good place to start.



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

Date: Thu, 13 Nov 1997 09:57:20 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
Subject: Re: readline
Message-Id: <64ff63$7m6@news.microsoft.com>


Daniel Pittenger wrote in message <346AB851.41C67EA6@iscmed.med.ge.com>...
>Sorry if this has been covered a million times--


Oh, perhaps, but like they say on TV, if you haven't seen it before it's new
to you. :D

<much stuff snipped>

>Basically I need to know how can I read from a string variable ($body)
>until I come to the word "Subject:" and seperate out and store that line
>for later use.

Perhaps this will do what you're looking for:

$_ = $body;
$subject = (/Subject: (.*?)\n/i && $1);
die "Could not find a subject line" unless $subject;
@temp = ($subject);
push(@mylist,@temp);

Here's a breakdown of what this does. Forgive me if I explain things you've
already figured out (or if I mess up along the way :D).

$_ is sort of a "magic variable." It's the default for a lot of operations,
including "match" (m// or just //) and "search & replace" (s///). By copying
$body (the variable we're searching for a subject) into $_ we can save a
little typing.

The second line searches in $_ (the magic variable) to see if it can find a
piece of text bounded by "Subject" (case insensitive -- looks like you
figured that part out) and a newline. The construct (.*?) is called a
"non-greedy match." It matches as little as it can and still meet the search
criteria you set. If you use (.*) instead, it will try and make the match as
big as possible, including everything from "Subject:" to the very last
newline character in $_ -- which, if it contains a long Usenet post, for
instance, could be much more than you wanted.

Why the parentheses? For one thing, to make it easier to tell what's going
on. For a second thing, if the match succeeds, whatever gets matched inside
the parentheses -- in this case, the subject line -- will be stored in the
variable $1. If you have more than one set of parentheses the second match
will be $2, and so on.

Finally, "&&" sets the value of $subject equal to $1 if we found a match. If
there was no match $subject will be undefined, and line 3 ends the script.

The last two lines just store $subject into a temporary list and pushes that
list onto the list of things you're going to process later.

>
>This is a great language!

We all think so; that's why we're here. We're glad you think so too and have
decided to join us.

>
>Thanks,
>Dan




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

Date: 13 Nov 1997 18:39:58 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Tk/Motif/Embedded Perl question
Message-Id: <64fhhu$n60$1@dismay.ucs.indiana.edu>

In article <01bcf037$af53bf20$d8131791@btpab1.knmi.nl>,
	"Peter Lagerweij" <lagerwey@knmi.nl> writes:

	Hmm.  I don't know the answer to your question, but I do have a
_related_ question:
	Is it possible to embed perl in a motif application and _use_ motif?
If it is...couldn't there be a perl plugin to netscape?  client side scripting
would be way cool...

Brian Wheeler
bdwheele@indiana.edu

> 
> Is it possible to use Perl/Tk within a Motif application?  I have Perl
> embedded in a Motif
> application, and I'd like to have the possibility for user scripts to pop
> up Tk dialog boxes for simple
> user interaction.  This concept works in the test harness (which doesn't
> use Motif), but when 
> integrated with the Motif application, I get a curious error:  (something
> like)
> 
> 1256ab08 ()  Not a hash in file
> /usr/local/lib/perl5/site_perl/Tk/MainWindow.pm on line 25.
> 
> For info, I'm using Tk400.202 (although VERSIONS file says Tk400.200) with
> Perl5.004_01 on a DEC Alpha Unix v4.0b
> 
> I know Apache embeds Perl, but does it allow Tk widgets/dialogs??  Has
> anyone else tried this?
> Is this even possible?  Is there some kind of conflict between Motif and
> Tk?
> 


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

Date: Thu, 13 Nov 1997 12:26:47 -0500
From: Bill Guindon <billg@networkapparel.com>
Subject: Re: What data is being returned from a form?
Message-Id: <346B3857.2075A30@networkapparel.com>

Found this at Selena Sol's site (mcp.selena.com):
http://selena.mcp.com/Scripts/Source/Misc/environment_variables.txt

Hope it helps.
Bill Guindon
billg@networkapparel.com

Gerrard Leach wrote:

> How do I see the exact stream of data which is coming into the Perl
> script.  I have managed to print out the buffer which includes all the
> fields, however, I would like to see all the header information as
> well.  Does anyone have any brilliant ideas?
>
> Thanks Gerrard





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

Date: Thu, 13 Nov 1997 15:39:19 -0500
From: Kurt Stype <kurt.stype@bani.com>
Subject: Y2000 Issues in PERL CGI scripts?
Message-Id: <346B6577.75CE@bani.com>

Does anyone have any suggestions on what things to look out for in PERL
CGI scripts that might cause Y2000 problems?

thanks!

Kurt :)


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

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

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