Skip Menu |

This queue is for tickets about the Spreadsheet-WriteExcelXML CPAN distribution.

Report information
The Basics
Id: 60256
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcelXML

People
Owner: Nobody in particular
Requestors: justincase [...] yopmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.11
Fixed in: (no value)



Subject: POD for write_url() should switch order of arguments $string and $format
Currently, the documentation for write_url() lists the arguments as "write_url($row, $col, $url, $format, $string, $tip)". This would seem to imply that if I wanted to give a label for the link ($string), but not a format ($format), I could do "write_url($row, $col, $url, undef, $string)". But that does not work. Although there is a provision in the code that allows the two arguments to be switched, that only works if the $format is defined. Instead, the documentation should be changed to be consistent with the write_url() function in Spreadsheet::WriteExcel, "write_url($row, $col, $url, $label, $format)", which correctly indicates that the label should be given *before* the format. This works whether or not a $format is given. Indeed, when you look at the source code of Spreadsheet::WriteExcelXML::Worksheet, the argument parsing initially parses argument 3 as $string and argument 4 as $format; only swapping them if argument 3 is a Format object (which won't work for undef).
On Wed Aug 11 16:22:03 2010, justincase wrote: Show quoted text
> Currently, the documentation for write_url() lists the arguments as > "write_url($row, $col, $url, $format, $string, $tip)". This would seem > to imply that if I wanted to give a label for the link ($string), but > not a format ($format), I could do "write_url($row, $col, $url, undef, > $string)". But that does not work. Although there is a provision in the > code that allows the two arguments to be switched, that only works if > the $format is defined. > > Instead, the documentation should be changed to be consistent with the > write_url() function in Spreadsheet::WriteExcel, "write_url($row, $col, > $url, $label, $format)", which correctly indicates that the label should > be given *before* the format. This works whether or not a $format is
given. Show quoted text
> > Indeed, when you look at the source code of > Spreadsheet::WriteExcelXML::Worksheet, the argument parsing initially > parses argument 3 as $string and argument 4 as $format; only swapping > them if argument 3 is a Format object (which won't work for undef).
Hi, The write_url() method predates the Excel option of adding a label. As such the first published API for write_url(), as part of Spreadsheet::WriteExcel, was: write_url($row, $col, $url, $format); Thus when the label option was added it had to be added at the end: write_url($row, $col, $url, $format, $label); However, since it was more likely that people would want to add a label rather than a format (when that option became available) I added and internal option to reverse the arguments so that it could be written: write_url($row, $col, $url, $label); At least that is how I think it happened. It is 7 or 8 years since I wrote that part of the code. And since there haven't been any other objections in that time I'll just leave the API and the documentation stand as is. John. --
Closing this issue for the reasons given in the RT system and since there were no objections. John. --