One of the things you'll see in the changelog for the next stable release of Catalyst, is a reworked component resolution system. By "component resolution" i mean, fetching components from view()/views(), model()/models(), controller()/controllers() and component().
Back in May I posted a message to the Catalyst-dev list describing some issues with the way it was currently working. Although I painted a slightly convoluted picture of doom and gloom -- it turns out that all is not lost; you were probably relying on an "undefined" behavior to begin with (kind of like assuming "keys %hash" will return things in a particular order).
For example, consider "MyApp" with two views: "Foo" and "Bar." Now, when you call "$c->view()" (i.e. with no arguments) what gets returned? Well, it depends. :) If you have none of the appropriate config (default_view) or stash variables (current_view, current_view_instance) set, then it's pretty much random.
If you write a test for the above, and see that "MyApp::View::Bar" is returned -- don't count on that test working in 5.7100 (the message I posted to the list has the technical details as to why). Though the test *may* continue to work, the above scenario will throw a pretty large warning:
Calling $c->view() will return a random view unless you specify one of:
* $c->config->{default_view} # the name of the default view to use
* $c->stash->{current_view} # the name of the view to use for this request
* $c->stash->{current_view_instance} # the instance of the view to use for this request
NB: in version 5.80, the "random" behavior will not work at all.
(FYI, if your application only has one view, calling "$c->view()" is considered "acceptable" and will spare you the warnings.)
A similar warning is thrown for $c->model(). $c->controller() with no arguments will continue to return the controller for the dispatched action. $c->component (sans args) will also stay the same, returning a sorted list of all component names.
Another issue I discovered while re-working the code was a failed reliance on the "regex" fallback.
Consider another "MyApp" with two views "Foo::Bar" and "Foo::Baz". What does "$c->view('Foo')" return? We've maintained backwards compatibility on this one -- it will return all matching views (order unknown). It is important to note that this returns an array, so list context is important. We've added a warning for this scenario as well:
Relying on the regexp fallback behavior for component resolution is unreliable and unsafe.
If you really want to search, pass in a regexp as the argument.
As noted above, if you truly were just searching for views, pass it a regex ("$c->view(qr{Foo})") and it will act as expected.
So, if you think you might be affected by these particular issues, test out the dev release! Don't say I didn't warn you. :)
(Crossposted to the Catalyst-dev list)
We're putting out one final development release before we go full bore
with 5.7100.
NB: It is IMPERATIVE that you TEST this release against YOUR code. Quoth
mst: "If you do not test now any bugs we ship with are your fault!" --
so, there you have it :)
Also, we've reworked the authors list to be much like DBIx::Class; in
one spot (Catalyst.pm) with each person's IRC nick, name, and email. In
you can fill in any of the blanks, fire off an email or catch us in
#catalyst-dev and well gladly fix it up.
Whilst the release is making its way to CPAN, you can grab it from here:
http://dev.thefeed.no/stuff/Catalyst-Runtime-5.7099_02.tar.gz
The Changes since the last stable release include:
5.7099_02 2008-07-16 19:10:00
- Added PathPrefix attribute
- Removed Catalyst::Build; we've long since moved to
Module::Install
- Updated Catalyst::Test docs to mention the use of HTTP::Request
objects (Rafael Kitover)
5.7099_01 2008-06-25 22:36:00
- Refactored component resolution (component(), models(),
model(), et al). We now
throw warnings for two reasons:
1) model() or view() was called with no arguments, and two
results are returned
-- set default_(model|view), current_(model|view) or
current_(model|view)_instance
instead
2) you call a component resolution method with a string, and
it resorts to a regexp
fallback wherein a result is returned -- if you really
want to search, call the
method with a regex as the argument
- remove 0-length query string components so warnings aren't
thrown (RT #36428)
- Update HTTP::Body dep so that the uploadtmp config value will
work (RT #22540)
- Fix for LocalRegex when used in the Root controller
- Get some of the optional_* tests working from dirs with
spaces (RT #26455)
- Fix Catalyst::Utils::home() when application .pm is in the
current dir (RT #34437)
- Added the ability to remove parameters in req->uri_with() by
passing in
an undef value (RT #34782)
- Added $c->go, to do an internal redispatch to another action,
while retaining the
contents of the stash
Taichi inspired me to post this and it's actually a QoTD on Vox Japan: today is Famicom (NES) 25th birthday since it was on sale 1983/07/15 in Japan. Let's talk about the memories!
I didn't have Famicom until 1986 when Twin Famicon along with the Disk System was out, which is a smart device that has both NES and the Disk System built in a single device.
At that time I didn't know the reason but now I can see that a bit clearer: our home didn't have an analog TV at that time and had a video deck and a monitor TV that doesn't have the antenna built-in. So the standard Famicom which requires the standard TV antenna input to display the game console output on channel 2 (I guess that's the origin of the anonymous bulletin board site 2ch. Is that correct?) didn't work for us. Twin Famicom has a standard video output so just connectin the Red-White-Yellow cable to the TV works. Oh yeah, the video deck was obviously SONY beta. Such a nerd is my dad :)
So I don't remember the exact date when I got the first famicom, but when I watch the video series of "Complete guide of NES games" on Nico Nico Douga, I can tell when I got the device based on the game I bought: it's early 1986, but wait, Twin Famicom was release July of 1986. Hmm, so maybe I got the console right when it was out and bought the titles backdated early 1986. Maybe.
The first game I played, I think, was Sky Destroyer. I don't know why but my Dad bought this when he purchased the Twin Famicom for me, probably that's one of the latest title at that time. But it's apparently not... Now I really doubt if Twin Famicom really is the first console for me since I remember I played lots of mid 1985 games real time, like Super Mario 1 and Gegege no Kitaro. Hmm :)
That said, I really am looking forward to the Retro Game Master (originally called Game Center CX) DVD is out in North America. I love the show.
What was the best thing about your weekend?
I saw a white girl wearing kimono with gothic lolita skirt and boots, eating Japanese rice cracker and drinking Kitty-chan Calpis, at San Francisco Japantown. Probably the best thing. Sorry there's no photo because I didn't carry around my camera nor cellphone.
So many Chrono Trigger music videos on Nico Nico Douga, but this really caught my eyes. This guy arranged the music into 8 bit (rather than 16 bit SNES) and then turned it into DS band brothers score! Amazing.
Today I launched a new site, Cartionary.com. This is part of a new company I've co-founded, with the intent of releasing a variety of niche social sites that are designed to generate high quality user content. It's been a lot of work, a ton of fun, and we're at a point of having some users actually kick the tires (no more car puns, I promise).
A few notes before anybody clicks over:
- The image uploading needs work. We were originally going with the YUI Uploader, but due to too many unfixed bugs and general stability issues we did a hasty switch to SWFUpload. We're still very happy using YUI elsewhere on the site, but their uploader simply doesn't work well enough to use. The source was not available earlier so we weren't even able to submit patches; and bug reports were summarily ignored.
- The visible features are not representative of the "1.0" of the site, which we're hoping to have out by September 1st at the latest. We're going to have an article system inspired by use.perl.org, as well as several other features that will make publishing valuable information an absolute joy.
- It is beta. In the real sense of the word. I'm not publicizing it yet outside of my blog here, and that is intentional. We're not even feature complete, so it could be considered an alpha. Or pre-alpha. Anyway, it is a web application. We don't need a proper release cycle but we do need a proper foundation and starting point. Our hopes are that enough people will get a handle on it and submit bugs and ideas that we can fix those while we're pushing out our killer features".
Thanks!