|
Just in case neither of you guys has seen it yet, german perl hacker elmex has recently made his own minecraft-inspired OpenGL game in Perl public. It works on both linux, windows and mac and for windows there are binary packages available: http://ue.o---o.eu https://www.youtube.com/watch?v=iZ4Qyto-JzI https://www.youtube.com/watch?v=qd95SrdNkgE https://www.youtube.com/watch?v=5SxD5PabLFQ
|
# ? Jul 10, 2011 23:23 |
|
|
# ? May 17, 2024 14:13 |
|
A quick question, I hope. You have two modules, ABC::EFG and FOO::BAR, each containing an arbitrary function happy(). As I understand it, you can do the following: code:
What happens if you do this? code:
code:
|
# ? Jul 12, 2011 05:44 |
|
I like turtles posted:A quick question, I hope.
|
# ? Jul 12, 2011 11:59 |
|
The most recent sub imported with a use statement will be the one that's called. No errors or warnings will be emitted by Exporter:code:
Perl does have a 'subroutine undefined' warning but it only shows up when the parser (compile-time or run-time) encounters a named sub block that matches an existing one in the current package: code:
|
# ? Jul 12, 2011 23:40 |
|
Another noob question for you guys. Trying to replace all letters with their respective numbers (A to 1, B to 2, etc), I come up with this: code:
code:
Is there any way to make this replacement without a bunch of if and elsif statements? Any help is appreciated. Another quick question, I see the words "foo bar" pop up in every textbook / example I run into (online and off), is it like the Wilhelm scream for perl programmers?
|
# ? Jul 16, 2011 18:48 |
|
Back Stabber posted:Another noob question for you guys. Sounds like you want tr///. (Scroll down a bit.)
|
# ? Jul 16, 2011 18:57 |
|
Back Stabber posted:Another noob question for you guys. If you want just upper case letters changed to 1..26, use this: code:
code:
Back Stabber posted:Another quick question, I see the words "foo bar" pop up in every textbook / example I run into (online and off), is it like the Wilhelm scream for perl programmers? http://en.wikipedia.org/wiki/Metasyntactic_variable
|
# ? Jul 16, 2011 19:54 |
|
Anaconda Rifle posted:If you want just upper case letters changed to 1..26, use this: Oh sure, assuming your character set is ASCII and the upper- and lower-case letters form contiguous ranges...
|
# ? Jul 17, 2011 00:33 |
|
qntm posted:Oh sure, assuming your character set is ASCII and the upper- and lower-case letters form contiguous ranges... Not to mention that the output is ambiguous as gently caress. Was the original string "Z", "BF", "2F", "B6", or "26"? I gave the self-proclaimed noob an answer that may lead to him/her reading up on ord and the e modifier on the substitution. My work here is done. *Flies away on an unnecessary look-behind assertion*
|
# ? Jul 17, 2011 00:50 |
|
qntm posted:the upper- and lower-case letters form contiguous ranges... There are character sets where this is not true?
|
# ? Jul 17, 2011 23:08 |
|
baquerd posted:There are character sets where this is not true? unicode also it is locale dependent
|
# ? Jul 17, 2011 23:21 |
|
more like ebcdic
|
# ? Jul 18, 2011 00:57 |
|
I think this deserves a mention here too: If you use catalyst and Template::Toolkit you can fix XSS issues globally now: http://blogs.perl.org/users/mithaldu/2011/07/fixing-xss-in-catalyst-with-a-really-big-hammer.html
|
# ? Jul 18, 2011 05:45 |
|
baquerd posted:There are character sets where this is not true? Yes.
|
# ? Jul 18, 2011 10:19 |
|
Mithaldu posted:I think this deserves a mention here too: If you use catalyst and Template::Toolkit you can fix XSS issues globally now: http://blogs.perl.org/users/mithaldu/2011/07/fixing-xss-in-catalyst-with-a-really-big-hammer.html Wow! I didn't know TT did no escaping by default. This makes me glad to be a Mason user, since it assumes HTML escaping unless otherwise specified.
|
# ? Jul 18, 2011 15:05 |
|
Mithaldu posted:I think this deserves a mention here too: If you use catalyst and Template::Toolkit you can fix XSS issues globally now: http://blogs.perl.org/users/mithaldu/2011/07/fixing-xss-in-catalyst-with-a-really-big-hammer.html
|
# ? Jul 18, 2011 20:24 |
|
Filburt Shellbach posted:Wow! I didn't know TT did no escaping by default. This makes me glad to be a Mason user, since it assumes HTML escaping unless otherwise specified. uG posted:Why the hell did this take so long
|
# ? Jul 18, 2011 21:39 |
|
I'm confused on how this piece of code is acting:code:
|
# ? Jul 21, 2011 15:37 |
|
uG posted:I'm confused on how this piece of code is acting: Because m// doesn't modify $drive. It's still the same string, so it still matches.
|
# ? Jul 21, 2011 15:57 |
|
qntm posted:Because m// doesn't modify $drive. It's still the same string, so it still matches.
|
# ? Jul 21, 2011 16:12 |
|
uG posted:Anyone know why it keeps iterating back to the first match and never breaks out of the loop? Works for me. All I did was uncomment the first line (and wrap the string with single quotes) and change the loop body to print "$1\n";. It outputs the match and exits.
|
# ? Jul 21, 2011 16:45 |
|
Perl, the language where there are 100 libraries for parsing SGML derivatives and everyone uses regular expressions anyway
|
# ? Jul 21, 2011 17:42 |
|
Is there a way I can do this that will keep Perl 5.8.x from puking? I'm trying to conditionally use the right regex for the Perl version in use, but it seems the interpreter parses the regex anyway, causing Perl to lose its lunch about my using (?|...) syntax. Trying to put it in an eval { }; block doesn't work either, the parser still looks at it and gets cranky.code:
|
# ? Jul 23, 2011 03:32 |
|
Dinty Moore posted:Is there a way I can do this that will keep Perl 5.8.x from puking? I'm trying to conditionally use the right regex for the Perl version in use, but it seems the interpreter parses the regex anyway, causing Perl to lose its lunch about my using (?|...) syntax. Trying to put it in an eval { }; block doesn't work either, the parser still looks at it and gets cranky. $url_rx = eval "qr//"; as a string will get you what you want
|
# ? Jul 23, 2011 16:20 |
|
slipped posted:qr forces a compile, and eval { BLOCK } is also a compile time compile. Oh word. Looks like that solves my problem. Thanks.
|
# ? Jul 24, 2011 17:38 |
|
shift / @_ question here. I ran into some unexpected behavior. Here is test code:code:
code:
|
# ? Jul 26, 2011 04:49 |
|
I'm hoping to put some snippets of Perl code online. Is there a Javascript library which I can use to apply syntax highlighting to my code? I'm hoping to be able to write <pre class="perl">...perl code...</pre> and have the Javascript prettify it when the user loads the page (because hell if I'm going to drag all my code through a manual prettifier at my end).
|
# ? Jul 27, 2011 18:46 |
|
qntm posted:I'm hoping to put some snippets of Perl code online. Is there a Javascript library which I can use to apply syntax highlighting to my code? I'm hoping to be able to write <pre class="perl">...perl code...</pre> and have the Javascript prettify it when the user loads the page (because hell if I'm going to drag all my code through a manual prettifier at my end). pastebin does all types of syntax highlighting. I'm not sure if you're putting your code just anywhere and linking to it, or you are going to put it in your personal space.
|
# ? Jul 27, 2011 19:24 |
|
I'm putting it on my site, so I'd like a JS library I can just put there.
|
# ? Jul 27, 2011 21:13 |
|
I found this person's site: http://www.tohtml.com/. Maybe you can ask them how they did it.
|
# ? Jul 27, 2011 21:23 |
|
GeSHi is the one I use on my site. It doesn't do Erlang, but it handles every other language I've thrown at it.
|
# ? Jul 27, 2011 21:27 |
|
I use Google Code Prettify on my site. It has some nice default supported themes and can handle most languages.
|
# ? Jul 27, 2011 23:35 |
|
Writing my first script however I have a question about how to cut down the output to what I need/want. A little background, I've got a few netapp's that I'd like to keep an eye on the temperature and eventually add it to RRD. code:
code:
-- nevermind, I am an idiot :p code:
vomit-orchestra fucked around with this message at 07:29 on Jul 28, 2011 |
# ? Jul 28, 2011 06:25 |
|
Is there a module that can take a variable and return what was used to set its value? So if earlier in the script you have $foo = 1 + 2, I could do something like how($foo) and have it return a string with a value of '1 + 2' instead of 3?
|
# ? Jul 28, 2011 19:14 |
|
uG posted:Is there a module that can take a variable and return what was used to set its value? So if earlier in the script you have $foo = 1 + 2, I could do something like how($foo) and have it return a string with a value of '1 + 2' instead of 3? There are a number of debugging tools you can use, but it sounds like you want to set a watch on this variable. There's a number of tools to do that. This is one: http://docs.activestate.com/activeperl/5.8/lib/Tie/Watch.html
|
# ? Jul 28, 2011 19:23 |
|
uG posted:Is there a module that can take a variable and return what was used to set its value? So if earlier in the script you have $foo = 1 + 2, I could do something like how($foo) and have it return a string with a value of '1 + 2' instead of 3? That sounds like it would be a pretty magical feature if it existed in any language. May I ask why you want this? I'm really interested to know what the applications could be.
|
# ? Jul 29, 2011 00:51 |
|
qntm posted:That sounds like it would be a pretty magical feature if it existed in any language. May I ask why you want this? I'm really interested to know what the applications could be. code:
|
# ? Jul 29, 2011 15:15 |
|
uG posted:I want to display the equation used to calculate certain values next to the actual values. So right now this involves: Perhaps something like code:
|
# ? Jul 29, 2011 17:06 |
|
qntm posted:Perhaps something like
|
# ? Jul 29, 2011 17:43 |
|
|
# ? May 17, 2024 14:13 |
|
you could write something that parses the script, grabbing all the strings on the right hand side of assignments to the variables you care about. It actually probably wouldn't be that hard.
|
# ? Jul 30, 2011 01:48 |