Hello,

I am having a strange problem with Strawberry Perl and file paths. Here is a short script that exhibits the problem:

use strict; use warnings; use AnyDBM_File; use POSIX; my $table_path = shift; my %hash_AB; my $table_file = "$table_path\\tableAB.db"; die "$table_path not a directory\n" unless ( -d $table_path ); die "$table_file not found\n" unless ( -f "$table_file" ); tie( %hash_AB, 'AnyDBM_File', "$table_file", 1, 0 ) or die( "open failed for $table_file: $!\n" );

When running this in Strawberry Perl, I get the following output:

>perl dbmopentest.pl Y:\path\to\dbdir open failed for Y:\path\to\dbdir\tableAB.db: No such file or directory

... even though I would expect to get one of the previous errors if the path were bad. Yesterday I could have sworn that I got it working in Cygwin, but only when I specified an absolute path. Today I can't get it to work in Cygwin either. I need it to work in Strawberry Perl and not Cygwin because I am planning to distribute my project with Strawberry Perl.

If I change the direction of slashes, I can make this work on Linux with the same file path (it's on a network drive). But Windows doesn't like it. Is there anything I can do?

Thanks in advance for your help.


In reply to AnyDBM on Strawberry Perl: file can't be found by captainmikee

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.