Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Perl Critic + tidy is a blessed thing. It's about the only way I can keep most of my code somewhat consistant, esp after long periods of inactivity.
  • I must be the only person in the world who thinks it is absurd to see code formatting as a matter of personal preference.

    If

        I just ( you know , like this )
    format my English text in any old way,it
        gets awfully hard to read.There are standard grammatical conventions for written text,yet we try to reinvent them for programming
    . See how silly it is to break before the operator
    ?And what's the deal with braces being non-tight
    ? ( I mean, we don't have space after an opening paren ( and
    • The problem is that while the big decisions are obvious, the little ones are not. And there are lots of little decisions to make while formatting. While you can get people to agree on some of them, you can't get them to agree on all of them.

      For example, based on your post you should not break before operators. However if you read Perl Best Practices, you'll find some excellent reasons given for why you should break before operators. Basically they have to do with how our eyes move when we skim through c
      • ...coding expertise is fragile. ... Suppose we take someone who is familiar with a particular formatting style. ... Well it turns out that the transition is a shock.

        Exactly. Like I said: babel. The conflict comes from the subtle differences.

        And that is what really drives these religious debates. ...

        I would rather than the debate be based in reason than religion (call it semantics, but "religious debate" is, by definition, a contradiction of terms.)

        Given one internally consistent system, which i

        • I would rather than the debate be based in reason than religion (call it semantics, but "religious debate" is, by definition, a contradiction of terms.)

          Actually it is not a contradiction of terms. It is a description.

          Debates happen. Both sides bring arguments to bear, and argue. But people wind up arguing past each other, and after a while it becomes apparent that the answers are hugely important to people, but they cannot logically justify that importance.

          Because this is so reminiscent of debates over r

    • I must be the only person in the world who thinks it is absurd to see code formatting as a matter of personal preference.

      In French, it's conventional to put a space before the question mark -- like this ? They also don't seem to indent new paragraphs. ¡In Spanish, they mark exclamations at the front too! In Czech, we can see, that they put commas before "that" when the independent clause comes first (as in this sentence, so "we can see" isn't parenthetical). In German, they capitalize Nouns and some

      • Though you could probably argue that those languages are consistent "internally", so picking a format for Perl would only be equivalent to picking it for one of those languages.

        Yes. And Perl is (quite arguably (on many levels)) linguistically based in English.

        Maybe programming languages each need a few hundred years to settle on formatting conventions.

        Maybe, but please name some French/ Spanish/ German/ Czech programming languages.

        (So I was trying to put one "phrase" per line, with continuations indented by one space.) They end up looking almost like poems, which I think makes them too flippant.

        Poems yes, but "poem" does not imply "flippant". Poetry has been quite influential throughout history (though we forget that thanks to technological advances like "fox news".) Poems are memorable because of the rhyme (or non-rhyme), beat, linebreaks, syntactical twists, etc. It's not much different than distending an array/hash decl

        • Maybe, but please name some French/ Spanish/ German/ Czech programming languages.

          Rasmus Lerdorf (Denmark) designed PHP.

          Bjarne Stroustrup (Denmark) designed C++.

          Guido van Rossum (Netherlands) designed Python.

          Yukihiro Matsumoto (Japan) designed Ruby.

          Niklaus Wirth (Switzerland, german part) designed ALGOL, Pascal, Modula.

          Jean David Ichbiah (France) designed Ada.

          The Ericsson company (Sweden) designed Erlang.

          French professors designed Prolog.

          Norwegian professors designed Simula.

          INRIA (France) designs OCAML.

          etc, etc.

          I could go through the thousands of programming languages listed

          --
          Close the world. txEn eht nepO
  • # Input/Output
    --check-syntax # Ask perl to check the syntax of the file
    --backup-and-modify-in-place # Dont output to another file
    --backup-file-extension=.tdy.bak # Backup.pl.tdy.bak
    --logfile # Save a log of what's going on

    # Formatting
    --output-line-ending=unix
    --format-skipping
    • I'm impressed!

      Did anyone ever tell you that you have too much time on your hands? :)
      • man, you'd see my other config files and you'd say it took me several years to get them like they are... wait, it took me several years to get them like they are...

        if you want some here's a list of my must have (they're in /etc/skel/ when i finish installing a new distribution):
        - .bashrc
        - .dircolors (very exhaustive)
        - .fvwm/* (minimal theme)
        - .indent.pro
        - .inputrc (works good with a lot of apps)
        - .links/links.cfg
        - .lynxrc
        - .mc/ini (with undocumented functions)
        - .perlconsolerc
        - .perlcriticrc
        - .perlt
        • yep. I am. Thanks

          • heh, in fact i wasn't really expecting someone to reply, yet you did. Give me a few days to comment the configurations files (when possible) and i'll post them back here, or in a .bz2 file somewhere on the net. Let's say next Sunday (sept. 30) you'll get all the files.

            I just ask for the delay to clean up my config directory, it's a real mess in there and i don't have the time to sort everything right now.
            • Take your time. I asked because I was curious to see how people organize their things. Lately I seem to waste time in simple yet important tasks with a net result of less time to code :(. Having a working (and portable) set of config files is certainly an asset.

              cheers --stephan
  • You could shorten this by invoking all of the Perl Best Practice options using -pbp or --perl-best-practices.

    John.
    --

  • We have one also based on pbp. I'm not quite sure how it evolved, but it's almost exactly the same.

    One difference is that we have "!~ >= = | & = **= += *= &= >= ||= //= .= %= ^= x="

    (didn't care to figure out the differences, sorry :-) )

    A few other options we use:

    --maximum-line-length=100 # be slightly more generous
    --warning-output # Show warnings
    --maximum-consecutive-blank-lines=2 # default is 1
    --nohanging-side-comments # troublesome for
    --

    -- ask bjoern hansen [askbjoernhansen.com], !try; do();