[17065] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4477 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 30 18:05:33 2000

Date: Sat, 30 Sep 2000 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970351512-v9-i4477@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 30 Sep 2000     Volume: 9 Number: 4477

Today's topics:
    Re: 5.6.0 lib.pm changes. (Daniel Chetlin)
        Array functions <evert@coolxs.com>
    Re: Array functions <mbudash@sonic.net>
    Re: Array functions (Martien Verbruggen)
    Re: Arrogant kid takes on huge group of programmers (wa <bmb@ginger.libs.uga.edu>
    Re: Candidate for the top ten perl mistakes list <bmb@ginger.libs.uga.edu>
    Re: Candidate for the top ten perl mistakes list <anmcguire@ce.mediaone.net>
    Re: CGI trouble <anonymous@anonymous.anonymous>
    Re: CGI trouble <simonis@myself.com>
    Re: CGI trouble (Tim Hammerquist)
    Re: DBI and MS-Access <jvahn@short.circuit.com>
        Executing exe from webpage Rand25@juno.com
    Re: File upload testing if it's there jim_marshall2268@hotmail.com
    Re: File upload testing if it's there yorktown5425@my-deja.com
    Re: File upload testing if it's there <godzilla@stomp.stomp.tokyo>
    Re: File upload testing if it's there <barbr-en@online.no>
    Re: File upload testing if it's there <barbr-en@online.no>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 30 Sep 2000 20:30:45 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: 5.6.0 lib.pm changes.
Message-Id: <8r5ihl0q9i@news1.newsguy.com>

On Fri, 29 Sep 2000 15:56:31 -0400, tc lewis <tcl@bunzy.net> wrote:
>so i can "use lib whatever" in perl, and with pre 5.6 perl that seemed
>to make perl look in whatever and whatever/arch for packages. with
>5.6.0, it seems to look in whatever, whatever/version, and
>whatever/version/arch, and not whatever/arch.

Yes, good catch. This is indeed a bug with 5.6.0. It's been fixed in
5.7. and I am fairly certain will be in 5.6.1 as well.

See

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-08/msg00232.html
(sorry for the long line)

for when this was fixed. If you really need this fix and 5.7.0 isn't an
option, you could consider applying this patch directly. The latest
ActivePerl doesn't include it, but it probably will soon.

>so we're a bit confused as to what changes are going on and what we can
>expect in the future. we used to use "use lib whatever" for our perl
>stuff, but i'm suggesting PERL5LIB now instead, but we're not sure what
>the best method is. another suggestion is to keep using "use lib
>whatever" and to instead install things with a PREFIX of
>whatever/version instead of just whatever.

I would resort to twiddling @INC directly before using PERL5LIB or
changing my directory structures. Environment variables always seem so
hacky to me. But as I say above, I'd definitely suggest at least
applying that patch. It's a very simple one line change, not likely to
break anything else.

-dlc


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

Date: Sat, 30 Sep 2000 18:16:10 GMT
From: "Evert" <evert@coolxs.com>
Subject: Array functions
Message-Id: <K5qB5.1582$gS1.10065@Typhoon.bART.nl>

Hi,

I'm working with a database which looks like this:

1    string
2    string#2
3    string#3
4    string#4
5    string#5
 ....
etc.

I need to print out each different string in a different field of a page.
To grab the last string and put it in a textfield is not a problem, but i
can't make it work to put the string before the last string in a textbox.
(and so on, until i have filled all available textboxes...)
Is there anyone who can help me with this problem!
Many thanks in advance!!

Evert




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

Date: Sat, 30 Sep 2000 11:19:09 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Array functions
Message-Id: <mbudash-5A4323.11190930092000@news.pacbell.net>

In article <K5qB5.1582$gS1.10065@Typhoon.bART.nl>, "Evert" 
<evert@coolxs.com> wrote:

> Hi,
> 
> I'm working with a database which looks like this:
> 
> 1    string
> 2    string#2
> 3    string#3
> 4    string#4
> 5    string#5
> ....
> etc.
> 
> I need to print out each different string in a different field of a page.
> To grab the last string and put it in a textfield is not a problem, but i
> can't make it work to put the string before the last string in a textbox.
> (and so on, until i have filled all available textboxes...)
> Is there anyone who can help me with this problem!
> Many thanks in advance!!
> 
> Evert
> 
> 

what have you tried so far? (let's see a relevant code snippet)
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sun, 1 Oct 2000 08:17:31 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Array functions
Message-Id: <slrn8tcm3b.jr6.mgjv@martien.heliotrope.home>

On Sat, 30 Sep 2000 18:16:10 GMT,
	Evert <evert@coolxs.com> wrote:
> Hi,
> 
> I'm working with a database which looks like this:
> 
> 1    string
> 2    string#2
> 3    string#3
> 4    string#4
> 5    string#5
> ....
> etc.

That's a database according to some loose definitions of database, yes.

> I need to print out each different string in a different field of a page.

This is about HTML and CGI, isn't it?

> To grab the last string and put it in a textfield is not a problem, but i
> can't make it work to put the string before the last string in a textbox.

I really don't know what you are saying here. What textbox? what last
string? Does this make sense to you, when you read it back?

> (and so on, until i have filled all available textboxes...)
> Is there anyone who can help me with this problem!

Just general advice: If this is about HTML and CGI, then you should be
using the CGI module.

use strict and -w

If you have a question, describe it clearly. It is really important that
you learn to describe your problems in a clear and concise manner.

If you have a request for people to write code for you, then show what
you have tried. Prepare a _short_ and _functioning_ example of what you
are trying to do, and show us. You look lazy if you don't. It looks like
you want us to do your work.

> Many thanks in advance!!

HTH, HAND

Martien
-- 
Martien Verbruggen              | My friend has a baby. I'm writing
Interactive Media Division      | down all the noises the baby makes
Commercial Dynamics Pty. Ltd.   | so later I can ask him what he meant
NSW, Australia                  | - Steven Wright


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

Date: Sat, 30 Sep 2000 17:17:21 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Arrogant kid takes on huge group of programmers (was Re: How to get length of scalar?)
Message-Id: <Pine.A41.4.21.0009301707250.11004-100000@ginger.libs.uga.edu>

On Sat, 30 Sep 2000, Mark Carruth wrote:
> I know I am getting boring now, but I really don't see why the huge group of
> programmers are literally taking the piss out of me. I am new to newsgroups
> so instead of slagging me off because I post HTML, someone could just tell
> me not to, and then I would willingly turn off HTML posting which I have now
> done.

Mark,

Since you're expressing a willingness accept suggestions, I suggest the
following:

Don't quote "jeopardy style".  That means please put your comments AFTER
the comments of the person you are answering.  It makes communication
easier and it's the polite thing to do.

Don't feel that you have to answer EVERY comment/attack that comes along.  
Sometimes it's better to simply let the water run off your back like a
duck.  It also makes you look smarter. :-)

Cheers,

Brad



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

Date: Sat, 30 Sep 2000 17:36:29 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <Pine.A41.4.21.0009301728080.11004-100000@ginger.libs.uga.edu>

On Sat, 30 Sep 2000, David Steuber wrote:

> My biggest Perl mistake was trying to learn Perl.  Now I am punishing
> myself for this horrid mistake by trying to learn Perl.

no warnings qw( recursion );

Brad



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

Date: Sat, 30 Sep 2000 16:56:59 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <Pine.LNX.4.21.0009301655520.25121-100000@hawk.ce.mediaone.net>

On Sat, 30 Sep 2000, David Steuber quoth:

DS> My biggest Perl mistake was trying to learn Perl.  Now I am punishing
DS> myself for this horrid mistake by trying to learn Perl.

So, I take it you have got recursion mastered, huh?

anm
-- 
$ENV{PAGER} = 'perl -wpe0';
system perldoc => '-t', '-F', $0;

=head1 
Just another Perl Hacker



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

Date: Sat, 30 Sep 2000 11:08:27 -0700
From: Anonymous <anonymous@anonymous.anonymous>
Subject: Re: CGI trouble
Message-Id: <39D62C1B.84DD260C@stomp.stomp.tokyo>

Rand25@juno.com wrote:
 
> I just installed Apache Server for Win32, and it seems to work fine,

You are indicating you have a problem. Your system setup
does not work fine, yes?

> but I cant access my cgi-bin directory to test a cgi script (test.cgi).

A good start would be to read this extensive documentation which
comes with an Apache install. Doing so, will provide answers to
almost all problems you encounter.


> I tried http://localhost/cgi-bin/test.cgi, but I got an internal error.

Then your system does not work fine. Is this not true?


> What url should I use,

None of us are Internet Mind Readers. Use an URL which
is appropriate for your system.


> and is there a way to browse my new "IntraNet" without 
> having to type localhost....its kinda long, and I'm really lazy.

Laziness is a personal problem only you can resolve.


Anonymous Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


--

  --------== Posted Anonymously via Newsfeeds.Com ==-------
     Featuring the worlds only Anonymous Usenet Server
    -----------== http://www.newsfeeds.com ==----------


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

Date: 30 Sep 2000 18:28:09 GMT
From: Drew Simonis <simonis@myself.com>
Subject: Re: CGI trouble
Message-Id: <39D62D61.B7C5E7B5@myself.com>

Rand25@juno.com wrote:
> 
> I just installed Apache Server for Win32, and it seems to work fine,
> but I cant access my cgi-bin directory to test a cgi script (test.cgi).
> I tried http://localhost/cgi-bin/test.cgi, but I got an internal error.
> What url should I use, and is there a way to browse my new "IntraNet"
> without having to type localhost....its kinda long, and I'm really lazy.
> I'm running Windows 98 and Apache 1.3.12.
> Thanks


You'd be best suited by asking a question about your web server
configuration in a NG dedicated to the discussion of such things.

comp.infosystems.www.servers.misc


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

Date: Sat, 30 Sep 2000 18:23:36 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: CGI trouble
Message-Id: <slrn8tccna.21b.tim@degree.ath.cx>

First, this is not Perl.  But...

Rand25@juno.com <Rand25@juno.com> wrote:
> I just installed Apache Server for Win32, and it seems to work fine,
> but I cant access my cgi-bin directory to test a cgi script (test.cgi).
> I tried http://localhost/cgi-bin/test.cgi, but I got an internal error.
> What url should I use,

Apache usually has the following setup (on Win32):

	D:\$DOCUMENT_ROOT\htdocs\   maps to  http://localhost/
	D:\$DOCUMENT_ROOT\cgi-bin\  maps to  http://localhost/cgi-bin/

 ...where D:\$DOCUMENT_ROOT\ is the directory where the Apache document
tree begins.  This is set with the DocumentRoot directive in your
httpd.conf or httpd_conf file.

Assuming all this is correct and permissions are set correctly, you
should be able to access your script, provided it's in the correct
directory.

What you failed to mention is _which_ server error.  Apache should give
you a 3-digit error code. The most common codes are 403, 404, and 500.
404 indicates you have a server configuration error, or your script just
isn't there.  500 means you're half-way to success; it usually means
your script isn't conforming to CGI protocol, often due to errors in the
script.

Check your error.log (aka error_log) to figure out what's causing the
error and if it's a script problem, THEN it's a Perl question.  (Are you
sending a Content-Type header?)  If it's a configuration problem, you
need to tinker with httpd.conf.

Check the server documentation that
comes with your server at http://localhost/manual on my box.

> and is there a way to browse my new "IntraNet"
> without having to type localhost....its kinda long, and I'm really lazy.

No.

Unless you're a client on another intranet and your computer's name is
something other than 'localhost'.  However, since you _can_ view your
server via 'localhost', this is most likely not the case, and you can
just deal with it or move to *nix where you can choose your machine's
name.

> I'm running Windows 98 and Apache 1.3.12.

My condolences.  I know what you're going through, but there _is_ hope.
My savior appeared as a penguin, but yours may just come from
Berkeley instead.[*]  ;)


[*]	http://www.freebsd.org/
	http://www.linux.org/

-- 
-Tim Hammerquist <timmy@cpan.org>

People get annoyed when you try to debug them.
	-- Larry Wall, 1999


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

Date: 30 Sep 2000 18:30:49 GMT
From: James Vahn <jvahn@short.circuit.com>
Subject: Re: DBI and MS-Access
Message-Id: <8r5bgp$bri$1@gonzo.circuit.com>

Jeff Zucker wrote:
> Here's my suggestion: put "Ms-Access Linux" in the search box at
> http://www.deja.com/usenet/ and read some of the 400 previously
> discussed messages on this topic.

I found no answers to the poster's question there.

Might be some help at http://unixodbc.org, it looks promising although
it's beyond me how to get it to work.

As to the archives at CPAN, the iODBC driver won't build here for some
reason. Dated 1994. In theory, it appears we are to run the cpan shell,
issue the following commands:

    install iodbc
    install DBI::ODBC

and be in business. What I managed to put together results in a
segfault..

    #!/usr/bin/perl -w
    use DBI;

    @driver_names = DBI->available_drivers;
    print "Available drivers: @driver_names\n";

    @data_sources = DBI->data_sources('ODBC');
    print "Data sources: @data_sources\n\n";

The output:

    Available drivers: ADO CSV ExampleP File ODBC Pg Proxy RAM mysql
    *Segmentation fault*

I'm not a programmer, but the script works as expected for the other
drivers. 





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

Date: Sat, 30 Sep 2000 21:18:03 GMT
From: Rand25@juno.com
Subject: Executing exe from webpage
Message-Id: <8r5la7$e9v$1@nnrp1.deja.com>

I cant seen to find a way to execute files from an html/javascript
menu....is there a way to do it with CGI or inline Perl? I want to have
be able to run games and My Computer from a menu attached to my Active
Desktop page.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 30 Sep 2000 20:04:37 GMT
From: jim_marshall2268@hotmail.com
Subject: Re: File upload testing if it's there
Message-Id: <8r5h0i$b27$1@nnrp1.deja.com>

The code I posted was a snippet from a larger perl script I wrote.  The
code compiles and actually RUNS, what fatal error do you think exists?


In article <39D56E78.81479CC@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> jim_marshall2268@hotmail.com wrote:
>
> (snippage)
>
> > I'm new to perl, started two days ago. I've been
> > doing C/C++ and Java for many years...
>
> Honestly? Then you know Perl code won't compile if
> it has fatal syntax errors. Post code which compiles
> and perhaps someone can help you. Gotta have code
> which works, before you can locate your bugs.
>
> Godzilla!
> --
> Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
> UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
> BumScrew, South of Egypt ¦ HTML Programming Class
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 30 Sep 2000 20:10:14 GMT
From: yorktown5425@my-deja.com
Subject: Re: File upload testing if it's there
Message-Id: <8r5hb4$beb$1@nnrp1.deja.com>

I thought using the 'defined' stuff was standard fair with CGI scripts
(CGI.pm), for example this code works:

<snippet of code>
	$Name = $query->param("Name");

	# make sure a name was sent
	if (!defined $Name) {
	  print "No name specified!!";
	  exit;
	}
</snippet of code>

If the person doesn't enter some text in the "Name" field then the if
block is executed, but if they do enter text then the if block is
skipped.

am I relying on an unintended side affect here?


In article <39D5683A.57BAA9BB@rochester.rr.com>,
  Bob Walton <bwalton@rochester.rr.com> wrote:
> jim_marshall2268@hotmail.com wrote:
> >
> > I'm new to perl, started two days ago. I've been doing C/C++ and
Java
> > for many years...
> >
> > I'm writing a small script to do file upload (fileupload), I'm using
> > the CGI.pm module.  The form I have has three file upload fields,
but
> > the user can select to upload only 1 file (or just 2 files, or all
3).
> > So I want to test if the field is present.
> >
> > I tried this
> >
> > $jpgFile = $query->param("pic1");
> > # if (defined $jpgFile) {
> > if ($jpgFile) {
> >   print "File pic1 is present";
> > }
> > elif {
> >   print "File 'pic1' is not present";
> > }
> >
> > No matter what the "is not present" code was being executed. I
ended up
> > having to do this
> >
> > $jpgFile = $query->param("pic1");
> > if ($jpgFile ne '') {
> >   print "File pic1 is present";
> > }
> > elif {
> >   print "File 'pic1' is not present";
> > }
> >
> > Can someone explain why the former didn't work?  And if it is safe
and
> > valid to use the later?  The code works fine with the 'ne' but I
want
> > to be sure it is ok.
> >
> > Thanks
> > -Jim
> ...
> Couple of things:
>
> 1.  Your printed messages indicate that you somehow think this code
will
> test for the presence of a file.  It is merely testing for the
presence
> of a filled-in filename in your form.
>
> 2.  The "defined" function will return true if the variable is
defined,
> regardless of the value it stores (except for undef).  If it contains
> the null string, it is still defined.  Thus, your call to defined will
> always return true, since you have defined $jpgFile and it will never
> contain undef.  See:
>
>      perldoc -f defined
>
> 3.  Your second way of doing it should be OK.  It is better than just:
>
>      if($jpgFile){...
>
> since that would fail if the value of $jpgFile was 0.  An unlikely,
but
> possible, filename.
>
> 4.  To actually test for the presence of a file, see the -e operator.
> See:
>
>      perldoc -f -e
>
> --
> Bob Walton
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 30 Sep 2000 14:15:57 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: File upload testing if it's there
Message-Id: <39D6580D.E9A770AF@stomp.stomp.tokyo>

jim_marshall2268@hotmail.com wrote:

> Godzilla! wrote:

> The code I posted was a snippet from a larger perl 
> script I wrote.  The code compiles and actually RUNS,
> what fatal error do you think exists?


I don't think your snippets are fatally flawed.
I know they are fatally flawed. This is obvious
with just a quick glance.

Your code does not run. Actually, I am very
skeptical this code of which you speak,
even exists.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Sat, 30 Sep 2000 23:21:47 +0200
From: =?iso-8859-1?Q?K=E5re_Olai_Lindbach?= <barbr-en@online.no>
Subject: Re: File upload testing if it's there
Message-Id: <7QsB5.1228$Q43.17691@news1.online.no>


<jim_marshall2268@hotmail.com> skrev i melding
news:8r5h0i$b27$1@nnrp1.deja.com...
> The code I posted was a snippet from a larger perl script I wrote.
The
> code compiles and actually RUNS, what fatal error do you think exists?

Perhaps not fatal, but use of 'elif' instead of 'elsif' isn't perl.;-)
You state you snipped it from the orginal.


It will look upon elif as a method, and do both things!

regards Mr Kåre Olai Lindbach.


--

Regards/mvh
Olai - Mr. Kåre Olai Lindbach
barbr-en@online.no
http://barbr-en.home.online.no    (Norwegian/English)
# NAPH, just perllover
# Perl/Emacs(Viper)/Apache/MySQL









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

Date: Sat, 30 Sep 2000 23:34:11 +0200
From: =?iso-8859-1?Q?K=E5re_Olai_Lindbach?= <barbr-en@online.no>
Subject: Re: File upload testing if it's there
Message-Id: <G%sB5.1234$Q43.17906@news1.online.no>


> Perhaps not fatal, but use of 'elif' instead of 'elsif' isn't perl.;-)
Sorry, in your case I meant: 'elif' instead of 'else'!

regards Mr Kåre Olai Lindbach.




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

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


Administrivia:

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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4477
**************************************


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