Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Perl Programming

A Bunch Of Perl Bits 91

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.
This discussion has been archived. No new comments can be posted.

A Bunch Of Perl Bits

Comments Filter:
  • by Anonymous Coward
    If you buy into the notion that perl programming replaces shell programming

    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.

    Bourne scripting is unbearable for anything but the most rudimentary scripts

    BS. I've written lots of complex sh scripts. (Yes, they worked, too.) 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. (At this point in the conversation, perl weenies usually point out with pride that in a perl program you don't need to "call out to" awk or sed, missing the point that duplicating their functionality in perl was a waste, since they already existed independently. Also, the merging of csh, awk, and sed in perl was crudely done, resulting in messy syntax that doesn't clearly distinguish between the various sub-languages, requiring excessive back-and-forth between perl's parser and interpreter just to get the code parsed.)

    The single thing I probably hate most about perl, though, is that stupid "default variable" (called $_ or something like that... I forget). Some perl bulitins operate only on $_, others do so only if you don't specify otherwise, leading to ugly code that is impossible for anyone not already perl-literate to understand, since every other line of perl is operating on this implicit variable.

    And don't even ask me about the six different ways of writing an "if" statement... in a language that doesn't even have a case statement! (Again, perl weenies rebut that the different forms of "if" allow you to be more expressive, but excuse the lack of "case" because you can emulate it with "if...elsif...". The hypocrisy of believing both of those claims at once is so obvious that no one but a self-deluded perl weenie could possibly do it.)

  • by Anonymous Coward

    What is the fascination with Perl in the *nix world? I can't fathom it - after all it adds little to what awk and sed have been doing for years. 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.

    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?

  • I've got perl turning my lights on and off in my house, wonder what's next.

    You sure your computer isn't posessed or something?

  • 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.

  • by Matts ( 1628 ) on Monday April 24, 2000 @07:32AM (#1113404) Homepage
    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 [assurdo.com]

  • by bjb ( 3050 )
    Welcome to PerlOS v1.0.0!

    (> Catalog

    DISK VOLUME 254

    B 203 PERL.KERNEL
    A 002 HELLO
    T 091 DOCUMENTATION

    (> Quake3

    Invalid command. Type ? for menu

    (> Drat!

    Invalid command. Type ? for menu

    (> Return to regular OS


    (by the way, site is definately /.'d)

    --

  • When I need more than what's comfortable to do in sh, I call out to awk or sed, or write a C program. (At this point in the conversation, perl weenies usually point out with pride that in a perl program you don't need to "call out to" awk or sed, missing the point that duplicating their functionality in perl was a waste, since they already existed independently.

    Of course you can "call out" to the sed or awk, but you have to use a totally different syntax with each of those.

    Shell scripting gives you 3 different regular expression flavors to use. Inconsistent meaning for whitespace. And lots of little sublanguages with different syntaxes. It's great for making code completely umaintainable.

    Some perl bulitins operate only on $_,

    You're simply incorrect here.

    in a language that doesn't even have a case statement!

    That's just what's needed, a statement whose common accepted default behavior is exactly wrong about 85% of the time.

  • You seem bitter, my friend ... Maybe you are shocked by the extra punctuation in variable name, or maybe you can't stand the ambiguity of the langage. Anyway, don't take our word for it and listen to the master [linuxjournal.com]. You should be enlightned.
  • Hrm. A guy with a name versus an overly-critical Anon. Coward. Are you so sure that he is the one making an idiot of himself...?

    If you'll look through his User Info, you'll notice that he has a posting history devoid of trolls and First Posts. How do you stack up?

    - Jeff A. Campbell
    - VelociNews (http://www.velocinews.com [velocinews.com])
  • How do you know I'm Jeff?

    Erm, you don't, I guess. I'm sure you aren't losing any sleep over it though.

    The point is, an Anonymous Coward can say whatever they want without their name being attached to their Insightful Post/Troll/Flame. My name is unimportant - what is important is that generally if a bunch of posts are made under the same name, that person is taking credit or blame for their content. An AC can do whatever they want without any fear of retribution or history.



    - Jeff A. Campbell
    - VelociNews (http://www.velocinews.com [velocinews.com])
  • Him having no name says little about him, but you not having one could say volumes about you.

    Either way, it's obvious that this is all based on a vendetta you (or whichever AC posted the original reply) have against him. His posts don't seem terribly insightful, and the non-breaking spaces are annoying as hell, but this doesn't mean he's a troll or karma whore (aren't those usually mutually exclusive?).

    Whatever. It's not like his original post was inflammatory or anything. I seriously hope you don't follow people in order to toss around witless insults whenever they post anything...

    - Jeff A. Campbell
    - VelociNews (http://www.velocinews.com [velocinews.com])
  • 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.

    Um, how about Unix and Python? And as an added bonus, you'll still be able to understand the script a year later.

    Yes, it's possible to write readable Perl code, but virtually all Perl programmers don't write readable code. That's what happens when your language doesn't encourage good style. Since maintainability is the most important feature of any serious programming language, Perl loses.

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

    I'm not even sure what the above means because... it doesn't parse. What are you claiming? That Perl doesn't need to be parsed? That other languages don't need to be parsed? Either way, you'd be wrong.
  • Perl loses because people can't write good code? Please.

    No, Perl loses because empiraical evidence shows that people don't write maintainable code in Perl. A reasonable explanation for this seems to be that Perl doesn't encourage people to write maintainable code, and instead encourages people to write a million "quick and dirty one-timer scripts", stick 'em together, and hope the mess does something useful.

    Perl is good because you can write beautiful, very maintainable code.

    You can also write beautiful, very maintainable, x86 assembly code. Neither language encourages you to do it though, so it'll take you a heck of a long time to get anything useful accomplished. At least with assembly code there's an efficiency benefit. Perl's only strength seems to be its ability to let a person write one-liners that not even the author can understand a month later.

    Perl is also good because you can write quick and dirty one-timer scripts to do anything.

    Really? To do anything? Write a 3D FPS in one line of Perl. No calling out to other programs allowed.

    Seriously though, Python lets one write quick one-off's just as easily as Perl. The main difference being that Python one-off's can then be incorporated into real applications without hurting the maintainability.

    The best description of this that I've ever heard is that Perl gets out of your way so you can focus on what you're trying to accomplish.

    Perl's goofy syntax gets in my way.

    Just because languages like Python, C, C++, and Java are pretty structured, it doesn't mean you can't write unmaintainable code.

    I never said that you can't make unmaintainable code in Python. Nor did I ever say that you can't make maintainable code in Perl. What I'm saying is that Python code tends to be very maintainable, while Perl code tends to be very unmaintainable.

    A likely explanation is that Python encourages good programming style (ie: maintainable code), while Perl actually encourages bad programming style (ie: unmaintainable code). Having used both languages, I believe this to be the case. Have you used both languages?

    Note that I never said Python was perfect either. It's got its warts. There are some things I'd really like to be fixed (like the namespaces issue). A lot of people seem to be turned off of Python because of the indentation thing though. That's unfortunate, and immature. You indent your code anyway. Do you worry about indentation gremlins going and un-indenting it during the night? Why do you think that will happen with Python code?

    If you don't agree that Perl encourages people to write unmaintainable code, explain why virtually all Perl code is virtually indecipherable. Why do even Perl programmers joke about the "write-only" characteristic of Perl?
  • What?!! PerlOS, PerlWM and PerlSH... no PerlPERL? You gotta be kidding!

    PerlPERL (a Perl interpreter written in Perl) would actually be a great way to implement a better debugger than the current perl -d. It's not so farfetched. After all, Lisp in Lisp has been around a long time. Perl now has the necessary introspective ability, it's just a lot of work because the interpreter is so complex.

  • The presence or absence of XS code (i.e. code that can segfault) in a PerlFS filesystem won't affect whether the kernel goes kaboom. The Perl code that executes, and any XS it calls, is in user mode, protected space. PerlFS defines a protocol for the userland fs code to return syscall results. It can't crash the kernel unless PerlFS (the kernel module) is buggy.
  • hehehe... looks too much like DOS 3.3 from the Apple II days...
    ...of course there are SOME differences in your example.... :)

    ahhhhh... for the days when code wasn't bloated.

    Just another computer geek....

  • Well, I had included a link to the webpages of YAPC, but slashdot decided to filter it out. You'd have to work it out for yourself (and ask the slashdot programmers to write better parsing software).

    While on the process of doing so, one might as well suggest a better language in which to write said software.
  • Shell scripting gives you 3 different regular expression flavors to use. Inconsistent meaning for whitespace. And lots of little sublanguages with different syntaxes. It's great for making code completely umaintainable.

    And that differs from Perl how?

    That's just what's needed, a statement whose common accepted default behavior is exactly wrong about 85% of the time.

    Randomly making up statistics to help your puny defense of a misfeature in your favourite language doesn't improve your argument, sir.
  • Is there any shame promoting PerlMonks every time a Perl story comes up? Is that part of the posting script?

    Here's another pearl:
    The Perl Rocket [rocketaware.com] - Rapid Knowledge Transfer for Perl programming.

  • by Kaufmann ( 16976 ) <rnedal&olimpo,com,br> on Monday April 24, 2000 @03:36PM (#1113419) Homepage
    (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.

    ")
  • by Camelot ( 17116 ) on Monday April 24, 2000 @06:53AM (#1113420)
    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.)

  • I do the almost the same thing. I ordered an X10 firecracker kit when they were featured on here and freshmeat. I don't know if it still can be ordered, but the link is here [x10.com]. It was only $5.90 and it comes with a serial passthrough that has an RF transmitter in it. All you have to do is send it simple commands and it will turn on and off up to 16 things that are connected to X10 control modules. Works great too.
  • How does one accomplish such an interface?

    Last year, at YAPC, Larry Wall, creator of Perl, told in his speech about how he had wired his house with X10. All Perl driven.

    -- Abigail

  • Well, I had included a link to the webpages of YAPC, but slashdot decided to filter it out. You'd have to work it out for yourself (and ask the slashdot programmers to write better parsing software).

    -- Abigail

  • by double_h ( 21284 ) on Monday April 24, 2000 @08:38AM (#1113425) Homepage

    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.

  • Your post will almost certainly be modded down as flamebait. Thou shalt not malign the great Camel on the holy slashdot and all....

    But the idea of being "expressive" with a computer language has always bugged me. I just don't get it. I want a computer language to be efficient and elegant, but not "expressive".

    Expressive is for poets and musicians. Bending notes and changing dynamics is "expressive". Metaphors are expressive.

    I don't want programmers to be expressive, I want them to be efficient and accurate. I don't want air traffic controllers to be expressive, either ("Turn away from the harsh yellow globe and climb higher than the billowy cotton vapor, for there is another much like yourself directly ahead.")

    So can someone please explain to a simpleminded guy what "expressive" programming is -- maybe with an example?
  • So basically the language allows the programmer to code the same way she or he thinks?

    Ok, assuming there's no performance penalty for choosing if (COND) {dostuff} over dostuff if COND , I can see the coolness of that. Thanks!
  • by DonkPunch ( 30957 ) on Monday April 24, 2000 @07:17AM (#1113428) Homepage Journal
    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....
  • Very interesting question indeed.

    I'm quite ignorant in OS design (still wading trough Tannenbaums "Operating Systems" at Uni), so take it with a grain of salt, but:

    1. The language needs a compiler* to create directly executable machine code.

    2. The language must provide features to manipulate/manage memory (as in pointers).

    3. The language has to provide direct access/control to/of the peripherals (device drivers)

    ...Other than that, I think anything would do.

    * Note that the difference betweeen an interpreted and a compiled language is not fixed and hasn't anything to do with the language itself. Altough Perl is usually (semi-)interpreted, one could create a compiler for it (or is there one already? I don't know Perl very well).

    Feel free to correct/flame me at will ;)
  • What?!! PerlOS, PerlWM and PerlSH... no PerlPERL? You gotta be kidding!
  • There seems to be the usual "Perl Is Ugly" threads going on here, so let me sum it up for all of you. People use Perl for the same reason people use Linix. Perl is superior to (most) other languages in the same way that Linux. If you want complete control over the language you use, there are few beside Perl for you. If you want hand-holding and coddling, write in VB.

    So far, almost every complaint about Perl attached to this story has been uninformed whining or out and out untruths. People complain that Perl is a read-only language. That absolute bullshit. There is no such thing as a read only language -- there are programmers who write read only code. Yeah, some of the worst code I have ever seen was written in Perl, but some of the best has been written in Perl. I feel sorry for all of you people who are afraid to express yourselves in your code -- Perl is probably very scary for you, and rightfully so. "It is a poor craftsman who blames his tools" -- bad code is written by bad programmers, and is language independant.

    To sum it up, and bastardize anoher great quote, "With most languages, you are limited by the language itself. With Perl, you are limited by your own imagination."


    Cthulhu for President! [cthulhu.org]
  • by bahwi ( 43111 ) on Monday April 24, 2000 @07:27AM (#1113432)

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

    Try checking CPAN [cpan.org] 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.

  • I'm the original author of one of the many Perl shells out there. Recent versions are getting quite usable. Info is available via:

    * http://www.focusresearch.com/gregor/psh/
    * http://sourceforge.net/project/?group_id=475
    * http://www.freshmeat.net (generally)
    * http://freshmeat.net/appindex/1999/08/02/933625664 .html (appindex)
    * http://www.perl.com/CPAN-local/modules/by-authors/ id/G/GR/GREGOR/

    I'd be interested to know of any other Perl shells besides the ones mentioned in the POD documentation.

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

    Meaning, do you have a text file which needs to be parsed? (html, source, ect.) Then perl is a good tool to use.

  • 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*).



    JAVA IS THE COBOL++ OF THE INTERNET.


    There, I feel better now.

  • 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*).

    JAVA IS THE COBOL++ OF THE INTERNET.

    There, I feel better now.

  • Six months? Yeah, it might have loaded by then...

    --
  • This reminds me of the old joke about creating a /vmunix.el, waiting six months, and then finding all of the people where using it, and killing them.
  • Theres a small typo in that, the corrected version should be:

    $PROMPT="PERL> ";
    print "$Prompt\n";
    while ( <> )
    {
    eval;
    print $@;
    print "\n$PROMPT\n";
    }

    Steve
  • 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).

    If you're worried about writing a script which needs to be secured you should be writing it in Perl, rather than a shell language.

    With Perls concept of taint'ed data you're probably more secure than with any Shell script you come up with..

    Steve
  • Actually, my original statements on that haiku were edited. I do indeed like the haiku, and BDSM.

    Cheers, KM

  • There really isn't a 'winner' out of the group. They are all winners, none deemed better than any other. That is why each has it's own heading, and not listed as "First place goes to..."


    Cheers,
    KM

  • Did you read that it should be a file named 'waiting'?
  • Once upon a time we had a bunch of good languages and a good OS. But you couldn't write the OS in those languages, though many tried, so C was invented.

    Flash forward a quarter century.....

    We have a bunch of good languages, and a good OS. But you couldn't write the OS in those languages, though many tried, so we all went back to C.

  • I didn't knew one can post to slashdot from late 60-ies! now that's a breakthrough. so is DonkPunch Kernighan or Ritchie or Thompson?

    erik
  • I am sorry, but every time there is mere mention of Perl someone has to post "Hey, what about Python". Are Python advocates so Perl envy that they cannot contain themselves. Several days ago there was a Python post (under the camel icon, mind you) and you did not see every third post saying "Perl can do that" or "Perl is has bla bla bla".

    Python is a fine language and I hope it has a long life and gains market share, but a topic on Perl is not a negative on Python.

    If your troll I bit.
  • Roman_Mir, you are one weird fucker.
  • I've been using this small perl script as an interactive shell for years. I wrote that because I found I often needed to do a quick on-liner computation and did not want to have to create a new file with the necessary perl code in it.


    #!/usr/local/bin/perl

    $PROMPT="PERL> ";
    print $PROMPT;
    while () {
    eval;
    print $@;
    print "\n$PROMPT";
    }


    This 'shell' has one internal variable, "PROMPT" :-). Have fun!
  • A shell which understands perl syntax? I guess it wouldn't be that difficult to wirte a perl script which acts as a shell, perhaps someone has done that already. but who knows. But I see no need, why a shell needs be as complex as perl is.

    Yes, Bourne Scripting has not the same possibilities as perl has. And if you dislike Bourne scripting, use !#/usr/bin/perl.

  • Is it possible to implement an Operating System with very language? And if not in any, what requirements must a programming language meet to write an operating system with it?
  • no no, PerlPERL was implemented long ago. There is a perl interpreter written in Perl on CPAN called PerlInterp.
  • Is it necessary to promote the PerlMonks site every time perl gets mentioned? I know it's a slashdot site. but still.

    --
  • It seems like the Slashdot Effect has swallowed the OS Link....

    Does anyone know if it plans to use the Perl from the Topaz Project [perl.com], or if the OS will be easily updatable each time a new distribution is released?

  • The use of Perl is not just restricted to the *nix world either. I work in an NT, AS400 shop, and I have used Perl to perform feats that blow the socks off my VB and VC programming coworkers. We even found a Perl port for the AS400 [perl.com], though I cannot convince the sysadmin to let me install it.... :)

    Perl has a place permanently in my toolkit for just about any job that I have. It's fast, it's easy, and if I don't know how to do something, I can find the answer pretty fast: perlmonks, perl.com, comp.lang.perl.misc...

  • Was I the only one who found the entries extremely boring? Perl is such a forgiving language that it doesn't take a great deal of work to get something that will run, so you're left with attempting to make it look neat, which most of the entiries didn't do, or make it clever and amusing, which most of them didn't do. The exception was Damon Harper's entry, which at least required some work and ingenuity, except that it doesn't run as it claims to on my system.
    * mild mannered physics grad student by day *
  • Another thing: What twit thinks Perl is an ideal language for their propsed "BioOS"? Their supposed justification is that it needs to be a high level language, therefore, Perl is the best choice. That doesn't sound very well thought out to me. I'd have chosen Lisp, personally, for all the reasons that John Koza uses Lisp in Genetic Programming.
    * mild mannered physics grad student by day *
  • wow, and then you and the 3 other individuals out there who actually use LISP could have a great time!!

    Actually, I don't use Lisp, because I don't do AI programming. But, if I was purporting to do AI programming, as the people at the supposed BioOS project are purporting to do, I'd damn sure want to learn Lisp. So there are a thousand bozos who know Perl. So what? You can have a thousand bozos working on your project, as opposed to three people who know what they're doing.
    * mild mannered physics grad student by day *

  • Is it me or is the PerlOS website one of the
    most hacked, unconsoildated piles of broken
    links and lack of content in existance? I mean
    the project sounded cool. I even would have a lot
    to contribute to the PerlGUI stuff and I like the
    idea of PerlSH. But unless they get their act together
    and present a good project page, I'm not touching it.
  • you need to rename the file containing the program to "waiting". Then run it.
  • I think the "Obfuscated one" should have wone.
    When you 'translate' it into clearer english, its the best poem.

    Plus, the code is more directly readable as a poem, if you skip the punctuation.
    PLUS: it actually outputs something, which intrinsically is bound to the meaning of the poem!
    I think that makes it the most "poetic" of all.

    Whereas the "winning" poem was most just a translation job of a poem,that works in english, but doesnt seem particularly 'elegant' in perl to me.
  • www.davinci.ca
    Why do you need my employer?!
  • It's a poem, art, Artists don't get appreciated during their life time. On the other hand, what do you know!
  • /*
    Yesterday (Lennon/McCartney)

    Yesterday, all my troubles seemed so far away
    Now it looks as though they're here to stay
    Oh, I believe in yesterday.

    Suddenly, I'm not half the man I used to be,
    There's a shadow hanging over me.
    Oh, yesterday came suddenly.

    Why she had to go I don't know she woldn't say.
    I said something wrong, now I long for yesterday.

    Yesterday, love was such an easy game to play.
    Now I need a place to hide away.
    Oh, I believe in yesterday.

    Mm mm mm mm mm.
    */

    import java.lang.*;
    import java.util.*;
    import java.awt.*;


    public class Yesterday extends Lyrics implements Beetles
    {
    private String wrong = (String)new Object();
    public static void main(String[] args)
    {
    Yesterday Y = new Yesterday();
    Y.run();
    }

    public String saySomething()
    {
    return wrong;
    }

    public void run()
    {
    // initialize song
    Object Me = (Object)new Random();
    Love love = new Love();
    int Suddenly=0;
    Calendar currentDate = Calendar.getInstance();
    Calendar dayBeforeNow = Calendar.getInstance();
    // initialization completed
    dayBeforeNow.set(
    dayBeforeNow.get(Calendar.YEAR),
    dayBeforeNow.get(Calendar.MONTH),
    dayBeforeNow.get(Calendar.DATE) - 1,
    dayBeforeNow.get(Calendar.HOUR),
    dayBeforeNow.get(Calendar.MINUTE),
    dayBeforeNow.get(Calendar.SECOND)
    );

    //Object objDream = new Object();
    //Object objReality = objDream;

    if ((Calendar.getInstance()).get(Calendar.DATE) == dayBeforeNow.get(Calendar.DATE))
    {

    try{
    while(Integer.MAX_VALUE > 1)
    {
    if (dayBeforeNow.get(Calendar.DATE) {
    Exception troubles = new Exception();
    throw troubles;
    }
    }
    }
    catch(Exception e)
    {

    System.out.println("Troubles");
    Object objHere = new Object();
    synchronized(objHere)
    {
    try
    {
    Suddenly = (new Random()).nextInt();
    wait(Suddenly); // until NoMoreProblem thread wakes this up
    }
    catch(Exception ie)
    {}
    }
    }
    }

    int Man = ((Random)Me).nextInt();

    while(Man / 2 - 1 == Man )
    {
    System.out.println("I am the man!");
    }

    Object Shadow = (Object)(Object)Me;

    //if (Suddenly != ) //implement later //{ // System.out.println(dayBeforeNow); //}
    String ISay = this.saySomething();
    if (ISay == wrong)
    {

    She she = new She();

    String Explanation = she.go();
    if (Explanation == null)
    {
    System.out.println("Reason Unknown.");
    }

    try
    {
    currentDate = dayBeforeNow;
    throw new Exception();
    }
    catch(Exception e)
    {
    currentDate = Calendar.getInstance();
    }

    }



    if ((Calendar.getInstance()).get(Calendar.DATE) == dayBeforeNow.get(Calendar.DATE))
    {
    love.isEasy(true);
    love.play();
    }



    this.hide();

    ((Yesterday)Me).believes();

    for(int i = 0; i System.out.print("mm ");

    }

    private void hide()
    {}
    private void believes()
    {}
    }

    class She
    {
    public String go()
    {
    return null;
    }
    }

    abstract class Game
    {
    abstract public void play();
    }

    interface Easy
    {}

    class Love extends Game implements Easy
    {
    public void isEasy(boolean easy)
    {}
    public void play(){}
    }

    class Lyrics
    {}
    interface Beetles
    {}

  • Don't piss on awk and sed. Both of them not only have logic support, both of them have functions.
    Just read through your man pages correctly, both AWK and SED implement logic, if, while, do etc and functions.
  • I am gonna fuck you in the ass
    (new PipedReader()).connect();

    Without making giant mess
    System.gc(); // garbage collection

    Then I'll be fucking you so much
    String str = "";
    BufferedReader BR = new BufferedReader();
    while((str = BR.readLine()) != null){}

    Can you believe it? I am Dutch! // at least it rhymes
    Object Dutch = (Dutch)(new Object());
    try
    {
    if (this == Dutch) return true;
    }
    catch(Exception e)
    {
    return false;
    }


  • Your right, my bad. Never really used them since I found Perl so I am unfamlair with there feartures and shouldn't of made any (uneducated) comments regarding them.
  • by jbarnett ( 127033 ) on Monday April 24, 2000 @07:21AM (#1113468) Homepage
    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"

  • by jbarnett ( 127033 ) on Monday April 24, 2000 @08:20AM (#1113469) Homepage

    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 [cpan.org] 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 [cpan.org]

    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? [apache.org]

    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

    :)
  • by Trollmastah ( 129873 ) on Monday April 24, 2000 @06:57AM (#1113470)

    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");

  • I am not a Perl-person, and so I do not understand this stuff in deep. But this Obfuscated Poem looked so astonishing that I just had to get a copy and test it (reminds me of how I got Linux :-). Problem is: it doesn't work as expected.

    $ perl perlfun.pl
    waiting
    -------
    ^C
    $

    Like that. It just waits. If anyone got it to work, I'd like to know. I have copied and pasted from the HTML source so I had to rewrite some &gt;'s etc. and though I tried I didn't find differences between my proggie and the displayed one on the page.

    OK, so this is a bullshit post. I just want to try out that proggie :-)


    It's... It's...
  • Could you change your .signature? Everytime I read it I get upset. 1984 was written between 1947 and 1948, but only got published in 1949 because Orwell was sick as a dog.

    thank you

  • by Tarsh ( 144250 )
    I can't get into the page for some reason.
  • You have to name the file "waiting"; if you look at the first line you'll see that it opens its source to a filehandle called "_and". I think that what it then does is read itself, then print the alphabetic/whitespace characters (and a bit of the punctuation); the last command is to sleep() indefinitely.
  • If you'd tried the link you'd see it was broken. Perhaps it was initially due to slashdottedness, but the point is that access to the link is cut off. And try to avoid belittling everyone especially for firing off "rapid posts" after all you found the post important enough to reply to didn't you? Your post seems like flamebait to me...
  • Um, are you currently employed as a programmer?

    If so, then how can I contact your employer?
  • Just that you're code is so bad I probably have no problems getting a job :-P
  • Perl makes hard tasks easy and impossible tasks manageable.

    >> IMHO Perl has no real domain in which it is better than everything else

    Even if you don't use it for web programming, it is a much better system admin tool than anything else. You can do everything you can do with sed, awk, or shell scripting with Perl. And its cross platform, so you could conceivably make one comprehensive system admin tool with Perl that did all the jobs you needed to do across multiple OS's.

  • I tried the perl shell out in one of its very earliest releases and found it promising but very rudimentary ... with later releases however it has shown itself to improve immensely in useability. It makes it unnecessary to write the small scripts that we do on a day-to-day basis for system admin work.

    I strongly suggest others to check this shell out before dismissing it out of hand.

    Rob
  • $man{"from"}=qw(Nantucket);
    ...

    -L
  • I've written lots of complex sh scripts. (Yes, they worked, too.) I'd rather write any amount of sh than perl I did also, but now I do everything in perl because I can use the same scripts in many unix flavours, and even in Windows ! This is a very good reason to use perl. It can be used in many OSes, including VMS, Macs, windows, unix !
  • by jargoone ( 166102 ) on Monday April 24, 2000 @09:54AM (#1113482)
    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.

  • I find the perl shell indispensible, even in its current form.
  • by Ars-Fartsica ( 166957 ) on Monday April 24, 2000 @06:29AM (#1113484)
    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.

  • nope, doesn't count. Gurusamy Sarathy's PerlInterp [perl.com] is an XS module that embeds the perl interpreter (which is currently written in C) for other perl code to access. it only serves as perl embedding example.
  • Perl's an amazing language. Follow the links and you see that you can be either a liberal arts major (poetry) or a CS major (PerlOS). Scarry stuff. I've got perl turning my lights on and off in my house, wonder what's next.
  • The RF power switch is available from Radio Shack for about $20 per kit. It comes in three frequencies A,B, and C. If you want to turn on multiple lights at once, be sure to get all of the same requency. There is NO way to turn on both an A and a B at the same time without wiring both controllers to your PC.
  • Check our your link. Still good and offer still valid. I have one on the way in the mail. It'll be fun to play with it (has to be better than the mess of wires hanging off my mother board with duckt tape).
  • I purchased two RF switchable power sockets. The kit comes with what looks like a clapper and a key-chain controller (like that for your car). Cracked the case of the controller and ran it into a serial controller card, but you could probably accomplish the same feat if you can program serial ports. Then I just used perl to launch my shell script that, for all intents and purposes, pushed the on or off button on the controller and turned on the lights. To answer your next question in advance, NO I WILL NOT GIVE YOU THE URL (The /. effect on my household lights would land me a spot on the couch tonight).
  • I am no troll. I was just wondering if anybody ever thought about it or if Perl always over shadowed it. I guess I got my answer.

An authority is a person who can tell you more about something than you really care to know.

Working...