LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I'm seeking for good ideas how to robustly solve this problem.

I want to use cygwin as development environment on win for scripts using the systems Perl (ActiveState)

Especially I want to use Emacs there because some el-module provider don't want to fix problems with win-emacs.

The problem is that cygwin uses a unix stile paths while the win-perl expect win-style path

While using cygwin-emacs with cygwin-perl works calling win-perl from emacs fails because the path to the script can't be resolved.

Example: C:\tmp\tst_flymake.pl is /cygdrive/c/tmp/tst_flymake.pl in emacs.

One workaround is to use a wrapper to call win-perl which does the translation:

perl `cygpath -w /cygdrive/c/tmp/tst_flymake.pl`

But the warnings and errors emitted from win-perl will be windows-style again and emacs will fail to automatically jump to the correct line number.

I also tried to work with softlinks to establish a common compromise path-system, like linking C: to /cygdrive/c/ but with little success.

I am sure I can come out with a more or less stable solution with several layers of complicated translations, but would appreciate other ideas...

related discussions

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

PS: before the emacs bashing starts, VIM users should face the same problem even more, because of more dependencies on a unix like environment.

Replies are listed 'Best First'.
Re: Pathproblems while using CygWin as development environement on Win
by haukex (Archbishop) on Nov 11, 2016 at 11:25 UTC

    Hi LanX,

    It's been a really long time since I last used CygWin, but I am curious if you've tried using File::Spec or Path::Class for portability? Also, can you use relative pathnames instead of absolute, or at least anchor absolute paths to some common place, such as the script's path (FindBin)?

    Regards,
    -- Hauke D

      If I understand you correctly you are suggesting to change the Perl code.

      But I don't have a portability issue, the code is never supposed to run under cygwin or Unix Perl.

      I (probably) need something on the level of Perlrun to force Perl emitting relative paths.

      There are many possibilities, I'm looking for the simplest and most robust.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        Hi LanX,

        Ok, I get what you are asking now, and in that case my suggestions - at least in regards to changing the scripts themselves - don't apply. Perhaps what you want to do can be solved with some kind of wrapper script, but since I don't have cygwin around at the moment I don't have any ideas, sorry...

        Regards,
        -- Hauke D

Re: Pathproblems while using CygWin as development environement on Win
by karlgoethebier (Abbot) on Nov 13, 2016 at 18:14 UTC
    "..use cygwin as development environment on win for scripts using the systems Perl (ActiveState)"

    But you remember the tales of the wise woman?

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      I have no intention to mix both Perl installations.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!