[11229] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4828 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 4 20:11:40 1999

Date: Thu, 4 Feb 99 17:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 4 Feb 1999     Volume: 8 Number: 4828

Today's topics:
    Re: _____FAQ list for this newsgroup_____               (Steve Linberg)
    Re: A problem for all you perl guru's <jcounts@voicenet.com>
    Re: ActivePerl on Win95 - "perlglob" pops up Command Wi (Jan Dubois)
        Apache APXS and mod_perl (Rob Tanner)
        Browser hangs using CGI.pm <aaron_newcomb@inter-tel.com>
    Re: can cgi(perl) do this? <stevenhenderson@prodigy.net>
    Re: checking existance of subroutine (Martien Verbruggen)
        Cookie not working, any idea why? (Andri Bell [aka Andre Bell])
        CPAN Shadow.pm <farber@admin.f-tech.net>
    Re: DBI + ODBC + MS Access <andrewf@beausys.demon.co.uk>
    Re: finding path to perl executable (Larry Rosler)
    Re: Help : Relative URL to cgi-local (Martien Verbruggen)
    Re: HELP!! How to delete files created by perl from tel chad@vcn.net
        How do I extract filename? <ricdola@email.msn.com>
    Re: How do I get local IP Address ? chad@vcn.net
        How to replace text in a text file. <tbogeman@nnex.net>
        MQSeries and Perl <ramme@ctp.com>
    Re: my $response = $ua->request ($req); (Martien Verbruggen)
    Re: Perl / DBI / HTML (Martien Verbruggen)
    Re: Perl programmers wanted (Martien Verbruggen)
        Perl Script Problem with Netscape Proxy Server Access (IG)
        Perl Script Problem with Netscape Proxy Server Access (IG)
    Re: Perl search string problem (Tad McClellan)
    Re: Postifix?? What is it? <palincss@his.com>
    Re: Question: Arrays of associative arrays dhosek@webley.com
    Re: Question: Arrays of associative arrays (Martien Verbruggen)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 04 Feb 1999 23:22:04 GMT
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: _____FAQ list for this newsgroup_____                              161
Message-Id: <slinberg-0402991822040001@cc11620-a.lwmrn1.pa.home.com>

In article <79d4t8$j68948@news2.bis.adp.com>, xmpxek@penis.nl wrote:

Kindly go FAQ yourself.


------------------------------

Date: Thu, 4 Feb 1999 19:49:28 -0500
From: "John Counts" <jcounts@voicenet.com>
Subject: Re: A problem for all you perl guru's
Message-Id: <79dfl1$lbj$1@news1.fast.net>

a few observations:

1) Using either VB or Perl to check for duplicate keys seems like a waste
since SQL Server itself is an order of magnitude faster than either for most
tasks and checking for duplicate keys is something SQL Server does very
well.  If you just want to eliminate the duplicate records just create a
temp table in your staging area and create a unique index on the key and add
'WITH IGNORE DUPLICATES' and copy your data from one of the tables into this
one.  If you want to list your dupes use something like:

select [keyfield], count(*)
from [table]
group by [keyfield]
having count(*) > 1

2)  If you really want to work with the textfiles and they are in fixed
length format you should look into the pack and unpack built-in functions in
Perl.  It's a little more difficult to work with than delimited data and
frankly since you're currently working from a staging database I would
continue doing that.  You can use either OLE or Win32::ODBC modules to
access a SQL Server database:

use OLE;
$Conn = CreateObject OLE ("ADODB.Connection") ;
$Conn->{'Mode'}=3;
$Conn->Open("driver={SQL Server};server=data;uid=sa;pwd=;database=temp");
$RS = CreateObject OLE ("ADODB.Recordset");
$SQL = "select * from whatever";
$RS->Open ($SQL, $Conn, 2, 2);
$k = $Conn->Errors->Count;
while ( ! $RS->EOF ) {
      $topic = $RS->Fields(0)->Value;

3) I agree that Perl is both faster and easier to program than VB and COM
objects.  I had a project that VB just wasn't able to do.  I rewrote it in
Perl and it worked very well.



>-  5 decent sized text files which hold customer data in fixed width
>format.  For ex.  one file is 50,000 rows with 30 columns.
>-  We are importing them into staging tables in SQL Server 6.5 with BCP.

>-  Then we validate the data using a COM component (written in VB
>utilizing ADO recordsets) which runs on the server.
>-  This validation goes row by row doing validation such as ....
>checking for valid dates, deleting any duplicate primary keys.
>-  Then the data is inserted into our production tables.
>-  This process takes a good amount of time and COM components aren't
>the most cooperative components sometimes.
>
>I was wondering, since I have read and heard so many great things about
>perl, if I could use a perl script to do the validation in the text
>files before they are put into SQL Server 6.5.  Any ideas for this
>process.





------------------------------

Date: Thu, 04 Feb 1999 23:53:54 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: ActivePerl on Win95 - "perlglob" pops up Command Window
Message-Id: <36c121ff.19159620@news3.ibm.net>

[mailed & posted]

"John Frendreiss" <fjj@mediaone.net> wrote:

>Can someone tell me if it's possible to stop the DOS Command Window from
>popping up on a Windows/95 (PWS) server when it's executing external
>processes like "perlglob"?  If not, does anybody know whether or not
>Windows/NT (IIS) servers operate in the same way?

if you are only concerned about perlglob and not about other external
commands:

    use File::DosGlob 'glob';

will override the Perl builtin function and execute everything internally
without the perlglob.* external program.

I have no idea about PWS and external commands at all though.

-Jan


------------------------------

Date: Thu, 04 Feb 1999 16:36:45 -0800
From: rtanner@linfield.edu (Rob Tanner)
Subject: Apache APXS and mod_perl
Message-Id: <rtanner-0402991636450001@wildflower.linfield.edu>

Configuration:
    mod_perl 1.17 and 1.18
    Apache 1.3.4
    Solaris 2.6 (SPARC)

Command to build makefiles:

    perl Makefile.PL USE_APXS=1 WITH_APXS=/opt/local/apache-DSO/bin/apxs

After the "make install", start Apache.  The above build results in a fatal
relocation error for file libperl.so, referenced symbol boot_Apache-URI not
found.  If I progessively add modules, the specific referenced symbol
changes, but the error still occurs. If I build with EVERYTHING=1, Apache
hangs on startup and has to be manually killed.  

I originally experienced this problem using the pre-built Apache binary
from Covalent -- prebuilt to include Raven-SSL patches.  The Raven module
itself loads dynamically.  Sine the apxs program distributed in their
binary was mucked up and I had to manually fix it to even build mod_perl, I
assumed there were further problem with thir distribution.

Next step.  Build Apache from apache.org sources.

Command to configure Apache:

   ./configure --prefix=/opt/local/apache-DSO \
               --enable-module=most \
               --enable-shared=max

Do a "make install" and everything starts up wonderfully.  Using the apxs
program that was built from this original source Apache build, I re-did the
mod_perl as explained above.  Results: exactly the same errors.

Is this a conflict with Salaris 2.6 or Apache 1.3.4?  Any ideas will be
highly appreciated.

-- Rob

      _ _ _ _           _    _ _ _ _ _    
     /\_\_\_\_\        /\_\ /\_\_\_\_\_\  
    /\/_/_/_/_/       /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
   /\/_/__\/_/ __    /\/_/    /\/_/          PROFUNDUM VIDITUR
  /\/_/_/_/_/ /\_\  /\/_/    /\/_/             
 /\/_/ \/_/  /\/_/_/\/_/    /\/_/         (Whatever is said in Latin
 \/_/  \/_/  \/_/_/_/_/     \/_/              sounds profound)

 Rob Tanner
 UNIX and Networks Manager
 Linfield College, McMinnville, OR
 (503) 434-2558 <rtanner@linfield.edu> _____________________________________________________________________


------------------------------

Date: Thu, 4 Feb 1999 18:47:35 -0500
From: "Aaron Newcomb" <aaron_newcomb@inter-tel.com>
Subject: Browser hangs using CGI.pm
Message-Id: <79dbju$l6s$1@remarQ.com>

I am trying to learn how to use CGI.pm. One problem I haven't been able to
solve is when I run a script that uses external information (whether I use a
form to post the info or even use "open (STDIN,"filename";)") and try to
manipulate the info my browser hangs. I am running Active Perl for Win32 on
IIS 4.0. The script runs fine from the command prompt and outputs exactly
what I would expect. For example, I can't run Lincoln Stein's own
http://www.wiley.com/compbooks/stein/text/htmlize.txt when I type out the
script and run it from the browser! Any suggestions would be great. In the
meantime, I am going to try running it on Apache to see if it is a server
issue.




------------------------------

Date: Thu, 4 Feb 1999 15:40:59 -0600
From: "Steven T. Henderson" <stevenhenderson@prodigy.net>
Subject: Re: can cgi(perl) do this?
Message-Id: <2equ2.8869$641.21008@news.san.rr.com>

yeah, like the other guy said its possible. do something like:

print "<META HTTP-EQUIV=\"Refresh\"
CONTENT=\"0;URL=$HTML_HOME/main2.htm\">";

which should bring up your file.


Jeff wrote in message <79d2au$lbp$1@remarQ.com>...
>When I want to display a confirmation message to the user after they submit
>thier info on my email auto-responder script is it possible for the CGI
>program to direct thier broswer to a specific html document rather than
have
>the html code hard-coded into the script? For instance if I want to have my
>html pages on another server (to avoid the bothersome hypermart pop-ups)
and
>the cgi is on the hypermart server(since it is free and allows cgi), after
>hypermart sends my email message for me is it possible for the "Thank You"
>page to be a seperate html document or do I have to type the html code into
>the cgi program? Because even if the page code is hardcoded into a cgi
>program, the pop-up banner appears on any page displayed through hypermart.
>I hope this makes sense.
>
>Jeff
>
>




------------------------------

Date: Fri, 05 Feb 1999 00:20:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: checking existance of subroutine
Message-Id: <EPqu2.76$fP3.5222@nsw.nnrp.telstra.net>

In article <36BA09CB.5E3C@datamail.co.nz>,
	Arran Price <arranp@datamail.co.nz> writes:

> How do I check to make sure the subroutine is valid?
> Any help or pointers to help appreciated.

Do you read this newsgroup at all? This question came up twice or
three times this week.

- You want to see if a sub is defined
	# perldoc -f defined
	[snip]
	You may also use C<defined()> to check whether a subroutine
	exists, by saying C<defined &func> without parentheses.

- You want to execute a sub, but you don't want your script to die
  when it dies
  	# perldoc -f eval

Your code just executes a piece of code that is the word that you
provide. It will warn, but it will succeed. You will need to put & in
front of it, but that wouldn't tell you anything either. It will tell
you whether the sub executed or not (after inspection of the correct
variables, explained in the documentation), and what it returned.
Failure does not mean that a sub could not be found.

First, define what you want, then pick one of the above.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd.       | am.
NSW, Australia                      | 


------------------------------

Date: Thu, 04 Feb 1999 22:45:53 GMT
From: cookies@ONE-CLICK.COM (Andri Bell [aka Andre Bell])
Subject: Cookie not working, any idea why?
Message-Id: <79df1c$7v5@dfw-ixnews7.ix.netcom.com>

This cookie isn't being returned to me when the html form is submitted. Any 
ideas why?

#!/usr/bin/perl5.003
# Copyright 1998 Adam Kalsey
#
# Permission granted to use and modify this code so long as the
# copyright above is maintained, modifications are documented, and
# credit is given for any use of the script.
#
# Portions Copyright 1993 Steven E. Brenner 

&ReadParse;
print "Content-type: text/html\n\n"; 

if (defined($ENV{'HTTP_COOKIE'}))
{


%cookies = &getCookies;
print "\n<input type=\"Hidden\" name=\"source\" value=\"$cookies{'source'}
\">\n"; 
} 
else {
&setCookie("source", "$in{'source'}"); 

print " \n"; 
} 

sub
SetCookie {
local($name, $value) = @_;
print "Set-Cookie: $name=$value\n";

} 

sub
GetCookie {
local(@browserCookies) = split (/; /,$ENV{'HTTP_COOKIE'});
local(%cookies); 

foreach(@browserCookies){
($key, $val) = split (/=/,$_);
$cookies{$key} = $val;
} 
return %cookies;


} 
sub ReadParse {
if (@_) {


local (*in) = @_;

} 
local ($i, $loc, $key, $val); 

# Read in text
if ($ENV{'REQUEST_METHOD'} eq "GET") { 

$in = $ENV{'QUERY_STRING'};

}
elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
for ($i = 0; $i < $ENV{'CONTENT_LENGTH'}; $i++) { 
$in .= getc;
}

} 
@in = split(/&/,$in); 

foreach $i (0 .. $#in) {


# Convert plus's to spaces
$in[$i] =~ s/\+/ /g; 
# Convert %XX from hex numbers to alphanumeric
$in[$i] =~ s/%(..)/pack("c",hex($1))/ge; 

# Split into key and value.
$loc = index($in[$i],"=");
$key = substr($in[$i],0,$loc);
$val = substr($in[$i],$loc+1);
$in{$key} .= '\0' if (defined($in{$key})); # \0 is the multiple separator
$in{$key} .= $val;


} 
return 1; # just for fun
} 

                                                 END OF SCRIPT 

I've recently tried using the above sources.cgi cookie by Adam Kalsey as a 
server side include at the top of the referrer page (before the html tag) and 
also placed immediately after the <form... tag on the form page. Both of these 
forms are on the same domain and each page ends with .shtml extensions -- and 
they fail to function. I don't know what is wrong (I'm sure it's user error) 
but could really use some help.  The only thing that looks strange is that 
when I compare this script to other perl scripts I've downloaded this one 
looks like it is unfinished at the end because it doesn't have the 'exit' 
instructions I see so commonly in other scripts(?). No idea if that is ok or 
not but thought I'd point it out. 

Thanks!

Andre


------------------------------

Date: Thu, 4 Feb 1999 18:24:51 -0500
From: Paul Farber <farber@admin.f-tech.net>
Subject: CPAN Shadow.pm
Message-Id: <Pine.LNX.3.96.990204182158.3554A-100000@admin.f-tech.net>

Hello all...

Trying to update the PERL 5.004 dist I have (RH 5.1) to allow me to get
the passwords in the /etc/shadow file to create my own login script.

I did:

tar zxvf Shadow.tar.gz
cd Shadows
perl Makefile.PL
make
make install
make test

But there is not documentation with the module.  perldoc -f getspnam
errors out, and there were no doc's in the tarball.

Am I all hosed, is there an easier way?

Thanks

Paul D. Farber II
Farber Technology
717-628-5303
farber@admin.f-tech.net



------------------------------

Date: Thu, 4 Feb 1999 23:47:47 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: DBI + ODBC + MS Access
Message-Id: <aUWYxBAjGju2Ewii@beausys.demon.co.uk>

Oops! I think this is because I havent registered the
file with the 32bit ODBC Data Source Administrator.

However, there seems to be a bug in the Administrator... :(


In article <lOg3XAA55Zu2Ewlt@beausys.demon.co.uk>, Andrew Fry
<andrewf@beausys.demon.co.uk> writes
>I am trying to use DBI + ODBC to read a small
>MS Access database (file name: afdb1.mdb).
>The connect statement looks like this:
>  $dbh = DBI->connect($dbdatasrc,$dbusername,$dbpassword);
>...where...
>  $dbdatasrc = "DBI:ODBC:afdb1.mdb"
>  $dbusername = ""
>  $dbpassword = ""
>
>However, I am getting the following error:
>
>  Error connecting to DBI:ODBC:afdb1.mdb: [911]
>  [] "[Microsoft][ODBC Driver Manager] Data source
>  name not found and no default driver specified
>
>Any suggestions as to what I might be doing wrong ?
>
>Note:
>1. This is using (ActiveState's) ActivePerl build 509
>   + DBI +DBD:ODBC packages.
>2. I tried the full pathname of the file - makes no
>   difference.
>
>---
>Andrew Fry
>"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).

---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).


------------------------------

Date: Thu, 4 Feb 1999 16:13:22 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: finding path to perl executable
Message-Id: <MPG.1123d77bd21a7c19989a07@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <797l10$m48$1@nnrp1.dejanews.com> on Tue, 02 Feb 1999 
19:52:05 GMT, mlevine@reshape.com <mlevine@reshape.com> says...
> Can anyone tell me how to find the path to the perl executable I am running?
> 
> IE, from inside script foo, I'd like to be able to find out that it was run
> from /usr/local/bin/perl.

Try this (quotesd from perlvar).  It gave me the full path on a Windows 
NT system (where the '#!' path is ignored) and on a Unix system (where 
it is honored).

$EXECUTABLE_NAME
$^X

The name that the Perl binary itself was executed as, from C's argv[0]. 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 04 Feb 1999 23:23:12 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help : Relative URL to cgi-local
Message-Id: <AZpu2.61$fP3.5222@nsw.nnrp.telstra.net>

In article <79bc6k$pvk$1@nnrp1.dejanews.com>,
	clrweav@netcom.ca writes:
> **Please don't tell me this is off topic. I am at my wits end. Just if someone
> can help me, I would very much appreciate it.**

Well, it _is_ off topic.

>>Well, it doesn't exist by default -- you have to create it.  After that, it
>>should be accessible relatively (as a URL) via: /cgi-local
> 
> I have put a question back on "HOW" to create this "alias" or shortcut to my
> cgi-local directory, and to this 3rd day, waiting patiently for a response, I
> still am at a standstill.

Depends on the operating system of your server.

most platform independent:

ftp to the server, change directory to where your web root is
(public-html or something like that, and 'mkdir cgi-local'. If you
have some point and click ftp client, use its functionality to create
a directory there.

Depending on the platform you may need to make this directory
accessible to everybody (just read and execute)

If it's unix, and you can telnet:

telnet machine_name
[log in]
cd public-html (or whatever)
mkdir cgi-local
chmod 755 cgi-local

Martien

PS. Why did I answer this? I must be ill.
-- 
Martien Verbruggen                  | 
Interactive Media Division          | 
Commercial Dynamics Pty. Ltd.       | 'I hate gramaticle errors!' 'Me to!'
NSW, Australia                      | 


------------------------------

Date: Thu, 04 Feb 1999 23:00:41 GMT
From: chad@vcn.net
Subject: Re: HELP!! How to delete files created by perl from telnet!!
Message-Id: <79d8qi$efs$1@nnrp1.dejanews.com>



first, log on to the machine and try:

man rm <enter>

That is the man page for the command 'rm', hopefully your on a UNIX
system.

To remove the file use:

rm -i <filename>

if you have permission, presto.

-chad

In article <01be4e55$80b6c180$ae89accf@default>,
  "MekaGames Staff" <support@mekagames.com> wrote:
> Hi!
> My perl program created some files in a certain directory. However, I do
> not have ftp access to this directory, but I do have telnet directory. What
> command do I have to use to delete this files? Thanks for your help!
>
> - Kaveh
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 4 Feb 1999 17:22:03 -0600
From: "Ric Alcazar" <ricdola@email.msn.com>
Subject: How do I extract filename?
Message-Id: <uIFQuTJU#GA.102@upnetnews02.moswest.msn.net>

hello all,

I'm trying to get the filename from an enctype="multipart/form-data" form
element using cgi-lib.pl.
It seems all I get is the file data... is there anyway to get the filename?

illfigah




------------------------------

Date: Thu, 04 Feb 1999 23:42:15 GMT
From: chad@vcn.net
Subject: Re: How do I get local IP Address ?
Message-Id: <79db8l$gfl$1@nnrp1.dejanews.com>



What kind of machine is it, I'm assuming it's not UNIX, if it
is use 127.0.0.1 which is standard for 'localhost', on Win machine use
the one in the Network settings or Just make one up.

-chad


In article <79cm96$t3r$1@nnrp1.dejanews.com>,
  darylh@trendwestresorts.com wrote:
> I have a program that uses sockets, but in order to open the socket my
> program needs to know the IP Address of the machine it is running on. Is
> there a function or system call that will get this address for me? I've
> looked through my perl books (which are both pretty useless) and can't find a
> thing. I guess I need to get a new Perl book.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Thu, 04 Feb 1999 17:03:22 -0600
From: Ted Bogeman <tbogeman@nnex.net>
Subject: How to replace text in a text file.
Message-Id: <36BA273A.9C0A19C7@nnex.net>

Please Help

I have a daemon that will call perl scripts when prompted.  What I need
it to do:  Is take the $username and edit the passwd file.  I would like
to just send the user info to the script for unlocking and locking user
accounts.  The script would find the username in /etc/passwd and then
change the x to ! , thus locking the account.

username:x:1887:100:Real Name:/home/jbsw:/bin/bash   (unlocked account)

username:!:1887:100:Real Name:/home/jbsw:/bin/bash   (locked account)


Could someone please help with completing this script.

#!/usr/bin/perl
open(INFILE,"@ARGV[0]");
$file = "@ARGV[0]";
$inline = <INFILE>;
($username,$password,$realname,$shell,$uid,$gid) = split(/\:/,$inline);
close(INFILE);

Thanks in advance.  You can email me direct.







------------------------------

Date: Thu, 04 Feb 1999 14:40:02 -0800
From: Roy Ammeraal <ramme@ctp.com>
Subject: MQSeries and Perl
Message-Id: <36BA21C2.C17F2D04@ctp.com>

Folks,

Does anyone have experience using and accessing MQseries from Perl? Any
experience shared, pitfalls, etc (maybe a Howto?) is welcome!

Roy Ammeraal


------------------------------

Date: Thu, 04 Feb 1999 23:49:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: my $response = $ua->request ($req);
Message-Id: <Amqu2.69$fP3.5222@nsw.nnrp.telstra.net>

In article <O$QnCeDU#GA.346@nih2naac.prod2.compuserve.com>,
	"Mike Watkins" <mwatkins@promotion4free.com> writes:
> Hi there,

Hi! (poised to answer the question)

> I'm building a URL submission script.  The actual submission works perfectly

A what?

> fine, but I'm having a little trouble with verifying that the submission
> went through.  Here's the 5 lines that I use:

Huh?

Where?

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd.       | clothes.
NSW, Australia                      | 


------------------------------

Date: Thu, 04 Feb 1999 23:19:04 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl / DBI / HTML
Message-Id: <IVpu2.58$fP3.5222@nsw.nnrp.telstra.net>

In article <79bg25$i7m$1@enyo.uwa.edu.au>,
	Richard Kok Fhung Law <law-kr@ee.uwa.edu.au> writes:
> 
> I have added the check connection code in, but still get the same error.
> The output only comes out on linux, but on the webpage, it complained
> the user authen. failed. see below. any help appreciated. thanks again.

> $conn = DBI->connect("dbi:Pg:dbname=$dbase", "rich", "rich"); 

I don't know much about Postgres databases (that is what you are
using, isn't it?), but I suspect that they may do authentication based
on the user that opens the connection. Since your web stuff runs as
the user who runs the web server (often 'nobody'), that user needs the
appropriate permissions in your database.

Either that, or provide some mechanism to get the correct uid and
password in there.

You could test this by running the script from the command line as the
user nobody (need to be root, use 'su username script')

Again: I am not familiar with Postgres, but I suspect that the problem
lies there. Why the database doesn't return some sort of error I don't
know.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | 
Commercial Dynamics Pty. Ltd.       | What's another word for Thesaurus?
NSW, Australia                      | 


------------------------------

Date: Thu, 04 Feb 1999 23:48:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl programmers wanted
Message-Id: <Hlqu2.68$fP3.5222@nsw.nnrp.telstra.net>

In article <36b98dce.462027400@203.29.210.32>,
	jday@vic.bigpond.net.au (John Day) writes:

> I hope you dont mind, but I need to find some PERL programmers for
> work I am doing in Australia.

I don't mind that you need to find some PERL programmers. I do mind
that you are trying to find them here, because:

- We don't talk about PERL here. We talk about Perl and perl.
  Occasionally we talk about the best recipes for baked bananas, but
  mainly about Perl and perl.

- Job posts should go in a job related newsgroup. Anything with 'job'
  somewhere in the name would have been appropriate. Even better, put
  an advertisement in the Perl Journal.

> Casual work for small marketing company with a nice idea and no time
> to code it! Involves database work with MySQL on FreeBSD & Apache.

Hey, as long as you have enormous loads of money to code it, it'll
happen.

> email me!!

Nah.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.       | the people out there are dumber.
NSW, Australia                      | 


------------------------------

Date: Fri, 05 Feb 1999 00:22:25 GMT
From: igraham@charm.net (IG)
Subject: Perl Script Problem with Netscape Proxy Server Access
Message-Id: <36ba3938.85395051@news.charm.net>

I'm a newbie to Perl and assigned myself a practical
task in order to learn this language. I'm creating a 
"Bot" that will traverse the WEB for specific kinds of
information. I'm creating this on Win NT 4 using Active
State's version of Perl. I've also been using a number
of excellent reference books from O'Reilly. However I've 
encountered a problem that I'm hoping someone can help
me with.

At my job, in order to access the WEB user's must pass
through a Netscape based proxy server. Normally when
using a browser, one is presented with a dialog box 
in order to enter a user name and password. Once this
is done all further WEB requests are passed through.

When I attempted to use my Perl based "Bot" I encountered
problems with this access. After performing some research
I modified my code to pass my user name and password in 
my HTTP requests: Some test code to test this access is 
as follows:

use LWP::UserAgent;

$ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.5" . $ua->agent);
$ua->proxy(['http', 'ftp'] => 'http://hoisproxy2:8080/');

$req = new HTTP::Request 'Get', "http://www.perl.com";
$req->header('Accept' => 'text/html');
$req->proxy_authorization("my_username", "my_password");

$res = $ua->request($req);
#print $res->content if $res->is_success;
if ($res->is_success) {
   pritn $res->content;
}  else {
     print "Error: " . $res->status_line . "\n";
}

When I run this code I receive the following:

Error: 407 Proxy Authorization Required

Can someone please help me to identify what it is that
I'm doing to cause my proxy access to fail? Also once I
pass my HTTP requests to the WEB, do I have to embed
this information with each request? Thanks for any 
assistance offered.



------------------------------

Date: Fri, 05 Feb 1999 00:23:14 GMT
From: igraham@charm.net (IG)
Subject: Perl Script Problem with Netscape Proxy Server Access
Message-Id: <36bc39e9.85572687@news.charm.net>

I'm a newbie to Perl and assigned myself a practical
task in order to learn this language. I'm creating a 
"Bot" that will traverse the WEB for specific kinds of
information. I'm creating this on Win NT 4 using Active
State's version of Perl. I've also been using a number
of excellent reference books from O'Reilly. However I've 
encountered a problem that I'm hoping someone can help
me with.

At my job, in order to access the WEB user's must pass
through a Netscape based proxy server. Normally when
using a browser, one is presented with a dialog box 
in order to enter a user name and password. Once this
is done all further WEB requests are passed through.

When I attempted to use my Perl based "Bot" I encountered
problems with this access. After performing some research
I modified my code to pass my user name and password in 
my HTTP requests: Some test code to test this access is 
as follows:

use LWP::UserAgent;

$ua = new LWP::UserAgent;
$ua->agent("Mozilla/4.5" . $ua->agent);
$ua->proxy(['http', 'ftp'] => 'http://hoisproxy2:8080/');

$req = new HTTP::Request 'Get', "http://www.perl.com";
$req->header('Accept' => 'text/html');
$req->proxy_authorization("my_username", "my_password");

$res = $ua->request($req);
#print $res->content if $res->is_success;
if ($res->is_success) {
   pritn $res->content;
}  else {
     print "Error: " . $res->status_line . "\n";
}

When I run this code I receive the following:

Error: 407 Proxy Authorization Required

Can someone please help me to identify what it is that
I'm doing to cause my proxy access to fail? Also once I
pass my HTTP requests to the WEB, do I have to embed
this information with each request? Thanks for any 
assistance offered.



------------------------------

Date: Thu, 4 Feb 1999 17:42:09 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl search string problem
Message-Id: <h8bd97.5i7.ln@magna.metronet.com>

brian d foy (comdog@computerdog.com) wrote:

: tr/// is a little different, and doesn't use character classes.


   tr/// is _wildly_ different. It takes only a couple simple lists 
   of chars (with rules for what to do when their lengths differ).


   s/// uses full power regular expressions rather than wimpy
   ol' character lists.


   (I know brian knows this, but I couldn't let "a little" be
    remembered as a good characterization by the less initiated.
   )


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 04 Feb 1999 19:52:22 -0500
From: Steve Palincsar <palincss@his.com>
Subject: Re: Postifix?? What is it?
Message-Id: <36BA40C6.AD726A4F@his.com>

In the domain of programming languages and calculators,
_postfix_ refers to a type of notation also known
as "reverse polish," where the arguments come first
(and are pushed on a stack) followed by the operator
(which consumes the arguments and returns the result).

One would add 2 and 2 together in forth, a language that
uses postifx notation, thusly:  2 2 + 

However, this is not spelled "postifix".  

$aside = <<EOT;
As for what "postifix" might be in other subject domains,
one can but imagine.

I am reminded of when as a kid I used to walk along
Southern Boulevard under the El past a strip joint.
The posters of the strippers used to be adorned with
what _must_ have been postifix stars in a couple of
strategic places...

EOT

Jeff wrote:
> 
> Anyone here have any idea what postifix is? I made an inquiry to my regular
> isp about using cgi on thier servers and they say sure but I have to do the
> following:
> "We are running linux and to do cgi, you would need to (the following came
> from our programmer) create the file with execution
> permssions set and .cgi postifix under the public_html directory."
> I understand ALL of this except the bit about postifix. I did a search
> through dejanews and several search engnies and I have seen 2 documents
> mentioning this vague mystery term. One was a final exam cheat sheet that
> had "C" as an answer to some postifix-machine code question (that in itself
> told me nothing) Another was a resume that had a calculator that translates
> "inifix" to "postifix" and still I know nothing >:) Any help would be
> appreciated. I have tried contacting the isp again but they are currently
> unavailible.
> Jeff


------------------------------

Date: Thu, 04 Feb 1999 23:43:26 GMT
From: dhosek@webley.com
Subject: Re: Question: Arrays of associative arrays
Message-Id: <79dbas$gg3$1@nnrp1.dejanews.com>

In article <36B9F39A.F2365854@synopsys.com>,
  Steve Chen <stevesc@synopsys.com> wrote:

> Are "arrays of associative arrays" useful in Perl?  I seem to be able to
> construct it, but the problem

yes, I use them all the time.

> is, how do I access the values of the associative arrays?  Let's say I
> have an array:

> @Array = (%comp1, %comp2, ..., %compn);

> where

> %compn = (keys, values)

> To print all the values of the associative arrays, I tried

> (loop over $i)
> foreach $key (sort keys($Array[$i])) {
>     print ....
> }

> But this won't fly with the compiler.  The function "keys" doesn't seem
> to like things that begin
> with a "$".  Any ideas?

I usually loop through (actually any array), using
for (@array) {
 ...
}

which puts the current array element in $_ while I'm looping.

In the case of an array of hashes, $_ is a reference to a hash so I can access
elements with
$$_{key}

You should be able to figure it out from there.

-dh


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Fri, 05 Feb 1999 00:09:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Question: Arrays of associative arrays
Message-Id: <hFqu2.74$fP3.5222@nsw.nnrp.telstra.net>

In article <36B9F39A.F2365854@synopsys.com>,
	Steve Chen <stevesc@synopsys.com> writes:

> Are "arrays of associative arrays" useful in Perl?  

not really. They're just there so that people can do cool things with
map and typeglobs. BTW. associate arrays are normally called hashes.

> I seem to be able to
> construct it, but the problem
> is, how do I access the values of the associative arrays?  Let's say I
> have an array:
> 
> @Array = (%comp1, %comp2, ..., %compn);

> To print all the values of the associative arrays, I tried
> 
> (loop over $i)
> foreach $key (sort keys($Array[$i])) {
>     print ....
> }

Ok, you need to read some documentation

# perldoc perldata
# perldoc perlref
# perldoc perllol
# perldoc perldsc

The last one in particular tells you how to do that, the others
provide you with the knowledge to understand it.

What you really want:

@Array = ( \%comp1, \%comp2...);

$hash_ref = $Array[0];

foreach my $key (keys %$hash_ref)
{
	print "$key : $hash_ref->{$key}\n";
}

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4828
**************************************

home help back first fref pref prev next nref lref last post