[27319] in Perl-Users-Digest
Perl-Users Digest, Issue: 9047 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 13 03:06:52 2006
Date: Mon, 13 Mar 2006 00:05:05 -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 Mon, 13 Mar 2006 Volume: 10 Number: 9047
Today's topics:
Re: A Problem With GD <Jeff.Stampes@xilinx.com>
Re: A Problem With GD <rvtol+news@isolution.nl>
Re: A Problem With GD <markem@airmail.net>
Re: A Problem With GD <markem@airmail.net>
Re: A Problem With GD <markem@airmail.net>
Re: Source Code Analyzing <uri@stemsystems.com>
Re: Source Code Analyzing <daniel@QMiC.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 12 Mar 2006 17:23:49 -0700
From: Jeff Stampes <Jeff.Stampes@xilinx.com>
Subject: Re: A Problem With GD
Message-Id: <dv2e2m$p678@xco-news.xilinx.com>
Tassilo v. Parseval wrote:
> The one best suited for Perl golf is of course:
>
> $|--;
<boggle>
------------------------------
Date: Mon, 13 Mar 2006 01:52:34 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: A Problem With GD
Message-Id: <dv2j9m.12o.1@news.isolution.nl>
Tassilo v. Parseval:
> [toggle]
> The one best suited for Perl golf is of course:
> $|--;
Test:
perl -le 'print --$| for (0..20)'
--
Affijn, Ruud
"Gewoon is een tijger."
echo 014C8A26C5DB87DBE85A93DBF |perl -pe 'tr/0-9A-F/JunkshoP cartel,/'
------------------------------
Date: Mon, 13 Mar 2006 01:33:02 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <121a7v648mfi72c@corp.supernews.com>
Abigail wrote:
> Abigail (abigail@abigail.nl) wrote on MMMMDLXXV September MCMXCIII in
>
>
> $var = [1, 0] -> [$var];
>
>
> Abigail
Now that is interesting. I hadn't thought of that one. :-)
------------------------------
Date: Mon, 13 Mar 2006 01:33:49 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <121a80kk7n3g46b@corp.supernews.com>
Uri Guttman wrote:
>>>>>>"r" == robic0 <robic0> writes:
>
>
> r> On 11 Mar 2006 21:20:50 GMT, Abigail <abigail@abigail.nl> wrote:
> >> $var = [1, 0] -> [$var];
> r> meaningless..
>
> perfectly valid and working perl. not for production.
Why not for production. Does it have side effects?
>
> brainless => robic0
>
> and yes i shouldn't be feeding the troll
>
> uri
>
------------------------------
Date: Mon, 13 Mar 2006 01:37:51 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <121a887bsepqmbf@corp.supernews.com>
robic0 wrote:
> On Sun, 26 Feb 2006 12:57:16 +1100, "Sisyphus" <sisyphus1@nomail.afraid.org> wrote:
>
>
> Too bad can't macro in perl, a simple RGB(255,255,255) gets a nice
> 24-bit color register value.
>
> sub RGB { return $red<<16|$green<<8|$blue }
Isn't eval similar in nature to macros in that they can be expanded during
execution? I know - it's not a substitution as in a true define statement - but
generally speaking wouldn't eval equate to a macro? (Not that using evals is a
good thing in most programs. Just wondering.)
------------------------------
Date: Sun, 12 Mar 2006 18:23:48 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Source Code Analyzing
Message-Id: <x7fylnckmz.fsf@mail.sysarch.com>
>>>>> "DZ" == Daniel Zinn <daniel@QMiC.de> writes:
DZ> The main reason is that I want to change the Perl code slightly without
DZ> breaking it's meaning. The B framework is geared to transform Perl code
DZ> without changing the meaning (well, it tries the best). The PPI interface,
DZ> on the otherside is to high-level. For example in 'print "x = $x\n";' PPI
DZ> tells me that there is a double quoted string - and I have to parse the
DZ> string on myself if I want to figure out the x is used inside this string.
DZ> Also the B modules do a much better job in understanding the Perl code
DZ> (they, for example load pm files...)
B:: has its problems too. just thought you should know it. PPI will
allow you to also modify the code and print it out.
DZ> [2]
DZ> this is important, because:
DZ> 8<---------------------------
DZ> sub foo {
DZ> {
DZ> local $x = 5; # line 5
DZ> print $x,"\n"; # line 6
DZ> }
DZ> print "$x\n"; # line 8
DZ> }
DZ> my $bla;
DZ> local $x = 6;
DZ> foo();
DZ> 8<---------------------------
DZ> is transformed into something like:
DZ> localNesting.pl foo 5 main $ x intro
DZ> localNesting.pl foo 6 main $ x used
DZ> localNesting.pl foo 8 main $ x used
DZ> unfortunately, $x in line 8 is not the $x which is introduced in line 5,
DZ> because of the curly braces.
i believe PPI will help you with nesting. for sure it will tell you line
numbers and such. but good luck with either module. i am curious as to
what perl code do you need to parse and why you need to modify the code?
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Sun, 12 Mar 2006 16:16:43 -0800
From: Daniel Zinn <daniel@QMiC.de>
Subject: Re: Source Code Analyzing
Message-Id: <dv2e09$f27$1@newsserver.rz.tu-ilmenau.de>
Uri Guttman schrieb:
By the way, is there someone who has some experience with the B::??? stuff?
> B:: has its problems too. just thought you should know it. PPI will
> allow you to also modify the code and print it out.
Can you think about some specific problems?
except those:
8<---------------------------------------------------------------------------
BEGIN {
eval ( time % 2 ? 'sub foo() { print "foo()\n"; }' :
'sub foo($) { print "foo(".shift.")\n"; }' );
}
foo();
8<---------------------------------------------------------------------------
> i believe PPI will help you with nesting. for sure it will tell you line
> numbers and such.
Yes, it does. PPi is good for the nesting. But it is still _very_ close to
the original source. Well, perhaps I should use PPI - at least I understand
how to use it...
Though I don't like that I have to parse strings on my own, since this can
be very tedious: my $x = 1; my $y = 3; print "well: @{[ $x + $y + 38]} \n";
resolves to PPI::Token::Quote::Double '"well: @{[ $x + $y + 38]} \n"'
whereas B::Xref tells me:
parseStr.pl (main) 4 (lexical) $ x intro
parseStr.pl (main) 4 (lexical) $ y intro
parseStr.pl (main) 5 main $ " used
parseStr.pl (main) 5 (lexical) $ x used
parseStr.pl (main) 5 (lexical) $ y used
parseStr.pl (main) 5 ? @? ? used
though these ? are not very good either :-/
> but good luck with either module. i am curious as to
> what perl code do you need to parse and why you need to modify the code?
It's for a class project. I want to identify functions that can be
bypassed/cached. To do this, I need (besides other stuff) where which
variables a how defined and used and the same for the functions. Well,
based on the grammar above, I have a small Hugs+Perl program that does the
variable usage/definition analysis - but I still need to transform the
program :-/
Daniel
------------------------------
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 9047
***************************************