| 
     
      
      
      From: Robert M. <rm...@po...> - 2005-11-08 19:33:40
      
     
   | 
Robert May wrote:
>> Hmm.  With 350 names in :compatibility_win32_gui, more files might be 
>> needed.  Maybe change Tags.pm
[snip]
>   eval "require Win32::GUI::Constants::Tags_$spec";
>   if($@) {
>     warnings::warnif qq(Failed to load definition for tag ':$spec': $@)
>   }
>   else {
>     $TAG_SPEC{$spec} = \@{"Win32::GUI::Constants::Tags_$spec::C"};
>  }
> 
> Although I'll not head down this route just yet - I'll add a comment to 
> the Tags.pm file.
A day to think about it and all becomes clear.  This is exactly what the 
AutoLoader module is for.  The definition for each tag becomes a 
subroutine, which the build process splits into separate files, and 
AUTOLOADs only the ones that actually get used.
In fact such is this solution that the whole lot could be folded back 
into Constants.pm - although that would make Constants.pm's AUTOLOAD sub 
significantly more complex (especially as we can export it to other 
namespaces), so I'll be keeping Tags.pm for now.
Seems like we have the full solution.
Regards.
Rob.
 |