[25862] in Perl-Users-Digest
Perl-Users Digest, Issue: 8097 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 20 00:05:19 2005
Date: Thu, 19 May 2005 21:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 19 May 2005 Volume: 10 Number: 8097
Today's topics:
Re: Can Win32:: module be used under windows 98? <sisyphus1@nomail.afraid.org>
http get param <alexj@freesurf.ch>
local, END, and $? <henry.townsend@not.here>
Re: local, END, and $? <kuujinbo@hotmail.com>
Re: local, END, and $? <joe@inwap.com>
Petrol <ed-no-spam@192.168.55.2.invalid>
Re: Petrol <none>
Re: Petrol <tken@socal.rr.com>
Re: Petrol <rxdxv@talk21.com>
Re: Petrol <Beach121@cyber-rights.net>
Re: semi-opacity with GD <richard.bennett@nospam.skynet.be>
Re: semi-opacity with GD <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 May 2005 12:34:56 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Can Win32:: module be used under windows 98?
Message-Id: <428d4cce$0$4657$afc38c87@news.optusnet.com.au>
"JJ" <jinsun@agere.com> wrote in message
news:d6irg2$l4u$1@alageremail2.agere.com...
> I am writing a perl script that uses some Win32 modules such as Win32,
> Win32::Daemon, Win32:ChangeNotify etc.. The program can run under windows
> XP. But when I tried under win98, I got compling problems. Is that because
> Win32 module cannot be used under win98? Thanks.
>
Best to provide a (minimal) example of something you tried, along with a
copy'n'paste of the actual error message.
Cheers,
Rob
------------------------------
Date: Fri, 20 May 2005 00:32:49 +0200
From: Alexandre Jaquet <alexj@freesurf.ch>
Subject: http get param
Message-Id: <428d1415$0$1160$5402220f@news.sunrise.ch>
I'm having a strang error when I try to disting my actions passed in
parameter, the parameter action is null :s
html code :
<form name="insert_form" action="/cgi-bin/recordz.cgi?lang=$LANG"
method="post">
<input type="hidden" name="action" value="register">
.....
.....
</form>
perl code :
loadLanguage ();
execute ();
sub execute {
my $query = new CGI ;
my $action = $query->param('action');
#open and write to file currently action
#action is empty in my file
my $dir = "C:/indigoperl/apache/htdocs/recordz/action.txt";
open (FILE, ">>$dir") or die "cannot open file $dir";
print FILE "$action\n";
close (FILE);
if ($action) {
switch ($action) {
case "login" { };
case "logout" { };
case "search" {};
case "register" {registerNewUser();}
}
}
else {loadPage ();}
}
thanks in advance
------------------------------
Date: Thu, 19 May 2005 20:36:36 -0400
From: Henry Townsend <henry.townsend@not.here>
Subject: local, END, and $?
Message-Id: <RPGdnajF3uCIrBDfRVn-qA@comcast.com>
I thought I understood local() but this one has thrown me for a loop.
Check out the following program:
exit 3;
END {
local $?;
print "status=$?\n";
}
I need an exit handler to do some cleanup; thus the END block. But
naturally I don't want to blow away the real exit status in the cleanup
block, so I localise $?. I do need to *see* the exit status within the
END block, but running the above results in:
% perl -w /tmp/ddd
status=0
% echo $?
3
So it loses $? within the block. If I change it to say "local $? = $?;"
then $? becomes 0 both in and out of the block. What am I doing wrong?
How can I both see $? and preserve it within the END block?
--
Thanks,
Henry Townsend
------------------------------
Date: Fri, 20 May 2005 12:01:47 -0400
From: ko <kuujinbo@hotmail.com>
Subject: Re: local, END, and $?
Message-Id: <428d52c3_2@x-privat.org>
Henry Townsend wrote:
> I thought I understood local() but this one has thrown me for a loop.
> Check out the following program:
>
> exit 3;
> END {
> local $?;
> print "status=$?\n";
> }
>
> I need an exit handler to do some cleanup; thus the END block. But
> naturally I don't want to blow away the real exit status in the cleanup
> block, so I localise $?. I do need to *see* the exit status within the
> END block, but running the above results in:
>
> % perl -w /tmp/ddd
> status=0
> % echo $?
> 3
>
> So it loses $? within the block. If I change it to say "local $? = $?;"
> then $? becomes 0 both in and out of the block. What am I doing wrong?
> How can I both see $? and preserve it within the END block?
>
I don't understand where the problem is:
$ perl -e 'exit 3; END { local $?; system("NON_COMMAND"); \
print "status:$?\n"; }'; echo $?
status:-1
3
perldoc perlvar ???
HTH - keith
------------------------------
Date: Thu, 19 May 2005 20:42:52 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: local, END, and $?
Message-Id: <OISdnWBjQeoowRDfRVn-hw@comcast.com>
Henry Townsend wrote:
> I need an exit handler to do some cleanup; thus the END block. But
> naturally I don't want to blow away the real exit status in the cleanup
> block, so I localise $?. I do need to *see* the exit status within the
> END block
It's quite obvious. Look at the value before localizing it.
END {
my $error_code = $?;
local $?;
...
}
------------------------------
Date: Fri, 20 May 2005 00:12:59 +0200 (CEST)
From: "ed" <ed-no-spam@192.168.55.2.invalid>
Subject: Petrol
Message-Id: <cDIzMTA=.61cfeb0bda0734a92e45300659ab9e03@1116540779.nulluser.com>
Does sniff anyone petrol to like?
I like surely sniff to petrol. Drug favourite mine of is. It safer,
is safe drugs any: cocaine, hash, heroin, codeine. This me left health
good in, fire for look out should you careful be. Years and no effects
adverse 20 it have do been. Expensive even more now is it, cocaine it
still cost not as, neither vicodin. I re-soaked rag just my now --
fact in-----
------------------------------
Date: Thu, 19 May 2005 15:51:25 -0700
From: blazing laser <none>
Subject: Re: Petrol
Message-Id: <826q819vmq1c19hndvopf6lh6odo35nsut@4ax.com>
On Fri, 20 May 2005 00:12:59 +0200 (CEST), "ed"
<ed-no-spam@192.168.55.2.invalid> wrote:
>Does sniff anyone petrol to like?
>
>I like surely sniff to petrol. Drug favourite mine of is. It safer,
>is safe drugs any: cocaine, hash, heroin, codeine. This me left health
>good in, fire for look out should you careful be. Years and no effects
>adverse 20 it have do been. Expensive even more now is it, cocaine it
>still cost not as, neither vicodin. I re-soaked rag just my now --
>fact in-----
>
(I'd like to see this guy! I bet he lives in a swamp, is about 3 ft.
tall, all wrinkled and wizened, and has green skin and pointy ears.)
------------------------------
Date: Thu, 19 May 2005 22:51:29 GMT
From: "Tommy Kendricks" <tken@socal.rr.com>
Subject: Re: Petrol
Message-Id: <RL8je.19080$J12.16963@newssvr14.news.prodigy.com>
Another Bush supporter chimes in
"ed" <ed-no-spam@192.168.55.2.invalid> wrote in message
news:cDIzMTA=.61cfeb0bda0734a92e45300659ab9e03@1116540779.nulluser.com...
> Does sniff anyone petrol to like?
>
> I like surely sniff to petrol. Drug favourite mine of is. It safer,
> is safe drugs any: cocaine, hash, heroin, codeine. This me left health
> good in, fire for look out should you careful be. Years and no effects
> adverse 20 it have do been. Expensive even more now is it, cocaine it
> still cost not as, neither vicodin. I re-soaked rag just my now --
> fact in-----
>
>
------------------------------
Date: 19 May 2005 19:15:28 -0400
From: Robert de Vincy <rxdxv@talk21.com>
Subject: Re: Petrol
Message-Id: <Xns965C3340755Drdv@216.128.74.13>
blazing laser did write:
> ed wrote:
>
>> Does sniff anyone petrol to like?
>>
>> I like surely sniff to petrol. Drug favourite mine of is. It safer,
>> is safe drugs any: cocaine, hash, heroin, codeine. This me left he
>> health good in, fire for look out should you careful be. Years and
>> no effects adverse 20 it have do been. Expensive even more now is
>> it, cocaine it still cost not as, neither vicodin. I re-soaked rag
>> just my now -- fact in-----
>
> (I'd like to see this guy! I bet he lives in a swamp, is about 3 ft.
> tall, all wrinkled and wizened, and has green skin and pointy ears.)
Grampa Shrek?
--
BdeV
"This isn't alt.digitiser, it isn't even son of alt.digitiser, it's
_the_ ADS."
-- Chris Young in <3D6969A2.MD-1.4.16.chris@amiga.org>
------------------------------
Date: Fri, 20 May 2005 00:17:50 GMT
From: "~xy~" <Beach121@cyber-rights.net>
Subject: Re: Petrol
Message-Id: <O0aje.1417673$Xk.1036543@pd7tw3no>
You just haven't lived until you've smoked it in a crack pipe mixed 50/50
with ether...
------------------------------
Date: Fri, 20 May 2005 02:00:19 +0200
From: Richard Bennett <richard.bennett@nospam.skynet.be>
Subject: Re: semi-opacity with GD
Message-Id: <428d2890$0$16290$ba620e4c@news.skynet.be>
Sisyphus wrote:
> use warnings;
> my $im2 = newFromPng GD::Image('top.png', 1);
> $im2->saveAlpha(1);
> $im2->alphaBlending(0);
>
> my $alpha_val = (70 & 0x7f) << 24;
> for my $x(0..$xsize-1) {
> for my $y(0..$ysize-1) {
> $index = $im2->getPixel($x,$y);
> $index |= $alpha_val;
> $im2->setPixel($x,$y,$index);
> }
> }
>
> open(PNG2, ">opacity2.png") or die "Can't open opacity2.png for writing:
> $!";
> binmode PNG2;
> print PNG2 $im2->png;
> close(PNG2) or die "Can't close opacity2.png after writing: $!";
>
> __END__
Hi,
Thanks a lot for that. It looks like your code should work, but it doesn't
for me...
Firstly it seems that $xsize and $ysize are not actually being set
anywhere... I added:
($xsize,$ysize) = $im2->getBounds();
but it still didn't work...
The PNG is being output OK, it's not translucent though.
The idea is that this PNG is positioned over another image in an HTML page,
and the other image will show through the translucent PNG.
This is a test.html page:
<html><body>
<img style="position:absolute;left:0px;top:0px;" src="/map.png" />
<img style="position:absolute;left:0px;top:0px;" src="opacity2.png" />
</body></html>
if you use the original light-blue square I had, you will see map.png (or
any image you put in as background) will show through the blue square
faintly.
Here's an example of a translucent PNG:
http://marginalhacks.com/Hacks/album/Themes/OldPhoto/Overlay.1.png
It looks like your code does what I want, but it doesn't seems to work...
Thanks again for your help,
Richard.
------------------------------
Date: Fri, 20 May 2005 11:47:54 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: semi-opacity with GD
Message-Id: <428d41c8$0$4658$afc38c87@news.optusnet.com.au>
"Richard Bennett" <richard.bennett@nospam.skynet.be> wrote in message
news:428d2890$0$16290$ba620e4c@news.skynet.be...
> Sisyphus wrote:
>
> > use warnings;
> > my $im2 = newFromPng GD::Image('top.png', 1);
> > $im2->saveAlpha(1);
> > $im2->alphaBlending(0);
> >
> > my $alpha_val = (70 & 0x7f) << 24;
> > for my $x(0..$xsize-1) {
> > for my $y(0..$ysize-1) {
> > $index = $im2->getPixel($x,$y);
> > $index |= $alpha_val;
> > $im2->setPixel($x,$y,$index);
> > }
> > }
> >
> > open(PNG2, ">opacity2.png") or die "Can't open opacity2.png for writing:
> > $!";
> > binmode PNG2;
> > print PNG2 $im2->png;
> > close(PNG2) or die "Can't close opacity2.png after writing: $!";
> >
> > __END__
>
> Hi,
> Thanks a lot for that. It looks like your code should work, but it doesn't
> for me...
> Firstly it seems that $xsize and $ysize are not actually being set
> anywhere... I added:
> ($xsize,$ysize) = $im2->getBounds();
>
Serves me right for cutting and pasting .... and *then* altering. I always
think that I can do that correctly .... but I often fail. (Sorry 'bout
that - I should know better.)
> but it still didn't work...
> The PNG is being output OK, it's not translucent though.
> The idea is that this PNG is positioned over another image in an HTML
page,
> and the other image will show through the translucent PNG.
> This is a test.html page:
> <html><body>
> <img style="position:absolute;left:0px;top:0px;" src="/map.png" />
> <img style="position:absolute;left:0px;top:0px;" src="opacity2.png" />
> </body></html>
>
How about, instead of creating the overlay as a file, you create it on the
fly - which, I think, is what you wanted to do anyway:
use warnings;
my $im2 = newFromPng GD::Image('top.png', 1);
$im2->saveAlpha(1);
$im2->alphaBlending(0);
($xsize,$ysize) = $im2->getBounds();
my $alpha_val = (70 & 0x7f) << 24;
for my $x(0..$xsize-1) {
for my $y(0..$ysize-1) {
$index = $im2->getPixel($x,$y);
$index |= $alpha_val;
$im2->setPixel($x,$y,$index);
}
}
binmode STDOUT;
print "Content-type: image/png\n\n";
print $im2->png;
__END__
The aim, as I now understand it, is to display top.png as a translucent
overlay. You probably can't do that by using "opacity2.png" - instead you
need to create the image on the fly (as per your original script). Hopefully
the above does that ... I'm curious now ... so I'll probably get around to
firing up my web server so that I can see for myself.
Cheers,
Rob
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 8097
***************************************