in reply to Question on XML output using Perl
sub error_excerpt{ return defined($error_excerpt)?$self->{_error_excerpt}:"No Error Excer +pt."; }
...what the A.M. said. In particular, where do $self and $error_excerpt come from? For example, did you just leave out the my $self = shift; at the beginning of the routine in this sample code only, or is it also missing from the real code?
In case $error_excerpt is not available in the scope of the routine, you'd always get "No Error Excerpt.". This would be the case if $error_excerpt is defined as a lexical variable in another routine. In this case, an empty package variable of the same name would (silently) be used instead — unless you enable strictures...
Always use strict; use warnings; — it would likely have warned you of these types of errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question on XML output using Perl
by siddheshsawant (Sexton) on Mar 16, 2010 at 16:08 UTC | |
by wfsp (Abbot) on Mar 16, 2010 at 16:16 UTC | |
by siddheshsawant (Sexton) on Mar 16, 2010 at 16:30 UTC | |
by almut (Canon) on Mar 16, 2010 at 16:17 UTC | |
by siddheshsawant (Sexton) on Mar 16, 2010 at 16:29 UTC | |
by Khen1950fx (Canon) on Mar 16, 2010 at 16:34 UTC |