Slashdot Mirror


A Bunch Of Perl Bits

Couple of Perl Bits fell into the bin worth noting today: dlc writes, "The results of the Perl Poetry Content are in, and are available." If you're into this sort of thing, you'll dig it. A lot of clever stuff there. Course the sonnet generator is probably my favorite... hack it to generate rock lyrics, and I can start a band and record a debut album. ;) If that's not weird enough for you, check out the PerlOS Project. A PerlWM, a PerlSH, and more. It will strike fear into even the most hardened of Perl Monks.

13 of 91 comments (clear)

  1. Re:Why is Perl so popular? by Ranger+Rick · · Score: 5
    after all it adds little to what awk and sed have been doing for years.

    Apparently you haven't used Perl much. :)

    For more complex tasks than a simple CGI script Perl seems unwieldly ...

    Like any other language, you need to plan ahead and design your software, or it's *always* unweildy. The difference is that because Perl has More Than One Way To Do It, there's no accepted "standard" for doing certain things certain ways. If you are organized when you code and turn on things like "use strict", this can be a wonderful blessing, in that it gives you a lot of leeway to do interesting things and to put them just like you want them. If you are a bad or sloppy coder then Perl isn't for you, because it will just make it worse. :)

    Some of the cleanest and best CGI code I've ever seen has been Perl, and some of nastiest, ugliest CGI code has been too. It's all in how you use it.

    As for What is the fascination with Perl in the *nix world?, because everyone is different and for some people it's the perfect language for most everything.

    Frankly, after using Perl, every other language I use seems constricting (and even if well-designed or well-intentioned, usually too verbose... *cough*java*cough*). I can use the same coding practices I would in a constrained/typed/object-oriented language, but I can do a lot more with it.

    Perl doesn't kill code. People do.

    --

    WWJD? JWRTFM!!!

  2. Don't forget the PerlFS by Matts · · Score: 3
    PerlFS is a linux kernel module that embeds perl so you can build file systems in Perl. Very cool technology, as you can actually build an ftp filesystem or a http filesystem, or all manner of cool things. Just don't add in any XS modules or your kernel might go kaboom... Ah well.

    The Perl Filesystem

    --

    Matt. Want XML + Apache + Stylesheets? Get AxKit.
  3. Re:Expressive Languages by Kaufmann · · Score: 3
    (with-prefix (list 'IMNSHO 'YMMV) "

    Perl allows a programmer to code more or less as he thinks. It's based on the principle that programming is telling the computer what to do, so the computer should try to understand what you mean - that a language should adapt to the programmer, not the way around. This philosophy shows up everywhere in the language.

    For example, it allows you to say both if (COND) { dostuff } and dostuff if COND because you (I, at least) can think in either way. The special variable $_ plays the part of the pronoun "it", so that you don't have to explicitly refer to big-named variables all the time.

    Perl is inherently imperative because we naturally think in terms of algorithms, but it also allows some declarative features, and it's even got lexical scoping, closures and higher-order functions for us Lispers.

    Most importantly, it allows the programmer to be concise, thus expressing what he wants quickly. So it allows for complex instructions to be coded in a very simple form; this is why you're not forced to declare variables if you don't want to. It's also why arrays are both stacks and queues, it's why hashes are also arrays, it's why we've got automatic string interpolation and scalar type conversion, it's why we've got built-in arrays... et cetera et al.

    Of course, this still begs the question of whether all this expressiveness damages formalism in its useful form - the form which allows them to be accurate and understandable by humans. I personally think so, but then again, not even I use Perl for everything. (As I said, I'm a diehard Lisper.)

    Well, I can't think of much else to say. I hope I've clarified something, at least.

    ")
    --
    To the editors: your English is as bad as your Perl. Please go back to grade school.
  4. o~ Pearl, my love by Camelot · · Score: 4
    Oh, forgive me, dearest Pearl - I have had forbidden thoughts about other computer languages. How can I stand this assault of venomous exclamations - they keep calling you ugly, unwieldy; they say you do not possess a warm heart of pure OO. You know, don't you, my love, that this is not how I feel.

    Even then, I have lingering glances to others - python, with it's elegance and - the whitespace ! Oh, those sinful temptations. And don't forget PHP - riding on top of that Apache, all the time - they banished you from there, too.

    But none of them can spin poetry like you do, and that is - I know it now - the best virtue a programming language can have. And I feel so ashamed that I have ever doubted your beauty. O~ sweet Pearl, I will never leave you.

    (Besides, you are pretty too damned handy with regexps.)

  5. Try it out for yourself by Imperator · · Score: 3
    --

    Gates' Law: Every 18 months, the speed of software halves.
  6. Re:Why is Perl so popular? by double_h · · Score: 3

    IMHO Perl has no real domain in which it is better than everything else - so why is it so popular?

    "Why I Like Perl":

    • It makes a great Swiss army knife. Whenever I need to throw together some sort of administrative/utility program where ease of development and maintainance are more important than raw performance (which is often the case), Perl makes a great choice. 95% of the things I used to do in shell script, I now do in Perl instead (the exceptions mostly being system scripts where I'm espescially paranoid about security or stability).
    • Perl is easily portable to lots of environments. I've had the same Perl code run on Unix, Win95, and Netware systems with only a couple of lines changed.
    • A lot of the Perl metaphor is shared with Unix and C (both conceptually and syntactically). There have been countless times where a Perl insight has proved useful when working with core Unix tools, and vice-versa.
    • The modules built into Perl and available on CPAN have saved me countless hours of re-inventing the wheel. Using a well-written module results in programs getting written faster, and the resulting code is cleaner and easier to maintain.

    In conclusion, Perl just makes my life easier as a programmer. It's not the end-all of languages (I think that as anything but an academic excercise, a Perl-OS is an absurd idea), but to me it's very intuitive, concise, and flexible. I've used Perl for everything from simple glue scripts to fairly heavy-duty CGI to other sorts of network programming to database administration tools.

    For more complex tasks than a simple CGI script Perl seems unwieldly, and even now technologies such as ASP and JSP are taking over the server-side processing domain.

    I just finished working on a fairly large webbable database that was implemented using PHP and Oracle. PHP worked nicely for the task, and so far stability and performance look great, but I'm pretty confident the same project could have been done using Perl/DBI instead. On the other hand, I do NOT envy the people where I work who do ASP; it blows up on them all the time, and even the stable/production ASP systems require way more babysitting then I've ever seen on a web database using Perl as intermediary.

  7. My OS Project by DonkPunch · · Score: 5

    After reading about the JavaOS project and now the PerlOS project, I've decided to start my own OS project.

    DonkPunch hereby officially announces: THE C OS PROJECT.

    That's right, folks -- an entire operating system written in C! Utilities and shells all written in C! It will be the most C-friendly OS the world has ever seen!

    It's a revolutionary idea, I know. In fact, I'm kind of surprised nobody has tried it yet....

    --

    Save the whales. Feed the hungry. Free the mallocs.
  8. Re:Why is Perl so popular? by bahwi · · Score: 4

    after all it adds little to what awk and sed have been doing for years.

    Try checking CPAN out.

    For more complex tasks than a simple CGI script Perl seems unwieldly

    Perl is insanely powerful, especially with CPAN, and for CGI use mod_perl. For simple CGI script's to complex ones. For more complex tasks is seems unwieldly? Production times are much more when using something like Java/C/C++ and many others. Perl also comes on most OS'es these days. It has a long history of being a CGI language. One CGI I have which is about 1,300 lines right now is simple to debug, add new features, and speed up parts of it. We're using mod_perl, so it runs much faster than before, despite some bottlenecks I have in there still, since it's still in development. I also decided to change the program into an OO program so we could customize it for our clients, that took about 10 minutes, and now I have all the advantages and disadvantages of object oriented programs. I can change it back simply too, if I ever wanted to.

    even now technologies such as ASP and JSP are taking over the server-side processing domain.

    I'll go ahead and forget that you didn't mention PHP. ASP is proprietary, for NT, unless you use a commercial program, or an ASP interpreter, written in Perl by the way. JSP is based on Java, which still does not have as much territory as Perl, and is much harder to debug. With mod_perl running, and a properly create program, you have the speed of ASP and JSP, more flexibility(excluding JSP, which is based on a full language).

    IMHO Perl has no real domain in which it is better than everything else - so why is it so popular? Can someone please tell me?

    Again, see CPAN. With Perl you can create anything from a simple text-processor to a fully featured web application using mod_perl, to a powerful workstation application using QT, GTK, both, or more. With a little knowledge of C/C++ you can create perl modules out of C/C++ libraries, and with C/C++ you can use perl code in your application. Need to make some graphs? There are several modules that'll help you, most of the work is done, just feed in the data and how you want it to look like. Check out CPAN for what is available, and check out perl.org for more information.

  9. correct me if I am wrong by jbarnett · · Score: 3

    The site is slashdotted, so I will make this stuff up for here on in...

    Correct me if I am wrong, but when Perl has to do something lowlevel it calls the native system calls for that OS right? So if Perl is the OS, how can it call it's self to something lowlevel when the low level system calls have never been defined (since it defines it, depending on what OS it is running). It seems like a chicken-egg problem...

    My guess is that they would have to hack up a kernel with hacked up Perl built directly into it. Then do everything else like memory management/ drivers/ etc though Perl code after the system gets up and going... Hell I don't know. Doing an OS in Perl is cool and all, just seems weird.

    Then again having Perl in kernel space would scream...

    Obfused Perl Kernel Drive contest.

    "Uh, Hrmmm so this is a Video Driver right?"

    "Nope"

    "Uh, sound card, see here is an IRQ entry"

    "Nope, that IRQ entry is run though a regexp 1000 lines down and it turns it into a DMA entry"

    "Uh right, hard drive driver?"

    "Nope, the file system information is imported, so that we can grep it for packed binary data, if any exists"

    "SCSI card?"

    "Nope"

    --

    "`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
  10. Re:Why is Perl so popular? by jbarnett · · Score: 5


    What is the fascination with Perl in the *nix world?

    What is the fascination with automation, quick development in the *nix world? I can do everything from send mail automatically, to parse my log files at 4:00 in the morning with a couple small scripts and crontab. Compared to other OS, *nix with perl/shell scripts can automate and build bigger applications from smaller ones in a quick and effective manner.

    For example, say I want to dial-in to the Internet, download slashdot every morning at 4:00, parse out the crap, format it into latex and send it to my other computer and post it into an sql database. This could be done with *nix and perl in about 3 cans of jolt cola. Name one other OS/launage that could do it in that short of time, and have it work well.

    Try that in .bat VB or VC++ and see how many cans of jolt cola it would take you.

    I can't fathom it - after all it adds little to what awk and sed have been doing for years.

    Uh, have you check out modules in Perl? Can awk or sed interact with a database? Can awk and sed combined send/get email/news? Also if I remeber correctly you can't do basic logic in awk+sed, like 'while' loops and 'if' statements. Also I think awk+sed lack support of things like OOP, arrays, hashes, sub routines, etc..

    Perl is ALOT more then a word parser

    For more complex tasks than a simple CGI script Perl seems unwieldly, and even now technologies such as ASP and JSP are taking over the server-side processing domain.

    Yea Perl is hard, especailly if you look at C, C++, ASM, Java, Perl seems extremely difficult to use. (sacarism).

    .ASP, now there is a winner, with it being all open and everything and not controlled by some greedy company, let me get on that bus (sacarism again).

    I haven't check .jsp yet, so I won't make any comments on it

    Perl is portable, can run Perl on %99.99 of all CGI enabled web servers, what does ASP run on, like 2 maybe 3 servers? Perl can do a hell of a lot more then ASP will ever be able to do, my freind once created a cgi interface to his coffee maker, not really usefull (to anyone but him), but I would have doubts of trying to do that in .ASP. Again, Perl is a REAL programming launage, that can interact with everything from C programs, other perl programs, other perl cgi scripts, coffee makers, databases, network sockets, other Internet services (smtp, pop3, nntp, irc, etc, etc), encrypted data (des, triple des, blow fish, etc, etc) and about any other thing you could possiablly think of

    IMHO Perl has no real domain in which it is better than everything else - so why is it so popular? Can someone please tell me?

    Have you even use Perl?

    1) It is open source

    2) It is Free software (as both in beer and speech)

    3) You can quickly develop programs/scripts

    4) It can "glue" together seemly random and unrelated compounds (ie. sql server and a pop3 email CLIENT, ie. coffee maker and the http protocol)

    5) You can choose your "programming sytle". Hate OOPing? Don't use it. Love OOPing? Your in luck. Like OOPing but hate the rules and interactive between objects? Break the rules.

    6) Does it have words in it? Does it need to be parse?

    7) Does it need to be portable?

    8) Does it have to be working before your jolt cola can goes empty?

    9) Does it have to be fast?

    10) Does it make you laugh when you have more or less "replaced" yourself as a system admin though the use of Perl/crontab?

    11) Is it fun to randomly "glue" odd, unrelated and obsecure things together using perl?

    12)Sometimes a 5 minute Perl script can save you 120 minutes of boring, manual work

    as the saying goes (in the voice of the comic book store owner in the simpsons)

    NOW GO AWAY OR I SHALL REPLACE YOU WITH A 10 LINE PERL SCRIPT USING THE ENGLISH MODULE

    :)

    --

    "`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
  11. Posting Perl by Trollmastah · · Score: 3

    seek topost (thatflamebait);
    Firstpost (the thread, fast);

    while ($natalie) {
    petrifies $to($stone);
    not grits;
    }

    accept the, moderation;
    seek the, $-1Troll, $-1offtopic'
    and wait;
    stat thekarma;

    unlink and listen (for, $theflames);

    for (a, karmawhore our /.) {
    system ("is trollheaven");

    --

    .

    Take all good things in moderation, including moderation.

  12. Re:PerlSH not so strange at all by jargoone · · Score: 3
    I buy into the notion that perl programming replaces masturbation with sandpaper as the stupid, masochistic thing geeks like to do to avoid realizing that they need to get a life.

    This coming from someone who says that they have written complex sh scripts, and, wait... get this... they work. Priceless.

    I'd rather write any amount of sh than perl. When I need more than what's comfortable to do in sh, I call out to awk or sed, or write a C program.

    If you knew how to use perl effectively, you wouldn't need to 'call out' to awk or sed. And writing a C program for something that you'd use sh for in the first place is pounding in a tack with a sledgehammer.

    The single thing I probably hate most about perl, though, is that stupid "default variable" (called $_ or something like that... I forget).

    Then quit your bitching and don't use it. Perl doesn't require you to use it. In fact, I didn't use it at all when I first started learning. Then a light bulb went on, and everything got much easier and made much more sense. Don't say something's 'stupid' because you lack the power to understand it.

    Some perl bulitins operate only on $_

    I'd like a few examples here.

    others do so only if you don't specify otherwise

    ... which allows flexibility and makes perfect sense when you know what you're doing.

    leading to ugly code that is impossible for anyone not already perl-literate to understand

    You have a point there. I forgot how you can't understand a language you don't understand. Don't you get it? Was sh easy for you to understand before you learned it? Was C?

    And don't even ask me about the six different ways of writing an "if" statement...

    You're free to use only the ones that your simple mind can comprehend.

    If you don't like Perl, don't use it. No one's twisting your arm. Take your sandpaper, go back to your desk, and write some shell scripts. Those of us who take the time to learn Perl will accomplish the task at hand much faster.

  13. PerlSH not so strange at all by Ars-Fartsica · · Score: 3
    If you buy into the notion that perl programming replaces shell programming, then its only a small leap to envision a shell that uses perl as its native syntax.

    This could actually be quite useful - Bourne scripting is unbearable for anything but the most rudimentary scripts.