Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

First, keep in mind that
try { ... } ...
is the same thing as
try sub { ... }, ...
and that's the source of many problems.

$GLOBAL_VARIABLE falls out of scope at the end of the (.pm) file, and before 5.10.0, a reference by an anon sub isn't enough to to keep it alive.

Simplified test case:

use strict; use warnings; { my $f = 'test'; my $g = 'test'; sub f { sub { print "f: $f\n" }->(); } sub g { $g if 0; sub { print "g: $g\n" }->(); } } f(); g();
>perl589\bin\perl test.pl Use of uninitialized value in concatenation (.) or string at test.pl l +ine 9. f: g: test >perl5100\bin\perl test.pl f: test g: test

Note that adding a reference to the captured variable in the named sub — even one that's optimized away — makes it available to the anonymous sub.

A similar problem exists with eval '$s'. While not fixed, a warning was added in 5.10.0.

>perl589\bin\perl -wle"{ my $s='test'; sub f { print 's: ', eval '$s' +} } f()" Use of uninitialized value in print at -e line 1. s: >perl5100\bin\perl -wle"{ my $s='test'; sub f { print 's: ', eval '$s' + } } f()" Variable "$s" is not available at (eval 1) line 2. Use of uninitialized value in print at -e line 1. s:

In reply to Re: global variable initialization inside try{} by ikegami
in thread global variable initialization inside try{} by legova

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [davido]: yeah, umount -f isn't powerful enough.
    [tye]: probably something in the init subsystem that does the mounting that you could disable and reboot.
    davido needs to close laptop to board flight home from yapc.
    [davido]: I'll look into it in a few hours probably.
    [davido]: when i do get to that point I think I'll do it in a vm snapshot just in case. :)
    [oiskuu]: tye, you were right: loginuid/sessionid are part of task struct if compiled with AUDITSYSCALL. I have some doubts if you should actually depend on that feature.
    [Corion]: oiskuu: Depends on what you want to do with that information
    [tye]: I'm not depending on that feature. But I could in this environment. I'm using getlogin(). shrug
    [Corion]: For benign logging (which user started this DB instance), it's OK
    [tye]: We use auditd for security monitoring. So we can rely on auditing being enabled. I'm not sure who would want to not be able to audit. Maybe some VM inside another system with audit?

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2017-06-23 20:09 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      How many monitors do you use while coding?















      Results (555 votes). Check out past polls.