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
| [reply] [Watch: Dir/Any] |
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.
| [reply] [Watch: Dir/Any] |
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. | [reply] [Watch: Dir/Any] |
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!) | [reply] [Watch: Dir/Any] |
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.) | [reply] [Watch: Dir/Any] |