Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: variable scopes in Excel::Writer::XLSX

by AnomalousMonk (Abbot)
on May 25, 2013 at 19:05 UTC ( #1035273=note: print w/ replies, xml ) Need Help??


in reply to Re^2: variable scopes in Excel::Writer::XLSX
in thread variable scopes in Excel::Writer::XLSX

If you look at this code...

By "this code", I assume you mean the code posted at the end of the Re^2: variable scopes in Excel::Writer::XLSX node, and that this code is all that is needed to produce the error you describe. (I'm not in a position right now to run the code; all I can do is literally 'look' at it.)

... I see no reason that the one extra assignment should cause an error.

Nor do I. The  $closure_workbook variable is never touched except to assign it a value in certain circumstances. It is never otherwise accessed within  func() and no other function than  func() can possibly access this lexical variable (unless there's something you're not showing us). The next step is to eliminate the
    if (@_) {
        $closure_workbook = $book;
    }
block of code (leaving the  my $closure_workbook; statement just for grins) and see if the error still occurs. My bet is it will. This means the root cause of your problem is entirely unconnected to anything you're doing with this 'closure' variable.

For a while, I had my suspicions about the  &func(@ARGV); ampersand invocation of  func(), but I can't see this has any relevance.

Update: Oops... Should have refreshed the thread before posting. I see from Re^4: variable scopes in Excel::Writer::XLSX that the problem is resolved. At any rate, the problem had, indeed, nothing to do with anything that was happening with the 'closure' variable.


Comment on Re^3: variable scopes in Excel::Writer::XLSX
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1035273]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-12-20 18:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls