I am in the process of teaching my self Perl. I am using the EPIC debugger in Eclipse. Whenever I have a var used only one time in a sub I get this warning:
Typographical errors often show up as unique variable names.
If you had a good reason for having a unique name, then just mention it
again somehow to suppress the message. The C<our>
declaration is
provided for this purpose.
What is C<our>
? Standard searching was inconclusive.
As far as C<>
part that may have confused you, it looks like EPIC took a text in POD format and printed it raw instead of rendering it from POD into a formatted text.
C<our>
in POD syntax means "Print text 'our' formatted as code", usually meaning mono-spaced font. This is similar to StackOverflow's `our`
backtick-surrounded format command your own question used.
The error itself comes from Perl's diagnostics
module, which provides extended explanations for otherwise somewhat cryptic Perl warnings (in this case, "Name "%s::%s" used only once: possible typo"). As a matter of fact, judging from the POD formatting which confused you, EPIC probably uses the source POD from which the above-linked "perldiag" document was generated.
If you're asking what our
does, you should read perldoc -f our - it is a way to create an alias into a global variable effective in a given scope (see tchrist's asnwer for details).
As far as googling technique in this case, when you're searching specifically for what you expect to be Perl keywords, it always pays to google for "perldoc someKeyword".
our
is a lexically scoped alias to a global variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With