i am using dbd-anydata v0.09 with activeperl 5.8.8 build 820 (and dbi
v1.609)

i have 2 'input' files 'Tab' delimited.  one 'field' of these 2 input files
may be used to 'join' the two tables.
using the notes found in cpan.org for this module, im 'simulating' a join
by basically;

iterating through the records of table 1
for each record read, i then extract the critical field (that may be used
to join with)

   i then run a query on table 2, attempting to select the single record
having a matching join field value

      if a rec is found from table 2,
            i am 'outputting' a new record that is a concatenation of all
joined fields to a 3rd 'output' file
      else
            i output a new record to a 3rd 'output' file (devoid of the
values that would have come from table 2)


there are, to best of my knowledge, only 3 instructions that have anything
at all to do with the actual 'opening' these files:

  #the main two INPUT tab delimited 'database' flat files
  $dbh->func( 'input1', 'Tab', 'input1.txt', 'ad_catalog');
  $dbh->func( 'input2', 'Tab', 'input2.txt', 'ad_catalog');

  #this file will be created for output
  $dbh->func( 'output1', 'Tab', 'output1.txt', 'ad_catalog');

as my program iterates through the main 'input1' file it prints to std out
the records that have been processed.

when my program ran the first time it worked just fine until some arbitrary
point in time whereby it bombs with the following message:

 [for Statement "INSERT INTO merged
(PUBLISHER,FONTCOLLECTION,PKGNO_INF,FILENAME
_INF,FONTTYPE,FAMILYNAME_INF,FONTNAME_INF,FONTNAME_PRIMARY,FONTNAME_SECONDARY,SC
RIPT_INF,SCRIPT,CURSIVE,CURSIVE_JOINED,SYMBOLS,LIGATURES,APPEARANCE,LATIN,SMALL_
CAPS,EXPERT_INF,EXPERT,OLDSTYLE_FIGURES,LINING_FIGURES,BOOK_INF,DECORATIVE,SWASH
,OCR,FIXED_PITCH_INF,SERIF_INF,ROUND_MITER,WIDTH_INF,ITALICS_ANGLE_INF,WEIGHT_IN
F,STEM_WIDTH_INF,ENCODING_INF,TRADEMARK_ORIGINAL,DESIGNER,NOTES) VALUES
('Adobe'
,'literal','110','nu______.pfb','Postscript Type 1','Nuptial Script','Nuptia
lScript','','','script','1','','','','','','','','','','','','','','','','','ser
if','','','-21','','56','StandardEncoding','','','')"]
at C:\perlsrc\POSTSC~1\FONTDB~1\MERGE_DB.PL line 132.
DBD::AnyData::db do failed:
Execution ERROR:  Cannot open 'merged.txt':
Permission denied at C:/Perl/site/lib/AnyData/Storage/File.pm line 93.
called from C:\perlsrc\POSTSC~1\FONTDB~1\MERGE_DB.PL at 132.

 [for Statement "INSERT INTO merged
(PUBLISHER,FONTCOLLECTION,PKGNO_INF,FILENAME
_INF,FONTTYPE,FAMILYNAME_INF,FONTNAME_INF,FONTNAME_PRIMARY,FONTNAME_SECONDARY,SC
RIPT_INF,SCRIPT,CURSIVE,CURSIVE_JOINED,SYMBOLS,LIGATURES,APPEARANCE,LATIN,SMALL_
CAPS,EXPERT_INF,EXPERT,OLDSTYLE_FIGURES,LINING_FIGURES,BOOK_INF,DECORATIVE,SWASH
,OCR,FIXED_PITCH_INF,SERIF_INF,ROUND_MITER,WIDTH_INF,ITALICS_ANGLE_INF,WEIGHT_IN
F,STEM_WIDTH_INF,ENCODING_INF,TRADEMARK_ORIGINAL,DESIGNER,NOTES) VALUES
('Adobe'
,'literal','110','nu______.pfb','Postscript Type 1','Nuptial Script','Nuptia
lScript','','','script','1','','','','','','','','','','','','','','','','','ser
if','','','-21','','56','StandardEncoding','','','')"]
at C:\perlsrc\POSTSC~1\FONTDB~1\MERGE_DB.PL line 132.


where C:/Perl/site/lib/AnyData/Storage/File.pm, line 93, is the asterisked
line:
    if ($open_mode =~ /[ru]/) {
        die "Cannot read file '$file': doesn't exist!" unless -f $file;
*       if (!($fh = IO::File->new($file, $mode{$open_mode}))) {
            die " Cannot open '$file': $!";
        }
    }

i find it odd that as its iterating through the (obviously successfully
opened files - as we couldnt be iterating through these records if the
files could not be successfully opened) - why would there be a need to
'open' the files again?  in the beginning of my program are the 3 key
instructions that actually 'open' the files, and they do open, as im seeing
lots of data coming from out of these files appearing in my cmd window.  if
the files are open, how/why would there be any need, or attempt to open
them again?

the first time it bombed, i checked the 'output' file and saw that 96
records had been successfully INSERTED into the 'output1.txt' file.

i ran the program a 2nd time and was curious to see if it woudl bomb at the
exact same place.  it did bomb again, i opened 'output1.txt' and found that
this time 516 lines had been successfully INSERTED before it bombed.

note ive not edited or changed either of the input1.txt or input2.txt files
so these drive the output.

there seems something inconsistent here at play that is causing this.

any suggestions to troubleshoot this?

yes, i know i can create my own output file by merely
print OUT '$field1\t$field2\n";

but it would be nice if i coudl get the module to just work normally.  if i
cant i will 'do it myself'.  honestly, i feel the problem has more to do
with INSERTING the records to the output file than it has to do with
reading the input files.  for if i remove the lines of code that INSERT the
output data, the proram is otherwise able to read through, and iterate
through the input files without any troubles.  it is once i INSERT output
records that this fails at inconsistent times.

greg
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to