Is there a simple way to do uid - username and usename - uid mapping?

2003-02-20 Thread Ben Siders
I've got a file for which I use 'stat' to acquire its information, but stat gives you numeric uid and gids. I need to get to the actual username and groupname. How can this be done? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Weird problem with writing to PostgreSQL through DBI

2003-01-29 Thread Ben Siders
I am parsing some XML and trying to write the tags to a table. Here is the table (PostgreSQL): Column | Type | Modifiers ---+-+--- id| integer | ref_id| text| ref_table | text| tag | text| seq | integer | Here is the code where I

Re: Weird problem with writing to PostgreSQL through DBI

2003-01-29 Thread Ben Siders
Nevermind. Got it figured out. Turns out I had a bad environment variable that was trying to insert into a parallel DB in which the ref_id field was defined as 'integer' instead of 'text'. Ben Siders wrote: I am parsing some XML and trying to write the tags to a table. Here is the table

Perl in OpenBSD Apache

2003-01-27 Thread Ben Siders
I installed OpenBSD's Apache but the default configuration is that httpd runs chroot'd to /var/www for security. This is fine, except that for the life of me, I cannot get my Perl CGI scripts to run. I've tried linking /usr/bin/perl into /var/www but that doesn't work because of the chroot,

Re: Perl in OpenBSD Apache

2003-01-27 Thread Ben Siders
John Baker wrote: On Mon, 27 Jan 2003, Ben Siders wrote: Date: Mon, 27 Jan 2003 08:48:58 -0600 From: Ben Siders [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Perl in OpenBSD Apache I installed OpenBSD's Apache but the default configuration is that httpd runs chroot'd to /var/www

Re: 1;?

2003-01-23 Thread Ben Siders
This is correct. When you include something the last line has to return a true value, so people often stick a 1; at the end. Consider it a bit of plumbing that a module or library just has to have. Dan Muey wrote: At the end of a lib file ( in the script you have require lib.lib; and lib.lib

Re: Question about a hash.

2003-01-22 Thread Ben Siders
OK apparantly I have a scoping problem below. If I add this line: print ok\n if exists $db_table-{codeline}; inside my function, I get nothing. If I put it right after the db_table declaration, it prints. So... are 'my' variables outside of a function not visible inside it? Ben Siders

Re: perl and progress database.

2003-01-22 Thread Ben Siders
Yes. DBI has support for PostgreSQL. You can perform almost any transaction through it that you would at the command line. Gerardo wrote: i want to know if i can to run perl with the dbi module and to view a Progress database. ... and sorry ... my english is very bad. thanks. --

Re: perl and progress database.

2003-01-22 Thread Ben Siders
Ah, I skimmed over it too fast. My bad. Bob Showalter wrote: Ben Siders wrote: Yes. DBI has support for PostgreSQL. You can perform almost any transaction through it that you would at the command line. Gerardo wrote: i want to know if i can to run perl with the dbi module

Re: Size of number in scalar

2003-01-22 Thread Ben Siders
You'll be waiting a long time. Perl quickly moves into scientific notation and can handle arbitrarily large values. I wrote a similar program a while back and got bored with it when the count hit about 10^17. :) Christopher D. Lewis wrote: Someone posted a question as to the size of number

Re: slurping function like shell

2003-01-21 Thread Ben Siders
You should always perform all error checking in any language to ensure that your program, if it fails, declines gracefully. One of the greatest shortcomings of C is that error checking is entirely manual, and you simply must, in every real-world application, check the return value of almost

Re: slurping function like shell

2003-01-21 Thread Ben Siders
strftime is an interface to a C function of the same name. It's a fairly common function in many applications that have to deal with dates and times. You may not need it here, but it's not a bad idea to get a little familiar with it. For the life of me, I can't ever remember all the format

Re: Upload - File Lock question

2003-01-20 Thread Ben Siders
Play around with *FILEHANDLE. For example: open FILEHANDLE, blah.txt; closeFile( *FILEHANDLE ); sub closeFile { my $fh = shift; print $fh I closed you.\n; close $fh; } Mkrous wrote: Cheers Joseph, thanks for your reply. Still it does not work, $FileHandle is set to the

Re: translation

2003-01-20 Thread Ben Siders
I suspect we're being baited, but I'll bite. Write this as a normal Perl program: #!/usr/bin/perl $_=7P0374;; tr[0-][ LEOR!AUBGNSTY]; print; It's setting the default variable to that goofball string and then translating the characters. If you process through the translation, you get a rude

Re: using if(0) statements

2003-01-17 Thread Ben Siders
Since it's commented out, it could be that somebody removed that function in previous maintenance. Jenda Krynicky wrote: From: Johnson, Shaunn [EMAIL PROTECTED] I am not familiar with using 'if' in a script and I have come across a list of new scripts that I now have to learn / maintain. In

Request for a CPAN Module

2003-01-16 Thread Ben Siders
Are there any CPAN modules that can analyze XML or HTML and report any cases of unclosed tags? For example: note subjectHello, world/subject authorMe/author contentHey, is thing boldthing on?/content /note In the above, I'd like to find a method of detecting that the bold tag is

Re: Perl book

2003-01-15 Thread Ben Siders
My Perl libary consists of Learning Perl, Programming Perl, The Perl Cookbook, Advanced Perl Programming, and I just ordered the DBI book. Most people probably don't need all those, and I probably wouldn't have them all if I hadn't received most of them during some professional training

Re: Perl book

2003-01-15 Thread Ben Siders
I generally like the O'Reilly Perl books, and I've had good luck with them. I can't use them as my only Perl reference, though. I don't pick up the condescending tone in them that you seem to have, but I definately agree that they're overrated. The Perl books, in general, are excellent, but

Re: Checking to see if input has valid data.

2003-01-15 Thread Ben Siders
The quest for an email validation script is becoming ancient and legendary. I'm sure somebody else already has sounded off on this, but the short answer is that there's no sure-way to validate email. There's any number of potential problems: 1. The email address does not conform to the RFC

Re: finding variable name in string

2003-01-14 Thread Ben Siders
Use two $$. if ( $line =~ /$$myVariable/ ) { doSomethingSpiffy; } Dan Muey wrote: If I do that won't it look for the 'value' of $variable? I need it to find the actual string '$variable' not what $variable contains. Any other ideas? -Original Message- From: Paul Johnson

Re: finding variable name in string

2003-01-14 Thread Ben Siders
. [bsiders@lysol perl]$ ./test.pl blorg 1. Line contains my variable. 2. Line contains by variable. Ben Siders wrote: Use two $$. if ( $line =~ /$$myVariable/ ) { doSomethingSpiffy; } Dan Muey wrote: If I do that won't it look for the 'value' of $variable? I need it to find the actual

Re: finding variable name in string

2003-01-14 Thread Ben Siders
I believe that what he's after is a RE that will match the name of a variable proceded by a dollar sign. I.E., given this: $foo = bar; if ( $var =~ /some RE here/ ) { print true } He wants the expression to evaluate true if $var contains the string $foo; that is, the character '$' followed

Question about creating a hash of key-value pairs based on sub parameters.

2003-01-14 Thread Ben Siders
I have a subroutine that will receive parameters as follows: key1, value1, key2, value2, key3, value3, ... keyN, valueN I want to create a hash of key1 = value1, key2 = value2, ... , keyN = valueN in the subroutine. I'm curious if there's a Perl trick to doing this beyond the obvious looping

Re: Question about creating a hash of key-value pairs based on sub parameters.

2003-01-14 Thread Ben Siders
This is perfect. The input is coming from a CPAN module so I'm fairly confident that the number of entries will be even, but checking is always a good idea. You may want to check first that the list has an even number of entries: die Invalid parameters if @_ % 2; but after that it's just:

Re: Where do die messages go?

2003-01-14 Thread Ben Siders
I'm not 100% confident that'll work as written. I *think* that if the open is successful then the die will never execute and that 'if' will never get checked. If the 'open' is successful on writing to a non-existant file, I'm not sure if this solution will correct it. Dan Muey wrote: Open

Re: Recommend an email module?

2003-01-14 Thread Ben Siders
If not for the need for attachments, I'd suggest using the 'mail' shell command via the ` ` operator. I don't know how to attach files using 'mail', for all I know it may not even be possible. This may be a stupid question, but have you looked at the modules on CPAN yet? Paul Kraus wrote: