Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / July 2005



Tip: Looking for answers? Try searching our database.

Cat and Dos2unix Command Line Utilities?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lola Lee - 09 Jul 2005 01:56 GMT
I finally heard back from the module owner of WWW::Search, and here's
what he had to say:

  Please accept my apologies, I don't get much time to work on my Perl
Modules these days...
  The errors you are seeing are actually caused by a bug in Pod::Parser
(I reported it to the author LONG time ago but no reply).  You can
install the distro and use it just fine despite these errors.
  In the Makefile.PL is a workaround for Unix-like systems (using cat
and dos2unix).  Does MacOS come with cat and dos2unix "command-line"
utilities?  If so, what are they called?  And what is the value of $^O?
 (darwin I think?)
  If the answer is no, I'll look into some other way of doing the
equivalent of dos2unix in my Makefile.PL code...  (suggestions welcome!)

So, what is the answer to his questions?  I'll pass these on to him.
Thanks!

Signature

Lola - mailto:lola@his.com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Terrorismus delendus est! (Terrorism must be destroyed utterly!)
I'm in Bowie, MD, USA, halfway between DC and Annapolis.

Daniel Staal - 09 Jul 2005 03:21 GMT
--As of Friday, July 8, 2005 8:56 PM -0400, Lola Lee is alleged to have
said:

> I finally heard back from the module owner of WWW::Search, and here's
> what he had to say:
[quoted text clipped - 13 lines]
> So, what is the answer to his questions?  I'll pass these on to him.
> Thanks!

--As for the rest, it is mine.

Darwin comes with cat, and is called 'darwin'.  (At least on my
Darwin-8.0.1 system.)  It does *not* come with dos2unix: this bit me once
already.  (It does compile just fine though.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
Chris Devers - 09 Jul 2005 03:26 GMT
>  In the Makefile.PL is a workaround for Unix-like systems (using cat
> and dos2unix).  Does MacOS come with cat and dos2unix "command-line"
> utilities? If so, what are they called?  And what is the value of $^O?
> (darwin I think?)

Does this guy literally mean MacOS, or does he mean MacOS X ?

OSX is Unix, so it includes a copy of cat at /bin/cat, just like most
other Unix variants do.

dos2unix doesn't seem to be available, but personally I have a trivial
one in my ~/bin directory that's just:

    $ cat ~/bin/dos2unix
    #!/bin/sh
    perl -pi -e "tr/\r//d"
    $

Works a charm. Whatever this guy is doing that needs dos2unix, chances
are excellent that he could get the same result with Perl itself with
little or no effort. For that matter, chances aren't bad that he doesn't
need to use `cat` either, as Perl can do that one too, but then I
haven't actually looked at this package so I don't know how he's trying
to use it; maybe it isn't really a Useless Use Of Cat :-)

Signature

Chris Devers

Joseph Alotta - 09 Jul 2005 03:57 GMT
>     #!/bin/sh
>     perl -pi -e "tr/\r//d"

Hi Chris,

I tried to call perl directly.  But this does not work
at all.  Does anyone know why?

#!/usr/bin/env perl -pi -e "tr/\r//d"

See, I was only trying to save you a line.  :-)

Joe.
Chris Devers - 09 Jul 2005 04:05 GMT
>>     #!/bin/sh
>>     perl -pi -e "tr/\r//d"
[quoted text clipped - 5 lines]
>
> See, I was only trying to save you a line.  :-)

Yeah, but it doesn't really matter how complex the script is, so long as
you can just do a

    $ dos2unix file.txt

and get back a clean result.

If I was going to make any modifications to the file, rather than
simplify it, I'd force it to quit rather than edit any binary file, as

    $ dos2unix file.jpg

can be *really* disastrous the way it is now :-)

But if I cared *that* much, I'd just get dos2unix from Fink and be done
with it. As it is, I almost never use this script in the first place, so
leaving it as is works fine for me :-)

Signature

Chris Devers

Ken Williams - 12 Jul 2005 02:09 GMT
>>     #!/bin/sh
>>     perl -pi -e "tr/\r//d"
[quoted text clipped - 5 lines]
>
> #!/usr/bin/env perl -pi -e "tr/\r//d"

Because using 'env' doesn't preserve switches.

Personally, I use a tcsh alias:

  % which dos2unix
  dos2unix:        aliased to perl -pi -e "tr/\r//d"

But Chris' script could become:

    #!/usr/bin/perl -pi
    tr/\r//d

which would save one level of processes but no longer search the $PATH.

 -Ken
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.