Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: "But I'm never going to..."

by Abigail-II (Bishop)
on Apr 08, 2004 at 09:06 UTC ( [id://343548]=note: print w/replies, xml ) Need Help??


in reply to "But I'm never going to..."

Well, that seems like an open door. But I disagree. Part of programming is finding a trade-off between conflicting goals. Portability is one goal. But readability is another - and not necessarely a less important goal than portability. For the majority of the code I write, if there are any portability issues they are whether they will work with a different version of the kernel, or different versions of other used tools.

The loss in readability between:

$file = "fnord/glop/bibba";
and
$file = File::Spec -> catfile (qw /fnord glop bibba/);
is significant. Enough for me to offset the loss of portability to, say, MacOS. Note that according to perlport, fnord/glop/bibba works, or can be made to work, under Unix, Windows, DOS, OS/2, VMS, VOS and RiscOS.
The XP folks wisely warn against designing in extra functionality "just in case"

Writing from the middle of an XP-to-Linux port

I know couple of meanings of XP: 1) a range of disk servers sold by HP, 2) a version of an OS made in the Pacific Northwest, 3) extreme programming. I'm pretty sure you aren't using "XP" in meaning 1). But I can't figure out whether you mean meaning 2) or meaning 3).

Abigail

Replies are listed 'Best First'.
Re: Re: "But I'm never going to..."
by ysth (Canon) on Apr 08, 2004 at 10:07 UTC
    It seemed pretty clear that the first XP was 3) and the second was 2).
Re: Re: "But I'm never going to..."
by flyingmoose (Priest) on Apr 08, 2004 at 18:43 UTC
    ActiveState perl already understands that slashes and backslashes are equivalent for most modules. This is not to say everything in CPAN will be friendly, but in all of my Windows scripts I just use "/" like normal -- and I haven't had any problems unless I am sending something to the shell.

    In the rare cases where I had to do this, a simple fix_path function is usually sufficient to insert (which turns slashes into backslashes). I *do* need to look at File::Spec and others in these cases, but in general, conciseness is important to me when it can be done without causing problems. And when only dealing with Windows, Linux, and basic Unix systems, this is good enough for me. I'll capitulate when I have to port to something more obscure, I'm sure.

      I've never had a problem with ActiveState not translating between "/" and "\" in a path. The main problem I've had is with the tests, where a path in a string is "t/foo/bar" and Windows returns "t\foo\bar". This is enough to cause a test and CPAN install to fail.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343548]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-16 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found