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.

#! perl -w #use strict; use Inline::Files -backup; print <INLINE>; seek INLINE, 0, 0; print INLINE for (1..10); __INLINE__ 10 9 8 7 6 5 4 3 2 1

The results I get are:

C:\test>inline 10 9 8 7 6 5 4 3 2 1 seek() on unopened filehandle INLINE at e:/Perl/site/lib/Inline/Files/Virtual.pm line 227. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. print() on unopened filehandle INLINE at C:\test\inline.pl line 14. C:\test>type inline.pl #! perl -w use strict; use Inline::Files -backup; print <INLINE>; seek INLINE, 0, 0; print INLINE for (1..10); __INLINE__ 10 9 8 7 6 5 4 3 2 1 C:\test>

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
#! perl -w #use strict; use Inline::Files -backup; print <INLINE>; #seek INLINE, 0, 0; open INLINE, ">$INLINE" or die $!; print INLINE for (1..10); __INLINE__ 10 9 8 7 6 5 4 3 2 1 C:\test>inline 10 9 8 7 6 5 4 3 2 1 Use of uninitialized value in concatenation (.) or string at C:\test\i +nline.pl line 7. Use of uninitialized value in substitution (s///) at e:/Perl/site/lib/Inline/Files/Virtual.pm line 120. Use of uninitialized value in substitution (s///) at e:/Perl/site/lib/Inline/Files/Virtual.pm line 120. C:\test>type inline.pl #! perl -w #use strict; use Inline::Files -backup; print <INLINE>; #seek INLINE, 0, 0; open INLINE, ">$INLINE" or die $!; print INLINE for (1..10); __INLINE__ 10 9 8 7 6 5 4 3 2 1 __INLINE__ 12345678910 C:\test>

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
C:\test>inline 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 Use of uninitialized value in concatenation (.) or string at C:\test\i +nline.pl line 8. Use of uninitialized value in substitution (s///) at e:/Perl/site/lib/Inline/Files/Virtual.pm line 120. Use of uninitialized value in substitution (s///) at e:/Perl/site/lib/Inline/Files/Virtual.pm line 120. C:\test>type inline.pl #! perl -w #use strict; use Inline::Files -backup; local ($,=' | ', $/="\n"); print <INLINE>; #seek INLINE, 0, 0; open INLINE, ">$INLINE" or die $!; print INLINE for (1..10); | __INLINE__ 10 9 8 7 6 5 4 3 2 1 | __INLINE__ 12345678910 C:\test>

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?


In reply to Inline::Files bug? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.