I'm the author of Pythonizer, and I'm trying to understand some more code from CGI.pm, specifically:
package CGI::MultipartBuffer;
....
$MultipartBuffer::INITIAL_FILLUNIT ||= 1024 * 4;
...
$INITIAL_FILLUNIT = $MultipartBuffer::INITIAL_FILLUNIT;
What I need to know is the fully qualified names of $MultipartBuffer::INITIAL_FILLUNIT
and $INITIAL_FILLUNIT
as in my interpretation they should both be $CGI::MultipartBuffer::INITIAL_FULLUNIT
but I must be mistaken as otherwise why would the second assignment statement be needed?
CodePudding user response:
$INITIAL_FILLUNIT
isn't declared, so it's a package variable.[1] Since the current package is CGI::MultipartBuffer
, it refers to $CGI::MultipartBuffer::INITIAL_FILLUNIT
.
This means that
$INITIAL_FILLUNIT = $MultipartBuffer::INITIAL_FILLUNIT;
means
$CGI::MultipartBuffer::INITIAL_FILLUNIT = $MultipartBuffer::INITIAL_FILLUNIT;
- This would be forbidden by
use strict;
.