|
Classes and method names can be strings or subrefs, you don't need to result to ugly poo poo like eval or disabling strict.code:
|
# ¿ Nov 15, 2007 00:51 |
|
|
# ¿ May 1, 2024 11:24 |
|
I've found CGI::Application is a good midway point between CGI.pm and Catalyst. Plus the tools like CAP::ValidateRM and CAP::FillInForm make easy work of boring, important things like input validation. It's even super easy to AJAXify the application if you bolt in CGI::Ajax or use a toolkit like Prototype or Ext.
|
# ¿ Dec 7, 2007 07:00 |
|
Yeah, sounds like you need to reinstall Net::SSLeay so that the XS components are properly linked.
|
# ¿ Jan 18, 2008 01:40 |
|
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 |
|
It might also be a symbolic reference:code:
|
# ¿ Jan 28, 2008 09:05 |
|
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 |
|
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 |
|
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've found CDBI to be the slowest of the three major ORM packages (Class::DBI, DBIx::Class, Rose::DB::Object), and this benchmark seems to support that. RDBO may be the fastest but in the end I decided to stick with DBIC since it's the one most often used in conjunction with Catalyst and all the documentation reflects that, plus it was closer in usage to CDBI which I had previous experience with.
Mario Incandenza fucked around with this message at 00:03 on Apr 17, 2008 |
# ¿ Apr 17, 2008 00:01 |
|
Triple Tech posted:Actually, there is a difference... And it's a terrible one. And I never use it. But in this particular scenario and use, you are correct. code:
code:
Mario Incandenza fucked around with this message at 15:33 on Apr 28, 2008 |
# ¿ Apr 28, 2008 15:31 |
|
Sartak posted:In case anyone was curious: using & means the function call ignores the function's prototype, and passes in a plain list. As Triple Tech mentioned, it's pretty terrible. Don't forget goto &subname - a magic goto useful mostly in AUTOLOAD subs, so you can replace the top frame of the call stack and cover your tracks. Ninja Rope posted:It's also useful when you want to make sure the parser knows you want to reference a function, like when using constants as hash keys: Don't really like constant.pm... the lack of (easy) interpolation and all the edge-cases requiring &s or ()s make the cure worse than the disease. Instead, why not: code:
Mario Incandenza fucked around with this message at 09:56 on Apr 29, 2008 |
# ¿ Apr 29, 2008 09:51 |
|
genericadmin posted:Because that Readonly module is going to be really slow. The whole point of constant.pm is that the compiler will inline the data (because it is a sub) and creates no symbol table entry. It's more like a pre-processor constant the way C constants are. The syntax is retarded, I agree, but it's a very important module.
|
# ¿ Apr 29, 2008 16:15 |
|
The angle brackets read until they find $/, which is usually set to \n. Your best bet is to keep calling getc and passing it to ord() so you can see what the printer is returning (untested):code:
|
# ¿ May 20, 2008 07:32 |
|
Net::IMAP::Simple makes IMAP access really easy, if your mail server speaks it. To parse the emails once you've gotten them, install MIME::Tools, and then:code:
Mario Incandenza fucked around with this message at 08:24 on May 24, 2008 |
# ¿ May 24, 2008 08:16 |
|
Wow, that looks awesome. Make sure you go see Adam Kennedy, his talks at YAPC::AU are entertaining and informative.
|
# ¿ May 25, 2008 15:28 |
|
LightI3ulb posted:I'm really confused as to why my script keeps giving me the errors Also, use placeholders: my $rows = $dbh->prepare("INSERT INTO foo (bar) VALUES (?)")->execute("this replaces the question mark");
|
# ¿ Jun 19, 2008 16:16 |
|
This doesn't work?code:
|
# ¿ Jul 6, 2008 10:04 |
|
Thanks to strict.pm's 33% stacking combo against skeletons you're better off loading it first, then warnings. But hey, whatever works for you. In the meantime the horrible code I'm paid to stop spontaneously combusting all the time is driving me insane, how do you guys mentally cope when dealing with really bad code all day, every day? Mario Incandenza fucked around with this message at 15:14 on Jul 23, 2008 |
# ¿ Jul 23, 2008 15:08 |
|
perl -w enables warnings globally, which you might not want. use warnings is lexical, and only affects the current file/sub/block.
|
# ¿ Jul 23, 2008 17:08 |
|
Sartak posted:I'll of course answer any Moose questions you guys have (and if I can't, I'll forward them to the guy who started the project). Triple Tech posted:I like things stock and low inertia... Even the syntax is not familiar looking.
|
# ¿ Aug 4, 2008 15:58 |
|
Intriguing. I like what I see in t/002_basic_array.t!
|
# ¿ Aug 4, 2008 18:39 |
|
Well, you could swap to HTML::Template::Plugin::Dot, which fakes up TT-style syntax and lets you write stuff like:code:
|
# ¿ Aug 5, 2008 10:55 |
|
A naive implementation for your example:code:
|
# ¿ Aug 6, 2008 18:48 |
|
Yeah, they're LIFO:code:
code:
|
# ¿ Aug 16, 2008 09:54 |
|
yaoi prophet posted:Just an obscure word of warning (since this somewhat unlikely to crop up for most people) but man did it ruin my day once: "list context" can crop up when you aren't always thinking about it, and due to perl flattening lists when you're not looking this can have interesting results. Update: Actually, I can see how checking for void context would be useful. List-vs-scalar is still too messy though. Mario Incandenza fucked around with this message at 08:38 on Aug 27, 2008 |
# ¿ Aug 27, 2008 08:31 |
|
heeen posted:
code:
Triple Tech posted:My objective is to have a module consume this handle without knowing where it comes from. Also, without manually typing out an if-else branch. code:
|
# ¿ Aug 29, 2008 06:26 |
|
You can subclass ResultSets too. This allows me to call $db->rs('domains.domain_names')->search_by_domain('foo.com') and still use indexes/joins properly. It's nice to encapsulate larger, reusable queries into one callable name, instead of copy and pasting the same SQL query in 13 different files code:
Mario Incandenza fucked around with this message at 11:28 on Sep 9, 2008 |
# ¿ Sep 9, 2008 11:07 |
|
Are you putting them inside your DBIC Schema, (e.g. MyDB/Schema/Table.pm), or MyApp/Model/MyDB/Table.pm? The model is just a wrapper around the schema, you'll need to place your custom methods in the schema if you want to reuse them properly outside of Catalyst.
|
# ¿ Sep 10, 2008 09:47 |
|
Yup, that works just fine, in fact I believe that's the recommended place, as it sits nicely alongside your relationship definitions (you mean resultset_class('Game::DB::ResultSet::Table'), yeah?). Also, I know it's in the docs, but it's useful enough to bear repeating... if you ever need a plain hashref, you can do this (though keep in mind the keys still will be lowercased): code:
|
# ¿ Sep 10, 2008 16:33 |
|
Inflation happens at the very end of the process, so as long as you define your join conditions by chaining calls to the resultset (as opposed to calling relations like $row->relation), your choice of inflator shouldn't impact the data you get back - just the form you receive it in. The HashRefInflator doesn't do much more than pass through a hashref after fiddling with its values a little - ordinarily it will be blessed into DBIx::Class::Row and packed inside an object's private _column_data attribute. The class is really small, just two subs. Mario Incandenza fucked around with this message at 10:50 on Sep 11, 2008 |
# ¿ Sep 11, 2008 10:41 |
|
Puck42 posted:I have, same thing happens. code:
uG posted:Then again maybe my idea is flawed to begin with, as ultimately I just want to get the Resources of all the nations that share a trade with x-nation. code:
code:
Mario Incandenza fucked around with this message at 17:33 on Sep 12, 2008 |
# ¿ Sep 12, 2008 16:51 |
|
I don't see what's wrong with providing hooks into the end of an iteration? Providing it's not abused.
|
# ¿ Sep 25, 2008 14:46 |
|
Depends on the error. If it doesn't require an exception then using it like a try/catch isn't too . It'd would be a useful place to call rollback(), now I think about it, if you wanted to have one transaction per iteration.
Mario Incandenza fucked around with this message at 10:44 on Sep 26, 2008 |
# ¿ Sep 26, 2008 10:41 |
|
Method::Signatures looks promising. It relies on Devel::Declare, which seems to do some semi-evil poo poo that kerplodes the debugger; however it's still pretty cool to write this:code:
|
# ¿ Sep 28, 2008 06:19 |
|
Interesting talk. I didn't know Devel::DProf was so useless. Eurgh, so I need to get Crypt::OpenPGP installed on a fresh Etch box but it looks like the module hasn't been touched for nearly 6 years and the test suite is blowing up like a motherfucker. In theory I should be able to drop in Crypt::GPG if I mock the interface, yes? Mario Incandenza fucked around with this message at 08:46 on Oct 7, 2008 |
# ¿ Oct 7, 2008 08:40 |
|
TiMBuS posted:Maybe you can get it running, someone left a rating on the module telling you how to make it work:
|
# ¿ Oct 8, 2008 09:33 |
|
If you can install Text::CSV_XS off CPAN (run su, then cpan Text::CSV_XS), it's fairly easy. I'm not sure about the $SD/$ST references so I've left them in there.code:
Mario Incandenza fucked around with this message at 01:17 on Oct 9, 2008 |
# ¿ Oct 9, 2008 01:14 |
|
It's possible, though only under Linux/Unix. According to this Perlmonks thread, Windows will exhibit the blocking you describe, so you must use a two-socket solution.
|
# ¿ Oct 22, 2008 09:36 |
|
If they can be convinced of a trip to OSDC, now is probably the best time to pay - the Aussie dollar has tanked in the last few months relative to the USD.
|
# ¿ Oct 30, 2008 09:00 |
|
|
# ¿ May 1, 2024 11:24 |
|
quote:map { s/\/[^\/]+$// } code:
|
# ¿ Nov 1, 2008 01:55 |