Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread Chas. Owens
snip > So I guess the question is - > > - is there a way in perl to authorize the callED perl script to have > higher perms than the callING app's, so that it can write to the file I'm > targeting? > > Or do I have to to this OUTSIDE of the perl script? > The short answer is that this is OS depen

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Chas. Owens
On Sun, Jan 15, 2017, 16:19 wrote: Hi, On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote: > > Is there a different, recommended way? > > Nothing's wrong. perlcritic does not this valid method, that's all. > > TIMTOWTDI (There Is More Than One Way To Do It.) Hm, ok. As long as it's not wro

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread alanj
> Is that your real program Close, but copied from my (changing) notes, not from the actual code. See below. > but changing something to the same data amounts to it being *unchanged*, > surely? Nope. Not using Path::Tiny. I found the info I need buried a further donw on its webpage. Appare

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Rob Dixon
Hi Alan You are unpacking `@_` in a way, but perlcritic doesn't recognise doing it this way. I think you'd be better off without dereferencing the hash, and using a slice to assign your local variables. I would write your subroutine like this sub modrec { my ($args) = @_;

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread Rob Dixon
Hi Is that your real program, because it's rather odd? The built-in variable `$@` holds the message from the latest error to be trapped by `eval`, so since you have no `eval` blocks it will probably be `undef`. Did you mean to assign the command-line parameter, like this? my ($newdata) = @

How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread alanj
I have an application that calls a perl script, feeding it input over STDIN. The perl script takes that input, processes it, and writes is as a change to an output file. I use Path::Tiny, and this works ok, use Path::Tiny qw(path); my $newdata = $@; $newdata = (some pro

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread alanj
Hi, On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote: > > Is there a different, recommended way? > > Nothing's wrong. perlcritic does not this valid method, that's all. > > TIMTOWTDI (There Is More Than One Way To Do It.) Hm, ok. As long as it's not wrong/broken in some weird way. I kep

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Shawn H Corey
On Sun, 15 Jan 2017 12:09:53 -0800 al...@myfastmail.com wrote: > What's wrong with the way I'm unpacking the arguments passed to the > subroutine, > > my %args = %{ shift @_ }; > > Is there a different, recommended way? Nothing's wrong. perlcritic does not this valid method, that's all.

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Илья Рассадин
Hi! You forgot arrow operator $args->{'FN'}, not $args{'FN'} 15.01.17 23:45, al...@myfastmail.com пишет: Hi On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote: I think, you can use this aproach If I use either of those sub modrec { - my %args = %{ shift

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread alanj
Hi On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote: > I think, you can use this aproach If I use either of those sub modrec { - my %args = %{ shift @_ }; + my ($args) = @_; 30 my $fn = $args{FN};

Re: script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread Илья Рассадин
Hi! I think, you can use this aproach sub modrec { my ($args) = @_; # or my $args = shift @_; use what you like more my $fn = $args->{'FN'}; } 15.01.17 23:09, al...@myfastmail.com пишет: Hi, I have a simple script with a subroutine that I pass scalar & array arguments

script that passes args to subroutine works ok, after I unpack the args. But perlcritic says I'm not unpacking?

2017-01-15 Thread alanj
Hi, I have a simple script with a subroutine that I pass scalar & array arguments to, #!/usr/bin/perl use 5.01201; use strict; use warnings; my $this_fn = "input.txt"; my @this_dr = qw( /path/1 /path/2 ); my $t