[26761] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8836 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 7 03:05:39 2006

Date: Sat, 7 Jan 2006 00:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 7 Jan 2006     Volume: 10 Number: 8836

Today's topics:
    Re: calling subroutine , name derived from variable <samwyse@gmail.com>
    Re: calling subroutine , name derived from variable <samwyse@gmail.com>
    Re: calling subroutine , name derived from variable <sdn.girths00869@zoemail.net>
    Re: GD - way to preserve PNG transparency? <wdr@TheWorld.com>
    Re: globbing files with spaces in the path <news@lawshouse.org>
    Re: globbing files with spaces in the path <usenet739_yahoo_com_au>
    Re: Line gives syntax error (Anno Siegel)
    Re: The Question headers vs. the Answer content <samwyse@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 07 Jan 2006 00:54:57 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: calling subroutine , name derived from variable
Message-Id: <BjEvf.10718$oW.5826@newssvr11.news.prodigy.com>

Tad McClellan wrote:
> Madhu Ramachandran <madhuram@nortel.com> wrote:
> 
>>Thank you very much for the help.
> 
> You are not fooling anyone.
> 
> If you truly were thankful, then you would follow the quoting
> conventions that folks expect here (and nearly everywhere else too).

I personally consider top-posting forgivable for a simple thank-you, 
since the preceding conversational context isn't needed to understand 
what's going on.

Full-quoting, OTOH, is definitely evil.


------------------------------

Date: Sat, 07 Jan 2006 01:05:49 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: calling subroutine , name derived from variable
Message-Id: <NtEvf.10721$oW.6362@newssvr11.news.prodigy.com>

axel@white-eagle.invalid.uk wrote:

> no strict;
> my $ret = eval(&$method ($aa));
> 
> use strict;

Or even (arguably) better:

my $ret = do { no strict; eval(&$method ($aa)); };


------------------------------

Date: Fri, 06 Jan 2006 21:02:52 -0600
From: "Eric J. Roode" <sdn.girths00869@zoemail.net>
Subject: Re: calling subroutine , name derived from variable
Message-Id: <Xns9743E0D93714sdn.comcast@216.196.97.136>

axel@white-eagle.invalid.uk wrote in
news:Ttxvf.21305$iz3.6947@text.news.blueyonder.co.uk: 

> Try:
> 
> #!/usr/local/bin/perl
> 
> use strict;
> use warnings;
> 
> my $method="aSub";
> my $aa= 'bla';
> 
> no strict;
> my $ret = eval(&$method ($aa));
> 
> use strict;
> print "ret = ", $ret "\n";
> 
> sub aSub() { 
>   my $arg1 = shift;
>   print "inside aSub, arg1=", $arg1, "\n");
>   return 1;
> }


Did *you* try it?

Please, don't post code unless you really know that it works.
Test first.

-- 
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`


------------------------------

Date: Fri, 06 Jan 2006 23:18:45 -0500
From: Bill Ricker N1VUX <wdr@TheWorld.com>
Subject: Re: GD - way to preserve PNG transparency?
Message-Id: <43BF4125.7AB1CE03@TheWorld.com>

Kirk Is [who gets a couresy BCC:] wrote:
> So I'm trying to load a PNG with transprency...
 %<snip
> but it always prints -1

Interesting.  I haven't tried that, but I ought to play with transparency.

What verion of Perl GD:: modules are you using?

What version of the underlying GD libraries are you using? 
(bgd.dll or libgd.so&.lib or whatever; libpng.lib also)

Where does the PNG with transparency come from?  Which kinds of pallete and
transparency does it have? There are a large number of possibilities.  If you
repeat the problem with one of the published test images, that might help.
(see below)

Boutell reports that as of gd 2.0.26, an issue with Binary Transparency was
fixed.
 http://www.boutell.com/gd/

> I think, confusing the issue, there might be two "blacks" in the palette,
> one use in the image, and one to set the transperency...

That could be a problem, haven't tried that.  Having the same RGB in the
palette of the input image twice could indeed be an error.  Where did the
image come from?
 
Besides checking for uptodate libraries, I'd suggest getting some test images
designed for transparency and see how they work.  
 http://images.google.com/images?q=transparency%20png
 http://entropymine.com/jason/testbed/pngtrans/


Cheers,

Bill
use.perl.org/~n1vux


------------------------------

Date: Sat, 07 Jan 2006 00:11:37 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: globbing files with spaces in the path
Message-Id: <1136592698.16714.0@iris.uk.clara.net>

robic0 wrote:
> Some of your program constructs truly suck. I'ts hard to cut and past
> with ratioanal. I suggest 

Scott, this robic fellow is really unpleasant.  Don't take any notice of 
him.

Have you tried debugging this with "perl -d"?  Look:

> F:\WIP>perl -d testng.pl "C:\wip\a b\*.txt"

> main::(testng.pl:12):   my @files;
>   DB<1> n
> main::(testng.pl:13):   while (@ARGV) {
>   DB<1> x @ARGV
> 0  'C:\\wip\\a b\\*.txt'
>   DB<2> n
> main::(testng.pl:14):      push @files, glob(shift @ARGV);
>   DB<2> n
> main::(testng.pl:18):   my ($dirname, $basename);
>   DB<2> x @files
> 0  'C:./wipa'

If I were you I'd not mess about trying to work out why glob is doing 
what it is.  Personally I've found glob to be a bit unpredictable from 
time to time and generally prefer readdir or maybe File::Find.   Or 
maybe separate out the path and the filespec from @ARGV and change to 
the directory separately from globbing the filespec.

-- 

Henry Law       <><     Manchester, England


------------------------------

Date: Sat, 7 Jan 2006 18:42:46 +1100
From: "Scott Bass" <usenet739_yahoo_com_au>
Subject: Re: globbing files with spaces in the path
Message-Id: <43bf70f8$0$15806$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

"Henry Law" <news@lawshouse.org> wrote in message 
news:1136592698.16714.0@iris.uk.clara.net...
> robic0 wrote:
>> Some of your program constructs truly suck. I'ts hard to cut and past
>> with ratioanal. I suggest
>
> Scott, this robic fellow is really unpleasant.  Don't take any notice of 
> him.
>
> Have you tried debugging this with "perl -d"?  Look:
>
>> F:\WIP>perl -d testng.pl "C:\wip\a b\*.txt"
>
>> main::(testng.pl:12):   my @files;
>>   DB<1> n
>> main::(testng.pl:13):   while (@ARGV) {
>>   DB<1> x @ARGV
>> 0  'C:\\wip\\a b\\*.txt'
>>   DB<2> n
>> main::(testng.pl:14):      push @files, glob(shift @ARGV);
>>   DB<2> n
>> main::(testng.pl:18):   my ($dirname, $basename);
>>   DB<2> x @files
>> 0  'C:./wipa'
>
> If I were you I'd not mess about trying to work out why glob is doing what 
> it is.  Personally I've found glob to be a bit unpredictable from time to 
> time and generally prefer readdir or maybe File::Find.   Or maybe separate 
> out the path and the filespec from @ARGV and change to the directory 
> separately from globbing the filespec.
>
> -- 
>
> Henry Law       <><     Manchester, England

Hi Henry,

Thanks for the positive comment re: robic.  I pretty much expect to be 
abused by someone whenever I post to c.l.p.m.  Unfortunately I don't work 
with Perl enough to get as good as I would like (love the language though). 
I do my best to read my O'Reilly books and check the doc before I post.

Your and other's comments about glob unpredictability triggered an idea 
about where to look in the doc.  This seems to have fixed the issue:

use File::Glob ':glob';

# glob files specified on the command line
my @files;
while (@ARGV) {
   push @files, bsd_glob(shift @ARGV);
}

It's important that the end user be able to specify something like this on 
the command line:

test.pl "C:\A Path\*.foo" C:\Path\*.bar "C:\Another Path\*.blah"

and all the files get processed.

Lastly, I want to configure this script as a custom action in Windows 
Explorer (say I call it "Batch Submit"), such that RMB --> "Batch Submit" 
executes the script against the file in question.  In that scenario, %1 is 
the full path of the file that was RMB'd, so Gunnar's idea of 
"C:\APATH~1\WITHSP~1\INIT~1\*.txt" wouldn't work.  (I'll have to use pl2bat 
to convert the script to a .bat file).

If I can do the above (process command line wildcards) using opendir and 
readdir, could someone post a code snippet?

Thanks again,
Scott 




------------------------------

Date: 7 Jan 2006 00:06:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Line gives syntax error
Message-Id: <dpn0lf$n6g$1@mamenchi.zrz.TU-Berlin.DE>

Ian Wilson  <scobloke2@infotop.co.uk> wrote in comp.lang.perl.misc:
> Marshall Dudley wrote:
> > Anno Siegel wrote:
> > 
> > 
> >>You don't have to *echo* the passcode to get it into gpg's stdin. Untested:
> >>
> >>    open my $gpg, "| gpg $options $filename" or die;
> >>    print $gpg $passcode;
> >>    close $gpg or die;
> >>
> >>is much safer.
> > 
> > 
> > That does work, except I had to take the die out of the close statement. I had
> > changed it to 'close $gpg or die print "$! closing gpg";'
> 
> Wrong syntax, that should be
>    close $gpg or die "$! closing gpg";

Yes, though $? is usually the variable you want to inspect after close().
It holds the return code of the command (see perlvar for details).

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: Sat, 07 Jan 2006 01:14:03 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: The Question headers vs. the Answer content
Message-Id: <vBEvf.10724$oW.4388@newssvr11.news.prodigy.com>

robic0 wrote:
> IS THIS ALL THIS NEWSGROUP IS?

Yes.


------------------------------

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 8836
***************************************


home help back first fref pref prev next nref lref last post