Re: blocks going out of scope

2002-10-12 Thread Paul Johnson
On Sat, Oct 12, 2002 at 02:27:09PM +0100, Nicholas Clark wrote:

> If you're the programmer, you can do something at end of scope by placing
> a local object in the scope, and have its DESTROY method do cleanup.
> 
> Can anyone think of a reliable, non-source filter way of attaching such a
> destructor method onto the scope of your caller?

I've been asking myself similar questions recently, and I've not been
able to come up with anything that doesn't involve messing about with
the op tree.

It seems that what's needed is the equivalent of Perl 6's FIRST and LAST
blocks, coupled with the ability to atatch these to arbitrary blocks.

I have a patch against bleadperl which adds support for a C callback
when a CV is destroyed, ie just before the op tree is reclaimed.  From
there it is a simple matter to call a Perl function, and this is enough
to scratch my particular itch (code coverage of BEGIN blocks).  The
patch still needs a little work, or maybe a complete rework before I
decide whether to submit it.  I had wondered whether something more
general might be more useful, but I haven't really thought through all
the issues at a Perl level.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: blocks going out of scope

2002-10-12 Thread Adrian Howard

On Saturday, October 12, 2002, at 02:27  pm, Nicholas Clark wrote:

[snip]

Can anyone think of a reliable, non-source filter way of attaching such a
destructor method onto the scope of your caller?

[snip]

Taking a look at the source for Hook::Scope might give some pointers.

(You didn't say non-XS :-)

Adrian





Re: blocks going out of scope

2002-10-12 Thread Dave Hinton at home
On Saturday 12 October 2002 2:27pm, Nicholas Clark wrote:

> Basically, I'm wanting to be able to write a subroutine skip that can be
> called unknowingly like this:
>
> {
>   ... # stuff
>   skip ("innocent parameter of some sort");
>   ... # more stuff
> } # X
>
> and have skip hang some sort of call back that fires when the scope marked
> with X exits.

Depends what you mean by "innocent parameter of some sort".


If you mean that you can arrange for it always to be invoked like

skip (my \$dinner);

then easy, you just say

sub skip {
$_[0] = new Callback sub { # write Callback.pm yourself :-)
# do whatever needs to be done in the callback
};
}


If you can't arrange for skip() to be called like that, maybe you could use 
B::Utils and B::Generate to add in that extra first parameter yourself?

Warning: I really don't know whether or not it's feasible.  But even if it 
is, it still looks very hairy


-- 
\|/GET| Dave Hinton
-/SOME| Battersea, London, England 
/SLEEP| http://thereaction.co.uk/dah




Re: Perl magazines

2002-10-12 Thread Piers Cawley
brian d foy <[EMAIL PROTECTED]> writes:

> On Mon, 7 Oct 2002, Greg McCarroll wrote:
>
>> Excellent, before I buy 2+ subscriptions is there a way I could buy 1
>> subscription but have it cost more? I warn the organisers that if they
>
> you can always donate more money to me :)
>
> TPJ's survival is far from certain though, according to my chat with their
> editors today.  they need 3000 subscribers and have slightly less than
> 1000, and only one month to go.  if you want to see it survive, subscribe
> now rather than later.

I am buggered if I'm going to subscribe to the website and give 'em
*more* money when my original subscription to the Perl Journal still
has some months to run. I've had *no* reply to my mail about this from
the TPJ people.

-- 
Piers

   "It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
 -- Jane Austen?




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread the hatter
On Sat, 12 Oct 2002, Greg McCarroll wrote:

>   "see, i told you to take vitamin C every day, i took
>it and i'm fine"
>
> reminds me of some crazed nobel laureate, pauling perhaps, who used to
> suggest that vitamin C was the cure for everything. common cold - take
> more vitamin C, heart disease - up the dose, cancer - not problem take
> even more vitamin C, just had your arm chopped off in an industrial
> accident - you guessed, even more vitamin C.

Yup, that was the other famous linus.  Possibly these days he's the second
most famous.

> as for the t-shirts how about "tom cruise is gay"[1], after all its shorter
> than, "tom cruise is gay and his marriage to nicole kidman was a PR
> conspiracy arranged by those f*ckers in the church of scientology"

But that's not true, his marriage to nicole kidman was a conspiracy
arranged by the CoS to prevent me from marrying nicole.

> btw, i wonder if you can order cough medicine in litre bottles, its
> good stuff *hic*

Some good italian dessert wine is a reasonable facsimile of benylin
expectorant.  Although not quite a gloopy, or as colourful.  It's about
the only wine that I ever drink though, and even then, they serve it in
tiny glasses, and the bottles tend to be smaller than normal wine bottles.


the hatter





blocks going out of scope

2002-10-12 Thread Nicholas Clark
If you're the programmer, you can do something at end of scope by placing
a local object in the scope, and have its DESTROY method do cleanup.

Can anyone think of a reliable, non-source filter way of attaching such a
destructor method onto the scope of your caller?

Basically, I'm wanting to be able to write a subroutine skip that can be
called unknowingly like this:

{
  ... # stuff
  skip ("innocent parameter of some sort");
  ... # more stuff
} # X

and have skip hang some sort of call back that fires when the scope marked
with X exits.

Nicholas Clark
-- 
Even better than the real thing:http://nms-cgi.sourceforge.net/




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread Greg McCarroll
* the hatter ([EMAIL PROTECTED]) wrote:
> On Sat, 12 Oct 2002, Nicholas Clark wrote:
> > Greg, get well soon. I think it will be to everyone's benefit :-)
> 
> So you think it's worth holding off the order for the 'common sense is
> gay' t-shirts, to see if we need to order one in his size ?
> 

It wouldn't be so bad if my wife didn't chirp in every few hours with the 
line,

"see, i told you to take vitamin C every day, i took
 it and i'm fine"

reminds me of some crazed nobel laureate, pauling perhaps, who used to
suggest that vitamin C was the cure for everything. common cold - take
more vitamin C, heart disease - up the dose, cancer - not problem take
even more vitamin C, just had your arm chopped off in an industrial
accident - you guessed, even more vitamin C.

the guy was taking 20g's of the stuff daily before he died. vitamin
C overdose probably. anyway he probably was right and the drug companies
probably spent the cash to discredit him.

as for the t-shirts how about "tom cruise is gay"[1], after all its shorter
than, "tom cruise is gay and his marriage to nicole kidman was a PR
conspiracy arranged by those f*ckers in the church of scientology"

btw, i wonder if you can order cough medicine in litre bottles, its
good stuff *hic*

Greg

[1] if you need any evidence just look at Top Gun.

-- 
Greg McCarroll http://www.mccarroll.org.uk/~gem/
   jabber:[EMAIL PROTECTED]




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread the hatter
On Sat, 12 Oct 2002, Nicholas Clark wrote:

> Then again, he must be ill, because he's suggesting common sense. I'm sure
> this insanity will pass, and we'll soon be back to the normal madness.
>
> Greg, get well soon. I think it will be to everyone's benefit :-)

So you think it's worth holding off the order for the 'common sense is
gay' t-shirts, to see if we need to order one in his size ?


the hatter





Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread Nicholas Clark
I'm going to quote all of this (bugger my rating on Greg's signal to noise
stats) [Oh, and hi to everyone whose corporate nanny filters will now bounce
my message. Remember, folks, Middlesex is a county, Scunthorpe a town in
Lincolnshire, slag is a by-product of iron making, and one use of bloody is
as an adjective related to blood]

Oh, oops. I digressed. I'm going to quote all of this because it's useful,
er, and hard to snip effectively:

On Sat, Oct 12, 2002 at 08:18:21AM +0100, Greg McCarroll wrote:
> Please don't be using common sense it will spoil all the best
> arguments on the list and on IRC. If you use this common sense thing,
> the next thing you know, people will be saying things like "yes, you
> prefer foo and i prefer bar, thats like a difference of opinion and we
> can live with that and not rant at each other for 3 hours on IRC".
> 
> Never again will we have the pointless arguments that have defined
> #london.pm for the last 2 years, people will just agree that fox
> hunting is stupid barbarism as opposed to adopting stances on the
> argument based on their stances in the fastseduction argument a
> few minutes previously.
> 
> It will be a terrible future, full of progress and a severe lack
> of dancing monkeys arguing about buckets.
> 
> ;-)
> 
> Greg
> 
> p.s. I apologise for all posts over the next few days, as I shall
> be OD'ing on cough medicine.


On Sat, Oct 12, 2002 at 10:45:15AM +0100, Lusercop wrote:
> On Sat, Oct 12, 2002 at 10:40:57AM +0100, Greg McCarroll wrote:
> > have set up their mail/news readers to use proportional fonts. Hence
> > identifying them as the sort of people who deserve to be irked ;-)
> 
> ``Watch those monkeys dance''

No, no, no. Don't give Greg ideas. :-)

It would seem that he's currently at home, recovering from illness, and I'd
guess somewhat down, so suggesting ways to make the monkeys dance more is not
good, as he might go for it.

Then again, he must be ill, because he's suggesting common sense. I'm sure
this insanity will pass, and we'll soon be back to the normal madness.

Greg, get well soon. I think it will be to everyone's benefit :-)

Nicholas Clark
-- 
Even better than the real thing:http://nms-cgi.sourceforge.net/




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread Lusercop
On Sat, Oct 12, 2002 at 10:40:57AM +0100, Greg McCarroll wrote:
> have set up their mail/news readers to use proportional fonts. Hence
> identifying them as the sort of people who deserve to be irked ;-)

``Watch those monkeys dance''

-- 
Lusercop.net - LARTing Lusers everywhere since 2002




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread Greg McCarroll
* Lusercop (`the.lusercop'@lusercop.net) wrote:
> But Dave's common sense would say that it's not too bad, indeed, unlike
> the silly ascii art above. ;-)
> 

Silly ASCII art should always be encouraged as it irks people who
have set up their mail/news readers to use proportional fonts. Hence
identifying them as the sort of people who deserve to be irked ;-)

Greg

-- 
Greg McCarroll http://www.mccarroll.org.uk/~gem/
   jabber:[EMAIL PROTECTED]




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread Lusercop
On Sat, Oct 12, 2002 at 08:23:45AM +0100, Greg McCarroll wrote:
> i don't think that .sig was really that objectional, it was started
> correctly with the '-- ' and was 5 lines long, i seem to recall the
> recommended length is 4 lines long, but i'm sure noone will object
> that strongly.

I don't object to the length, I just think it looks unbelievably ugly.
  .
 / \
/ . \
   /  |  \
  /  /|   \
 '-`
[  Warning:  ]
[Thread merge]
[  3 lines   ]

But Dave's common sense would say that it's not too bad, indeed, unlike
the silly ascii art above. ;-)

-- 
Lusercop.net - LARTing Lusers everywhere since 2002




Re: SIG: Apology - Plea: A funky deparse? (fwd)

2002-10-12 Thread Greg McCarroll
* Rafiq Ismail ([EMAIL PROTECTED]) wrote:
> Apologies for the large sig. I've been omitting it when submitting to
> lists from this account. Forgot this time. Deepest apologies to your
> inboxes and mailfilters.
> 

i don't think that .sig was really that objectional, it was started
correctly with the '-- ' and was 5 lines long, i seem to recall the
recommended length is 4 lines long, but i'm sure noone will object
that strongly.

Greg

-- 
    __  __    _ _ 
 / ___|_ __ ___  __ _  |  \/  | ___ / ___|__ _ _ __ _ __ ___ | | |
| |  _| '__/ _ \/ _` | | |\/| |/ __| |   / _` | '__| '__/ _ \| | |
| |_| | | |  __/ (_| | | |  | | (__| |__| (_| | |  | | | (_) | | |
 \|_|  \___|\__, | |_|  |_|\___|\\__,_|_|  |_|  \___/|_|_|
|___/ 




Re: Books on london.pm.org (was Re: applying patterns)

2002-10-12 Thread Greg McCarroll
* David Cantrell ([EMAIL PROTECTED]) wrote:
> On Fri, Oct 11, 2002 at 03:58:41PM +0100, Lusercop wrote:
> > On Fri, Oct 11, 2002 at 03:49:27PM +0100, Simon Wilcox wrote:
> > > * Must be a poster to the list
> > > * Or a regular on IRC
> > > * Or a regular at the pub and/or technical meets.
> > OK, how do you judge any of these?
> 
> Matthew, let me introduce you to this thing I found called "common sense".
> 

Please don't be using common sense it will spoil all the best
arguments on the list and on IRC. If you use this common sense thing,
the next thing you know, people will be saying things like "yes, you
prefer foo and i prefer bar, thats like a difference of opinion and we
can live with that and not rant at each other for 3 hours on IRC".

Never again will we have the pointless arguments that have defined
#london.pm for the last 2 years, people will just agree that fox
hunting is stupid barbarism as opposed to adopting stances on the
argument based on their stances in the fastseduction argument a
few minutes previously.

It will be a terrible future, full of progress and a severe lack
of dancing monkeys arguing about buckets.

;-)

Greg

p.s. I apologise for all posts over the next few days, as I shall
be OD'ing on cough medicine.

-- 
Greg McCarroll http://www.mccarroll.org.uk/~gem/
   jabber:[EMAIL PROTECTED]