in reply to Re: HELP chgrp
in thread HELP chgrp

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

Replies are listed 'Best First'.
Re^3: HELP chgrp
by monkey_boy (Priest) on Oct 20, 2005 at 15:56 UTC
    As i stated previously in your other node
    You cannot get any sub-routines or functions from this script, if you *really must* use this script, then you will have to run it through system:
    e.g.
    system("$path_to_bin/chgrp $new_group $file")


    This is not a Signature...
Re^3: HELP chgrp
by Trix606 (Monk) on Oct 20, 2005 at 17:02 UTC
    No burden. monkey_boy had the right answer, you need to use system().

    These programs are intended to be run from a command line via the MSDOS batch files that are in the \usr\local\ppt\bin directory. While these batch files DO call Perl scripts, I'd think twice about calling those scripts directly without looking at how the batch file calls the script.

    To me the safest way to call it is calling the batch file using the system() function.

Re^3: HELP chgrp
by fishbot_v2 (Chaplain) on Oct 20, 2005 at 15:48 UTC
    (Missing operator before $file?)

    I'm not familiar with the script in question, but you definitely need an operator between those scalars, as the error message suggests. Try this:

    chgrp( $new_group, $file ) or die( 'etc.' );

    Additionally:

    use lib '/usr/local/ppt/bin';

    Adds the path to the script to your lib path, but it doesn't actually load the script itself.

    Update: Looking at what you are trying to do in your unlinked-but-related node, what is wrong with just using chown?

    chown( -1, scalar getgrnam("save"), $file ) or die( "$! etc." );

    Note: that's an example usage, not a recommended one. Make sure that getgrnam returns something in production code.