[10781] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4382 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 8 18:07:23 1998

Date: Tue, 8 Dec 98 15:00:24 -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           Tue, 8 Dec 1998     Volume: 8 Number: 4382

Today's topics:
    Re: $|=0 (Greg Ward)
    Re: 3 perl cgi questions... (Martien Verbruggen)
        @INC newbie question <huang2@andrew.cmu.edu>
    Re: Beginner Book? (Nnickee)
    Re: Beginner Book? (Greg Ward)
    Re: Beginner Book? <jeromeo@atrieva.com>
    Re: Beginner Book? (Nnickee)
    Re: CGI Redirection <simsi@hotmail.com.nospam>
    Re: Code Bash: File Include <uri@ibnets.com>
        DBPerl (Ramesh B Vemulapalli)
    Re: Errors with SETUID and Perl Script mike_orourke@em.fcnbd.com
    Re: Errors with SETUID and Perl Script (Erik)
    Re: flock doesn't flock under perl/linux <jwilkie@turing.une.edu.au>
    Re: Help!  Possible permissions problem? (Martien Verbruggen)
    Re: Help!  Possible permissions problem? (Sean McAfee)
    Re: Installing Win32 Perl (was Re: Seeking Win32::DES.p (N H)
        Java in PERL <shaykevi@ptolemy.arc.nasa.gov>
    Re: Need Help. (Martien Verbruggen)
    Re: Newbie help plz (Martien Verbruggen)
    Re: Newbie help plz (Martien Verbruggen)
    Re: Packing Multiple Arrays.... <ebohlman@netcom.com>
    Re: Packing Multiple Arrays.... (Andrew M. Langmead)
    Re: Packing Multiple Arrays.... <uri@ibnets.com>
    Re: PERL experts/Houston riz@softedgesystems.com
        Perl glob one-liner problem on Win95 maneri@my-dejanews.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 8 Dec 1998 21:53:06 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: $|=0
Message-Id: <74k742$mgn$3@news0-alterdial.uu.net>

om7@cyberdude.com <om7@cyberdude.com> wrote:
> Can someone please tell what $|=0 does.
> I've read it up, and understand that it flushes the buffer or something.
> [Is that correct?]

No, that's wrong.  $| = 1 sets your pipes to be piping hot, that is,
makes it so the currently selected output handle is unbuffered.  This code:

  $| = 1;
  print '';

flushes the output buffer.

$| = 0 of course is the opposite of $| = 1: make the currently selected
output handle buffered again (ie. revert to what is usually the default).

> And why would you need to use it?

I can't imagine.  I use $| = 1 all the time; very often buffering gets
in the way and is annoying.  I suppose you would use $| = 0 if you really
want to be sure that an output handle is buffered (eg. for performance).

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Tue, 08 Dec 1998 22:31:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: 3 perl cgi questions...
Message-Id: <RMhb2.48$tg4.255@nsw.nnrp.telstra.net>

In article <366D7EA8.7B51@berbee.com>,
	Tim <ringwood@berbee.com> writes:
> Christian H. Knudsen wrote:
>> 
>> 1) Is it possible for a cgi perl script to check if a file
>> on a remote server server exists? Check the size?
> 
> You have to attempt to get at leat the first character

Not necessary. HTTP protocol provides for this, HEAD.  Of course, that
will only tell you about existence. To find out about the size, you
only need to read the response header, but that isn't very polite to
the server :)

> of the file. I'd just open up a socket and make the request,
> but then I'm wierd.
> 
> Maybe a module has a routine that does this for you.

LWP

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: Tue, 08 Dec 1998 17:28:59 -0500
From: Cathy Huang <huang2@andrew.cmu.edu>
Subject: @INC newbie question
Message-Id: <366DA82B.736C8C8B@andrew.cmu.edu>

This is on NT, perl v. 5.004_02.

I get this error message:
Can't locate name_decoders.pl in @INC (@INC contains: c:\perl\lib\site
c:\perl.....) at D:/listen/data/scripts\sessionify2.pl line 14.

This is the code in sessionify2.pl, ending in line 14:
-------------------
use Cwd;
$dir = cwd();
print "sess2 dir = $dir\n";
use lib $dir;
#$dir2 = "d:\\listen\\data\\scripts\\";
#use lib $dir2;

require("name_decoders.pl");
-------------------

I used both $dir and $dir2 but I get the same error message. How do I
correctly add the path of $dir2? sessionify2.pl should be starting in
that directory. Both sessionify2.pl and name_decoders.pl are in that
directory.

Thanks!
Cathy




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

Date: Tue, 08 Dec 1998 21:28:38 GMT
From: nnickee@nnickee.com (Nnickee)
Subject: Re: Beginner Book?
Message-Id: <36728475.16446313@news.centuryinter.net>

[mailed and posted]

On 8 Dec 1998 18:52:26 GMT, eln@cyberhighway.net (Erik) wrote:

>[Posted and mailed]
>
>In article <36705353.3866761@news.centuryinter.net>,
>	nnickee@nnickee.com (Nnickee) writes:
>> Might I suggest "Perl 5 for Dummies" without fear of 32 camels showing
>> up to take a dump on my front lawn?

>I doubt it...Perl 5 for Dummies is technically inaccurate in several points.
>Refer to Tom Christiansen's review of it:

>CAPSULE REVIEW: Barely achieving its two camels, this book is not only
>made for dummies, it's guaranteed to keep you one.

Interesting.  Perl 5 for Dummies hasn't and won't make me a perl guru
(probably nothing could accomplish that), but it has taken me from
knowing absolutely nothing about perl to having just written a client
daemon (with help from a friend on how to create the socket).

>So, it's technically screwed
>up, has hard-to-read style, does nearly everything the hard way, hides
>the good stuff where you won't find it, and likes to put its readers
>down.

I never felt put down by the book.  This review, however....

>I guess this just goes to show you that the old adage about avoiding books
>with numbers in their titles is right.

< end review snippet >

The number in the title was to indicate that the book was written with
Perl 5 in mind.  I guess they could have called it "The Most Recent
Version of Perl for Dummies", but then they'd be in trouble when perl
6 replaces perl 5.

>For more reviews, and probably a much better way of determining what books
>to buy, check out http://language.perl.com/critiques/index.html

>From that page:  "Here are reviews on Perl books, written unless
otherwise specified by Tom Christiansen."  

I'm not trying to debate Mr. Christiansen's Guru-ishness, but when I
want recommendations on a book for a beginner, I'm going to ask a
*lot* of folks for *their* opinion.  What works for one person isn't
necessarily going to work (or be the *best* choice) for the next
person, and one person's opinion on something isn't necessarily going
to match someone else's opinion.

I answered the original post with what worked *for me*.

>> Perl is my first language too (not counting html which just barely
>> (IMO) counts as a language) and P5FD was my first choice.  Easy to

>HTML is a formatting specification, not a programming language by any
>stretch of the imagination.

Maybe they should have named it Hypertext Formatting Specification
then.  I happen to agree with you though.  I do not call myself a
programmer just because I happen to know html.  (I also do not call
myself a programmer because I've started learning perl and had some
small successes with it.)

>It includes severely outdated versions of Perl, which have many known
>problems with them.

Agreed.  I probably shouldn't have even mentioned the CD in my post.

>Read the critiques page pointed to above.

I am.  But I still want more *personal* experiences/critiques of the
different books, ie, not just one man's opinion.  If that one man were
God himself, I'd still be asking other people for their opinions as
well, and then base my decision on all of the responses (with extra
points being given to God's suggestion).

A snippet from that page:

Programming Perl

by Larry Wall, Tom Christiansen, and Randal L. Schwartz [2nd edition] 

CAPSULE REVIEW: Even though it doesn't cover in detail a few of the
more esoteric issues, this is nonetheless the definitive reference
work. With Larry Wall as the primary author, you are guaranteed of its
unparallelled technical accuracy.

-- end snippet --

Yes!  Larry Wall is THE PERL GOD.  (I'm not being sarcastic there,
although I know it probably looks that way.)

The question that comes to my mind from the above review is.. "Is
Larry Wall a good teacher?"  I wouldn't know, as I've not read this
book (although it or the Perl Cookbook will probably be the next book
I purchase).

>I don't know, maybe people buy the books because they reflect what those
>people consider themselves to be.

Wow.. and to think I was worried about camels showing up in my lawn...

I do not consider myself to be a dummy.  I did not consider myself to
be a dummy before I purchased the book.  What I was, before I got the
book, was someone who wanted to learn a programming language.
Specifically I wanted something that would let me do "fun" things with
my web pages and would work on all browsers.  The "work on all
browsers" requirement of mine dropped both java and javascript from my
list of possibilities.

So there I was, someone with absolutely no programming background.  I
didn't even know what a variable was.  The very idea of _me_ learning
how to program absolutely boggled my mind, because I've always looked
up to programmers as being ... Gods... that's the only word that
really applies.  So to say I was a tad intimidated would be putting it
mildly.

P5FD has gotten me over my initial intimidation.  It's instilled in me
a love for perl and a hunger to learn more.

>If that's the case, then might I suggest
>a good psychiatrist rather than a book on perl.  I'm just waiting for
>"Perl 5 for Neurotic Technophobic Drooling Morons" to come out.  I'm
>guessing it'll be a huge success.

I know that comment wasn't directed at me personally, at least I hope
not.  I'm not neurotic or technophobic.  I very rarely drool, and I
don't consider myself to be a moron.

I'd like to take just a moment to plug a book I'm considering
writing... "Manners for Programmers" or (alternate title) "How To Not
Sound Like A Pompous Jerk Even When You're Talking To People Whom You
Feel To Be Your Intellectual And/Or Social Inferior".  Think it'll
make it to the top ten?

<gd&r>
Nnickee




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

Date: 8 Dec 1998 21:46:43 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: Beginner Book?
Message-Id: <74k6o3$mgn$2@news0-alterdial.uu.net>

> In article <3650788e.14819289@news.newsguy.com>,
>   jeff.kennedy@natdecsys.com (Jeff Kennedy) wrote:
> > I need a book geared to an ABSOLUTE BEGINNER!  No perl experience, no
> > programming experience, no real shell scripting experience.

Are you absolutely *sure* about this?  I don't think Perl is a good
choice for a first programming language; the syntax is occasionally
hairy and the semantics delightfully subtle.  And it builds a lot on
existing programming languages (C, awk, and Bourne shell especially); if
you don't know any other languages, many of Perl's most useful features
will seem bizarre and inexplicable.

On the upside, the documentation for Perl is first-rate.  If you can
handle it, Randall Schwartz's book *Learning Perl* is the place to
start.  But if that leaves you stumped and scratching your head, it
might be better to find another language to start with.  Python is
really cool and covers a lot of the same ground as Perl, but there
aren't as many books on it (and they aren't as good as the best Perl
books).

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Tue, 08 Dec 1998 14:00:38 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: nnickee@nnickee.com
Subject: Re: Beginner Book?
Message-Id: <366DA186.57A0E888@atrieva.com>

Nnickee wrote:

> I answered the original post with what worked *for me*.

Ultimately, this is the only thing that matters.  If you like the book,
and it helps you learn, then it's a good book.

I don't know if it's art, yadda yadda yadda...
 
> I am.  But I still want more *personal* experiences/critiques of the
> different books, ie, not just one man's opinion.  If that one man were
> God himself, I'd still be asking other people for their opinions as
> well, and then base my decision on all of the responses (with extra
> points being given to God's suggestion).

The best practical demonstrations of real world perl on the face of the
Earth are contained in Randal Schwartz's "Perl Review" column in "Unix
Review" (Now I think it's called "Performance Computing")  Old columns
are available at his webste: http://www.stonehenge.com. 

And you can't beat the price.

> The question that comes to my mind from the above review is.. "Is
> Larry Wall a good teacher?"  

I have read two "Real Live Larry" posts in my life, and each was full of
insight into the language.


> I know that comment wasn't directed at me personally, at least I hope
> not.  I'm not neurotic ...  I very rarely drool ...

You're not a *real* programmer, then. ;->

> I'd like to take just a moment to plug a book I'm considering
> writing... "Manners for Programmers" or (alternate title) "How To Not
> Sound Like A Pompous Jerk Even When You're Talking To People Whom You
> Feel To Be Your Intellectual And/Or Social Inferior".  Think it'll
> make it to the top ten?

Only if you subtitle it "Lifestyles of the Usenet Famous." 

Good luck with your endeavors, and don't let other people pick your
library.  Bibliophile is from the Greek, meaning "Snooty Pants."


-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Tue, 08 Dec 1998 22:50:48 GMT
From: nnickee@nnickee.com (Nnickee)
Subject: Re: Beginner Book?
Message-Id: <3676ab5c.26407629@news.centuryinter.net>

On Tue, 08 Dec 1998 14:00:38 -0800, Jerome O'Neil
<jeromeo@atrieva.com> wrote:

>Nnickee wrote:

>> I answered the original post with what worked *for me*.

>Ultimately, this is the only thing that matters.  If you like the book,
>and it helps you learn, then it's a good book.

Yup.  My feelings exactly.  Doesn't mean it has to be "the book to end
all books" or that you'll never need/want to get another book on the
subject.

>The best practical demonstrations of real world perl on the face of the
>Earth are contained in Randal Schwartz's "Perl Review" column in "Unix
>Review" (Now I think it's called "Performance Computing")  Old columns
>are available at his webste: http://www.stonehenge.com. 

Bless you.  I'm over there now learning about fork.

>> I know that comment wasn't directed at me personally, at least I hope
>> not.  I'm not neurotic ...  I very rarely drool ...

>You're not a *real* programmer, then. ;->

Real Programmers cannot possibly drool.  Drooling is not something
that Gods do.  Therefore, programmers cannot drool. :)

>> I'd like to take just a moment to plug a book I'm considering
>> writing... "Manners for Programmers" or (alternate title) "How To Not
>> Sound Like A Pompous Jerk Even When You're Talking To People Whom You
>> Feel To Be Your Intellectual And/Or Social Inferior".  Think it'll
>> make it to the top ten?

>Only if you subtitle it "Lifestyles of the Usenet Famous." 

LOL.  You got it.  I'd dedicate the book to you, but then folks might
think you're a pompous jerk, which you do not seem to be.  How about a
"thanks to Jerome O'Neil for the subtitle" on the acknowledgments
page?

>Good luck with your endeavors,

Thanks :)

Nnickee



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

Date: 8 Dec 1998 21:45:03 GMT
From: "Simmo" <simsi@hotmail.com.nospam>
Subject: Re: CGI Redirection
Message-Id: <01be22f3$f4cfa9c0$a4c448c2@is>

Amazing how unhelpful some people can be eh?

The way i'd do this is to create a simple print qq~ html page in the perl
script with a simple meta refresh tag to redirect.....but then i'm sure
there are better ways....

Cheers

Simmo

brian d foy <comdog@computerdog.com> wrote in article
<comdog-ya02408000R0712981744550001@news.panix.com>...
> In article <74cduh$4a4$1@nnrp1.dejanews.com>, fairbairn_97@yahoo.com
posted:
> 
> > I was enquiring whether any body knows where I can get a CGI script
that
> > redirects URLs to another place automatically... I was planning on
doing
> > something like ML.ORG where they redirect TEST.HOME.ML.ORG to
> > www.mydomain.com/test/test/test/go.html
>  
> > He who gives me the correct answer will be placed on the front page of
my web
> > site....... 
> 
> how would you recognize a correct answer?  if you want to do this,
> forget about Perl or CGI and configure the server to do it automatically.
> that is, unless you want to use a Perl trans handler or the like.
> 
> there are about 15 different ways to do this, and those are only
> the ones i know off the top of my head.  still, i don't want to be
> on your webpage ;)
> 
> -- 
> brian d foy                                  <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> 


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

Date: 08 Dec 1998 17:16:10 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Code Bash: File Include
Message-Id: <394sr6th3p.fsf@ibnets.com>

>>>>> "RS" == Randal Schwartz <merlyn@stonehenge.com> writes:

>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
  Uri> so a challenge for you would be a one liner that would also exit
  Uri> the @ARGV loop with an error message.

  RS> { local *ARGV; @ARGV = @list; die "cannot read one of these:
  RS> @ARGV" if grep ! -r, @ARGV; print while <>; }

close but no cigar, randal. it still doesn't have the exact behavior of
the original code. first the original didn't die, it just returned on
the first failure and all the previous good files were printed. the

print while <>;

doesn't have any exit mechanisms like last on an error. so i think that
idiom can't emulate that original loop.

and it was 4 statements in a block. pretty long for a one liner!

please try again.

:-)

uri


-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ibnets.com	


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

Date: 8 Dec 1998 20:54:14 GMT
From: rvemulap@osf1.gmu.edu (Ramesh B Vemulapalli)
Subject: DBPerl
Message-Id: <74k3lm$5ab@portal.gmu.edu>

Hello Guys,

I am running Oracle using the DBI in perl and I keep getting 
the message:

DBD::Oracle::st execute failed: ORA-01013: user requested cancel of current operation (DBD: oexfet error) at ./RegionInfo.pl line 121


Why is this happening? When I run it again it is ok. Blows my mind. If you have an answer please respond to medavarm@usa.redcross.org

Moorthy


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

Date: Tue, 08 Dec 1998 22:10:58 GMT
From: mike_orourke@em.fcnbd.com
Subject: Re: Errors with SETUID and Perl Script
Message-Id: <74k85g$k4t$1@nnrp1.dejanews.com>

In article <74juha$7lu$1@camel18.mindspring.com>,
  "Allan M. Due" <Allan@due.net> wrote:
> mike_orourke@em.fcnbd.com wrote in message
> <74jtnh$ana$1@nnrp1.dejanews.com>...
>
> [snip]
>
> >Below is an example of the code that I am using :
> >
> >$old_path = $ENV{"PATH"} ; $directory = "/export/home/lddv" ; $filename =
> >"test_chmod.txt" ; $file_owner = "lao7" ; if ($filename =~ /^([-\@\w.]+)$/)
> {
> > $filename = $1 ; } else {  die "Bad data in $filename" ; } if ($file_owner
> >=~ /^([-\@\w.]+)$/) {  $file_owner = $1 ; } else {  die "Bad data in
> >$file_owner" ; } if ($directory =~ /^([\/\-\@\w.]+)$/) {  $directory = $1 }
> >else { die "Bad data in $directory" ; } $ENV{"PATH"} =
> "/usr/sbin:/usr/bin";
> >system("chown  $file_owner '$directory/$filename'") && die "Could not run
> >CHMOD" ; $ENV{"PATH"} = $old_path ; exit ;
>
> Ow, ow, ow.  My head, my poor head hurts.  Just a little formatting please.
>
> AmD
>
> Sorry.... Cut and paste didn't come out so clean

Here is a better copy of the code :

$old_path = $ENV{"PATH"} ; $directory = "/export/home/lddv" ; $filename =
"test_chmod.txt" ; $file_owner = "lao7" ; if ($filename =~ /^([-\@\w.]+)$/) {
 $filename = $1 ; } else {  die "Bad data in $filename" ; } if ($file_owner
=~ /^([-\@\w.]+)$/) {  $file_owner = $1 ; } else {  die "Bad data in
$file_owner" ; } if ($directory =~ /^([\/\-\@\w.]+)$/) {  $directory = $1 }
else {	die "Bad data in $directory" ; } $ENV{"PATH"} = "/usr/sbin:/usr/bin";
system("chown  $file_owner '$directory/$filename'") && die "Could not run
CHMOD" ; $ENV{"PATH"} = $old_path ; exit ;

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


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

Date: 8 Dec 1998 22:24:40 GMT
From: eln@cyberhighway.net (Erik)
Subject: Re: Errors with SETUID and Perl Script
Message-Id: <74k8v8$kqf$2@news.cyberhighway.net>

In article <74k85g$k4t$1@nnrp1.dejanews.com>,
	mike_orourke@em.fcnbd.com writes:
> Here is a better copy of the code :
> 
> $old_path = $ENV{"PATH"} ; $directory = "/export/home/lddv" ; $filename =
> "test_chmod.txt" ; $file_owner = "lao7" ; if ($filename =~ /^([-\@\w.]+)$/) {
>  $filename = $1 ; } else {  die "Bad data in $filename" ; } if ($file_owner
> =~ /^([-\@\w.]+)$/) {  $file_owner = $1 ; } else {  die "Bad data in
> $file_owner" ; } if ($directory =~ /^([\/\-\@\w.]+)$/) {  $directory = $1 }
> else {	die "Bad data in $directory" ; } $ENV{"PATH"} = "/usr/sbin:/usr/bin";
> system("chown  $file_owner '$directory/$filename'") && die "Could not run
> CHMOD" ; $ENV{"PATH"} = $old_path ; exit ;

You have a weird definition of "better".

-- 
Erik Nielsen, Cyberhighway Internet Services NOC
It's nice to be loved, but there's a lot to be said for CRINGING RESPECT 
             -- Anonymous button bin


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

Date: Wed, 09 Dec 1998 08:13:09 +1100
From: Jon Snow <jwilkie@turing.une.edu.au>
Subject: Re: flock doesn't flock under perl/linux
Message-Id: <366D9665.FB47AC3A@turing.une.edu.au>

andrewc@newtonsols.net wrote:

> <snip>
>
>         if (!flock(USER,LOCK_SH))
>         {
>                 close USER;
>                 return;
>         }
>
>         print "We got past flock\n";
>
>         [snip]
> }
> -------------------------------------------------------------------------
>
> When this is run, flock always returns FALSE and the subroutine exits. It
> never gets to "We got past flock".
>

flock(2) returns 0 if successful, -1 and errno set if not successful.


>
> As I understand it, flock can only do three possible things when called just
> with LOCK_SH:
>
>         1.      It can obtain the lock and return TRUE
>

Returns as above.

>
>         2.      It can wait for the lock to be available

It will block unless or'ed with 4


>   Can anyone enlighten me as to what's going on here?

> I must confess I have no idea what to try next.

On your linux box - man flock

Hope that helps,
Jon Snow
jwilkie@turing.une.edu.au



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

Date: Tue, 08 Dec 1998 22:45:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help!  Possible permissions problem?
Message-Id: <UZhb2.51$tg4.255@nsw.nnrp.telstra.net>

In article <uceb2.1593$Bs.4222983@news4.atl>,
	abe@abe.com (Abe) writes:

> system( "mkdir $dir/$num" );
> 
> chmod 777, '$dir/$num';

A few words of advice:

- When perl has a builtin function that will do the job, try to avoid
  calling a shell and external program to do the job. 
- If you must use system, give it its arguments in a list, which at
  least avoids calling a shell.
- Whatever you use, always, always check the return value of these
  calls. I am pretty sure that your chmod up there did _not_ succeed,
  because most likely you don't have a directory with the name '$dir'
  in the current directory. (The single quotes prevent interpolation
  of the variables)

mkdir("$dir/$num") || die "Cannot mkdir $dir/$num: $!";
chmod(0777, "$dir/$num") || die "Cannot chmod $dir/$num: $!";

# perldoc -f mkdir
# perldoc -f chmod
# perldoc perlfunc

The last one just so you can have a little bit of a look at all the
functions perl provides for yout convenience.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: Tue, 08 Dec 1998 22:54:24 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Help!  Possible permissions problem?
Message-Id: <A6ib2.596$4w2.2912412@news.itd.umich.edu>

In article <UZhb2.51$tg4.255@nsw.nnrp.telstra.net>,
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>In article <uceb2.1593$Bs.4222983@news4.atl>,
>	abe@abe.com (Abe) writes:
>> system( "mkdir $dir/$num" );
>> chmod 777, '$dir/$num';

>mkdir("$dir/$num") || die "Cannot mkdir $dir/$num: $!";
>chmod(0777, "$dir/$num") || die "Cannot chmod $dir/$num: $!";

Not enough arguments for mkdir at -e line 1, at end of line

ITYM:

mkdir("$dir/$num", 0777);

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


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

Date: Tue, 08 Dec 1998 22:38:12 GMT
From: nhoop@centuryinter.net (N H)
Subject: Re: Installing Win32 Perl (was Re: Seeking Win32::DES.pm)
Message-Id: <3676a9c8.11346363@news.ot.centuryinter.net>


>You should have downloaded a file called APi506.exe or something like that
>and all it requires is for you to run it.  The install program is pretty
>simple but will ask you some questions and just so long as you can give an
>intelligent answer to them then everything should be just swell

Right! Version APi507 can be downloaded from 

Http://www.activestate.com/ActivePerl/download.htm

Nat


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

Date: Tue, 08 Dec 1998 13:45:51 -0800
From: Alex Shaykevich <shaykevi@ptolemy.arc.nasa.gov>
Subject: Java in PERL
Message-Id: <366D9E0F.AEE59D1A@ptolemy.arc.nasa.gov>

Hi,

The original release of JPL seemed only to support Perl calls from
within Java, and not the other way around.  I'd like to call Java
methods from within my Perl code.  I've seen several articles hinting
that this can be done, including one at www.perl.com.

Anyone have any experience doing this?   Any advice would be much
appreciated.

Thanks.

-- Alex Shaykevich
      NASA Ames Research Center



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

Date: Tue, 08 Dec 1998 22:38:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Need Help.
Message-Id: <PThb2.50$tg4.255@nsw.nnrp.telstra.net>

In article <74jgau$ukr$1@nnrp1.dejanews.com>,
	ccboone@amber.indstate.edu writes:

> I need to restart a process that needs to be ran by xxx, but I am
> root.  The process has to be ran by xxx.  Can someone point me in
> the right direction.

You fail to mention the platform you are working on, but the uid
'root' suggests some sort of Unix. I'll assume that for the remainder.

restart? Does that mean kill and run again? If it's a well written
program, it may have signals it listens for to restart it.

Assuming you want to kill it and start it again as another user:

# perldoc perlsec
# perldoc perlvar
(look for variables like $<, $> etc.

None of this is trivial. If you don't understand it, don't do it.

It may be easier to just use su with the username as an argument.
Something like

# su - username -c program_name

may work on your platform. Refer to the su(1) manual page to find out
more.

> Please email me at ccboone@amber.indstate.edu

no.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.       | enough features yet.
NSW, Australia                      | 


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

Date: Tue, 08 Dec 1998 22:25:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie help plz
Message-Id: <dHhb2.44$tg4.255@nsw.nnrp.telstra.net>

In article <74j9oh$oo4$1@nnrp1.dejanews.com>,
	clemenr@westminster.ac.uk writes:

> I need to make a cgi-bin script that does a 'ls' on a file
> system. What sort of things do I need to do this? Should I
> learn basic file handling, or is there a way I can do this
> the same way I would do a system( "ls -R <dir>" ) on a
> Unix box?

You may want to look into the File::Find module that comes with perl.

# perldoc File::Find

Without the -R option, you can just use opendir, readdir and closedir

# perldoc -f opendir

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

Date: Tue, 08 Dec 1998 22:27:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie help plz
Message-Id: <VIhb2.45$tg4.255@nsw.nnrp.telstra.net>

In article <dHhb2.44$tg4.255@nsw.nnrp.telstra.net>,
	mgjv@comdyn.com.au (Martien Verbruggen) writes:

> You may want to look into the File::Find module that comes with perl.
> 
> # perldoc File::Find

I forgot to say: You'll probably need the stat function to get
information about the file, maybe in conjunction with some of the file
test operators discussed in the perlfunc documentation.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


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

Date: Tue, 8 Dec 1998 20:55:57 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Packing Multiple Arrays....
Message-Id: <ebohlmanF3nzH9.1x6@netcom.com>

Jim Matzdorff <syran@shell1.ncal.verio.com> wrote:
: Does anyone know of a good way to pack two arrays (that are not identical)?
: For instance, lets say I have two arrays, a and b

: a = 1 2 3 4
: b = a b b c
: now, if I delete out of a the 3rd value (3), then i also want to delete out of b the 3rd value (b).

: after any (1..all) value have been deleted in a, i want delete the corresponding array value in b, and pack BOTH arrays, so there are no
: undefined value lurking the the middle:

: a = 1 2 4 (not 1 2 undefined 4)
: b = a b c

Take a look at the documentation for the splice() function.

: this is an off-the-wall question, so the perl faq and/or modules didn't help with this question (at least, not that i could find).  

: please note: although array "a" has unique values, array b's values are not unique (so i can't do an intersection and/or different on b).

: a mutli-dimensional array would work here, but as far as i can tell, it's not easily supported by perl.
: i was thinking of combining them into an associative array, but i'm also not sure that's the best idea, but maybe it is, in which case you can just
: tell me that :)

It sounds to me like you want a hash (the newer term for a Perl 
associative array) whose keys are the values you're storing in @a and 
whose values are the values you're storing in @b.  In general, if you 
find yourself using parallel arrays, you should seriously consider using 
another kind of data structure that will help you avoid writing code to 
manage the relationships between parallel pieces of data.



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

Date: Tue, 8 Dec 1998 21:32:20 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Packing Multiple Arrays....
Message-Id: <F3o15x.CJp@world.std.com>

syran@shell1.ncal.verio.com (Jim Matzdorff) writes:

>Does anyone know of a good way to pack two arrays (that are not identical)?
>For instance, lets say I have two arrays, a and b

>a = 1 2 3 4
>b = a b b c
>now, if I delete out of a the 3rd value (3), then i also want to delete out of b the 3rd value (b).


How about this:

my @a = qw(1 2 3 4);
my @b = qw(a b b c);
my $delete = 2;

for my $array ( \( @a, @b ) ) {
  splice @$array, $delete, 1;
}

print "@a\n@b\n";


The splice() function is probably the best way of removing arbitrary
chunks out of an array, and looping through a reference to arrays is
probably the best way of doing the same thing to each of them. The
syntax for the reference operator (the "\" operator) is a bit
misleading, it looks like it will create a reference to each element
of "@a" and "@b", but it really creates a reference to each array.

If you did turn this into into a two dimensional array, the solution
is similar to the one above but since you already have the references
to each dimension, you can avoid the reference creation operator
above.

my @array = ( [ 1 .. 4 ], [ 'a', 'b', 'b', 'c' ]);

for $dim ( @array ) { }
-- 
Andrew Langmead


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

Date: 08 Dec 1998 17:23:04 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Packing Multiple Arrays....
Message-Id: <393e6qtgs7.fsf@ibnets.com>

>>>>> "JM" == Jim Matzdorff <syran@shell1.ncal.verio.com> writes:

  JM> Does anyone know of a good way to pack two arrays (that are not
  JM> identical)?  For instance, lets say I have two arrays, a and b

don't use the word pack as it is a perl func already.

  JM> a = 1 2 3 4 b = a b b c now, if I delete out of a the 3rd value
  JM> (3), then i also want to delete out of b the 3rd value (b).

have you heard about the magical function, splice?

it will do what you wish.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ibnets.com	


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

Date: Tue, 08 Dec 1998 21:13:43 GMT
From: riz@softedgesystems.com
Subject: Re: PERL experts/Houston
Message-Id: <74k4q5$h1h$1@nnrp1.dejanews.com>

SoftEdge Systems, LLC is looking for PERL developers in houston for a six
month contract.  We need four individuals ona project with a large company in
West Houston.

If you have PERL and HTML background please send your resume via e-mail and
the best time to call you.

Great pay for the right individual.

Regards,

Riz Haq
SoftEdge Systems, LLC
972-241-0133 Fax

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


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

Date: Tue, 08 Dec 1998 21:20:48 GMT
From: maneri@my-dejanews.com
Subject: Perl glob one-liner problem on Win95
Message-Id: <74k57d$hgt$1@nnrp1.dejanews.com>

Hi,
I just upgraded my win32 perl to version 5.004_02 and can no longer do a one-
liner such as
perl -pi.bak -e "s/1/2/" *.out
without getting a
"Can't open *.out: No such file or directory" message.
This worked fine before. I've also tried both Win32 ports (ActiveState+the
other one).
Anyone else had this problem?
Thanks

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


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4382
**************************************

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