in reply to Re^3: Global variables issue in spreadsheets
in thread Global variables issue in spreadsheets
Thanks for the detailed comments. Please see my response below
Does your require line in main.pl use the full path to config.pl? I may be wrong, but I believe it should.
Comment:This part is extracted from a working project. For simplicity I gave you the piece of code that is broken. The path is fine
From what directory do you execute main.pl?
Comment:Both the scripts are in the same directory and I execute the code from the same directory
Please clarify your statement about using my <$var names>. Do you mean you're not using the config.pl and declaring my $workbook and my $worksheet in main.pl or something else?
Comments: Yes you are right I am not using the config.pl and instead declaring within main.pl. Sorry I was saving space in the initial post but ended up not giving too many details.
Since the code you've shown matches what's in the doc for my copy of S::WE (with the minor exception -- at line 15 -- of providing "0" values directly instead of by assigning "0" values to $col and $row), the possibilities include: Borked installs for both copies (you do have two, right?) of S:WE (a longshot, IMO) Something you haven't shown/told us (see my prior questions)
You might also want to look at lines around 1545-1546 in Workbook.pm to see if that section of the code provides any clues.
I checked the code and it breaks in these statements next unless $sheet->{_sheet_type} == 0x0000; next unless $sheet->_prepare_images(); I tried to print these two values and it is '0' both while using config.pl and while using the 'my variable'.
Update: And why, except for the sake of a learning experience, are you using a separate config.pl merely to declare two stock variables? That seems to me more than just a few degrees off vertical; an unnecessary bit of complexity or mis-direction.
Comment: I have a bigger working project and I am just introducing the spread sheet into it. So I need the global variable working since it will be used by other files and other processes also which will have access to the config file.
|
|---|