Hi!
I have a main script and a module I created myself:
main.pl:
#!/usr/bin/perl use strict; use warnings; use lib "."; use failingFormat qw (&printFormat); printFormat ("TEST", "Testing to print the TEST format.");
failingFormat.pm:
#!/usr/bin/perl use strict; use warnings; use Exporter; my $PKG = "failingFormat"; our $VERSION = "0.0.01"; our @ISA = qw (Exporter); our @EXPORT_OK = qw ( &printFormat ); my $text2print; sub printFormat { $~ = shift; $text2print = shift; write; $~ = "STDOUT"; } format TEST = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $text2print ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $text2print . 1;
In Perl v5.8.8, this works OK, but in v5.10.0 it complains about $text2print being uninitialized. To get this to work, I have to declare $text2print in main.pl:
our $text2printAnd then use that parameter in my module ($main::text2print).
Is that a feature or a fault introduced in the later version?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |