Nicholas Clark wrote:
> 
> On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote:
> 
> >       sub has_post_blocks{
> >               my $i = 3;
> >               post { print "i ended up as $i"};
> >               my $arg1 = shift; $arg1 > 4 or die "arg1 ($arg1) too small";
> >               my $j = 2;
> >               post { print "j ended up as $j"};
> >               ...
> >       };
> >
> > might only print the message about i when arg1 is too small.  This would
> > allow informational messages to be declared at the beginning, for instance.
> >
> > It would be implemented by pushing the post block onto the list of things
> > to do at scope exit, at run time.
> 
> I quite like this idea.  (I certainly like the ability to say "clean up this
> thing at the end of scope whatever exceptions may happen)
> 
> But part of me feels it should be a POST block.
> Because it's behaving much like CHECK or END
> 
> Nicholas Clark


Do you agree that they shouldn't get tacked on until execution passes their
definition, unlike END blocks which get appended when they are parsed?

perl -nle 'print 0; $_ and eval {BEGIN{print 1};END{print 2}}; print 3'

only prints one 1 and one 3.

-- 
                      David Nicol 816.235.1187 [EMAIL PROTECTED]
                           Pedestrians always have the right of way

Reply via email to