|
syphon^2 posted:Basically, my question is, where do I go from here? ... I enjoy coding in Perl and want to learn more, even if that means going to Python or Ruby. Learning other languages is a good idea, but you might want to get more confident in perl first. You will programming idioms you can bring to other languages, and ruby or python won't seem so much of a big step. If you understand the web model, have you considered branching out somewhat? A simple web server would cover using file and network i/o, as well as simple parsing for http/1.0. It's up to you how far you go with using libraries, as you could avoid writing a lot of code, and get a working project quicker. It will also allow you to gain a deeper understanding of the tools you use every day.
|
# ¿ Oct 24, 2007 23:01 |
|
|
# ¿ Apr 30, 2024 03:50 |
|
Triple Tech posted:I feel like all the temporary variables we use pollute the namespace. Like, certain structures aren't used for anything but the derivation of the last data structure. So I figured, why not tuck it into one temporary scope. Isn't that what my is for? code:
Outer: main=inner, temp= quote:I have this new coding style I've adopted, and personally, I like it. But I'm pretty sure no one else is keen on it. What do you guys think? Here is a simple metric to evaluate coding styles: Does it make the code simpler? Does it make the code more general? Does it make the code clearer? Yours doesn't make the code simpler, or clearer. tef fucked around with this message at 20:59 on Oct 30, 2007 |
# ¿ Oct 30, 2007 20:55 |
|
Triple Tech posted:I don't understand what you're trying to say with this. By your logic, a stream of ones and zeros is perfect, because there's nothing left to take away. But that doesn't mean it's good for programming. Similarly, just because Perl 5 is pretty good on its own now doesn't mean it is immune from things to which it is insufficient in the future, like multi-methods and concurrency. The original quote is "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exuper Or simply A perfect system is one with no unnecessary parts. It is often cited as an argument for minimalism and simplicity in design. You could also argue that a product with conceptual integrity has a small set of well chosen orthogonal features. You could make the argument that while loops are unneccesary as we have for loops, if statements if we have conditional gotos - but it wouldn't be a very convincing argument. You could argue that brainfuck is perfection in terms of features removed, but not in terms of usable features left. A similar quote might be "Make everything as simple as possible, but not simpler." -- Albert Einstein. Again we can see the theme of simplicity not being the bare minimum of what is needed, but also not having too much. Striking a balance is hard, and perl tends to err much more on the having too much (You could equally accuse other languages of being too simple). I can't speak for him, but I guess his point is that Perl 6 might have too many features (or even featuritis). Perl has always been guilty of this in it's own polyglot way, though. What other languages see as design choices, larry sees as developer choices: Prototypes vs Class Based OO Single vs Multiple Inheritance (and traits!) Lazy vs Strict Evaluation Static vs Dynamic Typing And so on... The problem here is that perl is becoming more of a series of dialects than a language itself. I often poked fun at people asking them if they coded basic in perl, c in perl or sh in perl - and it is becomming more true as more language paradigms are being embraced into perl 6. Going back to the original quote: I think perl 6 would have had a better start if they removed features from perl 5 first before starting to add them. A lot of the changes (fixed sigils, simplified syntax) would have been possible to migrate into the existing code base. The complete rewrite stalled all real progress until someone started to write it in haskell. I don't think larry was right to abandon the perl interpreter, and slowly but surely the perl5-porters are cleaning up the mess he left behind. In summary: Minimalism and Simplicity are easy ways to maintain conceptual integrity in a product. Removing features can be more important than adding them. Perl 6 suffers from the second system effect.
|
# ¿ Dec 9, 2007 06:24 |
|
Ninja Rope posted:However, it seems like some things are being added gratuitously to Perl5 (and 6), like the "say" function. We've already got print and $\, and printf, and they're adding another builtin to do something similar? I quite like say, I think it makes code more idiomatic and cleaner. It is not just about a few less characters, but making the code more obvious. You can see from the beginning if it is printing a new line or not. Edit: $\ is not exactly a readable name. I imagine most people would use join(,) for adding record seperators. print "...\n" is really really common, and I don't think it is that bad to have a short hand. Triple Tech posted:And then verbosity gets into how people think in terms of chunks and lines of code, despite what language they're in... Terseness rules, Perl wins. Remember: Code is much harder to Read than to Write. Perl excells at having short easy eays of writing idiomatic code, but it's a lot easier in perl to create things like this: code:
code:
(edit: double negative). tef fucked around with this message at 17:32 on Dec 9, 2007 |
# ¿ Dec 9, 2007 06:42 |
|
Satan's Scallion posted:If you spend most of your time writing classes, perl loses the terseness war pretty quickly. Aside: if you write a lot of oo perl, you might be interested in Moose: http://search.cpan.org/~stevan/Moose/lib/Moose.pm code:
Edit 2: Have you seen the perldelta for 5.10 ? http://search.cpan.org/~rgarcia/perl-5.10.0-RC2/pod/perl5100delta.pod It looks neat! tef fucked around with this message at 07:19 on Dec 9, 2007 |
# ¿ Dec 9, 2007 06:53 |
|
Triple Tech posted:I'm not saying that Perl is the end-all-be-all of terseness and that terseness is the One True Dimension by which one judges code. Of course not, that's silly. A bit different from "Terseness rules, Perl wins.". I think I will repeat myself here: "Neither Verboseness or Terseness is the objective of a good program, simplicity and clarity are." (I missed out generality from that list.) Terseness is not a useful measure of program quality at all - Clarity is a significantly better measure. In the same way being able to implement something in a short amount of lines is terse, you would be better arguing that (in general) shorter programs are clearer and easier to read (as well as write) than longer ones. It is possible to write something too short though, again finding a balance between terseness and verbosity is essential. Simple things should be terse, but often complex things have to be verbose. With regards to the Paul Graham article: (Again) "Code is much harder to read than to write". If you are under the illusion that we should optimise languages so it is fast to write rather than read, I hope I never have to maintain your code. quote:What is it that you can add to a programming language to say less, but still remain flexible. Again, adding features is not the be all and end all of language design. It is important to ask what can you remove from a language and still remain flexible? There is a lot of baggage in perl left over from perl 1 to 4. An example in this thread is Bareword filehandles. Adding more features does not always make a language more powerful. It can make the language more unwieldy. Here is a pictorial argument: This is the *actual* swiss army knife: This is what happens when you add features, even if each tool itself is distinct and useful: Edit: If you're still interested in arguing I would suggest we take this to a different thread. Edit: I guess my point is that there is a limit to how many features you can add to a language before they become more of a hindrance, and sometimes languages become more useful by removing features. tef fucked around with this message at 18:06 on Dec 9, 2007 |
# ¿ Dec 9, 2007 17:53 |
|
poofactory posted:What do I add to the perl script to take care of this? A developer. You are handling credit card details, so if you don't know about CGI, form escaping or the difference between "$Amount" and "Amount" it is time to give up and find someone who can. (Sorry for the turn about, I was willing to give you the benefit of the doubt in missing something obvious - but your later posts expose your inexperience fully)
|
# ¿ Apr 2, 2008 23:14 |
|
Post your code?
tef fucked around with this message at 19:34 on Apr 7, 2008 |
# ¿ Apr 7, 2008 19:32 |
|
(from irc) Eval is not run in a sandbox: code:
tef fucked around with this message at 19:50 on Apr 7, 2008 |
# ¿ Apr 7, 2008 19:47 |
|
Khorne posted:How do I convert an a4 value in perl (DWORD) to a string, or at least a decimal/hexadecimal number that I can pad some how? I'm not sure what you need to do, but it sounds like you need : http://perldoc.perl.org/functions/unpack.html http://perldoc.perl.org/functions/pack.html
|
# ¿ Apr 8, 2008 01:54 |
|
GregNorc posted:Any ideas how to fix this? I even looked in the appendix for the answer, and still no luck. For a start: turn on warnings and use strict; Avoid the use of $_, and be a little bit more explicit about what you're trying to do rather than relying on perl. code:
|
# ¿ Apr 28, 2008 11:06 |
|
mister_gosh posted:How can I NOT store the path for the files I put in a zip archive? Your code doesn't run for me, but there is a second parameter to addFiles which can specify the name of the zip in the file. I.e do $zip->addFile( $file,$file_name_without_directories ) http://search.cpan.org/dist/Archive-Zip/lib/Archive/Zip.pm#Zip_Archive_Member_Operations
|
# ¿ Jun 19, 2008 13:55 |
|
You could just do this:code:
code:
tef fucked around with this message at 02:19 on Jul 23, 2008 |
# ¿ Jul 23, 2008 02:15 |
|
Triple Tech posted:Am I not as good as I think I am? Yes. I would expect the top 1% of perl hackers to understand lexical scope.
|
# ¿ Jul 23, 2008 19:57 |
|
Sartak posted:That sort of thing is called dynamic scope. It was popular before (the much saner) lexical scope was invented. Perl supports it with the local operator. It was popular with interpreted languages as it simple to implement.
|
# ¿ Sep 17, 2008 17:37 |
|
dagard posted:It's been a while, but I seem to recall that, by default, you can't anonymously bind to the AD server I recently got some python code to talk to AD, and yes I had to use an existing account to bind to AD first. Bugzilla uses Net::LDAP, and I've used it to talk to ActiveDirectory. You might be able to fish a working example out of the code base.
|
# ¿ Oct 13, 2008 01:26 |
|
If speed is important why don't you do it in parallel ?
|
# ¿ Oct 22, 2008 01:23 |
|
Mithaldu posted:In fact, i have this on my "to read" list: http://gigamonkeys.com/book/ Higher order perl by mjd is well worth a read too.
|
# ¿ Nov 19, 2008 01:06 |
|
Aside, the string "0 but true" does what it says, and doesn't throw a warning when you use it as a number. $ perl -we "0+'0 foo'" Argument "0 foo" isn't numeric in addition (+) at -e line 1. $ perl -we "0+'0 but true'" $
|
# ¿ Nov 20, 2008 01:44 |
|
You can also use "0e0" as a true value without raising warnings.
|
# ¿ Nov 20, 2008 10:02 |
|
aside: sort in a void context is optimized out, and never executes. I had a friend who would do sort {$a+=$b} @a
|
# ¿ Dec 7, 2008 13:01 |
|
http://hop.perl.plover.com/book/ Higher order perl is available online.
|
# ¿ Dec 10, 2008 00:05 |
|
Captain Frigate posted:Wow, worked like a charm! What does that actually do? The differing end-of-line conventions wouldn't really matter in this situation, would they? http://perldoc.perl.org/functions/binmode.html quote:if you don't use binmode() on these systems, \cM\cJ sequences on disk will be converted to \n on input, and any \n in your program will be converted back to \cM\cJ on output. This is what you want for text files, but it can be disastrous for binary files.
|
# ¿ Jul 14, 2009 19:51 |
|
I would assume this line is mangling them: my ($who, $body) = $self->charset_encode($who, $body);
|
# ¿ Jul 19, 2009 00:15 |
|
shorter columns are easier to read (especially when everyone's got a big screen now, with content sprawling over it) that said I don't think the redesign is somehow 'modern' or nice either
|
# ¿ Aug 26, 2009 14:03 |
|
Triple Tech posted:Wow, you guys know nothing. That facelift is yards better than the design before it. And yes, that gluey top bar is executed oddly. I can't recall what it looked like before, but it now looks like 'if slashdot did man pages' p.s. a little bit more whitespace would be nice too
|
# ¿ Aug 26, 2009 15:53 |
|
Otto Skorzeny posted:e: (i should mention i'm on a 1400x1050 laptop screen so there's way more empty space when i load the page than in tef's screenshot (im too lazy to take a screenshot of my own (i'm not sure i have a screenshot program installed atm and i forget the hotkey (nil )))) I cropped it, I'm on a 1920x1200 display.
|
# ¿ Aug 26, 2009 16:30 |
|
Sabacc posted:Explanation, anyone? Your working directory is not what you think it is? If the only way you can access the files is absolute and not relative, perhaps your script *isn't* running with the cwd you expect.
|
# ¿ Jan 28, 2010 13:07 |
|
$$ is a variable, the pid of the process iirc. You want "\$" for a literal $
|
# ¿ Mar 22, 2010 20:12 |
|
Have you seen larry wall?
|
# ¿ Jun 27, 2010 17:31 |
|
qntm posted:Why doesn't this print the letter "K"? Standard out is line buffered. Either terminate strings with \n, or flush the buffer: The $| variable sets 'autoflush' in perl
|
# ¿ Nov 3, 2010 19:06 |
|
http://search.cpan.org/~sisyphus/Inline-0.47/C/C.pod
|
# ¿ Feb 12, 2011 00:06 |
|
baquerd posted:There are character sets where this is not true? unicode also it is locale dependent
|
# ¿ Jul 17, 2011 23:21 |
|
The same sort of people who frown own sort {$a+=$b} @foo
|
# ¿ Nov 23, 2011 23:29 |
|
OriginalPseudonym posted:
sort in a void context is a no-op code:
|
# ¿ Nov 24, 2011 02:22 |
|
Winkle-Daddy posted:Anyone else have better ideas? This seems like it would be an incredibly slow job for Perl...especially since we serve content for about 2 million accounts. keep backups, run a (trained) spam filter over the diffs more seriously, it looks like you are trying to write a virus scanner for php.
|
# ¿ Dec 9, 2011 18:23 |
|
Winkle-Daddy posted:Eh, more like a way to determine the probability that certain strings are base64 encoded without looking through all of the files I'm searching manually. Which you are doing for the purposes of finding malicious code.
|
# ¿ Dec 10, 2011 12:23 |
|
I've also heard of http://search.cpan.org/~mirod/XML-Twig-3.39/Twig.pm Xml::Twig
|
# ¿ Jan 3, 2012 08:39 |
|
Centripetal Horse posted:It's kind of cool to see that PERL (sorry, Perl... looks like it isn't all caps, these days) is still alive and kicking. I don't care what anyone says, I like Perl, and I loved coding in it. It's been ten years since I logged into my PerlMonks account, but I've still probably written more lines of PERL than any other single language I've used. the perl shibboleths I use are less code:
code:
code:
|
# ¿ Oct 9, 2012 17:46 |
|
|
# ¿ Apr 30, 2024 03:50 |
|
het posted:Oh, I did but I was just doing one-liners on the command line, that's funny I learned about sort in a void context from a crazed intercal programmer.
|
# ¿ Oct 10, 2012 01:45 |