houseabsolute / HTML-Mason

High-performance, dynamic web site authoring system
https://metacpan.org/release/HTML-Mason/
Other
9 stars 18 forks source link

Undef warning w/anonymous components #18

Open autarch opened 4 years ago

autarch commented 4 years ago

Migrated from rt.cpan.org #55159 (status was 'open')

Requestors:

From pause@nodekit.org on 2010-03-03 00:32:39 :

Hi,

The documentation for HTML::Mason::Component states that the value returned by "dir_path" is undefined for anonymous components. However, when using anonymous components, this can lead to an undef warning from HTML::Mason::Tools:

Use of uninitialized value $dir_path in concatenation (.) or string at /usr/local/lib/perl5/site_perl/5.10.1/HTML/Mason/Tools.pm line 114.

The line referenced above is a join() in the absolute_comp_path function.

I suggest that Component.pm and Request.pm should check to see if the current component's comp_id is set, before calling absolute_comp_path.

Thanks, --Alex

autarch commented 4 years ago

From pause@nodekit.org on 2010-03-03 21:04:26 :

More info-- This issue occurs when I execute an anonymous component which calls other components (via <& &> or $m->comp inside the anon component).

A simpler fix might be to have absolute_comp_path always stringify the second arg-- I did not observe any side effects or other weirdness by hacking absolute_comp_path to do ||= "" on $dir_path before trying to use it.

Please don't hesitate to contact me if I can be of any help.

--Alex

autarch commented 4 years ago

From drolsky@cpan.org (@autarch) on 2012-02-03 17:29:04 :

On Wed Mar 03 16:04:26 2010, pause@nodekit.org wrote:

More info-- This issue occurs when I execute an anonymous component which calls other components (via <& &> or $m->comp inside the anon component).

A simpler fix might be to have absolute_comp_path always stringify the second arg-- I did not observe any side effects or other weirdness by hacking absolute_comp_path to do ||= "" on $dir_path before trying to use it.

Please don't hesitate to contact me if I can be of any help.

Sorry for the ridiculously slow reply. If you have code that can replicate this I can probably fix it.