
Unix in Perl 154
An anonymous reader writes "Or at least a pretty comprehensive suite of the classic utilities. Tom Christiansen (well-known in Perl circles) has decided that it is easier to write the utilities in Perl and make them available on all platforms than to constantly rewrite Perl scripts that use backticks. Full details are available right here. "
why stop there? (Score:1)
mod_perl kernel module? (Score:1)
Tom v. Randal Flames (Score:1)
Geez, how old is Tom? Twelve? He acts like an immature brat, especially to send such a heated and off topic response to what I would consider to be good questions that should be discussed.
Or this (Score:1)
But, yes find a real reason or admit your your uninformed bias. (two posts up that is)
Can't you guys smell trolls yet? Hehehe... Laugh. It's funny.
why the argument? (Score:1)
point 1:
if you don't like the idea of the tools, don't
download them, don't use them.
point 2:
if you think it's a big waste of time to write
the tools, don't contribute your time to them.
point 3:
this project is unrelated to the perl5 distribution, and so nothing is being "taken" from
anything.
point 4:
I think I like a lot of the features and options in many GNU binutils, and so I'll probably stick with those. but that's just me, that's just my time, and I don't see why that should affect Tom's fun.
Slurrrrrpppppp! (Score:1)
what the hell are you talking about?
Write this in Perl for me, or write it in shell, and tell me which is fastest. I bet it's C.
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char * argv[]) {
int l, h, s, i;
if (argc>=2) {
l = atoi(argv[1]);
h = atoi(argv[2]);
if (l>h) { s = l; l = h; h = s; }
s = 1;
if (argc>=3)
s = atoi(argv[3]);
for (i=l;i=h;i+=s) printf("%d ",i);
}
return 0;
}
Lighten up.. (Score:1)
What the hell is wrong with you people?
Lighten the fuck up. Must everything have a clear
and explicit purpose to be allowed to exist?
I laughed out loud when I read that. Then I
checked out the page and realized they were
serious. It stopped being funny and I started
fingering the possibilities.
Sure, Perl is butt slow, but so what? So is Java.
Do we really have nothing better to do than
complain that an application takes 8 seconds to
load as opposed to 3 seconds? (Netscape vs. IE?)
I scoffed at Perl for awhile until I picked up
the O'Reilly "Camel" book a few weeks ago and
found that I loved it after I read the second
chapter. Perl is an attempt to change the
environment. To make things better. Something
the inventor of Java has said once.
As a C programmer, I spend way too much time
wondering what type a variable should be and how
to save memory and gain precious nanoseconds of
time. "Bah, don't use unsigned long, unsigned
short is enough". Do I really need to waste
precious seconds of my life to save two whole
bytes of memory? Which cost what? $0.000012?
That's an inefficient use of my life, since I
usually throw pennies away rather than let them
collect in my pocket. Not to mention that my
processor is 98% idle most of the time.
Computers are fast enough. Let's work on something
else. At this point I'll gladly trade in speed
for decent functionality. If I can write what I
do in C in Perl in 10% the time for a 1000% speed
hit. I don't care.
I only wish I was good enough at Perl (only a week
or two old here) to help this project out.
To reiterate, lighten the fuck up.
You're all missing the point. (Score:1)
--
Slurrrrrpppppp! (Score:1)
Before you diss the language, try looking to see if maybe your system or implementation of the language might be at fault.
All of my perl scripts are just as responsive and any load-time delays are unnoticable as any other C utility.
Though I do agree that often times Perl is touted as a fix-all language suitable for most any task. I use Perl for just about every little scripting task I need, simply because it's so much easier to use than most any other language I've dealt with, and it's actually *fun* to write under.
Let them do what they like. I might actually be contributing to this myself.
Not really.. (Score:1)
There are legitimate reasons why you'd want to fetch data from the Web and process it by a Perl script. There are hundreds of Perl modules that let Perl scripts interface with and use data from tons of different data sources and formats. These things are useful.
Spiiiiiiiiiit! (Score:1)
I run Perl under NT as well and I understand where the original poster was coming from...
I don't understand your post.
Perl IFF UNIX (Score:1)
UNIX: Any of a collection of similar operating systems that you can run the programming language 'perl' on.
Yesterday, while looking at dejanews.com, I found out that someone is still using it as a .signature. Somehow, I find this project to be most amusing.
"malloc by hand"?! HAHAHAHAHA! (Score:1)
Sure, experienced C programmers instinctively write well structured algorithms where pointers don't get lost, and everything malloc()d is free()d when it's done with, but to the mortal among us, that's hard work, and having our garbage collected for us is a blessing.
Ugh (Score:1)
Daniel
# Parse options here
import sys
import os
import re
if os.exists(sys.argv[-1]):
if not isdir(sys.argv[-1]):
throw "%s is not a directory!"%sys.argv[-1];
for i in sys.argv[:-1]:
infile=open(i)
outfile=open(sys.argv[-1]+os.path.split(i)[1],"w"
stuff=infile.read(16384)
while len(stuff)>0:
outfile.write(stuff)
stuff=infile.read(16384)
else:
if sys.len(argv)>2:
throw "Need two arguments!"
destname=argv[1]
if(os.isdir(destname)):
destname=destname+os.path.basename(filename)
infile=open(argv[0])
outfile=open(argv[1],"w")
stuff=infile.read(16384)
while len(stuff)>0:
outfile.write(stuff)
stuff=infile.read(16384)
oh, really. (Score:1)
Daniel
why i refuse to use python anymore (Score:1)
Daniel
What kind of integers do you use? (Score:1)
Daniel
Re: Little round ones! (Score:1)
Daniel
oh, really. (Score:1)
For interpreters, most Forths are written in themselves -- but then Forth isn't really interpreted (it's wordcoded). The Forthers call it metacompilation.
-Billy
Okay, you're a moron, too. Happy? (Score:1)
True, but not all individual systems have the GNU tools installed. And for those that do, it's not likely that they are installed as the standard tools.
The intention is that, in a perl script, instead of calling the external program in backticks (which, if you don't know perl, has the same effect as doing it in the shell) you would load in the equivalent script. So instead of calling whatever ls is installed on the system--not really knowing for sure what the command-line syntax or output format is on this particular machine--you just make sure and call the perl version.
Why perl? why not Python, or Java, or Tcl? (Score:1)
Tom, please provide the proof.
Yuk (Score:1)
-russ
haha - nice try (Score:1)
And you did prove, just now, you are exactly what he (or she I guess... Doubtful though) said you are.
oh, really. (Score:1)
Too bad you can't rewrite perl in perl.
The world's first recursive programming language.
Slurrrrrpppppp! (Score:1)
Great, undoubtedly, but the perl religion is really overdone. Sure, it's the only way to get anything done on NT, but that's no excuse.
Just a little DogBarf tossed at the faithful...
Hardly... (Score:1)
BTW- I like PERL
--Lenny
Just another Perl ranter . . . (Score:1)
just my 2 cents.
Slurrrrrpppppp! (Score:1)
Anyway, there's a simple reason why those of us who love Perl love Perl. It works. Having said that, reimplimenting UNIX utilities in Perl is really silly. Perl has a module system for a reason.
Java? Is this a troll? (Score:1)
Have you ever used Java? You know the way Netscape starts grinding the disk and doubling its RAM consumption when it runs into an applet? You want your system doing that every time you run "ls"?
So, okay, it's a pretty silly idea to have "ls" in Perl too. But last time I checked, Perl ran on more systems than Java, and though it's developing a bit of a gut these days, it's still the Laurel to Java's Hardy.
Why PERL? (Score:1)
# Java? It's more widely supported, faster, and can
# be compiled to native code for even more speed.
# Not to mention the porting process would probably
# be easier, since you could cut and paste parts of
# the code.
ROTFL! Java more widely supported than Perl? You're kidding, right? And porting easier? You must not know Java well. Its similarity to C is about the same as Perl's. And speed? Hehehehe. You really crack me up.
Perl kernel (Score:1)
While we're on the subject, an idea I've been playing with for quite some time is implementing perl as an OS kernel. Perhaps using the ext2fs and large portions of the Linux kernel as a base for hardware access and multitasking, but everything even remotely user-land using entirely Perl as the base.
Yes, its going a bit overboard on the Perl language. Still, such an OS would be enormously fun to play with. At least, I think so.
Why PERL? (Score:1)
Slurrrrrpppppp! (Score:1)
then:
... it's the only way to get anything done on NT
Then your NT kernel is coded in perl, or what? If your machine drops, the kernel is guilty (or you did some nasty lowlevel stuff). If NT is uncapable of running perl without crashing then I'm very sorry for it.
If you talk about "resource hog/pig" in conjunction with "NT" and "perl", guess to which this is attributed (grammar?)...
Nils
here's an idea for perl (Score:1)
Does nobody get the point? (Score:2)
logan
Great (Score:1)
Perlmacs (Score:1)
for chrissake, PERL?? (Score:1)
the POINT is (Score:1)
The other aim of the project is to reduce the usage of backtick subs in perl scripts. These are what makes perl slow -- I have a driver and display architecture for some LED display boards written entirely in perl. It speed up by a factor of three when I removed the numerous calls to system utilities in favor of a "native" solution.
Portability (Score:1)
(a) don't install them,
(b) don't install them completely and/or correctly.
The GNU utils work just fine on systems that have them. However, shell scripts tend to require some hacking at when their moved from one system to another ( even one *NIX system to another
--Elflord
--
Donovan Rebbechi
why i refuse to use python anymore (Score:1)
for chrissake, PERL?? (Score:1)
You moron. (Score:1)
Implementing Awk in Perl? Why not vice versa? (Score:1)
PMACS (Score:1)
Perl kernel (Score:1)
here's an idea for perl (Score:1)
xm@GeekMafia.dynip.com [http://GeekMafia.dynip.com/]
One-liners in Python (Score:1)
Sure, you can! Just use semicolons to separate statements and lambda. Then you end up with something as unreadable as the average Perl script
Why I love perl (Score:1)
How about:
theString.removeNewlines()
or
theString removeNewlines.
There's more than one way to skin a fish in a barrel.
GNU tools bloat (Score:1)
Implementing Awk in Perl? Why not vice versa? (Score:1)
And then back again! Write Awk in perl, then perl in that awk, then awk again in your new perl . . . Ultimately, you could waste literally DECADES of time that could -- in a less ideal world -- have actually been spent doing something useful, interesting, or productive.
Way to go, guys!
I like the idea of implementing all this stuff in a portable language, but why must it be such a horribly UGLY one?! Why, why . . . Yeah, sure, it does regular expressions -- but GNU has a perfectly good C library for that, right? What's the damn difference between writing in C with GNU's library, or writing in perl which probably uses the same damn GNU library anyway?!
Anyhow, as has been said above, all this guy's complaints (buffer length etc.) were addressed years ago -- in the GNU tools that they're using as examples. Uh, duh.
-j
Weird (Score:1)
I seriously doubt that perl's regexp code is derived from GNU. After all, with perl you have your choice of licenses -- GNU or Artistic. If you choose Artistic, you can keep things as proprietary as you wish.
Really? Well, yeah, then I guess they're not using much GNU code there. Odd. Hey, what the hell, it's their own code. More power to 'em.
-j
Ugh (Score:1)
I wonder why not?
Oh, it's because in Python, whitespace is
significant.
And now that it's gone, it's awfully hard to put it back because there's no other syntax indicating the block structure.
Too bad about that, huh?
perl in perl? (Score:1)
On second thoughts, this all sounds completely pointless...
Why PERL? (Score:1)
> like Java?
No.
> It's more widely supported,
Wrong.
> faster,
By what metric?
> and can be compiled to native code for even more
> speed
So? That's not the point of these tools (at least, as I can see.) They basically are a set of perl utilities that make the life of a perl programmer working in a brain-dead environment easier.
Finally,
> Not to mention the porting process would
> probably be easier, since you could cut and
> paste parts of the code.
I'm unsure exactly what this means, but the point of all this is that Jane Perl can carry a CD with all of these scripts on it to
Java is Java and perl is perl and they solve different problems and represent different approaches. Personally, I prefer Smalltalk, but that's neither here nor there.
Regards,
JFB
PMACS (Score:1)
Perl? Microsoft? Been there, done that. (Score:1)
As for Perl on Microsoft platforms, I've been using it daily since 1991 and it has made my professional life worth living, I can tell you. That and 4DOS/4NT, the command shell Microsoft should have done in 1983. (How they bought and butchered an already cut-down version of 4DOS from Norton/Symantec in the early 1990s is a story in itself.)
--------
Why PERL? (Score:1)
Why I hate perl (Score:1)
--
First off, if you can't have a sense of humor about what you do, it probably isn't worth doing. `chomp' is one of the most memorable commands in Perl 5, for that very reason. At least I seem to remember it well.
But you would rather have something like:
s/(.*)\n$/$1/;
That's much easier to remember. If only all Perl syntax was that clear.
Which brings me to one reason that I like Perl a great deal: "There's more than one way to do it."
-B
Oh lord... THAT WOULD DEPEND ON THE JOB, RIGHT? (Score:1)
use them differently. Blanket statements like,
"I would venture to guess then a good perl
programmer could out produce a good jave [sic]
programmer by 2 to 1," are incredibly ignorant.
There are, believe it or not, things that can
be easily done in Java and not done AT ALL in Perl. Likewise, there are things that can be done
in Perl (regex/text stuff) that is much more
difficult to do in Java (but probably not impossible).
That's why we have >1 language available.
So let's not be bandying about such crazy notions.
True, but "apples" ne "oranges". (Score:1)
oranges are no fun to compare. You would probably
be lying to yourself if you claimed that Java does
not have amazing distribution and maturity for
such a young language.
If you MUST compare languages (a trivial and useless exercise usually), let's at least compare Perl when it was 4 years old with Java now.
That'd be a fairer comparison, say, like apples and pears.
Braindead /. responses to article (Score:1)
However, that doesn't mean that it's either smart or useful to reimplement the Unix command toolset in Perl. On a busy server, Perl's resource footprint will still trip you up. We have had to reimplement a number of small Perl tools in sh, awk or C by virtue of the fact that even with a half-gig of RAM, we cannot afford to spawn fifty Perl processes every second.
Perl is still a great tool for a lot of our applications. Just not all of them. It might be fun to rewrite zork in Perl, but we're still going to be using good old-fashioned egregious GNU tools for getting real work done.
Perl (Score:1)