|
TiMBuS posted:I use ubuntu. It's my fav distro and you cant change my mind >=( What I did was do a source install to /opt/perl and just changed the shebang to #!/opt/perl/bin/perl. This is only temporary until 5.10 is made available for an upgrade.
|
# ? Jan 14, 2008 06:43 |
|
|
# ? May 21, 2024 15:03 |
|
Hm, feels a bit hackish to do it like that, plus ill have to change the shebang once 5.10 is out from the repositories.. But hey, that's probably easier than making my own package.
|
# ? Jan 14, 2008 07:16 |
|
TiMBuS posted:Hm, feels a bit hackish to do it like that, plus ill have to change the shebang once 5.10 is out from the repositories.. You can built it from source in your home directory, then alias perl=/home/timbus/bin/perl5.10. This way you can run 5.8.8 with ./script and 5.10.0 with perl script. Also, your one-liners will be 5.10.0.
|
# ? Jan 14, 2008 07:22 |
|
Install Perl 5.10 to /opt/perl and do the following:code:
HTH Donkey Darko fucked around with this message at 11:02 on Jan 14, 2008 |
# ? Jan 14, 2008 10:59 |
|
If I understand Ubuntu right, perl 5.10 will never be in the current Ubuntu distribution, since each distribution doesn't advance major package versions, just minor updates. So I believe you'll see it if you install Ubuntu 8.04 in 3 months. It may become available through the backports repository, which is disabled by default. If you really need Perl 5.10, you probably need it for something specific, so install it to /opt or your home directory and start your scripts with #!/opt/perl/bin/perl or somesuch. When the upgrade comes, just change the header lines.
|
# ? Jan 14, 2008 14:40 |
|
I don't really need it, I just really want it :3 I nearly went and installed perl over the top of the old one, but common sense prevailed and I instead installed it to /opt/. Now to go abuse the crap out of 'say'.
|
# ? Jan 15, 2008 09:22 |
|
TiMBuS posted:I don't really need it, I just really want it :3 Throw this at the beginning of a 5.8 script: code:
Fenderbender fucked around with this message at 09:36 on Jan 15, 2008 |
# ? Jan 15, 2008 09:33 |
|
Fenderbender posted:Throw this at the beginning of a 5.8 script: But then I would have to undef $\ when using print for other needs. =( I personally like having two keywords for output, because 'say' works exactly how it sounds, and 'print' can now function for purposes that don't require autoformatting. Personal preference, I guess.
|
# ? Jan 15, 2008 10:08 |
|
TiMBuS posted:But then I would have to undef $\ when using print for other needs. =( code:
|
# ? Jan 15, 2008 20:15 |
|
Ah yeah, nearly forgot about local. I mostly use local to undef $/ which makes it faster to glob through files. But it's not exactly a convenient workaround to locally scope $\ just to add an automatic newline. In the end I guess I just like say.
|
# ? Jan 16, 2008 04:30 |
|
TiMBuS posted:Ah yeah, nearly forgot about local. Say is definitely really cool, have you seen Perl6::Say?
|
# ? Jan 16, 2008 05:13 |
|
Anybody going to YAPC in Chicago this year? I think I'd like to convince my employer to let me go but I'm new here still...
|
# ? Jan 16, 2008 15:19 |
|
Triple Tech posted:Anybody going to YAPC in Chicago this year? I think I'd like to convince my employer to let me go but I'm new here still... Don't know yet. I'd like to go. I will be speaking at Frozen Perl next month though!
|
# ? Jan 16, 2008 15:26 |
|
Sartak posted:I will be speaking at Frozen Perl next month though! Oh yeah? A lightning talk probably... About what? Who are you really... Are you like a famous Perl guy? At least you've got balls to talk, that's gotta count for something.
|
# ? Jan 16, 2008 15:29 |
|
Triple Tech posted:Oh yeah? A lightning talk probably... About what? Who are you really... Are you like a famous Perl guy? At least you've got balls to talk, that's gotta count for something. I'm giving a twenty minute talk on Template:: Declare. It looks like this: code:
edit: drat smilies. another edit: Also, the only community I'm at all famous in is NetHack (where I go by the name Eidolos). I'm lucky enough to work on RT and Jifty, and I try to help with Moose when I can. Filburt Shellbach fucked around with this message at 15:55 on Jan 16, 2008 |
# ? Jan 16, 2008 15:47 |
|
Holy crap, how come I didn't know about this a little while ago when I needed a very simple way to generate XML output (and was getting very annoyed at the overhead of XML::Twig).
|
# ? Jan 16, 2008 16:15 |
|
Any clues to what could be causing this?code:
code:
code:
|
# ? Jan 17, 2008 15:03 |
|
Mustach posted:Any clues to what could be causing this? The only thing I can guess is that you have shared objects with mismatched versions?
|
# ? Jan 18, 2008 00:01 |
|
Yeah, sounds like you need to reinstall Net::SSLeay so that the XS components are properly linked.
|
# ? Jan 18, 2008 01:40 |
|
Thanks. I already tried reinstalling each module individually, then all at once, but maybe the order messed them up (which would be ridiculous if true). I'll try again tomorrow, anyhow. Update: No dice after reinstalling them. Mustach fucked around with this message at 21:54 on Jan 18, 2008 |
# ? Jan 18, 2008 03:27 |
|
If you can read its output, try strace perl -c failing_script.pl and see where Perl is loading its libraries from (look for stat and open calls in particular). That will probably give you an idea of why it's failing, at the very least you can try blasting the mismatched versions and installing them again.
|
# ? Jan 20, 2008 10:48 |
|
I have a problem with encoding. The resulting file must be UTF-8. I am opening a file handle, doing something with each line and then printing it out. code:
Other times, that makes things worse because it is already in utf8. Is there a way to test if the line is already utf8? I think I need a good encode tutorial.
|
# ? Jan 25, 2008 21:09 |
|
quote:
Not really. I think some software tries to guess (there's a famous bug in notepad about this) but there is no foolproof way. A string of utf-8 characters can be interpreted as a (somewhat nonsensical) string of iso-8859 characters.
|
# ? Jan 25, 2008 21:15 |
|
What does the extra dollar sign mean in a variable? For example: $$variableName
|
# ? Jan 27, 2008 21:31 |
|
mister_gosh posted:What does the extra dollar sign mean in a variable? That would dereference a reference to a scalar. Example: code:
|
# ? Jan 27, 2008 21:53 |
|
It might also be a symbolic reference:code:
|
# ? Jan 28, 2008 09:05 |
|
SpeedFrog posted:It might also be a symbolic reference: Also if you're using strict and warnings as you should at the top of every file: code:
code:
|
# ? Jan 28, 2008 16:40 |
|
I have drunk deeply of the Catalyst + DBIx::Class koolaid and am looking forward to overhauling the 80,000 lines of garbage I get paid to nurse.
Mario Incandenza fucked around with this message at 14:27 on Feb 7, 2008 |
# ? Feb 7, 2008 14:24 |
|
SpeedFrog posted:I have drunk deeply of the Catalyst + DBIx::Class koolaid and am looking forward to overhauling the 80,000 lines of garbage I get paid to nurse. Oh good, good you can tell me about how Catalyst works then. When I access a URL of a website that's running on Catalyst, what is the server actually hitting? Do all the URLs get submitted as an argument to a dispatcher, or are there individual .cgi files laying around? I'd like to move my company's site to a framework but I'm not sure how this fancy stuff works.
|
# ? Feb 7, 2008 16:19 |
|
Triple Tech posted:Oh good, good you can tell me about how Catalyst works then. When I access a URL of a website that's running on Catalyst, what is the server actually hitting? Do all the URLs get submitted as an argument to a dispatcher, or are there individual .cgi files laying around? All I know about Catalyst is that I went to school with the author of this book and he's the crazy shut-in nerd type who's so much smarter than you or any of his professors that he doesn't need to do his work because it's below him, which is why going to school is dumb and they SHOULD just kick him out for failing all his classes.
|
# ? Feb 7, 2008 22:56 |
|
more falafel please posted:All I know about Catalyst is that I went to school with the author of this book and he's the crazy shut-in nerd type who's so much smarter than you or any of his professors that he doesn't need to do his work because it's below him, which is why going to school is dumb and they SHOULD just kick him out for failing all his classes. Right... So does the nerd get shut in before or after the model interacts with the view?
|
# ? Feb 7, 2008 22:59 |
|
more falafel please posted:All I know about Catalyst is that I went to school with the author of this book and he's the crazy shut-in nerd type who's so much smarter than you or any of his professors that he doesn't need to do his work because it's below him, which is why going to school is dumb and they SHOULD just kick him out for failing all his classes.
|
# ? Feb 8, 2008 00:58 |
|
Triple Tech posted:Oh good, good you can tell me about how Catalyst works then. When I access a URL of a website that's running on Catalyst, what is the server actually hitting? Do all the URLs get submitted as an argument to a dispatcher, or are there individual .cgi files laying around? The controllers contain actions, which are just methods that have subroutine attributes defining the URLs they can handle. There's plenty of syntactic sugar for interacting with the models and views, and I'm really impressed with how easy it was to plug in authentication and other stuff, generally it was a simple case of installing a CPAN module and adding a couple of lines to the YAML config file. jrockway's book is okay but it's really just an intro, you'll get just as much out of the POD as you will from the book (except for maybe the REST and Jemplate stuff which are pretty snazzy). Here's a controller that handles AJAX-style logins: code:
Mario Incandenza fucked around with this message at 04:01 on Feb 8, 2008 |
# ? Feb 8, 2008 03:56 |
|
SpeedFrog posted:
|
# ? Feb 8, 2008 05:39 |
|
leedo posted:Whoa, I had never seen that syntax before (using a list of hash keys)... cool! Yeah, hash slices are neat. Here are some more idioms: code:
|
# ? Feb 8, 2008 05:51 |
|
Not entirely sure if this is okay to post here, since it's a little long, but it seems to fit. I posted a thread on this topic a while back (http://forums.somethingawful.com/showthread.php?threadid=2699687) and ya'll were very helpful, though my extremely poor perl skills meant I couldn't make much use of all the help given. But I have gotten a little bit better now... In a nutshell, I wanted to break a csv file filled with long paragraphs of text in rows into groups of single and multiple words, and then count the iterations of each word set. So for example, the previous two paragraphs would break down as follows:
posted a thread … I posted posted a a thread … I posted a posted a thread a thread on … And I initially planned for the script to count the number of times words or phrases appeared. I have since realised that I can use Access to cover the relatively hard part of the script (the counting of entries), which leaves me with the more straightforward problem of getting the damnable sentences to split at the correct point. Here's the (no doubt quite ugly) script I was able to write: code:
I'm also not sure how to get it to 'fall back' after its done a pair. So for example, if it gets "I posted" how am I going to get it to give me "posted a" instead of moving onto the 'next' pair, "a thread"... Any perl expert wisdom?
|
# ? Feb 8, 2008 21:54 |
|
Untested.code:
|
# ? Feb 8, 2008 22:09 |
|
COBOL programmers can write greate COBOL in any language code:
Triple Tech posted:Untested. This works a bit better: code:
Mario Incandenza fucked around with this message at 05:32 on Feb 9, 2008 |
# ? Feb 9, 2008 05:29 |
|
i'm using getopt::long to get command line arguments for my script. my problem is this, I want the script to die (or at least show my usage message) if someone passes a bad argument to the script. however, when someone passes a good argument then a bad argument the script executes, albeit with the message "Unknown option: foo". is there a way to catch this kind of exception? GOOD: code:
code:
code:
|
# ? Feb 12, 2008 20:22 |
|
|
# ? May 21, 2024 15:03 |
|
There might be a better way to do this, but using Getopt::Long::Configure to set pass_through (which preserves unspecified options in @ARGV without warning) lets you test to see if any are left. I tried the following:code:
|
# ? Feb 12, 2008 21:01 |