Re: Displaying a user's group memberships

2006-12-21 Thread Dr.Ruud
Tom Smith schreef: Mumia W.: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say that this is wrong... But does anyone else agree with this? If so, why is this way better than the pure Perl way? TIMTOWTDI.

Re: Displaying a user's group memberships

2006-12-21 Thread Mumia W.
On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say that this is wrong... But does anyone else agree with this? If so, why is this way better than the

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 09:24:51AM +0100, Dr.Ruud wrote: Tom Smith schreef: Mumia W.: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say that this is wrong... But does anyone else agree with this?

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Wed, Dec 20, 2006 at 10:47:25PM -0800, John W. Krahn wrote: Mumia W. wrote: On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n;

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Wed, Dec 20, 2006 at 05:28:46PM -0800, John W. Krahn wrote: Tom Smith wrote: Thank Chad (and John) for your input on this. I thought I'd post the portion of the script that I was trying to work out to see if there's room for improvement. This should work on any *nix system. The format

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 01:48:38AM -0600, Mumia W. wrote: On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say that this is wrong... But does anyone

Re: Displaying a user's group memberships

2006-12-21 Thread Dr.Ruud
Chad Perrin schreef: Dr.Ruud: TIMTOWTDI. On the shell machines of my provider (FreeBSD) the id approach will work, and the /etc/group one won't. I don't think that has anything to do with it being FreeBSD. That was and is also what I don't think. I only mentioned it because OP mentioned

Re: Displaying a user's group memberships

2006-12-21 Thread John W. Krahn
Chad Perrin wrote: On Wed, Dec 20, 2006 at 05:28:46PM -0800, John W. Krahn wrote: Since you are only reading from /etc/group you are not picking up the primary group stored in /etc/passwd. Singling out the primary group wasn't a requirement for the Perl script, as far as I recall. If I'm

Re: Displaying a user's group memberships

2006-12-21 Thread Mumia W.
On 12/21/2006 02:59 AM, Chad Perrin wrote: On Wed, Dec 20, 2006 at 10:47:25PM -0800, John W. Krahn wrote: Mumia W. wrote: On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=//

Re: Learning Perl books

2006-12-21 Thread Rob Dixon
Rob Dixon wrote: With regard to 'Learning Perl' and 'Learning Perl on Win32 Systems', can anybody who has read either or both of these books comment on their usefulness for an inexperienced programmer wishing to use Perl on a Windows platform? I have read neither but know that Learning Perl is

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Mumia W. wrote: On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say that this is wrong... But does anyone else agree with this? If so, why is this way

[Fwd: Re: Displaying a user's group memberships]

2006-12-21 Thread Tom Smith
Sorry, I sent these to the poster rather than the list--my bad. Original Message Subject:Re: Displaying a user's group memberships Date: Wed, 20 Dec 2006 20:23:53 -0700 From: Tom Smith [EMAIL PROTECTED] To: John W. Krahn [EMAIL PROTECTED] References: [EMAIL

[Fwd: Re: Displaying a user's group memberships]

2006-12-21 Thread Tom Smith
Sorry, I sent this to the poster rather than the list... My bad. Original Message Subject:Re: Displaying a user's group memberships Date: Wed, 20 Dec 2006 20:39:13 -0700 From: Tom Smith [EMAIL PROTECTED] To: John W. Krahn [EMAIL PROTECTED] References: [EMAIL

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Dr.Ruud wrote: Chad Perrin schreef: Dr.Ruud: TIMTOWTDI. On the shell machines of my provider (FreeBSD) the id approach will work, and the /etc/group one won't. I don't think that has anything to do with it being FreeBSD. That was and is also what I don't think. I

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Chad Perrin wrote: On Thu, Dec 21, 2006 at 01:48:38AM -0600, Mumia W. wrote: On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Tom Smith wrote: Dr.Ruud wrote: Chad Perrin schreef: Dr.Ruud: TIMTOWTDI. On the shell machines of my provider (FreeBSD) the id approach will work, and the /etc/group one won't. I don't think that has anything to do with it being FreeBSD. That was and is also what I

Re: Learning Perl books

2006-12-21 Thread Robert Hicks
Chad Perrin wrote: On Tue, Dec 19, 2006 at 09:08:11AM -0800, Randal L. Schwartz wrote: Learning Perl on Win32 Systems is still being published only because it sells. It was based on the second edition of Learning Perl, which was clearly Unix-bias. For the third and fourth editions of Learning

KSH and Perl output

2006-12-21 Thread oryann9
I am trying to get the equivalent in KSH to work in Perl and I cannot seem to get the same output. I need from /etc/passwd name, uid, gid and gecos for each passwd files. IN KSH: for i in `ls /var/tmp/passwd.*` do print $i; print \n; awk 'FS=: {print $1,\t,$3,\t,$4,\t,$5}'

glob and -f mismatch under Windows

2006-12-21 Thread Bryan K. Wright
Hi folks, I'm porting a script to Windows, and I've run into an odd mismatch between the results returned by glob and the -f operator. If I take a test script like the following: my @files = glob (*.exe); for my $f (@files) { print Processing \$f\...\n; -f $f

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 11:23:15AM +0100, Dr.Ruud wrote: Chad Perrin schreef: Dr.Ruud: TIMTOWTDI. On the shell machines of my provider (FreeBSD) the id approach will work, and the /etc/group one won't. I don't think that has anything to do with it being FreeBSD. That was and is

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 08:08:07AM -0700, Tom Smith wrote: Yeah, the smiley may have clarified the intentions a little... . . . or it may have just looked like part of the Perl code. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] print substr(Just another Perl hacker, 0, -2); --

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 03:06:38AM -0800, John W. Krahn wrote: Chad Perrin wrote: On Wed, Dec 20, 2006 at 05:28:46PM -0800, John W. Krahn wrote: Since you are only reading from /etc/group you are not picking up the primary group stored in /etc/passwd. Singling out the primary

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 08:05:05AM -0700, Tom Smith wrote: Dr.Ruud wrote: Chad Perrin schreef: Of course, if you're going to call out of the Perl script to the id utility, you may as well skip the Perl script entirely and just enter this at the shell prompt: id -Gn username That

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Chad Perrin wrote: On Thu, Dec 21, 2006 at 08:05:05AM -0700, Tom Smith wrote: Dr.Ruud wrote: Chad Perrin schreef: Of course, if you're going to call out of the Perl script to the id utility, you may as well skip the Perl script entirely and just enter this at the shell

Re: Learning Perl books

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 10:23:57AM -0500, Robert Hicks wrote: Chad Perrin wrote: On Tue, Dec 19, 2006 at 09:08:11AM -0800, Randal L. Schwartz wrote: Learning Perl on Win32 Systems is still being published only because it sells. It was based on the second edition of Learning Perl, which was

Re: Displaying a user's group memberships

2006-12-21 Thread Mumia W.
On 12/21/2006 09:05 AM, Tom Smith wrote: I try to avoid calling console commands because there tends to be differences in some of the CLI utilities between distributions--that was actually one of the first things I had considered doing, except with the `groups` command. You could limit

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 01:25:01PM -0700, Tom Smith wrote: Chad Perrin wrote: That's why I said you may as well either just use the id utility from the shell if you're not going to grab group memberships in an idiomatically Perlish way -- the Perl code is likely to be more portable. Of

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 03:02:04PM -0700, Chad Perrin wrote: I'm sure that could be made prettier by someone with better Perl mojo than I have at the moment, and it could be made a bit simpler if all you want is the gid for each group rather than the group name. I posted a gid version here:

Re: pdf to excel

2006-12-21 Thread Daniel Kasak
oryann9 wrote: I have a scanned PDF file and I want to convert its data so I can store it in an xls file. What module(s) do you recommened? I saw File::Extract::PDF ? If you've scanned it, chances are the PDF doesn't contain any text that you can extract. It will just be 1 image per

Re: Displaying a user's group memberships

2006-12-21 Thread John W. Krahn
Chad Perrin wrote: On Thu, Dec 21, 2006 at 03:02:04PM -0700, Chad Perrin wrote: I'm sure that could be made prettier by someone with better Perl mojo than I have at the moment, and it could be made a bit simpler if all you want is the gid for each group rather than the group name. I posted a

Re: pdf to excel

2006-12-21 Thread oryann9
Daniel Kasak [EMAIL PROTECTED] wrote:oryann9 wrote: I have a scanned PDF file and I want to convert its data so I can store it in an xls file. What module(s) do you recommened? I saw File::Extract::PDF ? If you've scanned it, chances are the PDF doesn't contain any text that you can

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 06:24:53PM -0800, John W. Krahn wrote: Chad Perrin wrote: On Thu, Dec 21, 2006 at 03:02:04PM -0700, Chad Perrin wrote: I'm sure that could be made prettier by someone with better Perl mojo than I have at the moment, and it could be made a bit simpler if all you want

installing modules via script

2006-12-21 Thread Mathew Snyder
I have a script which will determine which modules need to be installed for a certain application. It will take all of the module names and iterate through them installing each as such: system perl -MCPAN -e 'install $module'; I'd rather do this without a system call and instead do it

Re: installing modules via script

2006-12-21 Thread Mumia W.
On 12/21/2006 10:53 PM, Mathew Snyder wrote: I have a script which will determine which modules need to be installed for a certain application. It will take all of the module names and iterate through them installing each as such: system perl -MCPAN -e 'install $module'; I'd rather do

Re: installing modules via script

2006-12-21 Thread Mathew Snyder
Mumia W. wrote: On 12/21/2006 10:53 PM, Mathew Snyder wrote: I have a script which will determine which modules need to be installed for a certain application. It will take all of the module names and iterate through them installing each as such: system perl -MCPAN -e 'install