Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
I think the latest commit actually fixes that issue (thanks to t0m). You can check out here: https://github.com/rafl/catalyst-runtime/commit/a8946dc8b4ba4c46b4db564b8f9692d48cc7a62f Cheers On Thu, Mar 1, 2012 at 9:09 AM, Felix Ostmann ostm...@websuche.de wrote: Plz dont change to $FindBin::RealBin/.. ! That will break our projects (we use script/http/catayst_fastcgi_server.pl). 2012/2/29 Louis Erickson lerick...@rdwarf.net On Feb 22, 2012, at 10:57 PM, Dami Laurent (PJ) wrote: -Message d'origine- De : Kieren Diment [mailto:dim...@gmail.com] [...] My understanding was that a recent release of catalyst had a bug that meant that the scripts couldn't infer the location of the app's lib directory. It seems to be fixed in version 5.90010 as per this changes file: https://metacpan.org/source/MSTROUT/Catalyst-Runtime-5.90010/Changes ___ Well, I just installed, 5.900010, the bug is still there. There is a RT ticket, still open : https://rt.cpan.org/Public/Bug/Display.html?id=75098 The issue I noticed in 5.9.0010 is still true; it only adds the libraries to @INC if the current working directory contains the Makefile.PL. It's trying to guess if this is checked out from source control, and guessing oddly. What I don't understand is why it guesses that CWD is the place to check; wouldn't $FindBin::RealBin/.. be a better choice and less likely to be an error? CWD is a pretty external thing and can change easily. This little change messes up a bunch of tools I use, and means that the fastcgi version won't start in my webserver without a config change there. If I can ever get free time to poke it, I may offer a patch which adds a check for both CWD and a path relative to the script. Doing that neatly has been more time than I have had in the last week. It's on my list, really. Who would be the right person to send such a patch to? The list in general? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
Louis, Am 20.02.2012 um 19:52 schrieb Louis Erickson: I noticed a changed behavior in Catalyst, and wondered if it was deliberate. [...] I noticed that with 5.9.0010, installed via perlbrew, I get load failures: wwonko@holly:~/projects/MyApp/script $ perlbrew switch perl-5.14.2 wwonko@holly:~/projects/MyApp/script $ ./myapp_server.pl Can't locate MyApp.pm in @INC (@INC contains: /home/web/www.rdwarf.com/users/wwonko/TopazLib-v1.00.00/lib/site_perl/5.14.2//i686-linux /home/web/www.rdwarf.com/users/wwonko/TopazLib-v1.00.00/lib/site_perl/5.14.2/ /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/i686-linux /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2 /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/i686-linux /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2 .) at /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Module/Runtime.pm line 317. at /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Catalyst/Script/Server.pm line 239 I stumbled over this issue some days ago and asked about it in IRC. t0m wanted to add a fix for this but either he couldn't make it yet or the fix isn't yet on CPAN. Matthias -- rainboxx Software Engineering Matthias Dietrich rainboxx Matthias Dietrich | Phone: +49 7141 / 2 39 14 71 Königsallee 43 | Mobil: +49 151 / 50 60 78 64 71638 Ludwigsburg| WWW : http://www.rainboxx.de ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
On Feb 21, 2012, at 12:26 PM, Eden Cardim wrote: Louis == Louis Erickson lerick...@rdwarf.net writes: Louis No, I mean ../lib relative to the script's main directory. If I'm Louis in / and run the script with a full path, I don't want or expect Louis ../lib to be added to @INC. I want and expect the script to find Louis the paths relative to itself, as the structure of the app as it is Louis often used are. Yes, and Catalyst does try to locate lib (not inc) to the best of it's ability, you need one of Makefile.PL, Build.PL or dist.ini in the same directory as lib, cos' that's the mechanism it uses for locating an uninstalled app. If you don't have those, create at least one, even if it's bogus. If you do have them, and you're still having trouble, it's a bug. Ah! So, it's trying to use the files created as part of the build process to determine where lib is. That seems fair. And so: wwonko@holly:~/projects/MyApp/script $ ./myapp_server.pl Can't locate MyApp.pm in @INC (@INC contains: /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/i686-linux /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2 /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/i686-linux /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2 .) at /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Module/Runtime.pm line 317. at /home/wwonko/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Catalyst/Script/Server.pm line 239 wwonko@holly:~/projects/MyApp/script $ ls .. Changes lib/ Makefile.PL myapp.conf myapp.psgi README root/ script/ t/ wwonko@holly:~/projects/MyApp/script $ Which suggests there is, indeed a bug, as there's a Makefile.PL in the same directory as lib, right where catalyst.pl put it. Given the additional information you provided, it's possible for someone else to debug this and maybe help solve the problem. Thank you! I hope I'll have time to dig into it and see what's going wrong, and make sure I am not making matters worse for someone else. I may not until the weekend. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
Good afternoon, On 22/02/12 at 10:48 AM -0800, Louis Erickson lerick...@rdwarf.net wrote: Which suggests there is, indeed a bug, as there's a Makefile.PL in the same directory as lib, right where catalyst.pl put it. Given the additional information you provided, it's possible for someone else to debug this and maybe help solve the problem. I'm far from understanding the internals in this case, but I think it's the Makefile that's wanted, not Makefile.PL. Try running `perl Makefile.PL` to create the Makefile. Of course, those who understand better might want to clarify/correct that. Charlie -- Ꮚ Charlie Garrison ♊ garri...@zeta.org.au O ascii ribbon campaign - stop html mail - www.asciiribbon.org 〠 http://www.ietf.org/rfc/rfc1855.txt ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
Louis == Louis Erickson lerick...@rdwarf.net writes: Louis Looking at @INC, it's clear that Catalyst no longer adds Louis $basename/../inc to the path - I haven't dug into the code to Louis find where the change was. You mean ../lib, right? Louis I know all the help and samples have people run Louis script/myapp_server.pl, but I never do; I run it from the script Louis directory. There's no problem with that at all (caveats given below), but do you have a specific reason for doing it that way? Louis I'm also concerned that having to be in the right CWD Louis will allow loading of unexpected modules, rather than being based Louis on the app's location, as I'd expect. This isn't much about the CWD, it's about setting the right @INC, which is a problem related to perl (and pretty much any programming language) as a whole. You can run the app from anywhere, as long as you tell it where to find the libs it needs. If you used the standard scaffolding script, that should be lib/ under your MyApp dir, plus the site_perl libs (which are hard-coded into @INC by the perl binary in most cases). If you're concerned about loading unexpected modules, sanitize @INC before you use() anything. Catalyst tries to make a few guesses as to what @INC should be, and the doc examples try to match those assumptions, but there's no way it can catch all the possible scenarios, so if for some reason you decide to do something different than what's doc'ed, you'll need to adjust the environment accordingly. Louis Is this a deliberate change? Is there a reason for it? Or is it Louis an unexpected change? Louis So, I'd think this is deliberate. It will also affect all the Louis scripts. What is this going to do to myapp_fastcgi, when the Louis webserver doesn't set the WD as expected? I'm not exactly sure about the specific motivation for that change, but script/myapp_fastcgi.pl is just a perl source like any other, adjust @INC before running it (via PERL5LIB, -I, etc.) and you'll be fine. -- Eden Cardim Need help with your Catalyst or DBIx::Class project? Code Monkey http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd.Want a managed development or deployment platform? http://edencardim.comhttp://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
On Feb 21, 2012, at 5:24 AM, Eden Cardim wrote: Louis == Louis Erickson lerick...@rdwarf.net writes: Louis Looking at @INC, it's clear that Catalyst no longer adds Louis $basename/../inc to the path - I haven't dug into the code to Louis find where the change was. You mean ../lib, right? No, I mean ../lib relative to the script's main directory. If I'm in / and run the script with a full path, I don't want or expect ../lib to be added to @INC. I want and expect the script to find the paths relative to itself, as the structure of the app as it is often used are. Louis I know all the help and samples have people run Louis script/myapp_server.pl, but I never do; I run it from the script Louis directory. There's no problem with that at all (caveats given below), but do you have a specific reason for doing it that way? Mostly habit, honestly. Twenty years of my fingers running programs with ./whatever instead of from a directory up. I can change that, especially if there's a good reason. I'm more concerned about what this will do to fastcgi and my production web servers. In the virtual host file for Apache, I currently have: Alias / /path/to/app/script/myapp_fastcgi.pl ... and some other stuff to engage that as FastCGI instead of ordinary CGI. Nowhere does it set a working directory. What will it be? /? DocumentRoot? The script directory? So, to upgrade, I'll have to modify PERL5LIB to add the lib directory there, which it used to get right on it's own. I'm sure that'll be a pleasant surprise to a lot of people. Louis I'm also concerned that having to be in the right CWD Louis will allow loading of unexpected modules, rather than being based Louis on the app's location, as I'd expect. This isn't much about the CWD, it's about setting the right @INC, which is a problem related to perl (and pretty much any programming language) as a whole. You can run the app from anywhere, as long as you tell it where to find the libs it needs. If you used the standard scaffolding script, that should be lib/ under your MyApp dir, plus the site_perl libs (which are hard-coded into @INC by the perl binary in most cases). If you're concerned about loading unexpected modules, sanitize @INC before you use() anything. Catalyst tries to make a few guesses as to what @INC should be, and the doc examples try to match those assumptions, but there's no way it can catch all the possible scenarios, so if for some reason you decide to do something different than what's doc'ed, you'll need to adjust the environment accordingly. This is about CWD, at least my concern is. Changing the CWD shouldn't affect the operation of the program. To run a program, the operator shouldn't have to dig in and provide the library paths. That's something the program should be able to know on it's own, either through configuration or inspection. Perl has obvious tools to make that possible. The site_perl is, indeed, set by Perl. I have some other local stuff set in PERL5LIB. I know how to work around this... I'm asking why that's suddenly needed. This is a behavior change, and I'd like to know if there's a reason for it or if it can be fixed. Louis Is this a deliberate change? Is there a reason for it? Or is it Louis an unexpected change? Louis So, I'd think this is deliberate. It will also affect all the Louis scripts. What is this going to do to myapp_fastcgi, when the Louis webserver doesn't set the WD as expected? I'm not exactly sure about the specific motivation for that change, but script/myapp_fastcgi.pl is just a perl source like any other, adjust @INC before running it (via PERL5LIB, -I, etc.) and you'll be fine. I'm aware of the plethora of ways it is possible to set @INC. Converting from ./myapp_server.pl to perl -I../lib myapp_server.pl isn't something I'm looking forward to for development. Having to reconfigure all the production instances of the webserver to set a proper working directory and/or PERL5LIB isn't either. It's certainly an unexpected change. In the past, the scripts have always found the proper lib directory on their own. Why must I suddenly tell them explicitly or work more carefully so it just happens to line up? Another person responded that checkout meant checked out from source control, and yes, I'd guessed that. Checked out instead of what? How does that change the environment? Who is that affecting and how? Do the scripts not run in MyApp/scripts there, or is the difference for the alternative? Would that be after running 'make install', and then being in the path somewhere? Wouldn't finding lib be even more critical in that case? Adding a ../lib or even $basename/../lib wouldn't be appropriate there. I haven't had time yet - and now that the work week has started, won't for a day or two - to dig into the function that changed and see what changed. Without
Re: [Catalyst] Catalyst 5.90010 server must be in CWD to run?
Louis == Louis Erickson lerick...@rdwarf.net writes: Louis No, I mean ../lib relative to the script's main directory. If I'm Louis in / and run the script with a full path, I don't want or expect Louis ../lib to be added to @INC. I want and expect the script to find Louis the paths relative to itself, as the structure of the app as it is Louis often used are. Yes, and Catalyst does try to locate lib (not inc) to the best of it's ability, you need one of Makefile.PL, Build.PL or dist.ini in the same directory as lib, cos' that's the mechanism it uses for locating an uninstalled app. If you don't have those, create at least one, even if it's bogus. If you do have them, and you're still having trouble, it's a bug. Louis Another person responded that checkout meant checked out from Louis source control, and yes, I'd guessed that. Checked out instead of Louis what? Checked out as opposed to installed to site_perl/local-lib via a tarball where you won't have any of the marker files mentioned above, and Catalyst tries to find the app in there as well. Louis How does that change the environment? Basically, if the script isn't lower down the same hierarchy as the marker files, or it's not installed to site_perl, there's nothing Catalyst can do about it. Louis Who is that affecting and how? Louis Do the scripts not run in MyApp/scripts there, or is the Louis difference for the alternative? They run however you choose to run them, whether Catalyst can find lib or not depends on you providing enough info for it to do that. Louis Would that be after running 'make Louis install', and then being in the path somewhere? Wouldn't finding Louis lib be even more critical in that case? Adding a ../lib or even Louis $basename/../lib wouldn't be appropriate there. Yes, but there's only so much that can be automated. -- Eden Cardim Need help with your Catalyst or DBIx::Class project? Code Monkey http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd.Want a managed development or deployment platform? http://edencardim.comhttp://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/