[17802] in Perl-Users-Digest
Perl-Users Digest, Issue: 5222 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 4 13:56:08 2001
Date: Thu, 4 Jan 2001 10:55:43 -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: <978634543-v9-i5222@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 Jan 2001 Volume: 9 Number: 5222
Today's topics:
A color-contrast program in Perl (was: bitwise operatio (El Nadie)
Re: A color-contrast program in Perl (Martien Verbruggen)
Abigail's Deadly One-Liner (Garry Williams)
Re: Abigail's Deadly One-Liner (Ben Okopnik)
Re: Abigail's Deadly One-Liner (Garry Williams)
ActivePerl & Modules <pdenize@xtra.co.nz>
Re: ActivePerl & Modules <johngros@Spam.bigpond.net.au>
ActivePerl and IIS3 (Thomas j. Evans)
Re: ActivePerl and IIS3 <wyzelli@yahoo.com>
Re: ActivePerl and IIS3 <pricesteve@yahoo.com>
Re: ActivePerl and IIS3 (Martin Vorlaender)
Re: ActivePerl and IIS3 (Thomas j. Evans)
Re: ActivePerl and IIS3 (Martin Vorlaender)
Re: Ada feature borrowed for Perl?? (Mariusz Drozdziel)
Re: Ada feature borrowed for Perl?? <kevin@vaildc.net>
Re: Ada feature borrowed for Perl?? (Mark Jason Dominus)
Re: Ada feature borrowed for Perl?? <iltzu@sci.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 01 Jan 2001 20:34:19 GMT
From: nadie@latino-2000.com (El Nadie)
Subject: A color-contrast program in Perl (was: bitwise operation to find the inversion of a color)
Message-Id: <nadie3a50e94c12145@news.latino-2000.com>
Despite Abigail's typical comments, there has been some useful
discussion here about writing a Perl routine for generating a
contrasting color given another color's RGB representation.
As you folks know, Bart Lateur submitted Perl code and related
discussion for two possible schemes for doing this. And Ilmari
Karonen submitted Perl code and discussion for three other possible
schemes. Furthermore, Martien Verbruggen recommended doing a
conversion into H/S/V space in order to more easily calculate the
contrasting color values.
I wrote a Perl program which implements Mr. Verbruggen's suggested
algorithms, and I'm enclosing that program here, after a suitably
snipped and annotated quote of Mr. Verbruggen's message.
This program is to be run taking a triplet of R/G/B values (each
between 0 and 255) as command-line arguments. It prints out the
calculated contrasting R/G/B color values for each of the variations
of Mr. Verbruggen's algorithms.
I'm sure that many of you will be able to suggest ways to make my
Perl code more obfuscated^H^H^H^H^H^H^H^H^H^H"elegant" :) -- and to
fix possible bugs and make it more efficient. But even as is, the
program should be useful as a starting point for understanding how
to implement contrasting-color algorthms in Perl.
And by the way, I did a cursory Google search, and in the short time
I was looking, I didn't find any existing color-contrast or RGB-HSV
conversion Perl routines on the net, so perhaps this code will be
useful for those purposes, as well.
To Bart Lateur, Ilmari Karonen, Martien Verbruggen, and others:
Kudos for following up on this interesting topic and in
general, for discussing it in a Perl-based manner, suitable
for this newsgroup.
To Abigail:
Shame on you.
Ok. As mentioned above, right below my sig is Mr. Verbruggen's
snipped quote, followed immediately by my Perl code.
El Nadie
nadie@latino-2000.com
On Mon, 1 Jan 2001 17:36:08 +1100,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On 31 Dec 2000 05:11:34 GMT,
> The WebDragon <nospam@nospam.com> wrote:
>
> [ ... snip ... ]
>
> You wouldn't really want to discuss contrast and complement in RGB color
> space, because it is failry unsuitable for it. What you'd do is define
> what exactly you mean by contrast (and yes, there are several
> definitions, some of which you will need to take into account to create
> your computation, probably hue and brightness both), and do your
> calculations in HSV space.
>
> [ ... snip ... ]
>
> [ Mr. Verbruggen's first algorithm: ]
>
> convert RGB to HSV
> rotate hue 120 degrees clockwise and anticlockwise
> value becomes 1 - value
> convert both results back to RGB, and pick one.
>
> [ Mr. Verbruggen's second algorithm: ]
>
> Of course, for colours with middle values of value or brightness and
> little saturation, this won't really result in good contrasting colors.
> For pure grays, this is next to useless. It may be better to always pick
> a V of 1 if the current V < 0.5, and a V of 0 for V >= 0.5, or something
> like that. Many ways can lead to a 'valid' soltion. Contrast is not an
> absolute when talking about colours.
>
> [ ... snip ... ]
#!/usr/bin/perl -w
# -*- perl -*-
# Given an R/G/B triplet on the command line, print to stdout
# the possible triplets of contrasting colors, according to the
# algorithms discussed by Martien Verbruggen.
my $program;
($program = $0) =~ s:^.*/::;
if (scalar(@ARGV) < 3) {
usage();
# notreached
}
my ($r, $g, $b) = @ARGV[0..2];
my ($h, $s, $v) = rgb2hsv($r, $g, $b);
# The rgb2hsv() routine returns an array of `undef' values if
# its input parameters are not reasonable.
unless (defined($h) && defined($s) && defined($v)) {
usage();
# notreached
}
# Martien Verbruggen's first method
my $newH1 = $h - 120;
my $newH2 = $h + 120;
if ($newH1 < 0) {
$newH1 += 360;
}
if ($newH2 > 360) {
$newH2 -= 360
}
my $newV1 = 1 - $v;
# Martien Verbruggen's second method
my $newV2 = ($v < 0.5 ? 1.0 : 0.0);
print "Contrasting values:\n";
print " 1: " . join(' ', hsv2rgb($newH1, $s, $newV1)) . "\n";
print " 2: " . join(' ', hsv2rgb($newH2, $s, $newV1)) . "\n";
print " 3: " . join(' ', hsv2rgb($newH1, $s, $newV2)) . "\n";
print " 4: " . join(' ', hsv2rgb($newH2, $s, $newV2)) . "\n";
exit(0);
# notreached
sub usage {
die "usage: $program R G B [ values between 0 and 255 ]\n";
# notreached
}
# return the minimum value of an array or `undef' if it's
# an empty array
sub min {
my @values = @_;
my $min = undef;
foreach my $val (@values) {
if (!defined($min) || $val < $min) {
$min = $val;
}
}
return ($min);
}
# return the maximum value of an array or `undef' if it's
# an empty array
sub max {
my @values = @_;
my $max = undef;
foreach my $val (@values) {
if (!defined($max) || $val > $max) {
$max = $val;
}
}
return ($max);
}
# Given an r/g/b array, return an h/s/v array.
# The r/g/b values are treated as floats,
# each one between 0.0 and 255.0.
# The h value will be between 0 and 360, and
# the s and v values will be between 0 and 1.
sub rgb2hsv {
my $r = shift;
my $g = shift;
my $b = shift;
# limit this to r/g/b values between 0 and 255
unless (defined($r) && defined($g) && defined($b) &&
$r >= 0 && $g >= 0 && $b >= 0 &&
$r <= 255 && $g <= 255 && $b <= 255) {
return (undef, undef, undef);
}
$r /= 255.0;
$g /= 255.0;
$b /= 255.0;
my $min = min($r, $g, $b);
my $max = max($r, $g, $b);
my $delta = $max - $min;
my $h;
my $s;
my $v = $max;
# 0.003 is less than 1/255; use this to make the floating point
# approximation of zero
if ($max < 0.003 || $delta < 0.003) {
return (0.0, 0.0, $v);
}
else {
$s = $delta / $max;
if ($r == $max) {
$h = ($g - $b) / $delta;
}
elsif ($g == $max) {
$h = 2 + ($b - $r) / $delta;
}
else {
$h = 4 + ($r - $g) / $delta;
}
$h *= 60; # h is units of 1/6 of a circle;
# convert it to degrees
while ($h < 0) { # ... and make sure it's between 0 and 360
$h += 360;
}
}
return ($h, $s, $v);
}
# Given an h/s/v array, return an r/g/b array.
# The r/g/b values will each be between 0 and 255.
# The h value will be between 0 and 360, and
# the s and v values will be between 0 and 1.
sub hsv2rgb {
my $h = shift;
my $s = shift;
my $v = shift;
# limit this to h values between 0 and 360 and s/v values
# between 0 and 1
unless (defined($h) && defined($s) && defined($v) &&
$h >= 0 && $s >= 0 && $v >= 0 &&
$h <= 360 && $s <= 1 && $v <= 1) {
return (undef, undef, undef);
}
my $r;
my $g;
my $b;
# 0.003 is less than 1/255; use this to make the floating point
# approximation of zero, since the resulting rgb values will
# normally be used as integers between 0 and 255. Feel free to
# change this approximation of zero to something else, if this
# suits you.
if ($s < 0.003) {
$r = $g = $b = $v;
}
else {
$h /= 60;
my $sector = int($h);
my $fraction = $h - $sector;
my $p = $v * (1 - $s);
my $q = $v * (1 - ($s * $fraction));
my $t = $v * (1 - ($s * (1 - $fraction)));
if ($sector == 0) {
$r = $v;
$g = $t;
$b = $p;
}
elsif ($sector == 1) {
$r = $q;
$g = $v;
$b = $p;
}
elsif ($sector == 2) {
$r = $p;
$g = $v;
$b = $t;
}
elsif ($sector == 3) {
$r = $p;
$g = $q;
$b = $v;
}
elsif ($sector == 4) {
$r = $t;
$g = $p;
$b = $v;
}
else {
$r = $v;
$g = $p;
$b = $q;
}
}
# Convert the r/g/b values to all be between 0 and 255; use the
# ol' 0.003 approximation again, with the same comment as above.
$r = ($r < 0.003 ? 0.0 : $r * 255);
$g = ($g < 0.003 ? 0.0 : $g * 255);
$b = ($b < 0.003 ? 0.0 : $b * 255);
return ($r, $g, $b);
}
__END__
------------------------------
Date: Tue, 2 Jan 2001 09:25:31 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: A color-contrast program in Perl
Message-Id: <slrn9520ur.6lr.mgjv@martien.heliotrope.home>
On Mon, 01 Jan 2001 20:34:19 GMT,
El Nadie <nadie@latino-2000.com> wrote:
>
> And by the way, I did a cursory Google search, and in the short time
> I was looking, I didn't find any existing color-contrast or RGB-HSV
> conversion Perl routines on the net, so perhaps this code will be
> useful for those purposes, as well.
There are several around for Pascal and C. Here's some Perl, wich is
slightly shorter than yours:
sub max
{
my $max = shift;
for (@_) { $max = $_ if $max < $_ }
return $max
}
sub min
{
my $min = shift;
for (@_) { $min = $_ if $min > $_ }
return $min
}
sub rgb_to_hsv
{
my ($r, $g, $b) = @_;
my ($h, $s, $v);
my $max = max($r, $g, $b);
my $min = min($r, $g, $b);
$v = $max;
$s = ($max) ? ($max - $min)/$max : 0;
return (0, $s, $v) if $s == 0;
if ($r == $max)
{
$h = ($g - $b)/($max - $min);
}
elsif ($g == $max)
{
$h = 2 + ($b - $r)/($max - $min);
}
else # ($b == $max)
{
$h = 4 + ($r - $g)/($max - $min);
}
$h *= 60;
$h += 360 if $h < 0;
return ($h, $s, $v);
}
sub hsv_to_rgb
{
my ($h, $s, $v) = @_;
return ($v, $v, $v) if $s == 0;
$h = 0 if $h == 360;
$h /= 60;
my $f = $h - int($h);
my $p = $v * (1 - $s);
my $q = $v * (1 - $s * $f);
my $t = $v * (1 - $s * (1 - $f));
for my $sw (int($h))
{
($sw == 0) && return ($v, $t, $p);
($sw == 1) && return ($q, $v, $p);
($sw == 2) && return ($p, $v, $t);
($sw == 3) && return ($p, $q, $v);
($sw == 4) && return ($t, $p, $v);
($sw == 5) && return ($v, $p, $q);
}
}
sub rgb_to_hls
{
my ($r, $g, $b) = @_;
my ($h, $l, $s);
my $max = max($r, $g, $b);
my $min = min($r, $g, $b);
$l = ($max + $min)/2;
return (0, $l, 0) if ($max == $min);
$s = ($l < 0.5) ?
($max - $min)/($max + $min) :
($max - $min)/(2 - $max - $min);
if ($r == $max)
{
$h = ($g - $b)/($max - $min);
}
elsif ($g == $max)
{
$h = 2 + ($b - $r)/($max - $min);
}
else # ($b == $max)
{
$h = 4 + ($r - $g)/($max - $min);
}
$h *= 60;
$h += 360 if $h < 0;
return ($h, $l, $s);
}
sub hls_value
{
my ($q1, $q2, $h) = @_;
$h -= 360 if ($h > 360);
$h += 360 if ($h < 0);
($h < 60) && return $q1 + ($q2 - $q1) * $h/60;
($h < 180) && return $q2;
($h < 240) && return $q1 + ($q2 - $q1) * (240 - $h)/60;
return $q1;
}
sub hls_to_rgb
{
my ($h, $l, $s) = @_;
my ($p1, $p2);
return ($l, $l, $l) if $s == 0;
$p2 = ($l < 0.5) ?
$l * (1 + $s) :
$l + $s - ($l * $s);
$p1 = 2 * $l - $p2;
return (hls_value($p1, $p2, $h + 120),
hls_value($p1, $p2, $h),
hls_value($p1, $p2, $h - 120));
}
Martien
--
Martien Verbruggen |
Interactive Media Division | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd. | ain't.
NSW, Australia |
------------------------------
Date: Sat, 30 Dec 2000 18:36:02 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Abigail's Deadly One-Liner
Message-Id: <mWp36.40$zp4.3560@eagle.america.net>
On 30 Dec 2000 17:52:00 GMT, Ben Okopnik <fuzzybear@pocketmail.com> wrote:
>The ancient archives of 30 Dec 2000 15:59:06 GMT showed
>Abigail of comp.lang.perl.misc speaking thus:
>
>>perl -wlpe '}$_=$.;{' file # Count the number of lines.
>
>
>Yet another example of "Abigail's deadly one-liner". Sent me searching
>through the FAQs, as usual. :)
>
>What in the heck is that '}...{' syntax? I've even grepped my $PODS
>directory, and only came up with '} else {' which is a different sort of
>animal altogether. I've tried reversing the brockets and see the effect -
>but what's the mechanism?
The key is in perlrun. Check the explanation of -p.
--
Garry Williams
------------------------------
Date: 31 Dec 2000 04:35:58 GMT
From: fuzzybear@pocketmail.com (Ben Okopnik)
Subject: Re: Abigail's Deadly One-Liner
Message-Id: <slrn94tduf.72v.fuzzybear@Odin.Thor>
The ancient archives of Sat, 30 Dec 2000 18:36:02 GMT showed
Garry Williams of comp.lang.perl.misc speaking thus:
>On 30 Dec 2000 17:52:00 GMT, Ben Okopnik <fuzzybear@pocketmail.com> wrote:
>>The ancient archives of 30 Dec 2000 15:59:06 GMT showed
>>Abigail of comp.lang.perl.misc speaking thus:
>>
>>>perl -wlpe '}$_=$.;{' file # Count the number of lines.
>>
>>
>>Yet another example of "Abigail's deadly one-liner". Sent me searching
>>through the FAQs, as usual. :)
>>
>>What in the heck is that '}...{' syntax? I've even grepped my $PODS
>>directory, and only came up with '} else {' which is a different sort of
>>animal altogether. I've tried reversing the brockets and see the effect -
>>but what's the mechanism?
>
>The key is in perlrun. Check the explanation of -p.
Took a while of reading, writing test code, and cussing over it - but I've
*got* it! Thank you so much for the hint (better phrasing yet, thank for
not _telling_ me but giving me a hint instead.)
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If you have a talent, use it in every which way possible. Don't hoard it.
Don't dole it out like a miser. Spend it lavishly like a millionaire intent
on going broke. -- Brendan Francis
------------------------------
Date: Sun, 31 Dec 2000 09:22:42 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Abigail's Deadly One-Liner
Message-Id: <CVC36.53$Dm5.3640@eagle.america.net>
On 31 Dec 2000 04:35:58 GMT, Ben Okopnik <fuzzybear@pocketmail.com> wrote:
>The ancient archives of Sat, 30 Dec 2000 18:36:02 GMT showed
>Garry Williams of comp.lang.perl.misc speaking thus:
>>On 30 Dec 2000 17:52:00 GMT, Ben Okopnik <fuzzybear@pocketmail.com> wrote:
>>>The ancient archives of 30 Dec 2000 15:59:06 GMT showed
>>>Abigail of comp.lang.perl.misc speaking thus:
>>>
>>>>perl -wlpe '}$_=$.;{' file # Count the number of lines.
...
>>The key is in perlrun. Check the explanation of -p.
>
>Took a while of reading, writing test code, and cussing over it - but I've
>*got* it! Thank you so much for the hint (better phrasing yet, thank for
>not _telling_ me but giving me a hint instead.)
You're welcome. The first time I spotted it, I had fun with it too.
--
Garry Williams
------------------------------
Date: Sat, 30 Dec 2000 13:30:45 +1300
From: "Paul Denize" <pdenize@xtra.co.nz>
Subject: ActivePerl & Modules
Message-Id: <3a4d2bd4@news.attica.net.nz>
I'm developing a website in handcoded PerlScript (under Win NT). And struck
a few problems.
Modules cant access $Request - I created some modules for generic operations
(like a good programmer should). However I have found that some items
available in ActivePerl are not available in the Modules. (Example
$Request). I'm sure it is just loaded from another system module for me by
ActivePerl and not the Module but I simply cannot find our where. So far I
have been frced to pass the values required across to the module via an init
routine (yuck).
I can't read the Help - Each module in C:\perl... apparently has some
documentation at the end. It appears to be structured in some way (probably
to be read by something like man). I'm having to sift through it in text
mode. Can someone tell me how I should be reading this documentation?
use Strict & use Warnings - I've always tried to program with all the
seatbelts fastened. The books I am using advised using Strict and Warnings.
However when I turn these two on the number of warnings is horrific. I
tried to resolve some but others I could not figure out what it was trying
to tell me. I'm an ex-ansi C programmer so I thought I'd be familiar with
the types of warnings, but these were obscure. Could someone offer to
assist me (via email) in understanding a few of these messages in relation
to code segments.
Paul Denize
------------------------------
Date: Sat, 30 Dec 2000 10:38:06 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: ActivePerl & Modules
Message-Id: <iWi36.38249$xW4.304936@news-server.bigpond.net.au>
"Paul Denize" <pdenize@xtra.co.nz> wrote in message
news:3a4d2bd4@news.attica.net.nz...
> mode. Can someone tell me how I should be reading this documentation?
In your perl directory there should be a HTML directory if you click on the
index you get a framed page all your installed modules documentation will be
at the bottom of the other documentation.
Or from the command line you can use perldoc -X modulename
------------------------------
Date: Wed, 03 Jan 2001 06:33:17 GMT
From: thomas42@no.spam.bellatlantic.net (Thomas j. Evans)
Subject: ActivePerl and IIS3
Message-Id: <3a52c2a1.26406511@news.bellatlantic.net>
Hello,
I've been spending nearly a week trying to get ActivePerl working on
IIS3. I've followed the installation procedures precicely, checked
and double checked, but it still will not execute my perl scripts
through the web server. I can execute perl scripts from the command
line and I can execute them in IE by pointing to the local file (i.e.
C:\Perl\eg\example.pl as URL), but IE just hangs when I try to run a
script through the server (i.e. http://myserver/cgi-bin/example.pl as
URL).
The server is a FAT partition, so there are no file permissions to
worry about. I created a virtual directory for the cgi-bin directory
and gave it execute permission and no read permission. I added the
registry association for .pl to C:/Perl/bin/perl.exe, and I also tried
using ASSOC and FTYPE to associate it that way. I also found a
suggestion for adding registry key CreateProcessWithNewConsole, and I
tried that which didn't help.
Any ideas?
-T
To email me, remove no.spam
------------------------------
Date: Wed, 3 Jan 2001 16:14:47 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: ActivePerl and IIS3
Message-Id: <FLz46.34$kO2.4539@vic.nntp.telstra.net>
"Thomas j. Evans" <thomas42@no.spam.bellatlantic.net> wrote in message
news:3a52c2a1.26406511@news.bellatlantic.net...
> Hello,
>
> I've been spending nearly a week trying to get ActivePerl working on
> IIS3. I've followed the installation procedures precicely, checked
> and double checked, but it still will not execute my perl scripts
> through the web server. I can execute perl scripts from the command
> line and I can execute them in IE by pointing to the local file (i.e.
> C:\Perl\eg\example.pl as URL), but IE just hangs when I try to run a
> script through the server (i.e. http://myserver/cgi-bin/example.pl as
> URL).
>
> The server is a FAT partition, so there are no file permissions to
> worry about. I created a virtual directory for the cgi-bin directory
> and gave it execute permission and no read permission. I added the
> registry association for .pl to C:/Perl/bin/perl.exe, and I also tried
> using ASSOC and FTYPE to associate it that way. I also found a
> suggestion for adding registry key CreateProcessWithNewConsole, and I
> tried that which didn't help.
>
> Any ideas?
>
Have you read the Activeperl FAQ on IIS?
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Wed, 3 Jan 2001 11:14:01 -0000
From: "pricesteve" <pricesteve@yahoo.com>
Subject: Re: ActivePerl and IIS3
Message-Id: <AUD46.31408$y5.107503@news2-hme0>
check this out. Fixed my problems with IIS 4
http://www.geocities.com/SiliconValley/Park/8312/perlis.htm
Thomas j. Evans <thomas42@no.spam.bellatlantic.net> wrote in message
news:3a52c2a1.26406511@news.bellatlantic.net...
> Hello,
>
> I've been spending nearly a week trying to get ActivePerl working on
> IIS3. I've followed the installation procedures precicely, checked
> and double checked, but it still will not execute my perl scripts
> through the web server. I can execute perl scripts from the command
> line and I can execute them in IE by pointing to the local file (i.e.
> C:\Perl\eg\example.pl as URL), but IE just hangs when I try to run a
> script through the server (i.e. http://myserver/cgi-bin/example.pl as
> URL).
>
> The server is a FAT partition, so there are no file permissions to
> worry about. I created a virtual directory for the cgi-bin directory
> and gave it execute permission and no read permission. I added the
> registry association for .pl to C:/Perl/bin/perl.exe, and I also tried
> using ASSOC and FTYPE to associate it that way. I also found a
> suggestion for adding registry key CreateProcessWithNewConsole, and I
> tried that which didn't help.
>
> Any ideas?
>
> -T
> To email me, remove no.spam
------------------------------
Date: Wed, 03 Jan 2001 18:08:56 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: ActivePerl and IIS3
Message-Id: <3a535ca8.524144494f47414741@radiogaga.harz.de>
Thomas j. Evans (thomas42@no.spam.bellatlantic.net) wrote:
: I created a virtual directory for the cgi-bin directory
: and gave it execute permission and no read permission.
Correct.
: I added the
: registry association for .pl to C:/Perl/bin/perl.exe,
Wrong. The correct way is to set HKLM\SYSTEM\CurrentControlSet\
Services\W3SVC\Parameters\ScriptMap\.pl to a REG_SZ value of
C:\Perl\bin\perl.exe -w "%s" "%s"
: and I also tried using ASSOC and FTYPE to associate it that way.
Nothing to do with IIS.
: I also found a
: suggestion for adding registry key CreateProcessWithNewConsole
Correct (if the key is ...\Parameters\CreateProcessWithNewConsole
and the value is REG_DWORD 1).
cu,
Martin
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: Thu, 04 Jan 2001 00:26:51 GMT
From: thomas42@no.spam.bellatlantic.net (Thomas j. Evans)
Subject: Re: ActivePerl and IIS3
Message-Id: <3a53c296.14366099@news.bellatlantic.net>
On Wed, 03 Jan 2001 18:08:56 +0100, martin@radiogaga.harz.de (Martin
Vorlaender) wrote:
>Thomas j. Evans (thomas42@no.spam.bellatlantic.net) wrote:
>: I added the
>: registry association for .pl to C:/Perl/bin/perl.exe,
>
>Wrong. The correct way is to set HKLM\SYSTEM\CurrentControlSet\
>Services\W3SVC\Parameters\ScriptMap\.pl to a REG_SZ value of
>C:\Perl\bin\perl.exe -w "%s" "%s"
So without the -w "%s" "%s" it doesn't work? That was not what the
FAQs and documentation said to put. I recognize the parameter
variables, but what is the -w for?
>: I also found a
>: suggestion for adding registry key CreateProcessWithNewConsole
>
>Correct (if the key is ...\Parameters\CreateProcessWithNewConsole
>and the value is REG_DWORD 1).
Yes, that's the key I used.
Thanks for your help.
-T
To email me, remove no.spam
------------------------------
Date: Thu, 04 Jan 2001 05:54:28 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: ActivePerl and IIS3
Message-Id: <3a540204.524144494f47414741@radiogaga.harz.de>
Thomas j. Evans (thomas42@no.spam.bellatlantic.net) wrote:
: martin@radiogaga.harz.de (Martin Vorlaender) wrote:
: >Wrong. The correct way is to set HKLM\SYSTEM\CurrentControlSet\
: >Services\W3SVC\Parameters\ScriptMap\.pl to a REG_SZ value of
: >C:\Perl\bin\perl.exe -w "%s" "%s"
:
: So without the -w "%s" "%s" it doesn't work?
Let's put it that way: with them, it worked for me.
: That was not what the FAQs and documentation said to put.
Which documentation are you refering to? All IIS3 docs and Knowledge
Base articles on this topic I've seen have the "%s"'s.
: I recognize the parameter variables, but what is the -w for?
Please see `perldoc perlrun' for that - and the first sentence of the
BUGS section in `perldoc perl'.
cu,
Martin
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: 31 Dec 2000 03:10:35 GMT
From: nova@moo.pl (Mariusz Drozdziel)
Subject: Re: Ada feature borrowed for Perl??
Message-Id: <slrn94t8tb.cj2.nova@salceson.netwerke.org>
Czesc,
Dnia Mon, 18 Dec 2000 10:36:42 +1300, Peter Sundstrom napisał:
>> languages allow "else if", but Ada and Perl are the only languages I can
>> think of with an "elsif".
> The Bourne shell family has the very similar 'elif'
Quite. They spend hours thinking on new combinations
of 'else' and 'if', just to tell the world, that their language
differ from some others, and it was writen from a scratch.
Anyway merging this in one word is a little bit stange. Is it not
enough to tell, that there is other posabilty, if condition not accure?
Program will work the same way if we define 'else' statament as
new 'if' condition... Can somebody explain, what is real reason of
creating such instruction?
--
Mariusz.
== Mariusz Drozdziel <M.Drozdziel@elka.pw.edu.pl> * 2:482/52@fidonet ==
------------------------------
Date: Mon, 01 Jan 2001 10:26:39 -0500
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: Ada feature borrowed for Perl??
Message-Id: <kevin-331226.10263901012001@news.his.com>
In article <slrn94t8tb.cj2.nova@salceson.netwerke.org>, nova@moo.pl
(Mariusz Drozdziel) wrote:
> Czesc,
> Dnia Mon, 18 Dec 2000 10:36:42 +1300, Peter Sundstrom napisał:
>
> >> languages allow "else if", but Ada and Perl are the only languages
> >> I can think of with an "elsif".
> > The Bourne shell family has the very similar 'elif'
>
> Quite. They spend hours thinking on new combinations
> of 'else' and 'if', just to tell the world, that their language
> differ from some others, and it was writen from a scratch.
> Anyway merging this in one word is a little bit stange. Is it not
> enough to tell, that there is other posabilty, if condition not accure?
> Program will work the same way if we define 'else' statament as
> new 'if' condition... Can somebody explain, what is real reason of
> creating such instruction?
To avoid having to close two or more open "if"s. Without the el(s)if,
you have something like
if blah then
foo;
else
if blech then
baz;
else
if barf then
ew;
end if;
end if;
end if;
With it you can do
if blah then
foo;
elsif blech then
baz;
elsif barf then
ew;
end if;
which helps keep the code closer to the left margin. I find the latter
much easier to read, though I've seen people do the former as well. In
a language without a bracketed "if", like C, there's no advantage to
el(s)if at all.
--
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net | blazing high above your head.
. . . . . . . . . | But _in_ you is the presence that
. . . . . . . . . | will be, when all the stars are dead. (Rainer Maria Rilke)
------------------------------
Date: Mon, 01 Jan 2001 16:22:58 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Ada feature borrowed for Perl??
Message-Id: <3a50aee2.3873$2eb@news.op.net>
Mark Dominus said:
> Perl even has features that are borrowed from Ada, including one you
> use every day.
The features I had in mind were:
* Apostrophe as a package qualifier ($main'foo)
* Underscores in numeric literals (1_234_567)
* 'elsif'
With 'elsif' being the 'one you use every day'.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 1 Jan 2001 18:55:11 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Ada feature borrowed for Perl??
Message-Id: <978374927.4396@itz.pp.sci.fi>
In article <3a50aee2.3873$2eb@news.op.net>, Mark Jason Dominus wrote:
>
>With 'elsif' being the 'one you use every day'.
Hey, you're right! Though that's just because the only script that
"grep -l elsif perl/*" turned up is the one I use to post to Usenet.
..and when/if I get around to rewriting that pile of cruft, I'll most
likely replace that elsif chain with a dispatch table. I understand
the point of having "elsif", but in my experience it's a particularly
rarely needed feature, unless you're fond of spaghetti code.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
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 5222
**************************************