I'd suggest using In direct Filehandles for situations like this. Also by shifting off the first parameter, the function is slightly more useful, you can call the function with any filename you wish, workspace( '/root_to_file' );
package wslib; use strict; our @EXPORT = qw( workspace ); #place all the variables you want to ex +port by default in here (c.f. @EXPORT_OK) use Exporter; our @ISA = qw(Exporter); sub workspace { my $data_reg = shift || return; open my $page, "$data_reg" or die "Cant open $data_reg: $!"; while (my $line = <$page>) { print "$line<br>"; } close $page; } 1;
In reply to Re: data leak using package
by bingos
in thread data leak using package
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |