[19043] in Perl-Users-Digest
Perl-Users Digest, Issue: 1238 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 3 18:05:40 2001
Date: Tue, 3 Jul 2001 15:05:15 -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: <994197914-v10-i1238@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 3 Jul 2001 Volume: 10 Number: 1238
Today's topics:
[ANNOUNCE] Exporter::Simple 0.12 <marcel@codewerk.com>
Chmod Problem (BUCK NAKED1)
Re: executing perl in a browser on win2k server (Chris)
Re: executing perl in a browser on win2k server <monty@primenet.com>
Finding the subscript of an item in an array... (Weston Cann)
Re: Finding the subscript of an item in an array... <pne-news-20010703@newton.digitalspace.net>
Re: Finding the subscript of an item in an array... <jeff@vpservices.com>
Re: Finding the subscript of an item in an array... (Tad McClellan)
Re: Finding the subscript of an item in an array... <rsherman@ce.gatech.edu>
Re: Finding the subscript of an item in an array... <monty@primenet.com>
Re: Finding the subscript of an item in an array... <ren@tivoli.com>
Re: Generating Image Thumbnail Files (Randal L. Schwartz)
Re: How I came to love Perl... <SEE_MY_SIG@nospam.demon.co.uk>
Re: How to timeout a socket recv under win32? <magilfix@us.ibm.com>
Re: How to upgrade to newest (stable) version of Perl? <djberge@uswest.com>
Re: How to upgrade to newest (stable) version of Perl? (Andy Dougherty)
Re: how to Walk/dump Win32 registry? <rothd@roth.net>
Is there no solution to a malformed header? (Pape Toure)
Re: lvalue functions <nospam-abuse@ilyaz.org>
Re: map/hash question, functional style (Craig Berry)
Re: map/hash question, functional style (Craig Berry)
Re: map/hash question, functional style <uri@sysarch.com>
Missing modules ? <newsman@-takethisout-brol.org.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Jul 2001 11:11:25 GMT
From: Marcel Grunauer <marcel@codewerk.com>
Subject: [ANNOUNCE] Exporter::Simple 0.12
Message-Id: <tk43fkejj0sq56@corp.supernews.com>
NAME
Exporter::Simple - Easier set-up of module exports
SYNOPSIS
package MyExport;
use Exporter::Simple;
my @bar : Exportable(vars) = (2, 3, 5, 7);
my $foo : Exported(vars) = 42;
my %baz : Exported = (a => 65, b => 66);
sub hello : Exported(greet,uk) { "hello there" }
sub askme : Exportable { "what you will" }
sub hi : Exportable(greet,us) { "hi there" }
# meanwhile, in a module far, far away
use MyExport qw(:greet);
print hello();
$baz{c} = 67;
DESCRIPTION
This module, when used by a package, allows that package to define
exports in a more concise way than using `Exporter'. Instead of having
to worry what goes in `@EXPORT', `@EXPORT_OK' and `%EXPORT_TAGS', you
can use two attributes to define exporter behavior. This has two
advantages: It frees you from the implementation details of `Exporter',
and it keeps the export definitions where they belong, with the
subroutines and variables.
The attributes provided by this module are:
`Exported'
Indicates that the associated subroutine or lexical variable should
be automatically exported. It will also go into the `:all' tag (per
the rules of `%EXPORT_TAGS'), as well as any tags you specify as
options of this attribute.
For example, the following declaration
sub hello : Exported(greet,uk) { ... }
will cause `hello()' to be exported, but also be available in the
tags `:all', `:greet' and `:uk'.
`Exportable'
Is like `Exported', except that the associated subroutine or lexical
variable won't be automatically exported. It will still go to the
`:all' tag in any case and all other tags specified as attribute
options.
Exporting Lexical Variables
`Exporter::Simple' allows you to export lexical variables; something
`Exporter' can't do. What happens is that the lexical is aliased to a
global of the same name, which is then exported. So when you manipulate
that global, you're really manipulating the lexical.
The syntax for exporting lexical variables is the same as for
subroutines as lexicals can take attributes just as subroutines do.
`Exporter::Simple' expects some cooperation from you when exporting
lexicals. For reasons best explained by reading the (commented) source,
you need to make sure to have
1;
as the last line of code in your module. This is the true value you have
to return from the module anyway.
Exporting Global Variables
Global variables can't take attributes as of Perl 5.6.0, so it's
necessary to export globals manually. This needs to happen during
`BEGIN()' though, so you need to write code like this:
BEGIN {
export([ qw/EXPORTED_CONST @array $friend/ ], 'globals');
exportable('EXPORTABLE_CONST', 'globals');
}
Urgh.
However, globals will be able to take attributes in Perl 5.8.0, and this
module will then be updated to reflect those capabilities.
The two subroutines used to export globals are:
`export($symbols, $tags)'
As shown in the example above, both arguments can be either strings
(to indicate one symbol or tag) or array references to indicate
multiple symbols or tags.
The semantics are the same as for the `Export' attribute above.
`exportable($symbols, $tags)'
As `export()', but does not automatically export the symbols. The
semantics are the same as for the `Exportable' attribute above.
These two subroutines are automatically exported by `Exporter::Simple'.
The reason for this brute-force export is that these subroutines need to
be used during BEGIN, but `Exporter::Simple' doesn't have a chance to
use `Exporter' to export those two subroutines yet. Sigh.
TODO
reflection
Retrieve information about exports
test using two exporting modules
To see whether `Exporter::Simple' is ok with more than one module
using it. (I don't know why it shouldn't be, but that's what testing
is for).
BUGS
If you find any bugs or oddities, please do inform the author.
AUTHOR
Marcel Grunauer, <marcel@codewerk.com>
CONTRIBUTORS
Damian Conway <damian@conway.org>
COPYRIGHT
Copyright 2001 Marcel Grunauer. All rights reserved.
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
perl(1), Attribute::Handlers(3pm), Exporter(3pm).
Marcel
--
We are Perl. Your table will be assimilated. Your waiter will adapt to
service us. Surrender your beer. Resistance is futile.
-- London.pm strategy aka "embrace and extend" aka "mark and sweep"
------------------------------
Date: Tue, 3 Jul 2001 14:55:33 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Chmod Problem
Message-Id: <1425-3B422335-325@storefull-242.iap.bryant.webtv.net>
Why isn't this code chmodding all my files and directories under $tmpdir
to 644?
# chmod all files to 644
find sub {-f or return;
if(my $new = $_)
{ chmod 0644, $_; rename $_, $new; } }, $tmpdir ;
Thanks,
Dennis
------------------------------
Date: 3 Jul 2001 11:11:24 -0700
From: chris@wmccmsvr.ssr.hp.com (Chris)
Subject: Re: executing perl in a browser on win2k server
Message-Id: <ab9571e4.0107031011.3b47e0ed@posting.google.com>
> The %s %s 'thingy' goes in the application configuration section for the
> web-site properties of the site (or directory) you are calling the Perl
> scripts from. this is a server configuration issue, not a Perl issue.
> 'Just in' was referring to the Activestate documentation, wherein lies a FAQ
> about how to properly install Perl to work with IIS.
>
> After installing Perl itself, you may need to alter the application
> configuration section for other web-sites, and sub-directories to match that
> configuration. Ditto for any type of file extension you plan to use which
> is associated with Perl (the default is .pl but you can use .cgi or anything
> else you wish).
>
> It is not really likely to be a client side issue, but there are some
> oddities about SSI as well, which I am less familiar with.
>
> Wyzelli
I know the apps mapping is right because otherwise the scripts would
only run in the same path as perl.exe. That is not the case, I can
run a script anywhere in the path, and *some* scripts work in the
browser. I'll get a chance to check the IIS config today but I know
that's not the problem--dad's been working with computers longer than
i've been alive by a long shot, and missing something that simple is
just a rookie mistake that he would not make. Is there any other
reason why the scripts would run in a command prompt but not a
browser, and why some would run in a browser but not others? The
scripts that seem to be giving us problems deal with databases, so are
they getting hung up on opening files? I should put a "die" in there
to see if it is even attempting, I suppose. I've only been working on
it one day but it's driving me absolutely nutty. But I'm sure it's
not an file extension mapping problem.
Thanks again,
Chris
Documentation Specialist, Web Design
------------------------------
Date: 3 Jul 2001 20:18:01 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: executing perl in a browser on win2k server
Message-Id: <9ht99p$lgp$2@nnrp2.phx.gblx.net>
Chris <chris@wmccmsvr.ssr.hp.com> wrote:
> > The %s %s 'thingy' goes in the application configuration section for the
> > web-site properties of the site (or directory) you are calling the Perl
> > scripts from. this is a server configuration issue, not a Perl issue.
> > 'Just in' was referring to the Activestate documentation, wherein lies a
> > FAQ about how to properly install Perl to work with IIS.
> >
> > After installing Perl itself, you may need to alter the application
> > configuration section for other web-sites, and sub-directories to match that
> > configuration. Ditto for any type of file extension you plan to use which
> > is associated with Perl (the default is .pl but you can use .cgi or anything
> > else you wish).
> >
> > It is not really likely to be a client side issue, but there are some
> > oddities about SSI as well, which I am less familiar with.
>
> I know the apps mapping is right because otherwise the scripts would
> only run in the same path as perl.exe. That is not the case, I can
> run a script anywhere in the path, and *some* scripts work in the
> browser. I'll get a chance to check the IIS config today but I know
> that's not the problem--dad's been working with computers longer than
> i've been alive by a long shot, and missing something that simple is
> just a rookie mistake that he would not make. Is there any other
> reason why the scripts would run in a command prompt but not a
> browser, and why some would run in a browser but not others? The
> scripts that seem to be giving us problems deal with databases, so are
> they getting hung up on opening files? I should put a "die" in there
> to see if it is even attempting, I suppose. I've only been working on
> it one day but it's driving me absolutely nutty. But I'm sure it's
> not an file extension mapping problem.
This may be a stupid idea. I've never done *any* CGI programming,
so I'm way out of my element here. Oh, well...
Could this bizarre behavior be the result of something as trivial
as a line terminator problem? In other words, is the line terminator
of the working scripts <CR><LF> and those of the failing scripts
just <LF>? Were all the scripts FTP'd in TEXT mode? Or could some of
them inadvertently have been saved as Unicode using, say, MS Windows
Notepad?
I feel dopey posting this, but you seem at your wit's end. Good luck!
--
Jim Monty
monty@primenet.com
Tempe, Arizona USA
------------------------------
Date: Tue, 03 Jul 2001 19:07:50 GMT
From: iowa_song88.remove_eights_and_this@hotmail.com (Weston Cann)
Subject: Finding the subscript of an item in an array...
Message-Id: <iowa_song88.remove_eights_and_this-0307011315220001@55.westvalleycity-01rh15rt-ut.dial-access.att.net>
I know that you can find the subscript of an item in an array by
doing something like this:
my @foo = ('Travis','Bonnie','Flipper','Arnold','Deluxe');
my $item = 'Flipper';
my $index = 0;
my $subscript;
while($index <= $#foo)
{
if($item eq $foo[$index])
{ $subscript = $index; }
$index++;
}
This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
perl idiom/single line kind of way to do the same thing.
------------------------------
Date: Tue, 03 Jul 2001 21:41:56 +0200
From: Philip Newton <pne-news-20010703@newton.digitalspace.net>
Subject: Re: Finding the subscript of an item in an array...
Message-Id: <8r74kt4n1ath2n6331hidd7mqc0gkjphki@4ax.com>
On Tue, 03 Jul 2001 19:07:50 GMT,
iowa_song88.remove_eights_and_this@hotmail.com (Weston Cann) wrote:
> This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
> perl idiom/single line kind of way to do the same thing.
Not that I know of (though you could optimise your code above by
breaking out of the loop as soon as you've found the index), but in Perl
you tend not to need the exact index of an item as often as in other
languages.
Were you just asking in general or did you need the index for a
particular problem? If the latter, it may be possible to pose the
problem differently such that you no longer need the index. Or if you
need the index of different items frequently, you could invert the array
into a hash, with the keys being the array elements and the values being
the array indices. If array elements can occur multiple times, then you
can choose by your method of inverting whether to keep the first index,
the last one, or all of them (by putting them in an anonymous array and
storing a reference to that instead).
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 03 Jul 2001 12:38:02 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Finding the subscript of an item in an array...
Message-Id: <3B421F1A.8DBEFD5E@vpservices.com>
Weston Cann wrote:
>
> I know that you can find the subscript of an item in an array
> ...
> I'm wondering if there's a neat-o
> perl idiom/single line kind of way to do the same thing.
@keys = qw(Travis Bonnie Flipper Arnold Deluxe);
@array_index{@keys}=(0..$#keys);
print $array_index{Flipper};
--
Jeff Zucker
------------------------------
Date: Tue, 3 Jul 2001 14:51:47 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Finding the subscript of an item in an array...
Message-Id: <slrn9k4523.avt.tadmc@tadmc26.august.net>
Weston Cann <iowa_song88.remove_eights_and_this@hotmail.com> wrote:
>I know that you can find the subscript of an item in an array by
>doing something like this:
>
>
>my @foo = ('Travis','Bonnie','Flipper','Arnold','Deluxe');
>my $item = 'Flipper';
>
>my $index = 0;
>my $subscript;
my($subscript) = grep { $item eq $foo[$_]} 0 .. $#foo;
or, make a hash that maps the term to its index number:
my $i;
my %foo = map { $_, $i++ } @foo; # or @foo{ @foo } = 0 .. $#foo;
my $subscript = $foo{$item};
>while($index <= $#foo)
>{
> if($item eq $foo[$index])
> { $subscript = $index; }
{ $subscript = $index; last; }
If there cannot be duplicates, then might as well stop looking
when one is found. The grep() above and your original code
both look through the entire array every time.
> $index++;
>}
>
>
>
>This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
>perl idiom/single line kind of way to do the same thing.
You leave a lot of things unspecified, so we can't give directly
applicable help.
Does the order of the array elements matter?
Can there be duplicated elements? If so, report first/last/all indexes?
What should it do when the item is NOT found?
...
When you "need to know the index" you can often redesign your code
so that you do not need to know it (eg. put the strings in a hash as
suggested by "perldoq -q contains"). Don't know if you can do that
or not 'cause you haven't spec'd your circumstances very thoroughly.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 03 Jul 2001 15:45:25 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Finding the subscript of an item in an array...
Message-Id: <3B41A245.DFE74F3F@ce.gatech.edu>
Weston Cann wrote:
> I know that you can find the subscript of an item in an array by
> doing something like this:
>
> my @foo = ('Travis','Bonnie','Flipper','Arnold','Deluxe');
> my $item = 'Flipper';
>
> my $index = 0;
> my $subscript;
>
> while($index <= $#foo)
> {
> if($item eq $foo[$index])
> { $subscript = $index; }
>
> $index++;
> }
>
> This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
> perl idiom/single line kind of way to do the same thing.
----------------------------
@a = qw(flipper travis bonnie arnold deluxe);
$i=0;
for (@a) {if (/flipper/){ print $i; last; }$i++}
----------------------------
but i'm sure someone can beat that...
-rob
------------------------------
Date: 3 Jul 2001 19:56:01 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Finding the subscript of an item in an array...
Message-Id: <9ht80h$lgp$1@nnrp2.phx.gblx.net>
Weston Cann <iowa_song88.remove_eights_and_this@hotmail.com> wrote:
> I know that you can find the subscript of an item in an array by
> doing something like this:
>
> my @foo = ('Travis','Bonnie','Flipper','Arnold','Deluxe');
> my $item = 'Flipper';
>
> my $index = 0;
> my $subscript;
>
> while($index <= $#foo)
> {
> if($item eq $foo[$index])
> { $subscript = $index; }
>
> $index++;
> }
>
> This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
> perl idiom/single line kind of way to do the same thing.
foreach my $index (0 .. $#foo) {
$subscript = $index, last if $item eq $foo[$index];
}
for (0 .. $#foo) {
$subscript = $_, last if $item eq $foo[$_];
}
--
Jim Monty
monty@primenet.com
Tempe, Arizona USA
------------------------------
Date: 03 Jul 2001 14:10:45 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Finding the subscript of an item in an array...
Message-Id: <m3g0cdn80a.fsf@dhcp9-173.support.tivoli.com>
On Tue, 03 Jul 2001, iowa_song88.remove_eights_and_this@hotmail.com
wrote:
> I know that you can find the subscript of an item in an array by
> doing something like this:
>
>
> my @foo = ('Travis','Bonnie','Flipper','Arnold','Deluxe');
> my $item = 'Flipper';
>
> my $index = 0;
> my $subscript;
>
> while($index <= $#foo)
> {
> if($item eq $foo[$index])
> { $subscript = $index; }
{ $subscript = $index; last }
> $index++;
> }
Better:
for (0..$#foo) {
last if $item eq $foo[$_];
}
> This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
> perl idiom/single line kind of way to do the same thing.
Well, this normally isn't something you ever need to do when you are
solving problems the Perl way. Usually, the answer is, "use a hash."
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 03 Jul 2001 11:09:46 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Generating Image Thumbnail Files
Message-Id: <m14rst51g5.fsf@halfdome.holdit.com>
>>>>> "Mike" == Mike Bobbitt <bobbitt@nortelnetworks.com> writes:
Mike> I have a PERL CGI that I'd *really* like to generate image
Mike> thumbnails for me. (It's for an uploadable photo gallery, so I
Mike> have to keep manually generating new thumbnails each time
Mike> someone uploads a pic.) I've done a fair amount of searching,
Mike> and so far, I haven't been able to find any way to do this,
Mike> except from scratch (which seems like a big job).
Try this URL
http://groups.google.com/groups?as_q=thumbnail&as_ugroup=comp.lang.perl.*
Or this one
http://www.stonehenge.com/perl/googlecolumnsearch?search_for=thumbnail
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 3 Jul 2001 19:22:10 +0100
From: James Taylor <SEE_MY_SIG@nospam.demon.co.uk>
Subject: Re: How I came to love Perl...
Message-Id: <ant031810b49fNdQ@oakseed.demon.co.uk>
In article <27i3kto5maorj6npje5m835gfej2km505i@4ax.com>,
Lou Moran <lmoran@wtsg.com> wrote:
>
> --I end up finding out that I am making A LOT more at Coctco than I
> can as a first year teacher. I am still fixing computers. I decide
> "This Java sounds like a good idea." I buy two Java books. They
> still look like new. I am too stupid to learn Java.
Don't you mean too lazy to learn Java. :-)
(Lazy in a good way, of course.)
> --I start my journey with C and recognize a lot of things. I am
> "getting" it... then the modulo (sp?) (read math stuff) starts and I
> tune out and start looking for something I can "grasp". Then I see
> it! When I was learning Perl it was all about text, words, data and
> what I could do with it. Math (the bad thing) wasn't involoved!
You can do maths in Perl too, of course.
--
James Taylor <james (at) oakseed demon co uk>
Based in Southam, Cheltenham, UK.
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: Tue, 3 Jul 2001 15:26:06 -0500
From: Michael Gilfix <magilfix@us.ibm.com>
Subject: Re: How to timeout a socket recv under win32?
Message-Id: <9ht9lo$mcm$1@ausnews.austin.ibm.com>
select and vec are the way to go. The general idiom is to open up the socket,
do polling on the socket with select and then call recv on the socket only
when there is input to be read. So assuming that you have a socket already
open, you'll probably want something like this snippet:
my ($rin, $rout) ;
# Vec sets the bit within a series of bit flags (like an integer).
# You can think of this line as setting the bit flag in a set of
# read bits so that select knows to look for data from this
# socket
vec ($rin, fileno (MY_SOCKET), 1) = 1;
# This if statement will block until input is seen at
# the file descriptor. The last argument specifies the
# timeout. You could supply a number of seconds and
# the call will return if no data is seen.
if ( select ($rout = $rin, undef, undef, undef) ) {
my $my_packet = "";
my $length_to_read = 256;
my $server = recv (SOCKET, $my_packet, $my_length_to_read, 0);
# Do more processing
}
That should give you a general idea. You can always do a:
"perldoc -f select" and "perldoc -f vec" from the command line (in unix, not
sure about win) for more info.
-- Mike
On Tuesday 03 July 2001 03:34%, Horace wrote:
> Hi everyone,
> I'm new to perl and sorry if this question has been asked before,
> that's how to timeout a socket recv under win32 environmnet? I know that
> under unix, I can use "alarm", but how about win32?
> I saw some people suggested using "vec" and "select" to implement
> the timeout, but I don't know how.
> Please help and thanks in advance!
--
Michael Gilfix
Extreme Blue Group - IBM (Austin)
magilfix@us.ibm.com
------------------------------
Date: Tue, 03 Jul 2001 13:06:29 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: How to upgrade to newest (stable) version of Perl? (newbie)
Message-Id: <3B4209A5.17EACF32@uswest.com>
Athera wrote:
> I would like to upgrade the Perl on my FreeBSD system. I thought the
> instructions for doing that would be easy enough to come by, but I
> didn't find it anywhere in the FAQs or TFM. (Probably in there
> somewhere, but I couldn't find it -- and couldn't find it with search
> engines -- Maybe a good candidate for the FAQ?)
>
> My goal: To get threads enabled (and install the standard packages for
> them) without screwing up any of the modules like DBI I already have
> installed.
>
> It seemed like upgrading would be the best route -- since recompiling
> Perl should give me the option to compile with threads...
>
> Thank You,
> ..
Probably easiest to use shell interface to CPAN.
perl -MCPAN -e shell
Pay attention to the interactive questions. I'm not sure what the latest
Perl "bundle" is called but you'll be able to find it with little
problem.
Heh - good luck with getting Threads installed (and working). No offense
to the Perl community, but if you really need threads then consider Ruby
or Python.
Regards,
Mr. Sunray
------------------------------
Date: Tue, 03 Jul 2001 20:38:09 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: How to upgrade to newest (stable) version of Perl? (newbie)
Message-Id: <slrn9k4bc3.2cj.doughera@maxwell.phys.lafayette.edu>
>Athera wrote:
>> I would like to upgrade the Perl on my FreeBSD system. I thought the
>> instructions for doing that would be easy enough to come by, but I
>> didn't find it anywhere in the FAQs or TFM. (Probably in there
>> somewhere, but I couldn't find it -- and couldn't find it with search
>> engines -- Maybe a good candidate for the FAQ?)
>>
Build and installation instructions for perl5 are in perl5's INSTALL
file. It also includes extensive discussions, with examples, of
various upgrading options.
If you are trying to leave the existing perl on your FreeBSD system
alone and just install your own copy of a new perl (e.g. in
/usr/local) then those instructions should be just fine.
You can even have your new perl look back in the FreeBSD directories
for other modules.
If you are trying to *replace* the version supplied with FreeBSD, then
I think you're better off asking in a FreeBSD-specific forum. The
details of how each distribution handles upgrades are quite different,
and it would be impossible for the perl maintainers to keep
track of all the variations.
--
Andy Dougherty doughera@lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042
------------------------------
Date: Tue, 3 Jul 2001 14:24:20 -0700
From: "Dave Roth" <rothd@roth.net>
Subject: Re: how to Walk/dump Win32 registry?
Message-Id: <VJq07.2843$rh.100064@news6.giganews.com>
I suggest that you refer to either Greg's chapter (refer to the book he
cites below) or either of my two books (http://www.roth.net/books/extension/
and http://www.roth.net/books/handbook/). The "Standard Extensions" book
describes how to use Win32::Registry with various example scripts and the
"Administrator's Handbook" has a few scripts that use Win32::Registry
including a script that searches for strings in the Registry.
dave
"Greg Bacon" <gbacon@HiWAAY.net> wrote in message
news:tjpp5vq4ecd33b@corp.supernews.com...
> In article <uI4%6.31989$QM1.5174472@news2-win.server.ntlworld.com>,
> John Stumbles <john.stumbles@ntlworld.com> wrote:
>
> : Walking the filesystems is not too difficult, but the registries are
> : more so: using Win32::TieRegistry I can walk through at least the
> : major key systems, but I'm not sure how to interpret the various
> : values I get. [...]
>
> _Managing the Windows 2000 Registry_ by Paul Robichaux[*] contains
> several Perl examples, including a general Win32 registry walker and a
> registry dumper. The code examples don't seem to be available on the
> web, though. (FULL DISCLOSURE: I wrote the Perl section of this book
> but stand to gain no financial benefit from sales of the book.)
>
> [*] <URL:http://www.oreilly.com/catalog/mwin2reg/>
>
> : The other thing I'm looking for is a Perl 'diff' module. I can use an
> : external diff, but it would be neat to do it all 'in house' as it were.
>
> Take a look at Algorithm::Diff, which is available on the CPAN.
>
> Greg
> --
> Good times and riches and son of a bitches
> I've seen more than I can recall.
> -- Jimmy Buffett
>
------------------------------
Date: 3 Jul 2001 13:05:46 -0700
From: pape_toure@yahoo.com (Pape Toure)
Subject: Is there no solution to a malformed header?
Message-Id: <644fbcc7.0107031205.7dab42cd@posting.google.com>
Hello,
I've recently written a script linked to a webpage and everytime i run
it from the command line it works fine. But when I run the script from
the webpage, I get an error message, saying the I have a malformed
header in my script....
This is my script:
#!/usr/bin/perl -w
use CGI qw(:all);
print header;
$ENV{PATH} = "";
$shell = "test.sh";
chomp $shell;
system ("$shell");
I have looked through the previous posts, and have tried such methods
as: print "Content-type: text/html\n\n";
and a few others... But i still get the same result...
I was wondering if anyone could point me in the right direction or
sees faults within my script because this all makes sense to me...
Thank you
------------------------------
Date: Tue, 3 Jul 2001 18:53:00 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: lvalue functions
Message-Id: <9ht4ac$1p7a$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
<nobull@mail.com>], who wrote in article <u9bsn2szon.fsf@wcl-l.bham.ac.uk>:
> > > Would you please stop that.
> >
> > Cannot promise to remember this. But my setup grants Mail-Copies-To: never.
>
> I don't want CC "never". That would be throwing the baby out with the
> bathwater. I want CC "only when appropriate". If I'd wanted copies
> _always_ I'd have set a Mail-Copies-To header accordingly.
So insert it only when *you* think the copying is not appropriate.
You already know that in my opinion the copying is *always*
appropriate.
> > > Where? It's not in the standard docs. A web and Usenet search finds
> > > uses of the word but does not define it. From context it appears to
> > > be an obfuscated way of saying "subroutine call context".
> >
> > It means that using context to implement DWIM is evil, since the
> > context is quite often not what naive heuristics suggest.
>
> So you are now changing your claim from saying that my solution
> doesn't achieve exactly what was desired, to saying it does but does
> so by using black magic that not everyone understands. This is a
> completely different claim and one I would not dispute.
Yes it is different, but it is not what I said.
> The decision as to which method is to be called is not made until the
> the lvalue is _used_.
Then it is *always* returning a tied object, beating the whole purpose of
having different stuff done depending on the context.
Ilya
------------------------------
Date: Tue, 03 Jul 2001 18:08:42 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: map/hash question, functional style
Message-Id: <tk42haqurv6aae@corp.supernews.com>
Zeljko Vrba (mordor@fly.srk.fer.hr) wrote:
: I have a list of hash keys in a variable like this:
: @keys = qw(key1 key2 key3);
: and a list of values:
: @vals = (1, 2, 3);
:
: Now, what is the most elegant way to make a hash from this? I'd prefer using
: map and not foreach if at all possible. This is my current code:
@h{@keys} = @vals;
It's called a "hash slice". Very useful for this sort of thing.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Magick is the art and science of causing change in conformity
| with Will." - Aleister Crowley
------------------------------
Date: Tue, 03 Jul 2001 19:51:29 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: map/hash question, functional style
Message-Id: <tk48i136g9us5c@corp.supernews.com>
nobull@mail.com wrote:
: @hash=();
: @hash{@keys}=@vals;
Not clear how emptying the unrelated array variable @hash has any bearing
on loading the hash variable %hash. :)
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Magick is the art and science of causing change in conformity
| with Will." - Aleister Crowley
------------------------------
Date: Tue, 03 Jul 2001 20:08:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: map/hash question, functional style
Message-Id: <x7n16l6aiy.fsf@home.sysarch.com>
>>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:
CB> nobull@mail.com wrote:
CB> : @hash=();
CB> : @hash{@keys}=@vals;
CB> Not clear how emptying the unrelated array variable @hash has any
CB> bearing on loading the hash variable %hash. :)
because if that hash had old values they could still be there. and you
can't use hash slice assignment without first declaring it (you ARE
using strict?), so that is the equivilent of my %hash.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Tue, 3 Jul 2001 20:58:50 +0100
From: "Robin Abrol" <newsman@-takethisout-brol.org.uk>
Subject: Missing modules ?
Message-Id: <9ht87i$b35$1@news6.svr.pol.co.uk>
I am getting the follwing line when attempting to run a Perl script
downloaded.
Can't locate NDBM_File.pm in @INC
There are serveral others not being located....DB_File.pm and GDBM_File.pm
I assume these are Perl Modules, but am not sure as I have not used CGI
before. If these are Perl Modules, and I am running with a host who uses
Activestate on Windows NT servers, can I just download the modules and FTP
them to my directory (which is included in the @INC)? My host wants to
charge me extra to install them at their end, which I am not too keen on!
Also, if I can run them from my own directory on the server, where can I get
them from? I tried to access Activestate's site tonight, but can't seem to
get further than the 1st page.
Thanks a lot.
Robin
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.261 / Virus Database: 131 - Release Date: 06/06/2001
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 1238
***************************************