Here's one that, possibly, may not be possible.
Using Inline::Files and Convert::UU, I'd like to be able to say:
#!/usr/bin/perl -w
use strict;
use warnings;
use Inline::Files;
use Convert::UU qw/uuencode/;
my $type = 'TMP';
print uuencode(<main::$type>);
__END__
__TMP__
This is data to be uuencoded
where $type would correspond to the ALL_UPPERCASE_NAME of the virtual
file I'd like to access. This allows me to write functions which will
be passed which virtual file I need to encode. (I do need to have the
package in the filehandle in the actual program -- this example is
rather small, so it's somewhat overkill here, but I'm not sure if the
package name is getting in the way or not...)
This doesn't seem to work. There are two things going wrong. One is
that, for multiline virtual files, it only sees the first line. I can
work around this by doing:
my $val = join("\n", <main::TMP>);
and then uuencoding $val. However, I'd like to be able to do
join("\n", <main::$type>);
which doesn't work.
I can (sort of) solve this by doing:
my $val = eval qq{ join("\n", <main::$tmp>); };
but I've seen somewhere that eval of a string is a terrible performance
hit -- blocks are OK, but strings can't be compiled in advance.
Admittedly, in the scheme of the program, this particular piece of code
isn't the one where most time is being spent, but now I'm just curious
if there is any way to be able to select the correct file handle from a
variable without the eval...
Thanks muchly for any suggestions,
Ricky
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

