[18295] in Perl-Users-Digest
Perl-Users Digest, Issue: 463 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 11 03:05:37 2001
Date: Sun, 11 Mar 2001 00:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984297909-v10-i463@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 11 Mar 2001 Volume: 10 Number: 463
Today's topics:
Re: "uninitiatlized value" errors? <tony_curtis32@yahoo.com>
Re: "uninitiatlized value" errors? <tony_curtis32@yahoo.com>
Re: "uninitiatlized value" errors? (Tad McClellan)
dir listing <DeXteR>" <j.heidinga@chello.nl>
Re: dir listing (Tad McClellan)
Re: dir listing <c_clarkson@hotmail.com>
format/write to a variable not an output handle, possib <webmaster@webdragon.munge.net>
Re: format/write to a variable not an output handle, po <uri@sysarch.com>
Re: Help! Function call gives error 500! <shamilton@plateausystems.holdthespam.com>
Re: Help! Function call gives error 500! <shamilton@plateausystems.holdthespam.com>
Re: Help! Function call gives error 500! (Tad McClellan)
Re: How can I create files in directories other than th <costas@seleucia.tamu.edu>
Re: How can I create files in directories other than th (Tom Hoffmann)
looking for a script to count downloads (Richard Wilkerson)
Re: Maintaining the number format and not exponential <webmaster@webdragon.munge.net>
Re: Maintaining the number format and not exponential <uri@sysarch.com>
Re: newbie Q : problems with using 'use lib qw(....' to <c_clarkson@hotmail.com>
Re: Trying to capture current directory in variable (Martien Verbruggen)
Re: Trying to capture current directory in variable (Tad McClellan)
Would LOVE help sorting results numerically - clearing <cbell@interlog.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Mar 2001 20:05:29 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <873dclys9i.fsf@limey.hpcc.uh.edu>
>> On Sat, 10 Mar 2001 20:54:40 -0500,
>> "John A. Grant" <jazrant@zsc.nrcan.zc.ca> said:
> Yes, I am using "undef", here:
> DoIt($reason,$title,$config,\%captions,\%param,
> $param{$VAR_EMAIL},undef,undef,1,$font3);
> In the function, I have: my ($reason, $title,
> $config, $refcaptions, $refparam, $to, $cc, $bcc,
> $ccquery, $font3)=@_; ... if($cc) ...
At which point $cc needs to have a defined value, as you
are interrogating its value in a boolean context.
If you want to pass undef over, you need to change the
test to be
if (defined $cc) ...
> I don't see how this use of 'undef' affects code
> hundreds of lines away, especially in another function.
Textual distance is not the same as logical distance, nor
call-graph distance.
>> Bourne-ish shells. Were you perhaps using a csh-ish
>> shell instead?
> Yes, I use csh. Can't it be done with csh? That's
> odd.
csh is certainly odd :-) Try reading this:
http://www.landfield.com/faqs/unix-faq/shell/csh-whynot/
hth
t
--
The avalanche has already started.
It is too late for the pebbles to vote.
------------------------------
Date: 10 Mar 2001 20:13:28 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <87y9udxdbr.fsf@limey.hpcc.uh.edu>
[ 2nd follow up because I thought we were on the brink of
2 different threads ]
>> On Sat, 10 Mar 2001 20:54:40 -0500,
>> "John A. Grant" <jazrant@zsc.nrcan.zc.ca> said:
> I still have this problem: 1703: my
> $method=$ENV{'REQUEST_METHOD'}; 1704: if($method eq
> "POST"){ Use of uninitialized value in string eq at
> contact.cgi line 1704. Use of uninitialized value in
> string eq at contact.cgi line 1704.
> Why do I get 2 errors?
Not sure why 2 errors, but the non-literal value you are
interrogating is $method. Apparently the request handed
over no value for the environment variable REQUEST_METHOD.
This code snippet would also indicate you're probably not
using CGI.pm (to its full usefulness level), "perldoc CGI"
for how to save yourself all these kinds of woe.
> This problem still remains: my $MAGIC_NOHTML="!";
> ... 1639: if (substr($message,0,1) eq $MAGIC_NOHTML){
> ...
> "Use of uninitialized value in string eq at
> contact.cgi line 1639.
Either $message is not defined, or substr() returned
undef, "perldoc -f substr"
If the substring is beyond either end of the
string, substr() returns the undefined value and
produces a warning.
You could insert some test "print"s before the
conditionals to see where the undef occurs.
hth
t
--
The avalanche has already started.
It is too late for the pebbles to vote.
------------------------------
Date: Sat, 10 Mar 2001 23:43:48 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: "uninitiatlized value" errors?
Message-Id: <slrn9am0k4.kui.tadmc@tadmc26.august.net>
John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
>"Tad McClellan" <tadmc@augustmail.com> wrote in message
>news:slrn9ack2f.9vo.tadmc@tadmc26.august.net...
>> John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
> [...]
>> When perl says "uninitialized value" you should think "undef".
>> You are using the special "undef" value somewhere in your program.
>
> Yes, I am using "undef", here:
> DoIt($reason,$title,$config,\%captions,\%param,
> $param{$VAR_EMAIL},undef,undef,1,$font3);
>
> In the function, I have:
> my ($reason, $title, $config, $refcaptions, $refparam,
> $to, $cc, $bcc, $ccquery, $font3)=@_;
> ...
> if($cc) ...
if( defined $cc ) ...
> Here's the complete function:
>
> #return filename part of pathname
> sub FilenameFromPathname()
^^
^^
There you have prototyped the function to take no arguments at all.
> {
> my ($pathname)=@_;
^^^^^^^^^
There you access arguments.
You should fix the prototype, or delete it.
> my $filename=$pathname;
There is the last we hear of $pathname. The variable is useless.
Just put it directly into $filename if that is where you want it:
my($filename) = @_;
die "FilenameFromPathname() got called with the undefined value" unless
defined $filename;
> That raises another issue. I never know whether to refer
> to function parameters as "@" or "$".
The choice between @ and $ has nothing to do with subroutines or
subroutine arguments.
Use $ if you want "a single thing" (a scalar).
Use @ if you want "several things" (a list).
Arguments are *always* scalars.
The scalars are contained in a list. The list, in turn, is contained
in an array named @_.
> I still have this problem:
> 1703: my $method=$ENV{'REQUEST_METHOD'};
> 1704: if($method eq "POST"){
> Use of uninitialized value in string eq at contact.cgi line 1704.
> Use of uninitialized value in string eq at contact.cgi line 1704.
>
> Why do I get 2 errors?
^^^^^^
You have _zero_ errors.
You have 2 warnings there.
I do not know why you get 2 warnings for the same line. Seems you
should be getting one warning from each line (assuming there is
no REQUEST_METHOD environment variable defined in your environment).
> This problem still remains:
> my $MAGIC_NOHTML="!";
> ...
> 1639: if (substr($message,0,1) eq $MAGIC_NOHTML){ ...
>
> "Use of uninitialized value in string eq at contact.cgi line 1639.
Somewhere, in the part represented by the ellipsis above, the
value of $MAGIC_NOHTML was changed.
Try adding this at line number 1638.5:
print "what the heck happen to the value of \$MAGIC_NOHTML\n" unless
defined $MAGIC_NOHTML;
We cannot even tell from the code fragment given if the assigned
$MAGIC_NOHTML is even in the same scope as the usage that generates
the warning.
>> >But 2>err doesn't work on my solaris box (also running perl 5.6)
>> ^^^^^^^
What is the underlining for? You make no further mention of the OS...
>> The OS is not an issue, the _shell_ used may be the issue though.
>> That should work in Bourne-ish shells.
>> Were you perhaps using a csh-ish shell instead?
> Yes, I use csh.
You should consider fixing that.
> Can't it be done with csh?
Yes, but is is very homely, as well as off-topic here.
So homely that I would encourage you to use a Bourne-ish shell
rather than show you how to make do with csh.
>That's odd.
Indeed.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 10 Mar 2001 15:39:26 GMT
From: "<DeXteR>" <j.heidinga@chello.nl>
Subject: dir listing
Message-Id: <3AAA6736.7000504@chello.nl>
Hi,
I am writing a program that needs a recursivr directory listing, with
the full path. eg:
/file1
/file2
/file3
/subdir1/file1
/subdir1/subdir1.1/file1
/subdir2/file1
etc
I've tried to imort a 'ls' listing, bur it generates a list with not
realy usefull stuff :) (ls * -R -x). How should i get the right?
allmost forgot: i run a Linux system
--
Windows leads to fear,
fear leads to hate,
hate leads to Linux
<DeXteR>
------------------------------
Date: Sun, 11 Mar 2001 00:06:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: dir listing
Message-Id: <slrn9am1vg.kui.tadmc@tadmc26.august.net>
j.heidinga@chello.nl <j.heidinga@chello.nl> wrote:
>I am writing a program that needs a recursivr directory listing, with
>the full path. eg:
>How should i get the right?
perldoc File::Find
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 11 Mar 2001 00:21:38 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: dir listing
Message-Id: <6901E227010AF7FF.66EF21E83AECCD1C.5CC3B312E060D143@lp.airnews.net>
<DeXteR> <j.heidinga@chello.nl> wrote:
: Hi,
: I am writing a program that needs a recursivr directory listing, with
: the full path. eg:
: /file1
: /file2
: /file3
: /subdir1/file1
: /subdir1/subdir1.1/file1
: /subdir2/file1
: etc
: I've tried to imort a 'ls' listing, bur it generates a list with not
: realy usefull stuff :) (ls * -R -x). How should i get the right?
: allmost forgot: i run a Linux system
Take a look at Find::File. It's in the current standard
distribution and takes care of all the nasty file system
stuff for you.
HTH,
Charkles K. Clarkson
------------------------------
Date: 11 Mar 2001 04:11:14 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: format/write to a variable not an output handle, possible?
Message-Id: <98ett2$qfs$0@216.155.33.89>
I'd like to, if possible, use the format procedures to create a simple
output template (without the need for Text::Template if possible, since
the site where this is eventually going to be hosted is damned slow at
upgrading their Perl modules.) However, the context in which I'll need
this is for the eventual write to wind up inside a variable rather than
to an output handle. Can I assign a write to the RHS and dump it into an
array of lines?
I've been poking around in Programming Perl lately, just re-reading it
again to possibly pick up on things I wasn't ready to understand during
the last read, and came across the format command and was reminded that
this might actually fit the bill for what I need at this moment, without
the requirement of different modules, but only if I can do something
like:
@text_file_attachment_for_mime_lite = write
possible? if not, is it something worth considering for 5.6.x ?
I've only got 5.004 here until Chris Nandor finishes the port of MacPerl
5.6.0/5.6.1, although I could play with an alpha release now.
Otherwise what I'm going to have to do is set it up as a temp file and
then attach it to a MIME::Lite e-mail that way, rather than just assign
the contents of the @array to a file name within the headers.
comments?
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Sun, 11 Mar 2001 06:21:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: format/write to a variable not an output handle, possible?
Message-Id: <x7vgpgbzb7.fsf@home.sysarch.com>
>>>>> "SRG" == Scott R Godin <webmaster@webdragon.munge.net> writes:
SRG> I'd like to, if possible, use the format procedures to create a
SRG> simple output template (without the need for Text::Template if
SRG> possible, since the site where this is eventually going to be
SRG> hosted is damned slow at upgrading their Perl modules.) However,
SRG> the context in which I'll need this is for the eventual write to
SRG> wind up inside a variable rather than to an output handle. Can I
SRG> assign a write to the RHS and dump it into an array of lines?
have you read perlform? it's in there.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 11 Mar 2001 02:36:18 GMT
From: "Scott" <shamilton@plateausystems.holdthespam.com>
Subject: Re: Help! Function call gives error 500!
Message-Id: <CwBq6.169511$B6.37470905@news1.rdc1.md.home.com>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9algul.kms.tadmc@tadmc26.august.net...
> Scott <shamilton@plateausystems.holdthespam.com> wrote:
>
> So run your program from the command line, and watch stuff
> go by on the terminal.
No can do. The "sucky" host/provider won't allow telnet access, and I can't
run it local here b/c it needs to connect to a mySQL database.
> It is easy to run your Perl CGI program from the command line
> if you are using the CGI.pm module.
>
> Or, see the messages in a browser, Perl FAQ, part 9:
>
> "How can I get better error messages from a CGI program?"
>
Thanks for the tip!
------------------------------
Date: Sun, 11 Mar 2001 02:38:25 GMT
From: "Scott" <shamilton@plateausystems.holdthespam.com>
Subject: Re: Help! Function call gives error 500!
Message-Id: <ByBq6.169519$B6.37471826@news1.rdc1.md.home.com>
Ok all who are reading the thread, thanks, but I found the problem: a
circular reference in the uses between some modules. I won't go into
details, but the reason it was really keeping me from figuring out what was
going on was the fact that the debug routine I typically use to report stuff
was in one of the circularly-linked modules...
Yikes.
------------------------------
Date: Sat, 10 Mar 2001 23:59:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Help! Function call gives error 500!
Message-Id: <slrn9am1hp.kui.tadmc@tadmc26.august.net>
[ there is no comp.lang.perl newsgroup (sucky provider at work again?).
Newsgroups trimmed.
]
Scott <shamilton@plateausystems.holdthespam.com> wrote:
>"Tad McClellan" <tadmc@augustmail.com> wrote in message
>news:slrn9algul.kms.tadmc@tadmc26.august.net...
>> Scott <shamilton@plateausystems.holdthespam.com> wrote:
>>
>> So run your program from the command line, and watch stuff
>> go by on the terminal.
>
>No can do. The "sucky" host/provider won't allow telnet access,
Strike two.
>and I can't
>run it local here b/c it needs to connect to a mySQL database.
I thought mySQL was free (I didn't pay for my local copy anyway).
I prefer to do as much development as I can locally, then move
it when it is solid.
Get mySQL, load it up with some sample records, and test away.
>> It is easy to run your Perl CGI program from the command line
>> if you are using the CGI.pm module.
>>
>> Or, see the messages in a browser, Perl FAQ, part 9:
>>
>> "How can I get better error messages from a CGI program?"
>>
>
>Thanks for the tip!
You're welcome, but it should have been unnecessary.
You are expected to check the Perl FAQ *before* posting to
the Perl newsgroup.
perldoc -q CGI
would have give you the same tip in mere milliseconds!
perldoc -q 500
reveals this one too:
"My CGI script runs from the command line but not the
browser. (500 Server Error)"
Ignoring the docs that came with the software that you are using
is not working smart. You are wasting a lot of your time.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 10 Mar 2001 21:18:30 -0600
From: Costas Tzimeas <costas@seleucia.tamu.edu>
Subject: Re: How can I create files in directories other than the one that the perl script executes from?
Message-Id: <3AAAEE86.143B05D3@seleucia.tamu.edu>
--------------6FD10FD2407A478F72F2837C
Content-Type: text/plain; charset=iso-8859-7
Content-Transfer-Encoding: 7bit
Thanks Tom,
since I want the script to be as general as possible, in order to move it to
many different directories (with subtle variable changes), I get the path of
the executing script by using a system call of "pwd" and with some string
editing,
I get it to work.
Is there a better way of doing this?
Thanks for the prompt response,
Costas
Tom Hoffmann wrote:
> On Sat, 10 Mar 2001 19:30:58 -0600, Costas Tzimeas wrote:
> >How can I create files in directories other than the one that the perl
> >script executes from?
>
> When you open a file for output, give the full path to another directory.
> For example,
>
> open DAT, "> /tmp/output.dat" or die "can not create /tmp/output.dat";
>
> This will create the file output.dat in the /tmp directory regardless
> of the directory from which you run your script. If you want to put the
> name of the directory path in a variable, your code would be:
>
> $path = '/tmp';
> open DAT, "> $path/output.dat" or die "can not create $path/output.dat";
>
> Of course, you could also specify a relative path to the file.
>
> >
> >I guess I could move the files to any other directory after the script
> >is done writting
> >to these files but is there any way the files are "directly" created in
> >that "other" directory?
> >
> >Thanks in advance,
> >
> >Costas
> >Perl newbie
> >
--
_____________________________________________________________________
Texas A&M University
Dept. of Geology & Geophysics
College Station, TX 77843-3115
Tel: (979) 458-1169 (979) 845-0128
Fax: (979) 845-6162
e-mail: costas@nyssa.tamu.edu
URL: http://nyssa.tamu.edu/~costas/
_____________________________________________________________________
--------------6FD10FD2407A478F72F2837C
Content-Type: text/html; charset=iso-8859-7
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Thanks Tom,
<p>since I want the script to be as general as possible, in order
to move it to
<br>many different directories (with subtle variable changes), I get the
path of
<br>the executing script by using a system call of "pwd" and with some
string editing,
<br>I get it to work.
<br>Is there a better way of doing this?
<br>
<p>Thanks for the prompt response,
<p>Costas
<br>
<br>
<br>
<p>Tom Hoffmann wrote:
<blockquote TYPE=CITE>On Sat, 10 Mar 2001 19:30:58 -0600, Costas Tzimeas
wrote:
<br>>How can I create files in directories other than the one that the
perl
<br>>script executes from?
<p>When you open a file for output, give the full path to another directory.
<br>For example,
<p>open DAT, "> /tmp/output.dat" or die "can not create /tmp/output.dat";
<p>This will create the file output.dat in the /tmp directory regardless
<br>of the directory from which you run your script. If you want to put
the
<br>name of the directory path in a variable, your code would be:
<p>$path = '/tmp';
<br>open DAT, "> $path/output.dat" or die "can not create $path/output.dat";
<p>Of course, you could also specify a relative path to the file.
<p>>
<br>>I guess I could move the files to any other directory after the script
<br>>is done writting
<br>>to these files but is there any way the files are "directly" created
in
<br>>that "other" directory?
<br>>
<br>>Thanks in advance,
<br>>
<br>>Costas
<br>>Perl newbie
<br>></blockquote>
<pre>--
_____________________________________________________________________
Texas A&M University
Dept. of Geology & Geophysics
College Station, TX 77843-3115
Tel: (979) 458-1169 (979) 845-0128
Fax: (979) 845-6162
e-mail: costas@nyssa.tamu.edu
URL: <A HREF="http://nyssa.tamu.edu/~costas/">http://nyssa.tamu.edu/~costas/</A>
_____________________________________________________________________</pre>
</html>
--------------6FD10FD2407A478F72F2837C--
------------------------------
Date: Sun, 11 Mar 2001 03:01:20 GMT
From: tom.hoffmann@worldnet.att.net (Tom Hoffmann)
Subject: Re: How can I create files in directories other than the one that the perl script executes from?
Message-Id: <slrn9alqe5.28c.tom.hoffmann@localhost.localdomain>
On Sat, 10 Mar 2001 19:30:58 -0600, Costas Tzimeas wrote:
>How can I create files in directories other than the one that the perl
>script executes from?
When you open a file for output, give the full path to another directory.
For example,
open DAT, "> /tmp/output.dat" or die "can not create /tmp/output.dat";
This will create the file output.dat in the /tmp directory regardless
of the directory from which you run your script. If you want to put the
name of the directory path in a variable, your code would be:
$path = '/tmp';
open DAT, "> $path/output.dat" or die "can not create $path/output.dat";
Of course, you could also specify a relative path to the file.
>
>I guess I could move the files to any other directory after the script
>is done writting
>to these files but is there any way the files are "directly" created in
>that "other" directory?
>
>Thanks in advance,
>
>Costas
>Perl newbie
>
------------------------------
Date: Sun, 11 Mar 2001 06:27:20 GMT
From: rw@dreamgate.com (Richard Wilkerson)
Subject: looking for a script to count downloads
Message-Id: <3aab19dc.27320310@news.telocity.com>
Hi,
I need a script that will count and log the number times a pdf file
is downloaded by a visitor.
I realize the basic perl for this pretty simple and straightforward,
open the file, find the number, add one and close.
But how would the visitor selecting a hyperlink initiate this
counting in the first place?
double thanks,
richard
rcwilk@dreamgate.com
------------------------------
Date: 11 Mar 2001 03:53:59 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: Maintaining the number format and not exponential
Message-Id: <98essn$mpr$1@216.155.33.89>
In article <x71ys5ciji.fsf@home.sysarch.com>, Uri Guttman
<uri@sysarch.com> wrote:
| >>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
| and where is that additional coding? as usual you handle some tiny
| fraction of the cases and leave the rest. try and write a program that
| handles arbitrary length integers. i would love to see you try and then
| post it. but you won't
|
| and you talk about converting back to float which is exactly what the OP
| DID NOT WANT! so try to answer the question for a change.
|
| G> You have not stated full parameters on your expectations so
| G> there is a possibility you will need to make some modifications
| G> to deal with your unique circumstances. Nonetheless, my code does
| G> reflect basic principles of how to do this without use of a module.
|
| no it does not. it does not handle carries from any digit place.
Uri: as soon as the OP tries the code (one hopes that users would test
any code they recieve from a forum before putting it into production),
he'll figure out that it doesn't do what s/he wanted and will in all
likelihood come back and ask Godzila what she's been smoking and for how
long. :>
Should be interesting to watch.
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Sun, 11 Mar 2001 06:11:38 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Maintaining the number format and not exponential
Message-Id: <x7y9ucbzs5.fsf@home.sysarch.com>
>>>>> "SRG" == Scott R Godin <webmaster@webdragon.munge.net> writes:
SRG> Uri: as soon as the OP tries the code (one hopes that users would
SRG> test any code they recieve from a forum before putting it into
SRG> production), he'll figure out that it doesn't do what s/he wanted
SRG> and will in all likelihood come back and ask Godzila what she's
SRG> been smoking and for how long. :>
SRG> Should be interesting to watch.
one hopes he would. but like a stopped watch, moronzilla is right once
in a blue moon. not this time, of course.
as usual her response to me was not to any point and refuses to even
discuss her lousy logic. next task for moronzilla, write a fast decimal
math package in C. oops, she doesn't know c. too bad.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 11 Mar 2001 01:23:56 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: newbie Q : problems with using 'use lib qw(....' to point to modules
Message-Id: <D5C3718ADF21E201.90E3C0E4AF765BD6.CB9856228A96C634@lp.airnews.net>
null <nospamplease@thankyou.com> wrote:
[SNIP]
:
: The previous version of the script would work fine when told to output
gifs
: and would at least give me a broken image icon when told to kick out png's
: (I have been very careful to always upload in ascii and chmod 755 the pl
: file), but now all that I can get are 500 internal server errors.
Add this line, it will allow you to see any errors in your browser
window:
use CGI::Carp 'fatalsToBrowser';
:
: Uncommenting the #use GD line will give me the broken image icon again
Did you test this with .gif and .png formats like your last script?
This might indicate that GD.pm was found. and there is an error
sending to the browser. Show us the code for that part.
: (so I am sure that i didn't introduce any other errors accidentally) - it
seems
: that Perl can't find my GD.pm. The path given to me by my host to use was
: "/home/mydomain/mydomain-www/perlmods/GD-1.32/GD.pm", I was
: still getting the 500 error and, during testing on my own machine, I got
the
: "point to the directory containing the file, not the file itself" error
(although
: using /home/mydomain/mydomain-www/perlmods/GD-1.32/ or
: /home/mydomain/mydomain-www/perlmods/GD-1.32 have not fixed the
: problem at my site or locally, where I used the equivalent paths beginning
: with C:\).
:
: The problem definitely seems to be that Perl cannot find GD.pm, but I
don't
: know what I've done wrong.
If perl can't find the module it will give an error similar to:
Can't locate StatusFile.pm in
@INC (@INC contains: ../rt/modules/ C:/Perl/lib C:/Perl/site/lib .)
at prog.pl line 43.
You should be able see to it with the CGI::Carp line above.
HTH,
Charles K. Clarkson
------------------------------
Date: Sun, 11 Mar 2001 13:05:54 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Trying to capture current directory in variable
Message-Id: <slrn9alnc2.uuk.mgjv@martien.heliotrope.home>
On Sat, 10 Mar 2001 17:06:08 +0200,
Michael Rolfe <mumble[anti-spam]@maths.uct.ac.za> wrote:
[snip]
>
> Tx4this2U&Randal, ticuly as my sucky newsfeed didn't give me his post.
> Armed with new knowledge on existence of standard modules will pursue
> hotleigh.
What language is this?
Just letting you know that on technical newsgroups people generally are
_very_ unimpressed by AOL baby-talk. I habitually killfile people who
can't even be bothered to attempt to write intelligibly and spell
correctly. And I know I'm not alone in this.
Write English on an English-language group, and do it properly[1]
*plonk*
Martien
[1] or to the best of your ability at least.
--
Martien Verbruggen |
Interactive Media Division | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: Sun, 11 Mar 2001 00:06:08 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Trying to capture current directory in variable
Message-Id: <slrn9am1u0.kui.tadmc@tadmc26.august.net>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>On Sat, 10 Mar 2001 17:06:08 +0200,
> Michael Rolfe <mumble[anti-spam]@maths.uct.ac.za> wrote:
>[snip]
>>
>> Tx4this2U&Randal, ticuly as my sucky newsfeed didn't give me his post.
>> Armed with new knowledge on existence of standard modules will pursue
>> hotleigh.
>
>I habitually killfile people who
>can't even be bothered to attempt to write intelligibly and spell
>correctly. And I know I'm not alone in this.
^^^^^^^^^^^^^
>*plonk*
Just as a data point: I did that when I saw it too.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 11 Mar 2001 02:13:07 -0600
From: "Chris Bell" <cbell@interlog.com>
Subject: Would LOVE help sorting results numerically - clearing up an array issue
Message-Id: <lyFq6.23664$ZT5.500514@news.total.net>
Hi,
I'm starting to build a dealer locator script.
I have simplified my actual script so that it may be easier to see my
problem.
I want to sort the records by distance, starting with the smallest value.
Given a Zip Code, Long and Latitude to compare to: the $distance is
calculated for all zip codes in the datafile, all distances over 50 miles
are
rejected. (see sub "zipdata"). The TRIG works fine, it's the logic that
loses me.
The following URL will show what I have done so far, it's slow, but it need
not be live, and I'll remove the display later on:
http://privateforsale.co.uk/cgi-bin/locate2.cgi?action=search&State=WA&ZIP1=
98920
Order of the datafile: City|ST|ZIP|Lat|Long|
So, now I want to SORT the data, by distance.
I believe I can do this in the "zip_matches" subroutine, and I have found a
numerical sort in my PERL reference book:
print join(' ', sort { $a <=> $b } @array),"\n";
My problem is that I don't know how to create an array of the "$distances"
that can be related to my list of matches of records under 50 miles (in sub
"zipdata").
First I need to create/identify the distances array, then I want to sort the
records BY distance.
Would appreciate any assistance,
Chris
the two subs are below:
sub zipdata {
open (DATA, "$data_folder/zipcodes.txt");
@Ads = <DATA>;
close DATA;
$Count3 = 0;
@AdFile = "";
foreach $Ad (@Ads) {
@Info= split (/\|/, $Ad);
$distance = "0";
$zip1 = $in{'ZIP1'};
$lon1 =$in{'LAT'} ;
$lat1 = $in{'LON'};
$lon2 =$Info[4] ;
$lat2 = $Info[3];
$distance = &great_circle_distance($lon1,$lat1,$lon2,$lat2);
if ($distance <= "50") {
$AdFile[$Count3] = $Ad;
$Count3++;
}
}
if ($Count3 == 0) { # There were no ADs in that category
print "$Header1\n";
print qq! No Zip Code matches are not in Datafile:\n";
exit;
}
print "$Header1\n";
print qq! <B>$Count3 matching Zip Codes found in datafile</B><P>\n!;
foreach $Ad (@AdFile) {
@Zone = split (/\|/, $Ad);
{&zip_matches}
}
print "</body></html>";
exit;
}
sub zip_matches {
print qq!City: $Zone[0], State: $Zone[1], $Zone[2]\n!;
$distance = &great_circle_distance($lon1,$lat1,$lon2,$lat2);
print qq!Distance: $distance\n!;
}
------------------------------
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 V10 Issue 463
**************************************