Re: Metaprogramming

2002-12-13 Thread Randal L. Schwartz
> "Steffen" == Steffen Mueller <[EMAIL PROTECTED]> writes: Steffen> Okay, I admit to have relied on an overgeneralized interpretation of Steffen> Randal's post about closures being a problem for B::Deparse. Steffen> I *do*, however, remember B::Deparse failing to deparse some entries Steffen>

Re: grep substitute

2002-12-13 Thread Scott Wiersdorf
On Fri, Dec 13, 2002 at 05:31:35PM -0700, Scott Wiersdorf wrote: > FWPers, > > Pretending your machine did not have e?grep, how concisely could you > duplicate the GNUish "-q" (silent) functionality: stop scanning on > first match and exit(0). If no match, exit(1). > > Extra Credit: > > - is the

grep substitute

2002-12-13 Thread Scott Wiersdorf
FWPers, Pretending your machine did not have e?grep, how concisely could you duplicate the GNUish "-q" (silent) functionality: stop scanning on first match and exit(0). If no match, exit(1). Here's something simple to start with: perl -n0777 exit !(/pattern/) Necessary Improvements: - concisel

Re: fun with regex

2002-12-13 Thread Jeff 'japhy' Pinyan
On Dec 12, Abigail said: >On Thu, Dec 12, 2002 at 12:48:11AM -0500, Jeff 'japhy' Pinyan wrote: >> On Dec 12, Jonathan E. Paton said: >> >> >(my $sql = << '--') =~ s/\A(\s+)(?{$::c = $^N})|^(??{$::c})//gm; >> > >> >all over SQL related source code then your head is on the block! >> >> While it's co

Re: Metaprogramming

2002-12-13 Thread A. Pagaltzis
* Simon Cozens <[EMAIL PROTECTED]> [2002-12-13 14:55]: > Oh no! You mean it'll only work in non-pathological cases? > That's no good! Its inability to deparse a closure such that its bound lexicals and their values can be recreated is sometimes a serious hindrance. It works well enough and then so

Re: Metaprogramming

2002-12-13 Thread Steffen Mueller
Simon Cozens wrote: Steffen Mueller: So any code that uses closures is pathological? [closure being deparsed] Nope, seems not. Okay, I admit to have relied on an overgeneralized interpretation of Randal's post about closures being a problem for B::Deparse. I *do*, however, remember B::De

Re: Metaprogramming

2002-12-13 Thread Simon Cozens
Steffen Mueller: > Okay, I read up on it, but: > "You are expected to have read the Perl and XS sources to this module > before attempting to do anything with it." > > I cannot read XS :) Yeah, it was just a long-term plot to sell more books. -- IBM: It may be slow, but it's hard to us

Re: Metaprogramming

2002-12-13 Thread Steffen Mueller
Simon Cozens wrote: Steffen Mueller: I've been wondering whether it is possible to implement some kind of mechanism that allows a Perl script to modify itself at runtime. B::Generate's been doing this for ages. Okay, I read up on it, but: "You are expected to have read the Perl and XS sourc

Re: Metaprogramming

2002-12-13 Thread Simon Cozens
Steffen Mueller: > So any code that uses closures is pathological? Hmm, let's see: perl -MO=Deparse -e 'my $x; {my $foo = "Hello!"; $x=sub{print $foo};}; $x->()' my $x; { my $foo = 'Hello!'; $x = sub { print $foo; } ; } &$x(); Nope, seems not. -- I detest people who

Re: Metaprogramming

2002-12-13 Thread Steffen Mueller
Simon Cozens wrote: Randal L. Schwartz: "Michael" == Michael G Schwern <[EMAIL PROTECTED]> writes: Michael> Using B::Deparse you can get the source of any running subroutine. Nope, I've given examples of subroutines that cannot currently be accurately deparsed. Oh no! You mean it'll only w

Re: Metaprogramming

2002-12-13 Thread Randal L. Schwartz
> "Michael" == Michael G Schwern <[EMAIL PROTECTED]> writes: >> Nope, I've given examples of subroutines that cannot currently be >> accurately deparsed. Michael> Because of the nature of Perl or because of a mistake in B::Deparse? Not completely sure. The problem is closures, because you e

Re: Metaprogramming

2002-12-13 Thread Simon Cozens
Randal L. Schwartz: > > "Michael" == Michael G Schwern <[EMAIL PROTECTED]> writes: > Michael> Using B::Deparse you can get the source of any running subroutine. > > Nope, I've given examples of subroutines that cannot currently be > accurately deparsed. Oh no! You mean it'll only work in non-