[16491] in Perl-Users-Digest
Perl-Users Digest, Issue: 3903 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 3 18:05:58 2000
Date: Thu, 3 Aug 2000 15:05:27 -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: <965340327-v9-i3903@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 3 Aug 2000 Volume: 9 Number: 3903
Today's topics:
#include-type-of-thing-in-Perl <rtarpine@hotmail.com>
Re: #include-type-of-thing-in-Perl <tony_curtis32@yahoo.com>
Re: #include-type-of-thing-in-Perl <rtarpine@hotmail.com>
Re: #include-type-of-thing-in-Perl <uackermann@orga.com>
Re: (2nd attempt) I NEED HELP! <mjcarman@home.com>
Re: 5.005 to 5.6.0 migration- need help with some probl (Ilya Zakharevich)
Re: 5.005 to 5.6.0 migration- need help with some probl <lr@hpl.hp.com>
Re: 5.005 to 5.6.0 migration- need help with some probl (brian d foy)
Re: Algorithm for efficient creation of unique, random (Logan Shaw)
any Perl module for CRAM? bing-du@tamu.edu
Re: Any perl web experts out there - please help (Abigail)
Re: CGI.pm cookie failure <hillr@ugsolutions.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 3 Aug 2000 16:03:45 -0400
From: "Ryan Tarpine" <rtarpine@hotmail.com>
Subject: #include-type-of-thing-in-Perl
Message-Id: <8mcjak$4glc$1@newssvr03-int.news.prodigy.com>
How can I include in a Perl script subroutines in an external file in the
same directory?
Thanks,
Ryan Tarpine
------------------------------
Date: 03 Aug 2000 15:09:23 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <87lmye6r9o.fsf@limey.hpcc.uh.edu>
>> On Thu, 3 Aug 2000 16:03:45 -0400,
>> "Ryan Tarpine" <rtarpine@hotmail.com> said:
> How can I include in a Perl script subroutines in an
> external file in the same directory?
With #include like in C, and pass over the -P flag to the
perl interpreter.
However, you really don't want to do this if you don't
absolutely have to. Perl != C. Perl has libraries and
modules,
perldoc perlmod
which are much cleaner,
perldoc -f require
perldoc -f use
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Thu, 3 Aug 2000 16:13:02 -0400
From: "Ryan Tarpine" <rtarpine@hotmail.com>
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <8mcjs1$vk8$1@newssvr03-int.news.prodigy.com>
I am trying to program some CGI for my site on a shared server where I only
have access to my directory. What is the best way for me to reuse some of
my (Perl) code in multiple scripts?
Ryan Tarpine
Tony Curtis <tony_curtis32@yahoo.com> wrote in message
news:87lmye6r9o.fsf@limey.hpcc.uh.edu...
> >> On Thu, 3 Aug 2000 16:03:45 -0400,
> >> "Ryan Tarpine" <rtarpine@hotmail.com> said:
>
> > How can I include in a Perl script subroutines in an
> > external file in the same directory?
>
> With #include like in C, and pass over the -P flag to the
> perl interpreter.
>
> However, you really don't want to do this if you don't
> absolutely have to. Perl != C. Perl has libraries and
> modules,
>
> perldoc perlmod
>
> which are much cleaner,
>
> perldoc -f require
> perldoc -f use
>
> hth
> t
> --
> "With $10,000, we'd be millionaires!"
> Homer Simpson
------------------------------
Date: Thu, 03 Aug 2000 22:41:40 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <3989D904.B6A3D980@orga.com>
Ryan Tarpine wrote:
>
> I am trying to program some CGI for my site on a shared server where I only
> have access to my directory. What is the best way for me to reuse some of
> my (Perl) code in multiple scripts?
>
> Ryan Tarpine
>
> Tony Curtis <tony_curtis32@yahoo.com> wrote in message
> news:87lmye6r9o.fsf@limey.hpcc.uh.edu...
*snipp*
> >
> > However, you really don't want to do this if you don't
> > absolutely have to. Perl != C. Perl has libraries and
> > modules,
> >
> > perldoc perlmod
> >
> > which are much cleaner,
> >
> > perldoc -f require
> > perldoc -f use
> >
> > hth
Why don't you just follow the hints Tony gave you? I think it
answers not only your original post but also the second one!
Ulrich
--
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925
mailto:uackermann@orga.com
------------------------------
Date: Thu, 03 Aug 2000 13:03:31 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: (2nd attempt) I NEED HELP!
Message-Id: <3989B3F3.21FE5941@home.com>
Phil Hawkins wrote:
>
> I give up. I bought a self-learning book on "Perl 5" [...]
Hmm. I have warning buzzers in my ears about your book. I'm doubting
that it's one of the respected texts in these parts...
> My host is Unix, so I tried to download the Perl 5.6.00... and it just
> froze my browser.
By your host, do you mean a server that you admin, or a server on which
you have been granted web space? If you're just an end user of the
system, installing Perl is not your responsibility. (Nor within your
power.)
The version number has nothing to do with the platform.
Browser lock-ups are not Perl's problem. :)
> It appears that there are two versions? One for NT and the other
> for Unix? Huh?
Yes, there are different versions of the interpreter for different
platforms. Perl has been ported to just about every OS out there.
> I have to write two different scripts for each server type?
[By 'server' I believe you mean 'platform.']
No. (At least assuming you don't use OS calls or any of the few features
which behave differently across platforms.) Perl is an interpreted
language. That means that your scripts can be run on just about *any*
platform, usually with no changes at all.
> And what about the compiler?
I think you mean the interpreter. The machine which you want to run your
scripts on must have perl installed.
There is a Perl *compiler*, used to make stand alone executables that
can be run without an interpreter, but which are then only useful on the
platform for which they were built. I don't think that anyone uses it
much.
> I'm brand new to this, so someone please tell me what to do to get the
> right version of Perl on my (local) machine... I'm dazed and confused.
Now I'm confused, too. Do you want to run scripts on your local
computer, or on a remote server? You will most likely need to install
Perl yourself if you want the former.
> The CD that came with the book loaded the "source code" but when
The source code is not executable. Did you compile the source? Or did
the CD install a binary?
> I started to write my first scripts, it went belly up. I got wierd
> "Bare word found where operator expected"
Well, that's easy -- it's a syntax error. If you see *that*, then you
must have perl installed! Look at your script carefully, and see if you
have a typo somewhere -- maybe a missing semicolon?
-mjc
PS - Hang in there.
------------------------------
Date: 3 Aug 2000 18:51:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: 5.005 to 5.6.0 migration- need help with some problems
Message-Id: <8mcf0a$8o9$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Anthony Christopher
<anthonyc@blarg.net>],
who wrote in article <3989A215.5B38ED91@blarg.net>:
> In our code, and there is a lot of it, an equivalent of the first
> example, using 5.6.0, prints:
>
> 7FC3C3C3010ACCCCCCCCCC
>
> the expected result being:
>
> 7FFFFFFE010ACCCCCCCCCC
If you provide a one-liner which behave differently, you get a much
better chance to get an answer, or even get things fixed when 5.6 goes
out of beta.
Ilya
------------------------------
Date: Thu, 3 Aug 2000 12:55:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: 5.005 to 5.6.0 migration- need help with some problems
Message-Id: <MPG.13f36e14634f912a98ac34@nntp.hpl.hp.com>
In article <8mcf0a$8o9$1@charm.magnus.acs.ohio-state.edu> on 3 Aug 2000
18:51:54 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
...
> If you provide a one-liner which behave differently, you get a much
> better chance to get an answer, or even get things fixed when 5.6 goes
> out of beta.
That's not the way it has been promoted, though, is it?
Should the Perl people be different from the rest of the industry in
regard to shipping prototypes as if they were products?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 03 Aug 2000 17:36:56 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: 5.005 to 5.6.0 migration- need help with some problems
Message-Id: <brian-ya02408000R0308001736560001@news.panix.com>
In article <3989B24F.8A28ABC0@attglobal.net>, Drew Simonis <care227@attglobal.net> posted:
> "Godzilla!" wrote:
> > > We have encountered a few problems in moving from
> > > perl 5.005 to perl 5.6.0 on Solaris on a Sparc
> > > workstation.
> > > > Buggy Perl 5.6 strikes again!
> Can you please cite 5 bugs you have discovered? Can you
> cite 3? How about 1?
large file support and mod_perl is an issue which concerns me, at
least. it's not so much that the core is buggy, but i use a lot
more than the core, so if a module that i need doesn't work with
5.6, then i can't use it.
personally, i think 5.6 is a few minor releases away from being
ready for my production machines. but then, i'm a cautious person
not often close to the bleeding edge.
or maybe you were asking if that particular person could name
any :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: 3 Aug 2000 16:20:59 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Algorithm for efficient creation of unique, random array
Message-Id: <8mcnnr$ifq$1@provolone.cs.utexas.edu>
In article <3988D2CA.4D01@modulus.com.au>,
Peter Hill <phill@modulus.com.au> wrote:
>Logan Shaw wrote:
>> Anyway, imagine you have a list of items paired with floating numbers:
>>
>> %x = ( "a" => 1.2, "b" => 4.37, "c" => 2.10, "d" => 0.23, "e" => 1.05 );
>>
>> and you'd like to write a function that will randomly select
>> one of the items such that the probability of selecting a given
>> item is proportional to the number paired with the item.
>This would seem to be the Monte Carlo problem, where functions describe
>the distribution of a number of variables (e.g. normal, Chi-sq etc) and
>the aim is to sample each of the variables multiple times to obtain a
>statistical sample of their combined outcomes - commonly used in
>investment planning.
Actually, the application I was thinking of was load-balancing.
Imagine you want to distribute work among several machines and you have
some indication of how busy they are or what their average service
times are for requests. You'd then want to send more work to the ones
which are presently in the best position to handle it.
If you had such a function, you could then randomly dispatch each
incoming request to a machine, but your random selection would be
biased toward those machines that are idle. The problem is that you'd
want to keep updated on the load of each machine, but each time you
receive information about that, you'd have to completely rebuild the
list.
Anyway, after some thinking, I'm pretty sure it can be done with a
binary tree. In addition to pointers (or references) to its children,
each node would also contain the sum of all the weights of the things
that the references referred to. You'd then pick an item by starting
at the top of the tree and picking one of the two halves based on those
weights, continuing until hitting a leaf. Updating the weight on a
node would require propagating changes back toward the root, but that's
really not bad if you use recursion anyway.
The great thing about the tree method would be that it's O(log N) to
pick a node and also only O(log N) to update a node. The bad thing is
that's irritating to work with binary trees because it's a pain to
delete a node.
- Logan
------------------------------
Date: Thu, 03 Aug 2000 19:45:18 GMT
From: bing-du@tamu.edu
Subject: any Perl module for CRAM?
Message-Id: <8mci4c$a3e$1@nnrp1.deja.com>
I'm wondering if there is any module for doing authentication against
CRAM (Challenge-Response Authentication Method (or Mechanism?))
database? I'm working on a web interface accepting user's username and
password. The backend is a IMAP email server. And this email server
uses CRAM database to store user's account information.
Any clue? Thanks,
Bing
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 03 Aug 2000 21:27:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Any perl web experts out there - please help
Message-Id: <slrn8ojou2.io6.abigail@alexandra.foad.org>
David Krainess (davidkrainess@yahoo.com) wrote on MMDXXVIII September
MCMXCIII in <URL:news:8F84744A4davidkrainessyahooco@38.9.69.2>:
{} Assuming this ludicrously simple perl code run in cgi-bin
{}
{} /usr/bin/perl -w
{} use strict;
{} print "content-type: application/octet-stream";
{} my $txt = "abcdefg";
{} print $txt;
{}
{}
{} What I want is to have a 'save as' box pop up in the client's web browser
{} running this script that save "abcedfg" to a txt file on the client's hard
{} drive. If I print a octet content type line before printing $txt, just an
{} empty text file is saved. My goal is to have a dynamic text file sent
{} directly to the browser.
{}
{} Can this be done?
Of course. You would solve this problem in the same way as you would solve
it using Ada or Eiffel.
{} Any help would be greatly appreciated.
You probably would want to use the print statement.
And putting a she-bang as the first 2 bytes might make your program compile.
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
------------------------------
Date: Thu, 03 Aug 2000 14:02:50 -0700
From: Ron Hill <hillr@ugsolutions.com>
Subject: Re: CGI.pm cookie failure
Message-Id: <3989DDFA.63FB7C59@ugsolutions.com>
Hello Godzilla,
I am rather new to perl/programming and now I am confused.
I was under the impression to always use the -w switch and use strict,
when developing a perl script. Now it seems that this is not the case.
Can you provide an example of when not to use the -w or use strict? Or
better yet, when to use and when not to use.
Thanks
Ron
"Godzilla!" wrote:
> Clinton A. Pierce wrote:
> > Daniel Foster wrote:
>
> (snipped main body)
>
> > No -w? Bad programmer!
>
> > No "use strict"? Bad programmer!
>
> Are you suggesting warnings and strict
> should be used at all times and all
> programs should use these pragma hints
> under all circumstances?
>
> If so, I am quite tempted to eat your
> lunch for being an extremely bad programmer.
> Advice to always use these types of pragma
> hints, advice to include these pragma hints
> in all programs, is in direct contradiction
> of standards in practice set by experienced
> and knowledgable Perl programmers.
>
> In fairness to you, I must ask, Are you
> suggesting warnings and strict should be
> used at all times and all programs should use
> these pragma hints under all circumstances?
>
> An affirmative answer will indicate to me
> you are not aware of myriad penalities both
> a programmer and a program pay for use of
> pragma hints and, are not well qualified to
> comment on use of pragma hints. I tend to
> believe this is not the case based upon
> your posting history.
>
> My personal experience is a prudent comment
> would indicate there is correct usage of
> pragma hints and, incorrect. This seems more
> wise than outright branding a person a "Bad
> Programmer" when the case might be, you are
> giving exceptionally bad advice via dogmatic
> promulgation of Urban Cargo Cultist myths.
>
> Godzilla!
>
> --
> Get your motor running. I will rock you.
> http://la.znet.com/~callgirl3/bornwild.mid
------------------------------
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 3903
**************************************