Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Creating Nested Functions

by ikegami (Pope)
on Jul 10, 2008 at 01:42 UTC ( #696592=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    
       inner();
    }
    
  2. or download this
    >perl -c test.pl
    Variable "$foo" will not stay shared at test.pl line 8.
    test.pl syntax OK
    
  3. or download this
    use strict;
    use warnings;
    ...
    
       $inner->();
    }
    
  4. or download this
    >perl -c test.pl
    test.pl syntax OK
    
  5. or download this
    use strict;
    use warnings;
    ...
          $inner->()
       }
    }
    
  6. or download this
    Global symbol "$inner" requires explicit package name at test.pl line 
    +6.
    test.pl had compilation errors.
    
  7. or download this
    use strict;
    use warnings;
    ...
          $inner->()
       }
    }
    
  8. or download this
    >perl -c test.pl
    test.pl syntax OK
    
  9. or download this
    # ReleaseTracker.pm
    
    ...
    sub o { ReleaseTracker->new(); }
    
    1;
    
  10. or download this
    use strict;
    use warnings;
    ...
    outer( o() );
    
    END { print("On program exit:\n"); }
    
  11. or download this
    >perl test.pl
    On program exit:
    Destroyed           <--- BAD!
    
  12. or download this
    use strict;
    use warnings;
    ...
    outer( o() );
    
    END { print("On program exit:\n"); }
    
  13. or download this
    >perl test.pl
    Destroyed
    On program exit:
                        <-- good
    
  14. or download this
    sub outer {
       ...
    ...
       };
       helper(@_);
    }
    
  15. or download this
    sub outer {
       ...
    ...
          }
       } )->(@_);
    }
    
  16. or download this
    sub outer {
       ...
    ...
       weaken($helper);
       $helper->(@_);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://696592]
help
Chatterbox?
[marto]: List EXE_FILES installed by CPAN so a couple of people suggest that your code looks obfuscated. I'd have to ageree, from the perspective of those who can't follow all of that one liner, it doesn't read well
Veltro is a weirdo, obsessed with whitespace
[marto]: to use the word "obsession" when so few people have said so little about it is grasping at staws
marto wishes tye was around, he's so much better at this sort of thing
usemodperl likes tye!
usemodperl tye  too
[choroba]: Re^3: LiBXML: New markup while preserving earlier tags? would benefit from a couple of test cases
usemodperl meant tye&nbsp;
usemodperl pokes Veltro with line noise
usemodperl will try to make better shapes with his line noise, like a camel, or boobs, then it will be called "clever" :-)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2018-06-24 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?