Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

HELP chgrp

by Ronnie (Scribe)
on Oct 20, 2005 at 13:51 UTC ( [id://501667]=perlquestion: print w/replies, xml ) Need Help??

Ronnie has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: HELP chgrp
by defyance (Curate) on Oct 20, 2005 at 14:06 UTC
    I could make a system call to the UNIX script but I foolishly thought I'd use the Perl version!

    Foolishly? That's a little harsh, isn't it? ;)

    A little more verbosity in your question would be helpful, but googling showed me what you were looking at... Take a look here: http://ppt.perl.org and here: http://ppt.perl.org and you will see that this is a standalone script, and not a module/package. use/require won't get you what you want. You could copy the code available in the first link I posted in your own script and modify it to suit your needs, or even turn it into a package for code reuse.

    HTH

    --
    A conclusion is simply the place where someone got tired of thinking. -- Arthur Block

Re: HELP chgrp
by Corion (Patriarch) on Oct 20, 2005 at 13:55 UTC

    Usually, it helps if you at least tell us where you downloaded whatever script from, and what kind of error you get. How (not) to ask a question has many valuable hints in that direction. "Does not work" seldom constitutes an error which we can easily help with the diagnosis.

Re: HELP chgrp
by Trix606 (Monk) on Oct 20, 2005 at 14:25 UTC
    This "module" installs Perl programs that mimic Unix commands. These programs are installed in a usr\local\ppt\bin directory off the root directory. Batch files corresponding to each Perl program are also installed in that directory. On a MS operating system you just need to add usr\local\ppt\bin to your path. On a *nix system you already have those commands built-in.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: HELP chgrp
by blazar (Canon) on Oct 20, 2005 at 15:08 UTC
    What is it that didn't satisfy you in Anyone used the chgrp module? so much to force you to start a mostly duplicate thread?!? (Without even including a reference to the former!)
Re: HELP chgrp
by graff (Chancellor) on Oct 21, 2005 at 01:04 UTC
    The unix version of "chgrp" is not a script. It is compiled C code, and if you are choosing between running a perl version of chgrp via "system()" vs. running the unix version of chgrp via "system()", I think you'll be much better off running the unix version.

    I noticed that the perl version of "chgrp" uses the File::Find module to handle the "-R" (recursive descent into subdirectories) option, and I have to admit that File::Find is one of my pet peeves -- a module with a fairly counter-intuitive, byzantine usage and remarkably slow performance, relative to other techniques for doing the same thing.

    Even if you take the trouble to understand the code in the perl version of chgrp, and decide to do a "copy / paste / modify" sort of migration of that code into your own app (this is certainly doable -- it's just not as simple as "use ..." or "require ..." or "do ...", because you really have to copy a subroutine into your script and work out the logic for calling it), even so, the performance of resulting pure-perl approach to changing group ownership on files is going to be noticeably slower than running a system call to the unix version of "chgrp".

    So, assuming that you really are on a unix box, I don't know why you are fixating on a pure-perl approach here. (If you aren't on a unix box, I'm not sure what it would mean to do "chgrp" anyway.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://501667]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-28 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found