in reply to Re: How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
in thread How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
I use that file handle (in variable form - stored in a hash actually) multiple times throughout the module. My module doesn't know the bareword handle name, so I can't directly reference *main::OUT in my module code to "use it twice". Even if I get the name of the bareword file handle with some trick like $bareword_filehandle = select(), I wouldn't guess that I could satisfy the "use it more than once" requirement regarding main without typing the thing out in the code, and if I did that inside the module, I don't know if that would work for the warning about the file handle in main. How does sort do it WRT $a and $b? And how wouyld I replicate that when I don't know the name of the handle?sub openOut { my $file_handle = $_[0]; my $output_file = $_[1]; ... }
#!perl use Foo qw(openOut); openOut(*BAR,"~/output.txt"); print("Hello world!\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
by Your Mother (Archbishop) on Nov 07, 2019 at 22:38 UTC | |
|
Re^3: How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
by hippo (Archbishop) on Nov 08, 2019 at 11:27 UTC | |
|
Re^3: How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
by tobyink (Canon) on Nov 08, 2019 at 09:56 UTC | |
|
Re^3: How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
by Anonymous Monk on Nov 08, 2019 at 02:22 UTC |