Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Trying Win32 code on Linux

by zebedee (Pilgrim)
on Aug 14, 2001 at 13:34 UTC ( #104713=perlmeditation: print w/replies, xml ) Need Help??

(a) Apologies if this has come up before ... and ...
(b) I don't want to start a "my Linux distro is better than yours" war, so don't go there ...

As a Win32 developer, I want to make sure my Perl stuff will work on *nix ... but how? Most of my previous attempts at Linux installs has ended up with wailings and gnashings of teeth.

You might want to check out ZipSlack (I got my copy off a Computer Shopper CD) - it can be copied to a FAT/FAT32 partition with 100Mb free or a ZIP drive and booted from there (you may need to restart in DOS mode, or boot from a floppy). It's a lot easier than trying a full-on installation.
Got it working on an NT4 box (PPro 200; had to change an NTFS partition to FAT) and Win98 laptop (AMD K6-475).
One neat thing about this distribution is that it ships with Perl 5.6.0.
Might be worth a dekko if you're running Win32 and want to check your code (I haven't done much more than get a console up and have a nosey around with a Perl print "Hello World\n";, so I haven't tried anything fancy!).
Write your Perl code on Win32, copy it to the FAT partition, reboot into Linux, and check it.
With Code Red; VB .NET meaning a re-write of VB6 code; and XP activation, we might never go back to Win32 8-) ).

Replies are listed 'Best First'.
Re: Trying Win32 code on Linux
by tachyon (Chancellor) on Aug 14, 2001 at 14:38 UTC

    If you read up on 'mount' you will find you can mount a Windows partition under Linux, thus you don't have to copy anything anywhere to be able to read it under Linux - if it is on your system you can get it :-) Just mount your Windows partition(s) and you can acess whatever you want from Linux.




      This is true for VFAT, but as far as I know, Linux NTFS support is still "experimental" and not ready for prime time, so caution is advised. Mounting NTFS read-only might be relatively safe, but I'm not certain about that.

Re: Trying Win32 code on Linux
by bikeNomad (Priest) on Aug 14, 2001 at 21:55 UTC
    The easiest way to test on multiple OS's without re-booting has got to be VMWare. This allows you to run an OS in a virtual machine under another. For instance, on the few occasions I need to use Windows, I just click on my KDE desktop icon for VMWare, and up pops NT, running in a window on my Linux desktop. There's a fast suspend, so I don't even have to wait for NT to boot. You can use raw drive partitions, or make virtual drives using the host filesystem. There are versions that run under various Unixes including Linux, as well as under Win2K and WinNT 4.0.

    So you could do the same thing under Win2K: click, and up pops a Linux session.

      Thanks for the feedback.

      ZipSlack is working a treat for me - just set up a FAT32 partition, copy the files, boot off a floppy (under NT/W2K - the only painful part ... will have a look at ??? LILO ???. On my Win98 laptop I can just have a shortcut that restarts in DOS mode and runs linux.bat) I even got X working last night (personal first!)

      The problem with the "find an old machine" routine is that I haven't got any knocking around and with a hungry nipper there isn't enough money going round to buy another box. Well, I need the money to buy Linux books to read on the train!
Re: Trying Win32 code on Linux
by $code or die (Deacon) on Aug 14, 2001 at 19:46 UTC
    If you don't want to dual boot, configure Linux just for testing, etc, then download cygwin. It's free and does just what you want.

    Error: Keyboard not attached. Press F1 to continue.
      Cygwin is not the same as running linux. Cygwin is the same as running it under ActivePerl. There is no unix kernel or process management under cygwin, and it uses dll's and not shared libraries.

      Cygwin is one of the greatest things for windows users, but if you want to test your scripts under unix, there are way better ways.

      For example, buy an old box, install a unix on it and shell into it. If you are using gui's, set an X server up on your win32 box.

      Then again, dual booting/vmware also work well.

Re: Trying Win32 code on Linux
by dmmiller2k (Chaplain) on Aug 16, 2001 at 22:03 UTC

    There's another option to Linux, if you're running NT or better (i.e., non-Windows 9x/ME).

    Check out Unix for Windows. It replaces the braindead POSIX subsystem in NT (and NT-derived Windowsen) with a real one. It comes with various shells, perl, vi, etc. In essence, once you open a ksh window, you are in a true POSIX-compliant environment (full set of system calls).

    There is an academic/research version which includes everything and is free, as well as various commercial licensing options available from two different firms (follow approroate links from the URL, above).

    The upshot is, you can run your Win32-developed scripts in a normal Command Prompt window, and simultaneously in a UWIN ksh window, side-by-side, without rebooting.

    Way Cool, IMHO

    -----[ BofA: 212 583-8077 David.Miller(AT)bofasecurities(DOT)com ]-----
    David M. Miller                       | phone/FAX:         212 662-0715
    Business Visions, Inc., Suite #8E     | cell:              917 952-1600
    680 West End Ave, New York, NY  10025 | e-mail: dmmiller(AT)acm(DOT)org
          Spam Resistant (replace '(AT)' => '@', and '(DOT)' => '.')

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://104713]
Approved by root
[Corion]: Yaerox: That's a somewhat hard problem. Encode solves the conversion part, but for guessing what encoding a file is in, that's the hard part
[Corion]: Yaerox: There is Encode::Guess, but that needs a limited set of inputs, and it also cannot handle multiple single-byte encodings
[Corion]: If you have a BOM, that's a really easy way to recognize UTF-8. Otherwise, you can try to decode a file from UTF-8, and if that works OK and doesn't crash, most likely the file was valid UTF-8
[Corion]: But as "ansi" (Latin-1?) is a single-byte encoding, any file is a valid ANSI file

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2017-03-28 13:19 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (332 votes). Check out past polls.