Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use v5.14;
- use strict;
- use warnings;
- use Data::Dumper;
- my $wbuf=3;
- my $wtr;
- print "start $wbuf\n";
- $wtr = sub {
- my $done_cb = shift;
- my $mbuf=$wbuf;
- print "done_cb2 ".Dumper($done_cb);
- print "wtr3 ".Dumper($wtr);
- $wbuf--;
- print "cb $wbuf $mbuf\n";
- if ( $wbuf ) {
- print "cb wbuf\n";
- $wtr->($done_cb);
- } else {
- print "cb undef\n";
- print "wtr4 ".Dumper($wtr);
- undef $wtr;
- print "wtr5 ".Dumper($wtr);
- $done_cb->();
- print "wtr7 ".Dumper($wtr);
- print "after exit\n";
- }
- print "return wtr\n";
- print "cb $wbuf $mbuf\n";
- };
- print "wtr1 ".Dumper($wtr);
- $wtr->(
- sub {
- my $done_cb = shift;
- print "done_cb6 ".Dumper($done_cb);
- print "exit $wbuf\n";
- }
- );
- print "stop\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement