Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I routinely use perl on a Win XP box at work (at home I run Mac OS X) so I can offer a few pointers.

Unfortunately, just like the different versions/vendors/flavors/variants of Unix, Windows directory layout also varies from OS version to version. But, it is mostly quite predictable. And most system directories can be addressed by variables. I have never used Windows system variables in perl scripts, but it would be interesting to see if they work... they are usually surrounded by % signs such as %TEMP% or %SYSTEM% etc.

The ~/.app-name is actually followed, but it is not OS mandated but application specific. Of course, directories or files starting with a . are not invisible.

On Win XP there is a convolutedly named "Documents and Settings" folder on the C root where such things get stored usually, and under that folder is also an Application Data (I think that is what it is called) folder where app specific detritus can be stored such as mozilla prefs, etc.

You don't really have to hack the registry as it is mostly for system specific things such as asscoiating all .pl or .plx extension files with the perl binary so you can actually run those files by double-clicking on them.

Most config files get stored under the Winnt directory and they usually end with the .ini suffix.

Hope some of this helps. But you definitely will have to explore the various versions of Windows to figure out if your scripts are going to be affected. Alternatively you could run a config script that asks the user a few questions and makes its settings, but most users are not likely to know what goes where. Or, you could just make up your own tmp directory, store stuff there, and blow it away when the script is done (or not, if you want the settings to persist).

Since I have never needed to mess with those kind of things, I have found that my scripts run mostly without any changes and without any problems (except for changing the shebang line, of course when moving from Mac OS X to Win and back. If I have to store anything, I usually create a directory under my scripts directory where I can write stuff.


In reply to Re: "Porting" scripts to Win32 by punkish
in thread "Porting" scripts to Win32 by b10m

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 04:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found