P is for Practical | |
PerlMonks |
Inline::Files bug?by BrowserUk (Patriarch) |
on Aug 01, 2002 at 11:45 UTC ( [id://186742]=perlquestion: print w/replies, xml ) | Need Help?? |
BrowserUk has asked for the wisdom of the Perl Monks concerning the following question: I've attempted t use readmore tags to reduce the length of this, but I wont see if they have worked or not until I submit it....my apologoes in advance if they don't. I have been trying to make use of the Inline::Files module from CPAN. (Actually VERSION '0.60' from AS via PPM in conjunction with 'This is perl, v5.6.1 built for MSWin32-x86-multi-thread' ). After an extended CB session with podmaster and dada (thanks guys!), we concluded that I may have a legitimate bug report against the module, but I am posting here to see if anyone else can see my error(s) before I raise the report and make a fool of myself. Referencing the Inline::Files pod (Files.pm:lines 360-380) the following code should? read and print the number 10..1 from the virtual file (vf) __INLINE__ and then re-write vf __INLINE__ with the numbers 1..10.
The results I get are:
dada pointed out that the pod example doesn't work as listed, and that this is because when a VF is being read and EOF is reached, it is automatically closed, which This explains the "unopened filehandle" errors above. With dada's help, I worked out the syntax for opening a VF is: open INLINE, ">$INLINE" or die $!; This wasn't obvious (to me) as
Anyway these changes gave me this:
<p
Which, apart from the warnings from the open line in my code which I can't explain-- apart from the fact that $INLINE is never being set--also gives the two errors from Virtual.pm? Added to this, the open has caused a second __INLINE__ to be created, rather than the original being overwritten? Also, the (1..10) are being written as one line (my fault) so I thought I would correct this using my usual technique in test progs ie. using local($/="\n"); (which I think is a correct way to do things) so that resulted in this:
<p
Which as you can see, appears to have effected everything except what I wanted. I know that setting $, was unnecessary for what I wanted to achieve (I just cut&pasted the line from another file, but it would appear that despite my use of local, my changes to these vars has effected the IO done by Inline::Files?? Is this expected behaviour?
Back to
Seekers of Perl Wisdom
|
|