Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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

by AnomalousMonk (Chancellor)
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1035273]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-06-23 07:20 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.