Re: [Catalyst] Sending 3000 emails.
A queue in Perl is better when there is a need of sending thousand messages. Without a queue, if the Catalyst-based code just sends the messages directly and a browser is waiting for a page to load after the web app sent them, it may time-out. But otherwise it should work and not crash the web app. 3000 messages should be sent pretty fast if they are sent to the local SMTP server, but not fast enough for a pleasant experience. Regarding the success of those messages... if you don't want them to reach in the spam folder, it helps to sign them by using SPF/DKIM. If you'll find this complicated, a better solution might be to create an account on a site like mailgun.com or mandrill.com and send the messages using their servers. They offer APIs that you can use in your app very easy. mailgun.com allows sending 10,000 messages/month for free and after that limit the prices are pretty cheap. You will have reports with the list of email messages that bounced that you can get programaticly, plus a few other helpful features. --Octavian - Original Message - From: Andrew To: The elegant MVC web framework Sent: Thursday, November 26, 2015 5:32 PM Subject: [Catalyst] Sending 3000 emails. Hello, You lot are all experts at Catalyst and Perl, and because I'm using Perl to code a Catalyst program, I wanted to ask you about a problem I've encountered. The Catalyst app I'm coding is to replace a PHP website, which presently allows an admin to manage sending out an email to all members. The site has 3000 odd members. From what I could tell, the PHP code was simply using the PHP mail function to send email (although it did in my experience typically take two days for everyone to receive an email sent with it). I've also been asking other Perl programmers when I've had the chance - and the only concerns raised, were about IP blacklisting or emails bouncing back - not about actual code working. So could sending 3000 emails be as simple as Matt's old CGI form mail? I had a look on CPAN, and found the simple looking Email::Stuffer, and wrote a script, sending an email to myself, and it worked. I then modified the script to pick five email addresses from a MySQL database, and email them, and again - it worked. Okay - one final change - throwing 3000 email addresses at it. How does that do? Starts to work - then throws up an Internal Server Error in the browser window, and I find out my Fast CGI Plack Up server thingie isn't up, nor running my Catalyst app anymore. I have to type plackup and my details, etc, again from the command prompt. A log in to Web Host Manager (this is an apache2 VPS with CPanel) and a check of the "View Sent Summary" shows 1020 emails sent - 611 successful, 642 deferrals and 329 failures...curious, as that adds up to more than 1020, =S. If I click through for more details, it shows 1582 records - some with green ticks, and others with amber or red exclamation marks, ^_^. I can worry about IPs and failure rates later I just want to know why the whole FastCGI Plack loaded Catalyst app came down half way through, and how I can have a Perl script process sending 3000 emails without that happening every time, =S. Do I need to use a queue within Perl? Or does the postfix/sendmail on the server, automatically queue everything for me? If so - why did my code crash the Catalyst app, and not send all the emails? >_<. I'm guessing this is a common problem - how does a website email all its signed up members - and so there must surely be a common solution among Perl / Catalyst users? Any help, appreciated! Yours, Andrew. -- ___ 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] Keep Plack -r working when commandline closed...?
Thanks. The conclusion is that if huponexit is set to false we can simply run processes in background appending & at the end of the command line. So we don't need tmux nor screen unless we need other features offered by them. --Octavian - Original Message - From: Lasse Makholm To: The elegant MVC web framework Sent: Monday, October 26, 2015 11:37 PM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? On Mon, Oct 26, 2015 at 9:55 AM, Octavian Rasnita <orasn...@gmail.com> wrote: When I connect to Linux servers using SSH and run the programs using perl program.pl > something.log 2>&1 & then I can use the command exit to close the SSH console but the program continues to run. I remember that in past I needed to use nohup, but in last years I didn't need it anymore. Is the SSH connection a special case but it doesn't work when using a real bash console directly? Sounds like the huponexit is not set in your shell: http://stackoverflow.com/questions/21294283/when-did-hup-stop-getting-sent-and-what-can-i-do-about-it /L --Octavian - Original Message - From: Len Jaffe To: kie...@diment.org ; The elegant MVC web framework Sent: Monday, October 26, 2015 5:13 AM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? & just backgrounds a job. If you close the terminal, you lose job control. If you use tmux, you can close the terminal, but leave the session running, and reattach to the session later. It is well work looking into. On Sat, Oct 24, 2015 at 1:29 AM, Kieren Diment <dim...@gmail.com> wrote: Tmux is the poor man's deployment pathway ;). I use it to keep long running jobs going between logins a lot too, as well as for having an editor in the right place from where I last left off. All round a primo useful tool. Also handy for persistent IRC connections etc. On Sat, Oct 24, 2015 at 3:24 PM, Andrew <catalystgr...@unitedgames.co.uk> wrote: A further search online, throws up that screen and tmux can be useful if the app you want to run in the background needs input now and again. - Original Message - From: Andrew To: The elegant MVC web framework Sent: Saturday, October 24, 2015 5:06 AM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? Why is it better to use these over using an "&"? Or are you simply recommending them generally, due to their usefulness all round? Yours, Andrew. - Original Message - From: Kieren Diment To: The elegant MVC web framework Sent: Friday, October 23, 2015 10:48 PM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? Tmux is generally newer and easier to use than screen, highly recommended. On Sat, Oct 24, 2015 at 7:41 AM, Len Jaffe <lenja...@jaffesystems.com> wrote: I'd still consider using screen or tmux... On Fri, Oct 23, 2015 at 1:48 PM, Andrew <catalystgr...@unitedgames.co.uk> wrote: Turns out it's super easy to run it in the background, =). You just add "&" to the end of the commandline, =D. ^_^ Am learning these little server tricks, ;-). [Tweeted Tatsuhiko Miyagawa of Plack fame, who was kind enough to promptly respond, with this little gem, =D. Yay!] Yours, Andrew. - Original Message - From: "Trevor Leffler" <tleff...@uw.edu> To: "The elegant MVC web framework" <catalyst@lists.scsys.co.uk> Sent: Friday, October 23, 2015 4:28 PM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? What about wrapping your shell session with screen? $ man screen --Trevor On 10/23/2015 08:21 AM, Andrew wrote: > > I've ended up using Plackup to start the catalyst app's psgi script (still > via fast cgi), > and I'm using -r to indicate it should watch for changes, and reload the > server when changes are detected. > > It does this fine, as long as my commandline terminal is still open. > The moment I close it, the server continues to run, yet any watching for > changes, killing, and restarting no longer h
Re: [Catalyst] Keep Plack -r working when commandline closed...?
When I connect to Linux servers using SSH and run the programs using perl program.pl > something.log 2>&1 & then I can use the command exit to close the SSH console but the program continues to run. I remember that in past I needed to use nohup, but in last years I didn't need it anymore. Is the SSH connection a special case but it doesn't work when using a real bash console directly? --Octavian - Original Message - From: Len Jaffe To: kie...@diment.org ; The elegant MVC web framework Sent: Monday, October 26, 2015 5:13 AM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? & just backgrounds a job. If you close the terminal, you lose job control. If you use tmux, you can close the terminal, but leave the session running, and reattach to the session later. It is well work looking into. On Sat, Oct 24, 2015 at 1:29 AM, Kieren Dimentwrote: Tmux is the poor man's deployment pathway ;). I use it to keep long running jobs going between logins a lot too, as well as for having an editor in the right place from where I last left off. All round a primo useful tool. Also handy for persistent IRC connections etc. On Sat, Oct 24, 2015 at 3:24 PM, Andrew wrote: A further search online, throws up that screen and tmux can be useful if the app you want to run in the background needs input now and again. - Original Message - From: Andrew To: The elegant MVC web framework Sent: Saturday, October 24, 2015 5:06 AM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? Why is it better to use these over using an "&"? Or are you simply recommending them generally, due to their usefulness all round? Yours, Andrew. - Original Message - From: Kieren Diment To: The elegant MVC web framework Sent: Friday, October 23, 2015 10:48 PM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? Tmux is generally newer and easier to use than screen, highly recommended. On Sat, Oct 24, 2015 at 7:41 AM, Len Jaffe wrote: I'd still consider using screen or tmux... On Fri, Oct 23, 2015 at 1:48 PM, Andrew wrote: Turns out it's super easy to run it in the background, =). You just add "&" to the end of the commandline, =D. ^_^ Am learning these little server tricks, ;-). [Tweeted Tatsuhiko Miyagawa of Plack fame, who was kind enough to promptly respond, with this little gem, =D. Yay!] Yours, Andrew. - Original Message - From: "Trevor Leffler" To: "The elegant MVC web framework" Sent: Friday, October 23, 2015 4:28 PM Subject: Re: [Catalyst] Keep Plack -r working when commandline closed...? What about wrapping your shell session with screen? $ man screen --Trevor On 10/23/2015 08:21 AM, Andrew wrote: > > I've ended up using Plackup to start the catalyst app's psgi script (still > via fast cgi), > and I'm using -r to indicate it should watch for changes, and reload the > server when changes are detected. > > It does this fine, as long as my commandline terminal is still open. > The moment I close it, the server continues to run, yet any watching for > changes, killing, and restarting no longer happens (as far as I can tell). > > Is there any way to get Plack's scripts that watch and reload (i.e. > Restarter.pm, etc), to continue to run after I close OSX's terminal window / > end the SSH session? > > > Many thanks for any insights offered, > > Yours, > Andrew. > > > ___ > 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:
Re: [Catalyst] Where best to store database connection information?
Catalyst uses Config::General to read .conf files. If Config::General is configured with the option -UseApacheInclude, then you can use an apache include file.conf in the .conf file to include another file from another directory which is not saved by git. Or the option -IncludeDirectories can be also useful so all the files from the given directory will be included. --Octavian - Original Message - From: David Schmidt davew...@gmx.at To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Monday, February 16, 2015 6:22 PM Subject: Re: [Catalyst] Where best to store database connection information? the catalyst configloader can load more then just one file. by default it loads myapp.conf if a file named myapp_local.conf exists it is loaded aswell. docs: https://metacpan.org/pod/distribution/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod#Using-a-local-configuration-file On 16 February 2015 at 15:42, Adam Witney awit...@sgul.ac.uk wrote: Hi, I have a Catalyst / DBIx::Class application and I have been storing the database connection parameters in a config file which is sourced using MYAPP_CONFIG_LOCAL_SUFFIX. But this seems a bit of a security problem having the main password in a text file like this, especially if it goes into git. Is there a recommended or best practice place to store database connection information? Thanks for any help Adam ___ 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/ ___ 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] Where best to store database connection information?
If the application is owned by another user than root (as recommended) and it is kept in a directory with limited permissions, then other users won't have access to it. The root will have access, but it would have access to anything on that server... --Octavian - Original Message - From: Adam Witney awit...@sgul.ac.uk To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Monday, February 16, 2015 7:24 PM Subject: Re: [Catalyst] Where best to store database connection information? Hi, Thanks for your replies. I guess my question was more about any security issue of having the database username/password stored in a text file. And what do people consider best practice for this from a security point of view? Thanks Adam -Original Message- From: Octavian Rasnita [mailto:orasn...@gmail.com] Sent: 16. februára 2015 17:10 To: The elegant MVC web framework Subject: Re: [Catalyst] Where best to store database connection information? Catalyst uses Config::General to read .conf files. If Config::General is configured with the option -UseApacheInclude, then you can use an apache include file.conf in the .conf file to include another file from another directory which is not saved by git. Or the option -IncludeDirectories can be also useful so all the files from the given directory will be included. --Octavian - Original Message - From: David Schmidt davew...@gmx.at To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Monday, February 16, 2015 6:22 PM Subject: Re: [Catalyst] Where best to store database connection information? the catalyst configloader can load more then just one file. by default it loads myapp.conf if a file named myapp_local.conf exists it is loaded aswell. docs: https://metacpan.org/pod/distribution/Catalyst-Plugin- ConfigLoader/lib/Catalyst/Plugin/ConfigLoader/Manual.pod#Using-a-local- configuration-file On 16 February 2015 at 15:42, Adam Witney awit...@sgul.ac.uk wrote: Hi, I have a Catalyst / DBIx::Class application and I have been storing the database connection parameters in a config file which is sourced using MYAPP_CONFIG_LOCAL_SUFFIX. But this seems a bit of a security problem having the main password in a text file like this, especially if it goes into git. Is there a recommended or best practice place to store database connection information? Thanks for any help Adam ___ 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/ ___ 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/ ___ 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] forward not working correctly ?
From: Luca Ferrari fluca1...@infinito.it Hi all, I'm surely missing something in my action: sub edit : Local Form { my ( $self, $c, $id ) = @_; my $form = $self-formbuilder(); ... if ( $is_form_ok ){ ... $c-forward( 'list' ); } else { ... } } The result is that the same page (the form for the edit action) is always rendered, even if all the business logic works fine. detach is not working as I'm expecting too, and only visit appears to render the list action, but without changing the url. $c-forward() just calls another method, but in the same request. I think you want to use $c-redirect(). $c-redirect( $c-uri_for_action( ... ) ); --Octavian ___ 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.90080 on CPAN!
From: Craig Chant cr...@homeloanpartnership.com Thanks Chakkit, However, I run Active-State Perl on IIS and have done for 12 years. Regards, Craig Catalyst works fine with ActivePerl, so you shouldn't have any problem upgrading it. You can make a backup of your current Perl instalation with Control+C, Control+V, then do the upgrade. If something horrible happends, you can revert easy to the old Perl with previous modules you currently have. And if you'll find problems after upgrading, it may be helpful to ask about them on this list. --Octavian ___ 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] Advent Calendar... Grant proposal...
From: r...@hiranyaloka.com I think that one of the main use of Perl is to create web apps. And the best way of creating web apps is by using a web framework. And the most developed web framework for Perl is Catalyst. But those who prefer other frameworks do it because they consider Catalyst too complex and hard to understand. So yes, a more clear documentation for Catalyst should be very helpful. Newbies might have the time and willing to write it, but they might not know what to write. :) So... applying for a grant to do it may be the solution. --Octavian Good documentation is clearly necessary, but I don't think that it will by itself be enough to attract newbies. What else do you think that it may attract you? I am an interested newbie, so perhaps I can add something to the conversation. My impression is that Catalyst is not so complex by itself, but it sits at the top of a pyramid of knowledge domains that are both broad and deep. MVC (each letter is a book in itself), Perl/CPAN, OO, web servers, security, web hosting (your shared hosting won't work), etc. What did I miss? The loosely coupled Catalyst approach to web frameworks therefore benefits from a loosely coupled approach to Catalyst training. What's the minimum required knowledge to create a best practice web application using Catalyst? Each area requires a loosely coupled learning module, that both stands on its own, and directly supports a minimal, yet best practice prerequisite understanding necessary for integration into a Catalyst application. Imho a beginner should not start by creating best practice apps, but apps which help him/her to understand each step as easy as possible. She or he just need to know that there are better ways that will be learned later. When we say that Catalyst is hard/easy or elegant/confusing for beginners we compare it with other web frameworks, but the apps made with all web frameworks need to interact with a web server, use OO, CPAN modules, should take care of security, should be installed on a remote server etc, so it is not a big difference. Dancer examples are nice and sweet, much more elegant than Catalyst's examples, most of them in just a single file, but in real world applications we may want to split the web apps in more modules for a better maintenability, we might need to access more databases, we might want to use more complex URL dispatching styles, and in that case we would see that if we would do those things in a Dancer app, that app might not be so elegant anymore. It sounds very good that Mojolicious doesn't require other CPAN modules but it offers its own modules for many things, and it looks like it would be much easier to install a Mojolicious app, but unless the app is simple enough we may still need to use other CPAN modules, so we should still need to be able to use cpan or cpanm. And in that case, it wouldn't be a big problem to install a large distribution like Catalyst either. Beginner may mean many things, so it is not very clear what recommendations you are searching for. For a Perl - beginner level it is recommended to use the common Perl best practices regarding the variables/subroutine naming, indentation etc, for a web developer beginner is recommended to learn about HTTP and CGI protocols, how web servers work, about security in web apps, for a Catalyst beginner is recommended to read: http://dev.catalystframework.org/ and the POD docs in Catalyst::Manual, trying to concentrate on Catalyst - related code and not DBIx::Class or Template-Toolkit or different form processors if you haven't used them yet. The Catalyst docs are not very good for real beginners that have never used a web framework and also never used an ORM or templating system. Many of them give best practice examples which may be harder to understand by a beginner because they contain Catalyst code intermixed with code from different other modules and a beginner may not know where ends Catalyst and starts DBIx::Class for example. This is why is said that Catalyst has a steap learning curve. It may be very helpful if the beginner first starts by learning to use a simple RDBMS like MySQL or SQLite and DBIx::Class ORM which is the prefered ORM by most and also Template-Toolkit which is the preferred templating system, even only superficially, and only after that start learning to use Catalyst because then it would be much easier to see that Catalyst is just a glue between other modules and that it is not hard to use it. --Octavian ___ 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] Advent Calendar... Grant proposal...
From: r...@hiranyaloka.com Octavian said: Imho a beginner should not start by creating best practice apps, but apps which help him/her to understand each step as easy as possible. She or he just need to know that there are better ways that will be learned later. Your 2012 Catalyst Advent Calendar articles Catalyst in 9 Steps embodied that principle nicely. I'd like to see those articles extended further, and have them linked in the official documentation. Yes, my intention was to show a few really simple ways of using Catalyst without an ORM or other CPAN modules as first steps of learning Catalyst by a beginner, even most of those steps are not intended to be used in production. It would have been very good to have the time to continue the serial and show more and more advanced steps by adding one by one more CPAN modules or Catalyst components, show different URL dispatching types from the most simple to the most complex, show how to use REST etc. Why not set a documentation goal that would allow a perl newbie with Perl Beginner/(Intermediate) under his/her belt, be able to start hacking on a Catalyst app, with relevant documentation to take them all the way to a production ready, best practice site? The people who know Catalyst the best are very occupied so they probably don't have the time to also maintain the documentation very well. Catalyst is mainly used for serious projects and they are probably thinking that the main target audience are the advanced developers, so a documentation/book for beginners probably was not considered a priority. --Octavian ___ 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] Advent Calendar... Grant proposal...
From: Kieren Diment The catalyst docs could do with a substantial review, they haven't had much attention lately. In particular there could do with being a good index. I think the issue with people thinking catalyst is too big/complex is that lots and lots of developers are used to a procedural approach to dealing with web applications, and have troulble with a couple of things. These are: 1. Lots of people are in the habit of writing procedural web apps, and don't feel that they want to shift over to a more OO style. Yes, but shifting to OO style requires a very good knowledge of the entire module stack used. If these modules are too smart, the documentation should explain they very well. 2. Some aspects of the dispatcher freak people out until they learn it (and especially until they get comfortable with chained) and this is a bit of a point of resistance. And I'd say that the fact that Catalyst uses method attributes which in general are discouraged and very rarely found in other projects is another obstacle. Probably some people might like to be able to write their own hello world script that also uses method attributes in order to see how they work and what are their limits in order to understand then a more complex system of attributes in Catalyst. 3. Catalyst used to be hard to install (and catalyst had a lot of influence on improving the cpan toolchain during the relatively early days), but this isn't the case any more, but the perception lingers in places. :-) I think that the last time I also installed Catalyst or a Catalyst component in a hurry by using --force. I spent today a pretty long time trying to install RapidApp, which is a Catalyst extension, but finally I abandoned the idea. I installed a few modules by using ActiveState's ppm and a few others after looking in the .log file with the errors generated by cpanm, but there are other modules required, like JSON::DWIW which don't appear to be made to work under Windows. --Octavian ___ 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/
[Catalyst] Requirement to add for C::A::Serialize::JSON to not give Content-Type application/json is not supported
Hello and... Marry Christmas! I tried to use Catalyst::Controller::REST, but it returned the error Content-Type application/json is not supported.. I've seen that somehow I had the module Catalyst::Action::Serialize::JSON installed, so it should have been working. I checked its source code and I've seen that it uses the module JSON::MaybeXS, but I didn't have that module. I installed it and now it works fine. This is just a note that may be helpful for others that may have this problem. Also maybe JSON::MaybeXS will be added as a requirement for Catalyst::Action::Serialize::JSON. --Octavian ___ 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] Random thoughts on helper class generation
From: neil.lunn n...@mylunn.id.au On 27/01/2014 1:27 PM, John Napiorkowski wrote: Neil, I know the problem we have here, but honestly I think the solution is going to be more about having less stuff in Catalyst.pm rather than more... Hi John, Actually probably missed something in my intended context in the course of the rant. Couldn't agree more with that statement, truly less is more and I wasn't putting a shout out to either change 'Catalyst::Helper' or otherwise bloat things in 'Catalyst Core'. So I think we can agree that it is better to pull things out and delegate to more generic add-in's. I have seen in some reading terms and statements such as monolithic catalyst application ..., which is sadly a sad misnomer and seems more of an indictment on the development model of the authors than an actual problem of Catalyst itself. That said, it doesn't help today much :) Feel free to try a plugin and see what people think. Is a good way to shakeout new ideas. So largely a position on how many people are generally cargo culting the catalyst helper default files, which probably would have been a better title. And otherwise trying to get a feel for what other people were doing as typical, App, Controller, View, Model setups. As for the code, that was my way of saying here's one other way of doing it, what's yours? If anything, the only critique here regarding the helper templates is that new inductees are likely to come on board and just so things as they are in the manual, without much thought to what is actually happening. Hence the reference to getting logging set up under ConfigLoader, and so we show another approach. But not sure exactly what to do about making people think, and think differently, yet. I think a better documentation for Catalyst *written by those who know the internals very well* would be very helpful to solve this problem. Too bad that those people don't have the necessary time for that. I think the fact that Catalyst has too much magic is a reason why most beginners prefer Dancer or Mojolicious. Octavian ___ 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] Re: Content Disposition filename
From: Bill Moseley On Tue, Nov 19, 2013 at 10:32 AM, Bill Moseley mose...@hank.org wrote: Anyone aware of a good, portable way in Perl to encode the filename in a Content-Disposition header? I would like to support UTF8 filenames, but support in browsers is unclear (if not changing). Is this complexity something that the Catalyst framework should handle? It's one of those areas where it's easy to get wrong (I can see many different approaches in our own code). http://greenbytes.de/tech/tc2231/ http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http I have no idea what the client can accept or what its OS uses as a path-separator, and I don't want to go down the client-sniffing path, anyway. I have a user-supplied character string that I want to use as the filename, which I have to assume can contain any unicode character since it's user-supplied data. From my limited tests it seems most modern browsers are supporting the filename* extension. Each browser does some special handling (like replacing the path-separator, or adding a file extension based on content-type if no file extension is in the filename). All I want to do is make valid HTTP headers and let the client decide how to handle it, but also provide a usable filename (not just underscores, for example). So, all I'm after is to make this valid markup: $c-res-header( content_disposition = qq[attachment; filename=$ascii_file; filename*=UTF-8''$utf8_file] ); The filename* is easy, I'm finding: my $utf8_file = uri_escape( Encode::encode( 'UTF-8' = $filename ) ); But the $ascii_file is a bit more work. Percent-encoding doesn't work. So, have to do a bit of filtering. See any easier/cleaner/more-correct approach? When I see this much code I tend to think it's the wrong approach. You can use Text::Unidecode if you want to replace special chars with ASCII chars. Octavian ___ 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] Can't detach from root / create action object
From: Craig Chant cr...@homeloanpartnership.com Hi Andre, That is clearer, and Alexander provided me with a working solution, but it doesn't make sense with your example. $action is an action object isn't it? So Alexander's example has :- $c-detach($c-controller('ComplianceUpdate')-action_for('index')); So I assume $c-controller('ComplianceUpdate')-action_for('index'); is returning an action object that is passed to detach. However, your example just has a string path '/a/my_action_1' , how is that an action object? Are you saying detach (for the single argument signature) takes a URL path and that $action is just a string scalar with a URL path in it and not an action object reference as I got the impression? Below is a piece of text I created for the Catalyst documentation a long time ago (perldoc Catalyst). It tries to makes the things a little bit clearer for using uri_for_action() method, but it is the same in any case an action path is used. The idea is that even though the action path looks like a URL, it is not an URL. It is not the URL that calls that action. Note that although the path looks like a URI that dispatches to the wanted action, it is not a URI, but an internal path to that action. For example, if the action looks like: package MyApp::Controller::Users; sub lst : Path('the-list') {} You can use: $c-uri_for_action('/users/lst') and it will create the URI /users/the-list. --Octavian ___ 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] Re: New design
Maybe it was made for Dancer but they rejected it :-)) --Octavian - Original Message - From: Hernan Lopes hernanlo...@gmail.com To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Wednesday, July 24, 2013 3:20 PM Subject: Re: [Catalyst] Re: New design its because catalyst can do everything, including dance. And its solid like a brick. And cpan is the universe that has all the things. []'s Hernan On 7/24/13, Lance A. Brown la...@bearcircle.net wrote: David Dorward said the following on 7/23/2013 7:30 PM: Then we come to Man With A Brick. Putting the first brick in place is a good image for getting started … but completely breaks from the space theme from elsewhere in the page. It's also the first section that uses translucent backgrounds and it really feels like part of a different site. Man with a Brick is an image from near the end of the movie The Fifth Element. Does that generate licensing/copyright/etc. issues? Design looks cool. I see the same issue with the space dancers others have mentioned. --[Lance] -- GPG Fingerprint: 409B A409 A38D 92BF 15D9 6EEE 9A82 F2AC 69AC 07B9 CACert.org Assurer ___ 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/ ___ 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 $c-request-params
From: ?? Dear friends: I read and follow http://www.catalystframework.org/calendar/2012/8 article, These code --- $c-request-params --- in controller Manage.pm, and write_file $database_file, { append = 1 }, $id|$params-{first_name}|$params-{last_name}|$params-{email}\n; -- in model DB.pm, 'first_name' and 'last_name' can't get from database_file.txt and two pm file. What's the principle? $c is so import and complex, how can I get it from formal pod document or some special article such as http://www.catalystframework.org/calendar/2012/8? Thanks a lot. Thai Heng Hi, You need to read the serie of those 9 articles starting from the first one, because each new step uses the code from the previous steps and just explain the changes. And please read Catalyst POD documentation on CPAN first. The context variable $c is the second variable you can get in controllers actions (after $self) like: package MyApp::Controller::MyController; use Moose; use namespace::autoclean; BEGIN {extends 'Catalyst::Controller'; } sub my_action : Local { my ( $self, $c ) = @_; #Here you have the var $c } Octavian ___ 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/
[Catalyst] Catalyst web site
Hi, I think the content of this page should be changed a little because it is not OK and shows that the Advent Calendar has stopped: http://wiki.catalystframework.org/wiki/adventcalendararticles --Octavian ___ 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] How to get IP address of the interface which therequest come through
From: N.A. n...@u01.gate01.com To: catalyst@lists.scsys.co.uk I wan to get the IP address of the interface(network device) which the request come through. My bad. Unless there is a more direct way of getting the IP address, you can create distinct virtual hosts for each IP address that can access your web app and set an HTTP environment variable that specifies that IP address. Then read that env var in your app. --Octavian ___ 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::Model::DBIC::Schema and caching row objects
Hi Bill, From: Bill Moseley Not sure if the is a Catalyst or DBIC question. Catalyst::Model::DBIC::Schema returns objects blessed into classes related to the app. Then the problem is I cannot share (cached) objects across applications. If you want to use DBIC in more apps, don't use Catalyst::Model::... but create a standalone module that can be used from more apps, even in CLI scripts. And access that standalone module using Catalyst::Model::Adaptor. Octavian ___ 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] Advent wrap-up blog and next steps
Thanks for letting us know that there was a calendar entry on December 26. I didn't know about it. I read on it: The decisions to use Params::Validate and Data::FormValidator were rock-solid. However, they are ageing modules and we would evaluate Module inline declarations and HTML::FormBuilder if we were starting from scratch now. I couldn't find any module named HTML::FormBuilder. Could it be CGI::FormBuilder? I am wondering because in the last period I've seen recommendations only for HTML::FormFu and HTML::FormHandler and I thought that it appeared a better module. --Octavian - Original Message - From: John Napiorkowski To: The elegant MVC web framework Sent: Friday, January 11, 2013 4:06 PM Subject: [Catalyst] Advent wrap-up blog and next steps Hey All, I did a quick blog on Advent 2012, which you can review here (http://jjnapiorkowski.typepad.com/modern-perl/2013/01/catalyst-advent-wrap-up-and-thoughts.html). In particular be sure to check out any of the late published entries, as well as review the list of great articles of Christmas past. If we are going to make that project fly I would need the following assistants: 1) People willing to update and modernize articles (Ideally would be the original author, or people associated with mentioned projects. 2) Catalyst Super Experts willing to act as article Peer reviewers. Thanks! John -- ___ 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] Re: Advent 2012 -- Catalyst in Nine Steps -- Kudos toOctavian
From: John Napiorkowski jjn1...@yahoo.com Pretty solid list, mind if I use it to blog? Very good. Of course I don't mind. :-) regarding the thing about Catalyst and its half in and half out regarding Moose, yeah I think this is definitely a problem. Luckily I think a lot of the more important bits that are not moose could be moved to Plack middleware (authentication and authorization stuff for example). John Yes that's true, but unfortunately there is no documentation for how to do that and it is not clear how complete is the support offered by Plack middleware for all the things that can be moved outside Catalyst. IMHO I think that ideally the business logic should be done in a standalone library that can be used with other interfaces than by web, and the web-specific part should be moved to Plack as much as possible. Octavian ___ 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] Windows Deployment
From: Tadhg Hi All, I’m trying to deploy a simple Catalyst application for internal users, so I don’t need anything fancy load balancing or proxy servers etc. My environment, Server: Windows 2003 server 32 bit Dev Client: Windows 7 64 bit Perl: 5.14.12 32 bit Catalyst: 5.90018 I’ve had a look at the deployment page on the Catalyst Wiki, which gives a good indication of what sould work (though I think some of it may be out of date). Each option I try leads to a roadblock, so I start down a new path with the same result. My no doubt misguided impressions are, Nginx/Lighttpd have limited win support, Acache is difficult and so not recommended and IIS needs Apache and FastCGI and is therefore doubly complex. What I’d like is somebody to tell me what they have working on windows, or even better what the best/least painful solution is? If appropriate I’ll then update/extend the wiki. Thanks, Tadhg Apache with mod_perl works fine. (Installing mod_perl using ppm) Apache configuration is very simple to make a Catalyst app work with it. Octavian ___ 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] Re: Advent 2012 -- Catalyst in Nine Steps -- Kudos toOctavian
From: John Napiorkowski jjn1...@yahoo.com - Original Message - From: Octavian Rasnita orasn...@gmail.com To: John Napiorkowski jjn1...@yahoo.com; The elegant MVC web framework catalyst@lists.scsys.co.uk Cc: Sent: Saturday, December 29, 2012 4:32 PM Subject: Re: [Catalyst] Re: Advent 2012 -- Catalyst in Nine Steps -- Kudos toOctavian From: John Napiorkowski jjn1...@yahoo.com Hi John and thank you again. I'd really like to see a project to gather up, modernize and peer review all the best / informative Advent articles of years past, and we could gather it together as an open source project on github (similarly to the way the Modern Perl book is done). Crafting an ebook would be straightforward, even if we didn't have a publisher. We could version it and update it from time to time as well. We could even put it on some various ebook sites and charge a small fee, to try and raise some money for the project. I mean, if we are talking about existing articles only, I think that even a beginner can read catalystframework.org and Catalyst advent articles from previous years. I guess my thinking is some of the older articles that are good are also pre Moose and pre PSGI. I figured modernizing them and having people review it for modern practices would make them more valuable. Yes, this is true. modernizing is the key word as you said in your original message, but I skipped it. Maybe it can be a good idea to present the modernized article, and also add a link in it to the old article, to make more obvious what is changing, and what's the benefit (because it wouldn't be helpful to just tell that now we should use use Moose; extends '...'; instead of just use parent '...'. But... maybe it could be also helpful to modernize Catalyst modules on CPAN, because some of them use Moose, and some of them don't and some helpers generate models that use Moose and others generate models that don't use it, and this may be a little confusing for newbies. And yes, I think you are right about the reasons of not too much contribution in the last period... Maybe it would require a smaller effort to just create a page with links to the recommended articles, and I think the recommended articles for a beginner should be those who allow him to create a web site with little effort, not the best posible which may be hard to understand by a beginner. No doubt, we could easily do that! OK, I visited Catalyst Advent, and I made a list of articles which I think that may be helpful. Some of them need to be modernized. Here below is the list. It is a kind of vote for them. The other list members can also give their vote pro or against and also express their opinions or propose other articles. It could be helpful if somebody can make a list of articles from main Catalyst web site that might be also included (eventually modernized). I don't know how many of the Catalyst developers would have the time to do that modernization though... (2005) Catalyst Advent - Day 11 - Caching http://www.catalystframework.org/calendar/2005/11 (2007) Making your Catalyst App Cache-friendly http://www.catalystframework.org/calendar/2007/11 (2010) Painless Memcached Configuration With Catalyst DBIx::Class http://www.catalystframework.org/calendar/2010/3 (2005) Catalyst Advent - Day 15 - Sessions http://www.catalystframework.org/calendar/2005/15 (2005) Catalyst Advent - Day 16 - Adding RSS feeds http://www.catalystframework.org/calendar/2005/16 If there are better ways to add an RSS feed, it should be modernized. (2005) Catalyst Advent - Day 18 - Catalyst::View::TT http://www.catalystframework.org/calendar/2005/18 (2005) Catalyst Advent - Day 19 - Testing http://www.catalystframework.org/calendar/2005/19 (2006) Day 7 - Testing with an External Web Server http://www.catalystframework.org/calendar/2006/7 (2006) Day 17 - Testing Catalyst Controllers http://www.catalystframework.org/calendar/2006/17 Eventually create a single big article or a serie of articles regarding testing. (2005) Catalyst Advent - Day 22 - Action Types http://www.catalystframework.org/calendar/2005/22 (2005) Catalyst Advent - Day 23 - Static::Simple http://www.catalystframework.org/calendar/2005/23 (2009) Delivering Static Media with Catalyst http://www.catalystframework.org/calendar/2009/16 (2006) Day 1 - Getting started with Catalyst and Subversion http://www.catalystframework.org/calendar/2006/1 Maybe it can be modernized to use distributed source control systems like git and mercurial. (2006) Day 2 - Handel http://www.catalystframework.org/calendar/2006/2 (2007) A Future Look at Mango http://www.catalystframework.org/calendar/2007/12 (2006) Day 3 - The Layout of a Catalyst Application http://www.catalystframework.org/calendar/2006/3 (2006) Day 9 - Web Services with Catalyst::Action::REST http://www.catalystframework.org/calendar/2006/9 (2009) Writing REST web services with Catalyst::Controller
[Catalyst] Catalyst::Authentication::Store::DBI::ButMaintained
Hi, I am trying to use Catalyst::Authentication::Store::DBI::ButMaintained. The problem of that module is that it says that it requires Catalyst::Model::DBI, but actually it requires a model named DBI.pm which is strange. I corrected it and now it can work with a model with any name, which inherits from both Catalyst::Model::DBI and Catalyst::Model::Adaptor (if the model has a dbh() method), so it can also be used with a standalone lib. I tried to contact the author on the email I found in the POD documentation and sent him the patch, but my message came back with an error. I can use my patched version, but maybe it could be helpful for others also. If somebody know how I can contact the author, please tell me. It would be strange to make another module ::ButMaintained::ButReallyMaintained :-) Thanks. --Octavian ___ 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] Re: Advent 2012 -- Catalyst in Nine Steps -- Kudos toOctavian
From: John Napiorkowski jjn1...@yahoo.com Hi John and thank you again. I'd really like to see a project to gather up, modernize and peer review all the best / informative Advent articles of years past, and we could gather it together as an open source project on github (similarly to the way the Modern Perl book is done). Crafting an ebook would be straightforward, even if we didn't have a publisher. We could version it and update it from time to time as well. We could even put it on some various ebook sites and charge a small fee, to try and raise some money for the project. Do you think it can be helpful enough? I mean, if we are talking about existing articles only, I think that even a beginner can read catalystframework.org and Catalyst advent articles from previous years. And yes, I think you are right about the reasons of not too much contribution in the last period... Maybe it would require a smaller effort to just create a page with links to the recommended articles, and I think the recommended articles for a beginner should be those who allow him to create a web site with little effort, not the best posible which may be hard to understand by a beginner. Octavian ___ 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/
[Catalyst] Re: Advent 2012 -- Catalyst in Nine Steps -- Kudos to Octavian
From: John Karr brain...@brainbuz.org I was just looking at Octavian Rasnita's 9 part contribution to the Advent Calendar. This is exactly what I needed when I was learning Catalyst, and would have made it a lot easier. I would love to see this approach carried out to a larger book for beginners and this article added to the main Catalyst Documentation area on CPAN. Thank you John. I'm glad you found my approach useful. It is a slower way to teach something step by step, but I like that way because it doesn't assume that some things are known beforehand, but they are explained step by step. Yes, I am thinking to write a Catalyst book for beginners, but for the moment is just an idea. (We all know that Catalyst is the most used Perl web framework, but I don't know for sure how much interest still is in Catalyst these days. I am thinking to how many days remained without articles in Catalyst advent last year, and this year also...) A book that shows how to use Catalyst as we use it these days should also explain at least a little other modules like Moose, DBIC, Template-Toolkit, FormFu, Plack, because there are no books for them, (but only for Template-Toolkit), and without knowing those modules, it will appear that Catalyst is very hard to understand. All of them have good POD documentation, but Catalyst also has POD documentation, however that documentation is mostly a kind of reference, but a book is usually prefered by a beginner, because it doesn't just tell how to do the things, but it also tell why to do it that way and not in a different way. I have sent the articles for the Catalyst advent in POD format, and if they are considered good enough, I would be glad if they will be added in the CPAN Catalyst documentation. Octavian ___ 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::Plugin::Email, TT, html config problem
From: Dimitar Petrov Hello Thag, I think plugin is the wrong approach here. Plugins seemed to be good idea in the past, but now they are recommended only if you mess with the internals. I think the recommended think to send emails within Catalyst application is either: a) https://metacpan.org/module/Catalyst::View::Email or https://metacpan.org/module/Catalyst::View::Email::Template b) create a separe model, like shown here http://modernperlbooks.com/mt/2012/07/extracting-a-reusable-catalyst-model.html Cheers, Dimitar As Chromatic said in that article in modernperlbooks.com, it is a good idea to create a standalone script that can send email because it can work in Catalyst apps, and can also work in standalone scripts ran manually or by cron jobs. It can also work with job queues. The module from that article uses Mail::Builder::Simple which can be simply used with something like: use Mail::Builder::Simple; my $mail = Mail::Builder::Simple-new; $mail-send( from = 'm...@host.com', to = 'y...@yourhost.com', subject = 'The subject with UTF-8 chars', plaintext = Hello,\n\nHow are you?\n, ); Mail::Builder::Simple sets the MIME headers automaticly and also encodes the MIME headers and the HTML and text body of the messages to UTF-8. If you know that you'll never want to send email with a program outside the Catalyst app, you can use Mail::Builder::Simple easier by installing Catalyst::Helper::Model::Email and create a model for sending email with it, using something like: ./script/myapp_create.pl model MyMailer Email SMTP smtp.host.com usr passwd And then you can send email with it using something like: $c-model(MyMailer-send( from = 'm...@host.com', to = 'y...@yourhost.com', subject = 'The subject with UTF-8 chars', plaintext = Hello\n\nHow are you?\n\n, ); For more info: https://metacpan.org/module/Catalyst::Helper::Model::Email and https://metacpan.org/module/Mail::Builder::Simple Octavian ___ 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] The optimal captcha
There is no optimal Captcha. All of them block the access for some human users, so Captcha can't make the distinction between humans and non-humans, but only the distinction between sighted humans and anything else. reCaptcha offers an audio alternative for the blind but it is almost uninteligible almost always. And there are users which use a Braille display because they are both blind and deaf also... So, I would recommend using reCaptcha only if it is absolutely necessary, for example if you work for a site that will probably have very very many users, and if you think the spammers would make the effort to create a scraper specially designed for that site to create accounts and submit spam. Captcha is overkill if it is needed just to block the general spam robots that can work with all the sites. --Octavian - Original Message - From: peterp...@bk.ru To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Friday, December 14, 2012 11:33 AM Subject: [Catalyst] The optimal captcha Hi! Needed the captcha for project. May some one recommend something about? ___ 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] Its time for Advent again
Hi John, I have sent you a message with articles attached but I haven't received any message from you, so I don't know if they reached your mailbox. It's December 1st, but I can still see The calendar has been retired. message on the page: http://www.catalystframework.org/calendar It's the advent calendar really abandoned? --Octavian - Original Message - From: John Napiorkowski jjn1...@yahoo.com To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Friday, November 16, 2012 6:39 PM Subject: [Catalyst] Its time for Advent again Hey everyone, Here's a copy of a blog post I did announcing calls for advent articles: = So last year wasn't the most spectacular Perl Catalyst Advent we've ever had. Lets see if we can do better this go around! In order to assist, here's a few thoughts on simple articles you can do: * Take any old article and modernize it... * ...or show an alternative approach. * Elaborate or improve on an idea you've previously written about in a blog, or that you read about in some else's blog. * Cools things you can do now that Catalyst is Plack at the core. * Alternatives to using the stash to pass data around. * Examples of applications not using Template Toolkit or DBIx::Class * Examples of using Catalyst with other frameworks such as Web-Simple and Web-Machine * Examples of testing, especially anything using Behavior Driven techniques (think rspec or cucumber). Alternatively we don't need tech oriented articles. I'd be really happy to see some people write something from a business or planning perspective. For example, if you are a CTO or person in planning, something about how you used Catalyst effectively to rapidly meet business goals would be very helpful. Or if someone wanted to look at the results of the recent poll and perform some interesting analysis, I think the community would love to see that. Lets get it rolling! = What I didn't announce via the blog is that if we don't get enough commitment, it would be better to not do a catalyst only advent article, and just combine our submissions over the one of the general Perl Advent calendars. Having a poor showing in our advent calendar doesn't send the right message and it would be better to have a one or two in a popular and full calendar than a bunch of empty dates on ours. Lets here your thoughts on the matter! John ___ 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/
[Catalyst] Storing the hash of the session token with C::P::Session::Store::File
Hi, I read a good suggestion: And DO NOT STORE THE PERSISTENT LOGIN COOKIE (TOKEN) IN YOUR DATABASE, ONLY A HASH OF IT! The login token is Password Equivalent, so if an attacker got his hands on your database, he/she could use the tokens to log in to any account, just as if they were cleartext login-password combinations. Therefore, use strong salted hashing (bcrypt / phpass) when storing persistent login tokens. I've seen that C::P::Session::Store::File stores the token of the session on the server, and not only its hash. Is there a way to configure this plugin to store just the hash of the token on the server? --Octavian ___ 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] thoughts on a catalyst roadmap
Hi, From: John Napiorkowski Hey All, I published a blog regarding my thought (and only my thoughts at this point) regarding how to approach understanding what a long term roadmap for Catalyst could be. From the recent poll it seems this is a major gap. So here's my way to kick off a conversation, and I'm sharing linkage here on the list since I know not all of you hang on on IRC or follow a lot of blogs: http://jjnapiorkowski.typepad.com/modern-perl/2012/10/thoughts-on-a-catalyst-roadmap-1.html Thanks! John I think that it could be helpful if that roadmap would tell more clear for what kind of web sites would be Catalyst better than other frameworks (and for what kind of sites would not be). For example, I think that Catalyst is good for big web sites as well as for small sites, but in case of limited resources, especially memory, Catalyst might not be the best choice, and because the apps made with Catalyst usually have many dependencies, it might not be the best choice when the app is deployed on the cloud. Or am I wrong? It would be helpful to be sure... Then, in order to find where is Catalyst on his road, it can be positioned in comparison with other web frameworks (especially Dancer and Mojolicious, but maybe even frameworks for other languages, like Ruby on Rails). I've seen that some newbies use to put questions about the recommended web framework on some sites (like Linkedin) and I think that it could be helpful for them if they could see the most important differences between most important frameworks without needing to learn them all before beeng able to decide. And the things that can be compared could be... if the framework has scafolding scripts, if they use a single file or more, how scalable they are, if they need a manual URL dispatcher or if it is done automaticly, if they can be used on some cloud sites or not, how easy is to use other modules from CPAN with them, like DBIC, TT, HTML::FormFu, or Rest, or how easy is to integrate Catalyst apps with other existing apps... and which are the proposed improvements where they are necessary. Also some things about using Catalyst and Bread::Board in the future and how it be useful would be also helpful. The recommendation is to create Catalyst apps as standalone as possible and to use the web just as an interface... one of the interfaces of the app, but most of the tutorials and examples are not done this way. It would be also helpful to know if there are intentions to make Catalyst to be even more easier to use with such a standalone app, and how should be the interface offered by that app to work with Catalyst I mean, if some best practices should be expected, or TIMTOWTDI (each on his own) will be the single recommendation in the future. Octavian ___ 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] (no subject)
Hi Dimitar, From: Dimitar Petrov Hello Octavian, If you take a look at the generated files from DBIx::Class::Schema::Loader you'll see something like: # Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-07-25 17:05:05 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YCnxLAuOQnGE4pbIiellqA where the md5sum, the loader version and date are going to be different. You are not suppose to editi anything above so I guess you made some change above the line and there is mismatch with the md5sum? Cheers, Dimitar Yes I know that it should be so, but I haven't changed anything on the server, above or below that line. The file on the Linux server is exactly the same as the file on Windows (I have checked them using diff -u) and they both have Windows end of line. But I can change the DBIC schema under Windows without problems, but not the DBIC schema on Linux. Maybe it has something to do with the fact that the Perl module on Linux uses a Windows end of line... although if the files are exactly the same, they should generate the same MD5 sum... Octavian ___ 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] (no subject)
From: piet molenaar Subject: [Catalyst] (no subject) Hi, We work with svn were we've committed the schema classes also into the repository. Using the Catalyst helper script we tried to update the DBIC schema that was created with the Catalyst helper after checkout on another machine and the following error appeared.DBIx::Class::Schema::Loader::make_schema_at(): It is not possible to downgrade a schema that was loaded with use_moose = 1 to use_moose = 0, due to differing custom content at /home/danny/perl5/lib/perl5/Catalyst/Helper/Model/DBIC/Schema.pm line 635 I have to mention that we work both on Linux (Ubuntu) and Windows (7) configurations. The error appeared after building the schema on the Windows machine; checking it in and subsequently rebuilding (after changes) on Ubuntu. We also tried to install the latest version of DBIx::Class::Schema::Loader and the latest Catalyst helper, and then the latest DBIx::Class, and run the Catalyst helper to update the schema, but it still gives that error. What can we do? Where can we specify use_moose = 1 to make it work? We've looked into documentation but there is no mention about a best practice of keeping the schema files out of a shared repository. Or am I confused here? I also noted that a similar question was posed on the DBIX mailing list, but IMHO this list might be more appropriate. Cheers thanks in advance, Piet Yep, I put that question on DBIC mailing list because actually is about DBIC, but got no answer, so if someone on Catalyst mailing list know... please help. I have the same problem. Development on Windows and use in production on Ubuntu and then tried to update the DBIC schema on Ubuntu. Octavian ___ 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/
[Catalyst] Plack::Middleware based session for Catalyst apps?
Hi, Is it possible to use Plack::Middleware sessions in Catalyst apps? (To be able to set/get to/from $c-session...) --Octavian ___ 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] upstart script for Starman-based app?
From: Bill Moseley Subject: Re: [Catalyst] upstart script for Starman-based app? On Thu, May 3, 2012 at 2:24 AM, Octavian Rasnita orasn...@gmail.com wrote: Hi all, Does anyone have an upstart script that can be used for automaticly starting a Cat app using Starman? I use Perlbrew and local::lib and I start the app in my own account and not as root and I don't know how to make upstart start the app under my account. Maybe it will be helpful to see an upstart script that works, and try to adapt it. I'm curious: why you use both Perlbrew and local::lib vs. installing all modules in the Perlbrew Perl lib? Thanks, Hi Bill, No special super technical reason. I use Perlbrew because I want to leave the system Perl alone, and I thought that I will use a single Perlbrew and a different local::lib dir for the 2 different apps I made. But finally I installed a separate Perlbrew for each of them. Octavian ___ 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] upstart script for Starman-based app?
From: Jack Downes jdow...@krmc.org Subject: RE: [Catalyst] upstart script for Starman-based app? I do something similar with FreeBSD. My install consists of a local install of perl, cat, dbic, etc to get my app running. I use nginx from system configured as a proxy. Now, I see a lot of people using Starman with nginx and you are asking for Starman, so that's doable... Anyway I use nginx to proxy to the fastcgi process... I'm pretty sure this isn't starman, but then, I don't know for sure. My point in this is that I have not written rc scripts for my catalyst app, and probably won't. There exists another way which, for me as a standard user on this system is pretty much perfect I use @reboot in the crontab. Perhaps this will work for you as well? It's quite simple... perhaps overly so. Jack Downes Not exactly. I would also like to be able to use a simple command to stop/restart/start the app manually if I need it, like start app or service app start because I know how to kill -QUIT `cat file.pid`, but this would appear pretty complicated if I must tell it to somebody else by phone to use it if necessary. Octavian ___ 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] upstart script for Starman-based app?
From: Todd Lyons tly...@ivenue.com Subject: Re: [Catalyst] upstart script for Starman-based app? On Thu, May 3, 2012 at 12:24 AM, Octavian Rasnita orasn...@gmail.com wrote: Does anyone have an upstart script that can be used for automaticly starting a Cat app using Starman? I use Perlbrew and local::lib and I start the app in my own account and not as root and I don't know how to make upstart start the app under my account. Maybe it will be helpful to see an upstart script that works, and try to adapt it. What follows is for starting a python app as an unprivileged user with upstart, I don't think it would be too difficult to adjust it for your starman based app: http://stackoverflow.com/questions/10250682/how-to-write-an-ubuntu-upstart-job-for-celery-django-celery-in-a-virtualenv Follow the link in the first answer for the authoritative confirming response from the upstart guys: http://superuser.com/questions/213416/running-upstart-jobs-as-unprivileged-users/234541#234541 ...Todd -- Thanks. Even though I've succeeded to make it work in a different way, I will also try these ways. Octavian ___ 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] upstart script for Starman-based app?
From: Dave Rolsky auta...@urth.org Subject: Re: [Catalyst] upstart script for Starman-based app? On Fri, 4 May 2012, Octavian Rasnita wrote: expect fork I'm not sure why you need this. There's no fork happening with your config, AFAICT. But isn't Starman doing a fork? Yes, but the expect fork is telling upstart to expect the process to fork once and create a single child, letting the parene exit. Upstart will track the pid of the child and kill that when you stop the process. With Starman, the parent stays active, and it's what should be killed when you want to stop the process. I see that this is not happening, at least if starman receives the --user and --group parameters. I have use --user teddy --group teddy in the upstart config, and even though I execute start prg and stop prg from the root account, all the starman processes are owned by teddy account. And there are 11 processes, even though I asked starman to run 10 children, so the master process is also owned by teddy account. To be honest, I kind of hate upstart. It's really freaking inscrutable and the docs suck. I've gotten some info out of it by putting it into debug mode and watching /var/log/daemon.log I really wish Ubuntu would just kill upstart and switch to systemd. I have never used nor seen a systemd script although I heard about it. I was able to compare just the huge and complicated systemv init scripts and upstart, and upstart is better (if it works:) Isn't OK to install systemd using apt-get? I've found that there is a systemd package available for Ubuntu: p live-config-systemd - Debian Live - System Configuration Scripts (systemd backend) That won't magically make all the other packages use systemd instead of upstart, and I don't think trying to run two init daemons is a great idea ;) -dave I've seen that not all the processes started automaticly use upstart under Ubuntu. For example, I can manage apache2 process using service apache2 status but not status apache because apache2 uses a SystemV script. I read somewhere that upstart can work somehow with upstart scripts, but that the old SysV init scripts are also executed... but I don't know if it can also work in the same way with SysD scripts... Octavian ___ 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] upstart script for Starman-based app?
From: Dave Rolsky auta...@urth.org Subject: Re: [Catalyst] upstart script for Starman-based app? On Thu, 3 May 2012, Octavian Rasnita wrote: Does anyone have an upstart script that can be used for automaticly starting a Cat app using Starman? I use Perlbrew and local::lib and I start the app in my own account and not as root and I don't know how to make upstart start the app under my account. Maybe it will be helpful to see an upstart script that works, and try to adapt it. Here's an upstart script I use for vegguide.org. Note that I have root access to my server, so you'll need to adjust a bit. description VegGuide starman server start on (local-filesystems and net-device-up IFACE!=lo) stop on runlevel [016] respawn limit as 524288000 524288000 pre-start script mkdir -p /var/run/vegguide chown www-data:www-data /var/run/vegguide mkdir -p /var/log/vegguide chown www-data:www-data /var/log/vegguide end script exec /opt/perl5.14.2-no-threads/bin/starman --listen 127.0.0.1:8088 --workers 12 --preload-app --user www-data --group www-data /opt/perl5.14.2-no-threads/bin/vegguide.psgi 2 /var/log/vegguide/error.log This code base is in a git repo at git://git.urth.org/VegGuide.git I also have a log monitor script which was watches this error log and emails me when there are errors. I start that via upstart too, and it's dependent on this job. -dave Hi Dave, Thank you for your script. Finally I've made it to work, although there still is one thing I don't understand... Here is my version (the paths are just for testing): description Startup script for the web site start on (local-filesystems and net-device-up IFACE!=lo) stop on runlevel [016] env PERL5LIB=/home/teddy/perl5/lib1/lib/perl5/i686-linux:/home/teddy/perl5/lib1/lib/perl5 env PATH=/home/teddy/perl5/perlbrew/bin:/home/teddy/perl5/perlbrew/perls/perl-5.14.2/bin:/home/teddy/perl5/lib1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games export PERL5LIB export PATH expect fork respawn exec /home/teddy/perl5/lib1/bin/starman --listen :5000 --workers 5 --max-requests 1000 --preload-app --pid /srv/log/site.pid --access-log /srv/log/access.log --error-log /srv/log/error.log --user teddy --group teddy --daemonize /srv/BRK/brk.psgi I've also tried to exec a bash script that contains the same command above (without exec) using: exec /srv/BRK/start1.sh But I don't know why it doesn't start the app this way. If I exec the full command in the upstart script it works fine though. I've seen that the app starts fine if I don't use the expect stanza, but in that case I can't close it using the stop command. But I can start and stop it fine if I use either expect fork or expect daemon. Octavian ___ 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] upstart script for Starman-based app?
From: Dave Rolsky auta...@urth.org Subject: Re: [Catalyst] upstart script for Starman-based app? On Fri, 4 May 2012, Octavian Rasnita wrote: expect fork I'm not sure why you need this. There's no fork happening with your config, AFAICT. But isn't Starman doing a fork? To be honest, I kind of hate upstart. It's really freaking inscrutable and the docs suck. I've gotten some info out of it by putting it into debug mode and watching /var/log/daemon.log I really wish Ubuntu would just kill upstart and switch to systemd. I have never used nor seen a systemd script although I heard about it. I was able to compare just the huge and complicated systemv init scripts and upstart, and upstart is better (if it works:) Isn't OK to install systemd using apt-get? I've found that there is a systemd package available for Ubuntu: p live-config-systemd - Debian Live - System Configuration Scripts (systemd backend) Octavian ___ 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/
[Catalyst] upstart script for Starman-based app?
Hi all, Does anyone have an upstart script that can be used for automaticly starting a Cat app using Starman? I use Perlbrew and local::lib and I start the app in my own account and not as root and I don't know how to make upstart start the app under my account. Maybe it will be helpful to see an upstart script that works, and try to adapt it. Thanks. --Octavian ___ 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] upstart script for Starman-based app?
From: Morad IGMIR mig...@alliancemca.com Subject: RE: [Catalyst] upstart script for Starman-based app? I'm currently using CatalystX::Script::Server::Starman to do just this, it works fine so far, and you don't need to adapt your script, just use myapp_server.pl https://metacpan.org/module/CatalystX::Script::Server::Starman Thanks. I know about it, but it doesn't solve what I want... to start the web server automaticly when the computer starts after MySQL was started. Octavian ___ 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] upstart script for Starman-based app?
From: Tomas Doran bobtf...@bobtfish.net Subject: Re: [Catalyst] upstart script for Starman-based app? On 3 May 2012, at 08:24, Octavian Rasnita wrote: Hi all, Does anyone have an upstart script that can be used for automaticly starting a Cat app using Starman? I use Perlbrew and local::lib and I start the app in my own account and not as root and I don't know how to make upstart start the app under my account. Maybe it will be helpful to see an upstart script that works, and try to adapt it. Just write an upstart script that executes su - your user -c'x'. Or write a shell script that starts the app in the right way (when run as root) and execute that from upstart. Except you do not want to run the app as the same user which installed it in production. You also don't want to run it as root (of course), but running it as your user gives the app permissions to re-write any of your files, including it's own source code… Cheers t0m ** Yes, good tip for not running in production with the same user as the one that installed it. But for the moment I just want to test the upstart script so I will run it with the same user. No luck until now. I have tried the following script (site.conf): start on (mysql and runlevel [2345]) stop on runlevel [016] env PERL5LIB=/home/teddy/perl5/lib1/lib/perl5/i686-linux:/home/teddy/perl5/lib1/lib/perl5 env PATH=/home/teddy/perl5/perlbrew/bin:/home/teddy/perl5/perlbrew/perls/perl-5.14.2/bin:/home/teddy/perl5/lib1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games exec su - teddy -c'/srv/BRK/start_all_modules.sh' But it didn't start the web server at all. Then I copied the environment vars definitions in the script start_all_modules.sh which starts starman and this way it started the web server. But the problem is that I can't stop it using upstart because it gives the error unknown instance. If I use the command status site, it gives the result stop/waiting even though the server is running. root@ubuntu:/srv/log# start site; status site site start/running, process 28528 site start/running, process 28528 root@ubuntu:/srv/log# status site site stop/waiting It appears that immediately after it starts, it passes to the stop/waiting mode. I tried to add in the script: instance $UPSTART_EVENTS env UPSTART_EVENTS= but no change. Then I added: expect daemon After this change, it seems to start well and using status site doesn't show it as stopped anymore. But if I want to stop it using stop site, it just sits and waits and I don't get the prompt back so after a long time I need to kill it and all the starman processes are running fine. So I have tried expect fork instead. But with this configuration it blocks when I use start site and it doesn't return the prompt, and of course, it doesn't start the server. So I am surely missing something, and I don't know why I can't stop it using upstart. Thanks. Octavian ___ 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] upstart script for Starman-based app?
From: Morad IGMIR mig...@alliancemca.com Subject: RE: [Catalyst] upstart script for Starman-based app? So you're looking for an /etc/init.d/ init script ? Thank you for your script. I hope I will be able to use an upstart script, because upstart requires much less code and it is more powerful than the old SysV init style scripts, but if I won't find a solution for the problem I found in my script, I'll probably go back and create a script based on yours. Octavian ___ 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] Re: Using model layers between Catalyst and DBIC
Hi Bill, From: Bill Moseley On Tue, Jan 10, 2012 at 1:18 PM, Jason Galea li...@eightdegrees.com.au wrote: hehe.. you want layers, I got layers.. I just got out of yet another meeting about this architecture redesign. (I'd like to see the graph that relates productivity to the number of people involved some day...) Jason, this is probably a question best for you and your experience, but I (ignoring that graph above) would like to hear other's opinions and reasoning. My goal was to put a layer between Catalyst and DBIC for a few reasons, including: 1.. To have a place to put common model code that cannot be represented in DBIC (e.g. data from other sources) 2.. To be able to split up the model into logical units that can be tested and used independently. 3.. To abstract out the physical layout of the database -- be able to change data layer w/o changing the API. I also needed that flexibility for exactly the same reasons, but the bad thing is that Catalyst does so many things automaticly and DBIC the same that it would imply a decrease in productivity if the app would do those things. ...At least if the app is not very big and complex. Some actions, like getting some records from a db, is surely the job of a model, but that model could use records as simple hashrefs (as returned by DBI's fetchrow_hashref), or it could use DBIC records, or other models could offer the data with another structure. But there is no standard structure defined for a model that should unify the data from more such models and offer it to the view. I guess that it could be hard to define such a structure because it would differ among different apps and it might also imply a performance degradation. But some other actions are considered to be the job of the controller, for example the authentication/authorization, or anyway the job of the web framework, however sometimes that authentication/authorization should be made in other ways, not by web, but by a simple command line script, or by a GUI interface. I guess that for beeing able to totally decouple the web interface from the app, that app should offer a certain interface which would be compatible with Catalyst and the developer would just need to configure Catalyst part to handle the app foo at /foo, and another app bar to /bar and another app baz to /. And the interface of all those apps should accept an authorization/authentication object with a standard format, and the authentication should be made by Catalyst or the GUI app, or the CLI script... And the apps used by Catalyst could offer their authentication/authorization and the developer could configure Catalyst to use the authentication offered by the app foo, or the app bar, or the app baz, or an external authenticator that uses the database of another app, authenticator that should do the validation and offer the authentication object in that standard format accepted by the apps. This way would be more simple to create adapters for existing apps and combine them in a single web site, or change the authentication... Anyway, the question regarding the common format of the data returned by the model to the view remains, and because it could imply performance degrading to change the data structures returned by the underlying modules, it might not be a good way. I am also thinking that there are many developers that like the very limited style of other web frameworks which accept a single ORM, a single templating system and don't even think to decouple the app from the web framework... Just thoughts Yeah I know, patches welcome. :-) My idea was that Catalyst would call a method in the new model layer and possibly get a DBIC object back. There is concern from some at my meeting that we don't want to give the Catalyst app developer a raw DBIC object and that we should wrap it (as it appears you are doing, Jason) in yet another object. That is, we want to allow $user-first_name, but not $user-search_related or $user-delete. That requires writing new wrapper classes for every possible result -- not just mirroring DBIC's result classes but possibly many more because the new model might have multiple calls (with different access levels) for fetching user data. That is, $user-email might work for some model methods that return a user but not methods called on the model. Frankly, to me this seems like a lot of code and work and complexity just to prevent another developer from doing something stupid -- which we cannot prevent anyway. And smart programmers can get at whatever they want, regardless. Seems more risky to make the code more complex and thus harder to understand. The cost/benefit ratio just doesn't seem that great. ** Yep, for not allowing the developer to do something stupid, but also for making the application not depend so much on the underlying model... DBIC for example.
Re: [Catalyst] What are the best practices for using phrasebooks inCatalyst applications?
- Original Message - Subject: [Catalyst] What are the best practices for using phrasebooks inCatalyst applications? I am working on a project where the terminology we are using for objects in the system is diverging from terminology that the client is using for those things. And it also seems that other clients may use different names for these objects. (And this is just for English-language interfaces.) So I would like to use some kind of phrasebook, so that the source code can use the same, consistent terminology, but the clients see their terminology in the UI. I'd prefer not to maintain a separate set of templates for each client, since that requires keeping changes to templates consistent across sets, and requires keeping changes to terminology consistent in a set. So... is there an existing plugin that is used for such things? Otherwise, I am thinking of writing a plugin that makes use of Data::Phrasebook (or something similar), allows for configuration of the phrasebook in the configuration file, and adds a new method to the Catalyst context variable for querying the phrasebook, e.g. the template may have something like h1[% c.phrase('widgets') | html %]/h1 Does this make sense, or is there a better way to do this? Thanks, Rob If the terminology differs, then you may use I18N. You could define your own languages for all the terminologies you need, set the current language with: $c-languages([$language]); and then you'll just need to use something like: [% l('widgets') | html %] where l() is a macro defined with: [% MACRO l(text,args) BLOCK; c.localize(text,args) || text; END ~%] It may work unless the site already needs to use I18N for real languages. Octavian ___ 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] What are the best practices for using phrasebooksinCatalyst applications?
Hi, On 27 January 2012 14:13, Dave Howorth dhowo...@mrc-lmb.cam.ac.uk wrote: Octavian Rasnita wrote: It may work unless the site already needs to use I18N for real languages. I think the solution in that case is to use a language tag something like en-US-x-my-private-tag-for-this-user It may work, but in this case shouldn't all the strings should be translated in that language? Is there a way of defining en-us or another real language code as the base language and for the strings that don't have a translation in the language en-us-x-client1 to be translated in en-us as a backup? If there is a way, than it would be OK. Octavian ___ 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] Running Catalyst apps with start_server
Hi t0m, From: Tomas Doran bobtf...@bobtfish.net On 23 Jan 2012, at 21:34, Octavian Rasnita wrote: So something's obviously wrong if so much memory is occupied even after 1 hour of inactivity. To start with, you're testing entirely wrong. Well, this is good news. :-) Testing the free RAM on the machine is bullshit - as the kernel is going to cache data for you, so the 'free' RAM figure means nothing. I know that, but a problem I had was that when the used memory reported by top reached to be as big as the total memory, the system started to swap. This is why I was looking at it. The only figures really of note is the VSZ of each process. (And this doesn't account for memory sharing). OK, I will make some tests to see if the size of that memory increases. What will (appear) to happen is that starman pre-loads all your bits (lets say that's 20Mb for the sake of argument). It then forks, giving you 5 workers... So you now have 6 x 20Mb (VSZ) - there is memory sharing going on here, so you're not actually using that memory, but lets ignore that... Then you do a load of (the same) request, which generates a 1Mb output document, but generating that document involves the user of 10Mb of RAM. After 5 requests (one to each worker), you will now be (appearing to be) using 20 + 5 * (20+10) Mb of RAM (combined VSZ). Now, if you continue making the same request, memory useage should not go up significantly (although as your workers process more requests, they're more likely to become un-shared, so 'real' memory use in the background goes up.. but again, let's ignore this). You stop making requests... Nothing changes.. Perl _never_ gives RAM back to the system, until it restarts. If you come back and do another web request, the memory perl has internally free will be re-used, but it won't be released back to the operating system. If you now kill Starman, then the operating system _may_, at _it's discression_ free up all the pages from which perl code was cached, and it may not. Measuring the OS free memory is just wrong... Thanks for your explanations. It is helpful. I was also thinking that Perl should reuse the memory has free internally, but I have seen that the used memory as reported by top continues to increase, so the free memory looked like it was not reused, but now I understand that this memory size is wrong. I have made harder tests that should use the entire memory and make the system swap, but I've seen that the used memory reported by top continued to increase, but only up to a certain size that never reached the total memory size, so that increase looks to be false indeed. No, this (the 'after 1 hour' thing) is not a leak - this is perl not giving the OS memory back, by design. (And yes - you may have a tiny leak in there somewhere due to the small continuing RAM increase per request - although I'd be more likely to blame your app than Starman for this) For doing those tests I used a simple Catalyst app made with catalyst.pl MyApp and nothing more. And I also tested it with Catalyst's test server and it doesn't seems to be leaking. This is why your generally arrange for workers to restart after N requests, as if they serve a _massive_ page, then they won't give that memory back ever... So just set children to die after a few thousand requests and stop worrying? Yep, I am doing that. The test app wasn't leaking, but my real app might have some leaks. I have used CatalystX::LeackChecker and I didn't find any leaks, but anyway, if the app has some leaks that I can't find, what do you suggest it is the solution for not consuming the entire memory? Is closing and starting starman now and then the only solution? Thanks. Octavian ___ 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] Running Catalyst apps with start_server
Hi t0m, From: Tomas Doran bobtf...@bobtfish.net On 21 Jan 2012, at 22:16, Octavian Rasnita wrote: But of course, it doesn't go in the background... I can put it to run in the background if I add a after the command line start_server ... and I've seen that if I do that it works and I can also add or remove workers with kill -TTIN|TTOU, but... is it a good way? Or it is better recommended to run starman directly? Any way you like is fine - as we're a ubuntu shop at work, we're mostly deploying things just using upstart to start a (not daemonizing) server - which works well for us. I intend to use my app under Ubuntu, so I'll probably also want to use upstart, but for the moment I am testing it and not with very good results. You could alternatively try using CatalystX::Script::Server::Starman - this should make your normal myapp_server be starman, and then try the deamonize and pidfile options from the Catalyst script? Does that work I will try that, because it would be easier, but for the moment I have a problem with starman which seems to be leaking memory and I don't know how I can solve it. I use Ubuntu 11 and Perl 5.14.2 and latest Catalyst and Starman and I am testing a simple MyApp Catalyst app created with: catalyst.pl MyApp I have compared Catalyst test server with starman and I am just following the used memory as it is reported by the top command and here are the results of my tests: Before running the Catalyst test server: 340508k used memory After running the Cat test server: 360992k After the first request: 360992k After 1000 more requests (with ab -n 1000 -c 1): 360992k So Catalyst seems to be working fine, with no leaks. After 1000 more requests (with ab -n 1000 -c 20): 361116k After ~ 1 minute with no activity: 360868k After killing Catalyst test server: 340532k after ~ 2 minutes of inactivity: 340516k ...which is almost as before running the Catalyst test server. After running again Catalyst test server: 360984k After ~ 1 requests (with ab -n 10 -c 50): 361248k After ~ 9 requests: 361248k After closing Catalyst test server: 341052k After ~ 1 minute of inactivity: 340060k So I can say that Catalyst and MyApp app don't leak. After reboot, before running starman: 110192k After running starman in a memory-friendly style, by preloading some modules, using: starman \ --listen :5000 \ --workers 1 \ --max-requests 1000 \ --pid /srv/log/myapp.pid \ --access-log /srv/log/myapp_access.log \ --error-log /srv/log/myapp_error.log \ --daemonize \ -I /home/teddy/perl5/lib1/lib/perl5 \ -I /home/teddy/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2 \ -MMoose \ -Mnamespace::autoclean \ -MCatalyst \ -MCatalyst::Plugin::ConfigLoader \ -MCatalyst::Plugin::Static::Simple \ /srv/MyApp/myapp.psgi 144800k After the first request: 145296k After the second request: 145296k After 1000 more requests (with ab -n 1000 -c 1): 146412k After ~ 5 minutes of inactivity: 146412k After another 1000 requests (with ab -n 1000 -c 20): 146784k After ~ 5 minutes of inactivity: 146412k After 1 requests (with ab -n 10 -c 50): 156188k After 9 requests: 221836k After 10 requests: 228572k After ~ 15 minutes of inactivity: 227696k After 15 more minutes of inactivity: 227696k After one more hour of inactivity: 227944k So it seems that there is a memory leak if the memory is not freed even after 1 hour. I made a second test with Starman: Before starman starts: 109944k After starman started: 145252k After the first request: 145392k After 1000 requests (with ab -n 1000 -c 1): 146012k After 1000 more requests: 146400k After 10 requests (with ab -n 10 -c 1): 229864k After 10 more requests (with ab -n 10 -c 50): 320128k After 100 more requests (with ab -n 100 -c 100): 1129368k After ~ 1 hour of inactivity: 1123904k After 100 more requests (with ab -n 100 -c 100): 1933104k After ~ 1 hour of inactivity: 1933096k So something's obviously wrong if so much memory is occupied even after 1 hour of inactivity. After closing starman with kill -quit `cat myapp.pid` 1905312k After ~ 1 hour of inactivity: 1905560k This is even stranger, because the memory is not free even though Starman was closed, and the single solution is to reboot. And before closing Starman I have also tried to use kill -HUP `cat myapp.pid` to reload the workers but the memory didn't decrease. I have also tried to run starman with 5 workers and and also tried without putting it to run in the background, but it still leaks. Does this happends only to me and others can run starman without leaks? Or at least is there a way of limiting the memory size and make Starman restart the workers that pass that limit? I have also tried to use: builder { enable Plack::Middleware::SizeLimit = ( max_unshared_size_in_kb = 1024 * 4, check_every_n_requests = 2 ); $app; }; But it doesn't seem to have any effect. I
[Catalyst] Running Catalyst apps with start_server
Hi, Is Server-Starter a good way for starting a Catalyst app? I am asking this because I don't have success with using start_server with the --daemonize option. I use Perl 5.14.2 under Ubuntu 11. Here is the command I used: start_server \ --port :5000 \ -- starman \ --workers 15 \ --max-requests 1000 \ --pid /srv/log/site.pid \ --access-log /srv/log/access.log \ --error-log /srv/log/error.log \ --daemonize \ /srv/BRK/brk.psgi The command is not executed in the background, but it keeps printing the following errors: new worker 7423 seems to have failed to start, exit status:256 starting new worker 9044 Pid_file already exists for running process (27684)... aborting new worker 9044 seems to have failed to start, exit status:256 starting new worker 10428 Pid_file already exists for running process (27684)... aborting new worker 10428 seems to have failed to start, exit status:256 So I need to break it. After breaking it, I can see that there are still some starman processes running, and their number seems to decrease, then increase again and so on, but the Starman web server doesn't answer to requests: teddy12843 0.0 0.0 0 0 pts/2Z+ 23:05 0:00 [starman] defunct teddy14076 0.0 0.1 9820 5096 ?R23:05 0:00 starman master --workers 15 --max-requests 1000 --pid /srv/log/site.pid --access-log /srv/log/access.log --error-log /srv/log/error.log --daemonize teddy14080 0.0 0.0 0 0 ?R23:05 0:00 [starman master ] teddy14082 0.0 0.0 0 0 ?Z23:05 0:00 [starman master ] defunct teddy14083 0.0 0.1 9820 5020 ?R23:05 0:00 starman master --workers 15 --max-requests 1000 --pid /srv/log/site.pid --acce ss-log /srv/log/access.log --error-log /srv/log/error.log --daemonize ... On the other hand, if I use the same command, but without the --daemonize option, start_server seems to work fine and the web server can be also accessed with no problems. It prints: start_server (pid:17145) starting now... starting new worker 17146 But of course, it doesn't go in the background... I can put it to run in the background if I add a after the command line start_server ... and I've seen that if I do that it works and I can also add or remove workers with kill -TTIN|TTOU, but... is it a good way? Or it is better recommended to run starman directly? Octavian ___ 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/
[Catalyst] Running a Cat app with HTTP::Prefork
Hi, I have tried: root@webtest:/srv3# catalyst.pl MyApp ... Change to application directory and Run perl Makefile.PL to make sure your install is complete root@webtest:/srv3# cd MyApp/ root@webtest:/srv3/MyApp# CATALYST_ENGINE='HTTP::Prefork' script/myapp_server.pl [debug] Debug messages enabled [debug] Statistics enabled [debug] Loaded plugins: .. | Catalyst::Plugin::ConfigLoader 0.30 | '' [debug] Loaded dispatcher Catalyst::Dispatcher [debug] Loaded engine Catalyst::Engine::HTTP::Prefork [debug] Found home /srv3/MyApp [debug] Loaded Config /srv3/MyApp/myapp.conf [debug] Loaded components: .-+--. | Class | Type | +-+--+ | MyApp::Controller::Root | instance | '-+--' [debug] Loaded Private actions: .--+--+--. | Private | Class| Method | +--+--+--+ | /default | MyApp::Controller::Root | default | | /end | MyApp::Controller::Root | end | | /index | MyApp::Controller::Root | index| '--+--+--' [debug] Loaded Path actions: .-+--. | Path| Private | +-+--+ | / | /index | | /...| /default | '-+--' [info] MyApp powered by Catalyst 5.90007 Error while loading /srv3/MyApp/myapp.psgi: Can't locate object method build_psgi_app via package Catalyst::Engine::HTTP::Prefork at /usr/local/share/perl/5.10.1/Catalyst.pm line 2779. I have the latest version (0.51) of Catalyst::Engine::HTTP::Prefork installed and I run it under Ubuntu 10 with Perl 5.10. Should it be used diffrently with Catalyst 5.9, or why does it give that error? Thanks. Octavian ___ 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] Using a model class from other class
From: linuxsupport lin.supp...@gmail.com Hi, I have a model called DB where I have 3 classes, User, Group, UserGroup Now, I have created a resultset for Group ie. Myapp::Schema::ResultSet::Group How can I call User class from Myapp::Schema::ResultSet::Group ? For example In Group resultset I am working with some groups and want to fetch all the users, is it possible? ___ List: Catalyst@lists.scsys.co.uk Although it is off-topic... Yes, you can do that: package Myapp::Schema::ResultSet::Group; use parent 'DBIx::Class::ResultSet'; sub some_method { my ( $self ) = @_; my $users = $self-result_source-schema-resultset( 'User' ); } Octavian ___ 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 still doesn't work under Windows
From: Tomas Doran bobtf...@bobtfish.net On 21 Sep 2011, at 06:48, Octavian Rasnita wrote: Hi, Even though I have the latest Catalyst installed under Windows, it seems that Catalyst is not compatible with Windows anymore, because I cannot run the apps that use it. When I try to run the app, it gives the error that Plack::Handler::Starman is not installed, and if I try to install it, it informs that This distribution doesn't support your platform MSWin32. How are you running the application? I tried with: perl script/myapp_server.pl -p 80 -k I was using ActivePerl 5.10.1 but I've just tried with a clean install of ActivePerl 5.14 and it gave the same result. Octavian ___ 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 still doesn't work under Windows
From: Tomas Doran bobtf...@bobtfish.net On 21 Sep 2011, at 12:03, Octavian Rasnita wrote: From: Tomas Doran bobtf...@bobtfish.net On 21 Sep 2011, at 06:48, Octavian Rasnita wrote: Hi, Even though I have the latest Catalyst installed under Windows, it seems that Catalyst is not compatible with Windows anymore, because I cannot run the apps that use it. When I try to run the app, it gives the error that Plack::Handler::Starman is not installed, and if I try to install it, it informs that This distribution doesn't support your platform MSWin32. How are you running the application? I tried with: perl script/myapp_server.pl -p 80 -k Why do you need -k? Cheers t0m This was the recommendation when accessing it with Internet Explorer. Isn't it needed anymore? Does that error depend on this parameter? Octavian ___ 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 still doesn't work under Windows
From: Tomas Doran bobtf...@bobtfish.net On 21 Sep 2011, at 13:30, Octavian Rasnita wrote: This was the recommendation when accessing it with Internet Explorer. Isn't it needed anymore? No idea. Don't know what recommendation from where by whom. Catalyst::Manual::Tutorial::01_Intro - Catalyst Tutorial - Chapter 1 Also, the -k keepalive option to the development server can be necessary with some browsers (especially Internet Explorer). Does that error depend on this parameter? Yes. the simple dev server in plack doesn't support keepalive requests, ergo us loading Starman for keepalive. So if you don't need -k, then everything should be fine. Cheers t0m Great! Thank you. Octavian ___ 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/
[Catalyst] Catalyst still doesn't work under Windows
Hi, Even though I have the latest Catalyst installed under Windows, it seems that Catalyst is not compatible with Windows anymore, because I cannot run the apps that use it. When I try to run the app, it gives the error that Plack::Handler::Starman is not installed, and if I try to install it, it informs that This distribution doesn't support your platform MSWin32. Does that mean that this is the end of life for Catalyst under Windows? (Because I cannot run a VM with another OS under it.) I use Catalyst with Apache/mod_perl, so Starman is not necessary. Thanks --Octavian ___ 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] Can the latest Catalyst version from CPAN be installedunder Windows?
Sorry for the false alarm, but there may be something wrong on my home computer that doesn't allow installing Plack, because I was able to install Catalyst::Runtime 5.90002 on my office computer without problems. --Octavian - Original Message - From: John Napiorkowski jjn1...@yahoo.com To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Friday, September 09, 2011 4:02 PM Subject: Re: [Catalyst] Can the latest Catalyst version from CPAN be installedunder Windows? - Original Message - From: Matthias Dietrich mdietr...@cpan.org To: The elegant MVC web framework catalyst@lists.scsys.co.uk Cc: Sent: Friday, September 9, 2011 6:55 AM Subject: Re: [Catalyst] Can the latest Catalyst version from CPAN be installed under Windows? Erm... Anyone saw the subject line of this thread? It's about Windows ... not Mac OS X. LOL, I guess I just noticed stuff about macports etc and just responding to that. Sorry, I also can't say much about windows expect you can always using a virtual machine :) John Sorry Octavian, I don't have any clue of what's going on there on Windows. Matthias -- rainboxx Software Engineering Matthias Dietrich rainboxx Matthias Dietrich | Phone: +49 7141 / 2 39 14 71 Königsallee 43 | Fax : +49 3222 / 1 47 63 00 71638 Ludwigsburg | Mobil: +49 151 / 50 60 78 64 | WWW : http://www.rainboxx.de CPAN: http://search.cpan.org/~mdietrich/ XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html -- rainboxx Software Engineering Matthias Dietrich rainboxx Matthias Dietrich | Phone: +49 7141 / 2 39 14 71 Königsallee 43 | Fax : +49 3222 / 1 47 63 00 71638 Ludwigsburg | Mobil: +49 151 / 50 60 78 64 | WWW : http://www.rainboxx.de CPAN: http://search.cpan.org/~mdietrich/ XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html ___ 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/ ___ 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/
[Catalyst] Strange DBIC error, only when used in Catalyst
Hi all, I have the following action: sub top : Local { my ( $self, $c ) = @_; my $top = $c-model( 'Intra::User' )-search_rs({ 'clients.id' = {'!=' = undef}, }, { join = 'clients', prefetch = 'clients', select = [ 'id', 'username', 'first_name', 'last_name', {count = 'clients.id'} ], as = [ 'id', 'username', 'first_name', 'last_name', 'nr_clienti' ], group_by = [ 'username' ], order_by = [ {-desc = 'nr_clienti'}, {-asc = 'me.last_name'} ], }); my $nr_contacts = $top-count; } When I access this action on the web, Catalyst displays the following error: DBIx::Class::ResultSet::count(): No such relationship clients on User at E:/web/TB2/script/../lib/TB/Controller/Clienti.pm line 255 But the Result class User.pm does have the clients relation: package TB::Schema::Result::User; ... __PACKAGE__-has_many( clients, TB::Schema::Result::Client, { foreign.user_id = self.id }, {} ); And if I use the same code outside Catalyst, it works fine and it prints the result: use strict; use lib 'lib'; use TB::Schema; my $schema = TB::Schema-connect( 'dbi:mysql:database=intranet;host=10.50.28.70', 'user', 'pass'); my $top = $schema-resultset( 'User' )-search_rs({ 'clients.id' = {'!=' = undef}, }, { join = 'clients', prefetch = 'clients', select = [ 'id', 'username', 'first_name', 'last_name', {count = 'clients.id'} ], as = [ 'id', 'username', 'first_name', 'last_name', 'nr_clienti' ], group_by = [ 'username' ], order_by = [ {-desc = 'nr_clienti'}, {-asc = 'me.last_name'} ], }); my $nr_contacts = $top-count; print $nr_contacts; The model Intra::User is the TB::Schema::User class as can be seen in the following configuration of the app: 'Model::Intra' = { schema_class = 'TB::Schema', connect_info = { dsn = 'dbi:mysql:database=intranet;host=10.50.28.70', user = 'user', password = 'pass', }, }, There are no other errors reported, but just a warning which I think that has nothing to do with that error generated by the Catalyst app: Class::C3::Componentised::load_components(): Use of DBIx::Class::UTF8Columns is strongly discouraged. See documentation of DBIx::Class::UTF8Columns for more info Thanks. --Octavian ___ 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] Strange DBIC error, only when used in Catalyst
I have forgotten to add some details about my environment. That error was given when running the app under Catalyst's own server under Windows, using ActivePerl 5.10.1 and Catalyst 5.80033 with the latest DBIC. When I ran it under Debian, it gave another error: Couldn't render template undef error - DBIx::Class::UTF8Columns::get_column(): No such column 'nr_contacte' at /oct/TB/root/templates/clienti/top.tt line 19 ...that makes me think that DBIx::Class::UTF8Columns is the culprit. It is an older app that was using that module. Is there anything I could do to make it work with that module? I am afraid that if I would delete all its settings from all the Result classes, the UTF-8 chars from DB might not show correctly. Thanks. --Octavian - Original Message - From: Octavian Rasnita To: The elegant MVC web framework Sent: Thursday, September 08, 2011 12:45 PM Subject: [Catalyst] Strange DBIC error, only when used in Catalyst Hi all, I have the following action: sub top : Local { my ( $self, $c ) = @_; my $top = $c-model( 'Intra::User' )-search_rs({ 'clients.id' = {'!=' = undef}, }, { join = 'clients', prefetch = 'clients', select = [ 'id', 'username', 'first_name', 'last_name', {count = 'clients.id'} ], as = [ 'id', 'username', 'first_name', 'last_name', 'nr_clienti' ], group_by = [ 'username' ], order_by = [ {-desc = 'nr_clienti'}, {-asc = 'me.last_name'} ], }); my $nr_contacts = $top-count; } When I access this action on the web, Catalyst displays the following error: DBIx::Class::ResultSet::count(): No such relationship clients on User at E:/web/TB2/script/../lib/TB/Controller/Clienti.pm line 255 But the Result class User.pm does have the clients relation: package TB::Schema::Result::User; ... __PACKAGE__-has_many( clients, TB::Schema::Result::Client, { foreign.user_id = self.id }, {} ); And if I use the same code outside Catalyst, it works fine and it prints the result: use strict; use lib 'lib'; use TB::Schema; my $schema = TB::Schema-connect( 'dbi:mysql:database=intranet;host=10.50.28.70', 'user', 'pass'); my $top = $schema-resultset( 'User' )-search_rs({ 'clients.id' = {'!=' = undef}, }, { join = 'clients', prefetch = 'clients', select = [ 'id', 'username', 'first_name', 'last_name', {count = 'clients.id'} ], as = [ 'id', 'username', 'first_name', 'last_name', 'nr_clienti' ], group_by = [ 'username' ], order_by = [ {-desc = 'nr_clienti'}, {-asc = 'me.last_name'} ], }); my $nr_contacts = $top-count; print $nr_contacts; The model Intra::User is the TB::Schema::User class as can be seen in the following configuration of the app: 'Model::Intra' = { schema_class = 'TB::Schema', connect_info = { dsn = 'dbi:mysql:database=intranet;host=10.50.28.70', user = 'user', password = 'pass', }, }, There are no other errors reported, but just a warning which I think that has nothing to do with that error generated by the Catalyst app: Class::C3::Componentised::load_components(): Use of DBIx::Class::UTF8Columns is strongly discouraged. See documentation of DBIx::Class::UTF8Columns for more info Thanks. --Octavian -- ___ 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/
[Catalyst] Can the latest Catalyst version from CPAN be installed under Windows?
Hi, I have tried to install Catalyst with CPAN, but it gave an error telling that it has a missing dependency in Plack::Test::ExternalServer. That module couldn't install because of a test error (something like a missing empty port or something like that) So I force installed Plack::Test::ExternalServer, but after this step, when I tried to install again Catalyst, it gave more errors: Failed 107/141 test programs. 15/385 subtests failed. Octavian ___ 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/
Test (please ignore) - was Re: Bounces (was Re: [Catalyst] Multiple applications (some cat based)on the same server)
Great! Thanks. Hope this message reaches the list. --Octavian - Original Message - From: Chris Jackson c.jack...@shadowcat.co.uk To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Friday, August 26, 2011 2:49 PM Subject: Re: Bounces (was Re: [Catalyst] Multiple applications (some cat based)on the same server) On 26/08/11 11:41, Aaron Trevena wrote: Cool - I must have missed my first email about bounces as I was kicked off around the 12th as well, and only just re-enabled delivery. I've just reset everyone who was disabled by bounce. This seems to have been caused by a misconfiguration which only came to light when we enabled ipv6 - so, apologies about that. -- Chris Jackson Shadowcat Systems Ltd. ___ 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] Accessing the catalyst user data from a template
From: Adam Jimerson I am trying to display display information about the user currently logged into my catalyst app but for some reason it is returning blank (or even null). I am trying to display the uniqid (user id) and username of the current user. From my template I am calling [% c.user.object.username %] and [% c.user.object.uniqid %] respectively. I know that my authentication is working because the $c-user_exists() calls in my controller is passing. You need to use: [% c.user.get('uniqid') %] and [% c.user.get('username') %] The c.user object also has other methods like id() and get_object() that might help you. Octavian. ___ 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] Suggestions for sending email from cron jobusing'Catalyst' templates?
From: Peter Edwards On 12 April 2011 00:50, Charlie Garrison garri...@zeta.org.au wrote: Good morning, On 11/04/11 at 6:58 PM +0300, Octavian Rasnita orasn...@gmail.com wrote: The TT templates used by the Catalyst app might contain many things like c.user, c.uri_for_action, may display images, may depend on other templates which are loaded automaticly when those templates are specified in the app config file. So there is no sane way of using those wrapper templates for sending email from a cron job. That was the conclusion I was reaching; I wanted feedback from others before I tried to make my own garden path. Put the logic in a model class that reads a config shared with but independent from your controller so you can run it outside of Catalyst. This article outlines how to do this http://www.catalystframework.org/calendar/2007/14 At the top of that article appears: UPDATE: As of 2008, there is a new module which avoids the kludgy solution mentioned below: Config::JFDI. At a certain moment, Config::JFDI started to support __path_to(). The problem is not the model only, but the templates that use the Catalyst context in them. As it is not very recommended to access the entire Catalyst context in a model, it should be not recommended to use the context in the templates, because those templates won't be usable in external applications without loading the entire Cat app, but because using the Catalyst context in the templates is very handy, most of us probably prefer to create separate templates for using them in external apps than to provide only sane variables to all the templates. Octavian ___ 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] Validation of entered content
From: John M. Dlugosz wxju46g...@snkmail.com I have a form where an admin can change a part of the content on a page. The form lets someone do it without having to update the files on the server in a more traditional manner; BUT, it must be correct XHTML. If the admin types a p or a stray '' for that matter, it will render the resulting page not well-formed. Combine that with the feature of serving XHTML to browsers that accept it, and the site breaks on browsers other than IE. What's a good way to validate something programmatically before committing it? Better yet, is there a rich editor or wiki- or phpbbs-like translator that I might use for soliciting the input that I might use instead? The current content has a couple paragraphs and a bulleted list. So it's not just a simple blank, but must allow an amount of rich content. Better than storing html, store a Textile format which is easy readable and similar to plain text when not rendered, but which renders as valid html. You can use http://search.cpan.org/~bchoate/Text-Textile-2.12/lib/Text/Textile.pm or you can use http://search.cpan.org/~idoperel/DBIx-Class-InflateColumn-Markup-Unified-v0.21.1/lib/DBIx/Class/InflateColumn/Markup/Unified.pm for beeing able to choose if you want to store the markup as Textile, Markdown or BBCode. The Textile format allows the biggest flexibility and you can also use html elements in it, but you can create with its features headings, lists of different formats, tables with many settings, links, images, and many other things. Octavian ___ 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] Suggestions for sending email from cron job using'Catalyst' templates?
From: Charlie Garrison garri...@zeta.org.au Good evening, First, I may not be approaching this the right way at all. So I'm happy to take any suggestions for a better way to do what I need. I've got a daily task (cron job currently) which sends emails to users. I want to use existing TT templates to generate the email content. I'm using Mail::Builder::Simple for the message creation sending. All the simple tests are working fine, until I want to use the existing template setup that I've been using to send email from within Catalyst. Specifically, the wrapper template (with header, footer, etc) makes fairly extensive use of c.uri_for and c.uri_for_action. And of course the Catalyst context is not available from the cron job (at least no way that I could find). One option is to move all the logic to a controller action and just have the cron job make an http request. That doesn't seem like the right approach though. Does anyone have suggestions on how I can use my existing template structure and still be able to use `c` from a cron job? Or should I use a completely different approach? Thanks, Charlie Hi Charlie, The TT templates used by the Catalyst app might contain many things like c.user, c.uri_for_action, may display images, may depend on other templates which are loaded automaticly when those templates are specified in the app config file. So there is no sane way of using those wrapper templates for sending email from a cron job. When you send a picture included in the email message you may want to embed it and not let the email message access it on your web server. Also, the Catalyst context depend on the request, so you'll need to make a web request in order to have the same context variable and it would affect much the performance if you'll load the Cat app just for sending email. You can do it this way, but... it isn't a way I prefer to do this thing. Whenever you will find that a template used in the Cat app can't be used in a cron job, split that template into smaller templates, and for the templates that use the Catalyst context create another version that doesn't use it. Then make a template that include those templates which work in the Cat app and another template that works in the cron job. This way, the Cat app and the standalone program will share those templates they can share, and there won't be dupplicate templates, but there won't be any problems with those parts of the templates that use the Catalyst context. You need to use the same approach you use whenever you find that you need to use a part of a template into another template... extract it as a separate template and include it in both templates with INCLUDE or PROCESS. If there are too many parts of the template that needs to be changed, it is a better idea to create a separate entire template for using it in the external program. The alternative of sharing the templates among the Cat app and other external program would involve using templates that don't depend on the Catalyst app, and this can be done easily, but we would miss many features offered by the Catalyst context, and we probably need to share too few templates to prefer to lose those features. Octavian ___ 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] Sending Email from Page?
From: John M. Dlugosz wxju46g...@snkmail.com On 3/21/2011 2:41 PM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: If you want this, it is more simple, because you can try to send the message directly, but if the message is not sent, your page visitors will be able to read that a certain message was not sent, but they won't be able to do anything to send it, unless they try again, by filling again a subscription form or something like that. So don't tell them it wasn't sent; just drop it on the floor instead, because it would just confuse them? I'm not expecting any errors once the deployment is shaken-out, but my feedback message states that it was not sent and suggests using the mailto link instead (and hyperlinks it within the message). And the form is still shown filled out, so the person can copy/paste his content to a file to save, rather than losing it. This is the job of a... job queue. It tries to send the message or execute another task you give it, and if it can't execute it, it marks it as not-executed and you will be able to see later the errors found. This way you can put it to try for more times to do that job automaticly. But as I said, if you have the mail server running on the same server and if you just need to send a single message, you don't need a job queue. If you need to send thousands of messages after you have made a selection of the recipients from a database, it might take less time to insert a few thousands records in a database than to send those messages directly. So sending the messages directly is not very scalable. Octavian ___ 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] Sending Email from Page?
From: John M. Dlugosz wxju46g...@snkmail.com On 3/21/2011 2:47 PM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: If you use that key, the module won't report the error. If you don't use it and there will appear some errors, it will generate a detailed error. The error is generated by Email::Sender::Simple directly. It will be something like unable to establish SMTP connection plus ~ 1 kB of error trace. I found it; thanks. I started a discussion on PerlMonks because $@ was empty, even though letting the program die instead showed all the error info. You must use Try::Tiny to try/catch around it. I prefered to use send() or try_to_send() depending on the user's preference - if he wants or not to have the errors reported, but yes, using Try::Tiny may be a good alternative that should be investigated. Octavian ___ 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] Sending Email from Page?
From: Jorge Gonzalez El 21/03/11 20:58, Octavian Rasnita escribió: Yes, it is very simple to use Mail::Builder::Simple directly, but there are some advantages when using it in a model: - You can share the configuration data among more controllers and even external programs; You can do it also without the model. Just create a new section in the application config file: (YAML): ... Mail: from: source_addr...@yoyo.com to: whoe...@wherever.com subject: Hello ... And then from the controller: ... my $mail = Mail::Builder::Simple-new; $mail-send( from = MyApp-config-{Mail}{from}, to = MyApp-config-{Mail}{to}, subject = MyApp-config-{Mail}{subject},, plaintext = Hello,\n\nHow are you?\n, ); ... - You need to write less code in your controllers; As we can see by the above example, it's more or less the same amount of code. In this example yes, you are right, because Mail::Builder::Simple requires very few lines of code in any case, but if the mail sender is SMTP and needs to specify the host name, possibily the port if it is not a common one, the username and the password if it requires authentication, and also specify if it uses SSL... then it would be more simple to use a model to access Mail::Builder::Simple. The model is very thin anyway. But as you said... TIMTOWTDI. Octavian___ 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] Sending Email from Page?
From: John M. Dlugosz If Catalyst had something called an accessory that could draw upon the auto-discovery, loading, configuration, etc. of Components, but did not claim to be a model, I might agree. A model is not only a source of data, but also a destination of data. When sending email, some data is sent to a certain destination. However, I agree that some actions like sending email is not very appropriate for a view nor for a model, but for another kind of accessory with a more appropriate name as you said, but this is only because the words view or model are usually used for something else, so... it's just words. When we need to call a certain method in a controller we need to use $c-forward(), although it doesn't involve any forward or redirection, but again... there are just some words. Another advantage of using a model versus creating the object and using a mailer directly is that maybe after a certain time will appear a much better mailer than Mail::Builder::Simple, and you may want to switch to the new mailer. In that case you will need to make some changes in a single model, and not in every controller. Octavian ___ 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] Sending Email from Page?
From: John M. Dlugosz wxju46g...@snkmail.com Any pointers as to the right (or best) way to send an email from my Catalyst App? I see there is a Plugin::Email and also a View::Email, which seems to be something totally different? You can use any of them or Catalyst::Helper::Model::Email. The plugin is no longer recommended. The most simple way is not the best. The best way is to send the messages in a job queue and let the worker module to send the message immediately or whenever the mail server is free. If you send the message directly from your application, in that moment the server might not be free and the user would need to wait too much until the message is sent, or the mail server might give a timeout and in that case the message is lost because the application doesn't send it again when the mail server is free. Octavian ___ 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] Sending Email from Page?
From: John M. Dlugosz wxju46g...@snkmail.com On 3/21/2011 1:48 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: You can use any of them or Catalyst::Helper::Model::Email. The plugin is no longer recommended. It looks like helper just installs a dummy Model that calls Mail::Builder::Simple. So I thought I'd just call that. But, there is no documentation as to the return value, and the code appears to return 1 if it makes it to the end. But what does it return on error, and where is the error particulars? In Mail::Builder::Simple you can find about live_on_error. If you use that key, the module won't report the error. If you don't use it and there will appear some errors, it will generate a detailed error. The error is generated by Email::Sender::Simple directly. It will be something like unable to establish SMTP connection plus ~ 1 kB of error trace. Octavian ___ 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] Sending Email from Page?
From: Jorge Gonzalez jorge.gonza...@daikon.es Catalyst offers you some posibilities, but it does not force you to use them. To me, using a model for sending email is like hammering a nail with a screw driver. You can surely do it, but it's simpler to use the hammer. Even if you have a fancy screw driver. :-) Regards J. Yes, it is very simple to use Mail::Builder::Simple directly, but there are some advantages when using it in a model: - You can share the configuration data among more controllers and even external programs; - You need to write less code in your controllers; - It is more elegant, because it uses the Catalyst style - you don't need to use Mail::Builder::Simple in every controller in which you need to send mail... You can send email by just using: $c-model( 'Email' )-send( from = ['m...@myhost.com', 'My Name'], #This line can be also defined in the configuration file and not here to = 'someb...@anotherhost.net', subject = 'The subject', htmltext = 'h1Hello/h1 world', attachment = $c-uri_for('/path/to/attachment.pdf'), ); Octavian ___ 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] Sending Email from Page?
From: John M. Dlugosz wxju46g...@snkmail.com Reading the page for Catalyst::Helper::Model::Email, and assuming that a ')' keeps getting lost, it's just a simple to use but you look up an object via Model first. What is the benefit of that? I suppose you can have more than one configuration pre-set, but I don't see that happening. Is there some other advantage or conceptional purpose for making a feature or content sink or side effect call presented as a Model? Yes you can define more email models, one for sending with Gmail, another one with your SMTP server and so on. But the most important thing is that you can use the same configuration files and the same syntax for sending email from Catalyst and from a cron job. Catalyst is just a glue and you can use Mail::Builder::Simple very easy in Catalyst directly. Catalyst::Helper::Model::Email is helpful just because it allows you to use the configuration from your models or from the configuration file of your app and you can share that configuration among different Catalyst controllers and standalone programs which are ran as cron jobs. (And if you need to send UTF-8 encoded messages, you also don't need to do the encoding nor to create the MIME headers yourself.) The most simple way is not the best. The best way is to send the messages in a job queue and let the worker module to send the message immediately or whenever the mail server is free. If you send the message directly from your application, in that moment the server might not be free and the user would need to wait too much until the message is sent, or the mail server might give a timeout and in that case the message is lost because the application doesn't send it again when the mail server is free. I like being able to get a return result so I know it was sent! If that is not possible on a real server, is there some module already that does this? If you want this, it is more simple, because you can try to send the message directly, but if the message is not sent, your page visitors will be able to read that a certain message was not sent, but they won't be able to do anything to send it, unless they try again, by filling again a subscription form or something like that. Hmm, maybe it depends on the mailer used? Postfix just queues the incoming message anyway! Why am I needing to duplicate what it already does? Would another queue process in front of it be less likely to get stuck? If the mail server is running locally, not on another server, and if you are sure that it runs fine, then you don't need a job queue. Octavian ___ 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] Error in Accessing Database model
From: sushant kumar I'm using SQLite3 and catalyst to develop an application. When I try to access the database file (tmp/daatabase) , It gives error as UNABLE TO OPEN tmp/database. When I access databse without mentioning the name of database file, It works!! But Catalyst does not recognize the changes made in databse. $ sqlite3 tmp/database sqlitecreate table sample(id INTEGER(3), name TEXT); unable to open tmp/database!!! $ Do you have the directory tmp in the current directory? Octavian ___ 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] Escaping of argument of private path
From: John M. Dlugosz wxju46g...@snkmail.com On 3/15/2011 4:56 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: uri_for() escapes only the chars which are not in the following list (from URI.pm): $reserved = q(;/?:@=+$,[]); $mark = q(-_.!~*'());#'; emacs $unreserved = A-Za-z0-9\Q$mark\E; The char is a valid char in the URI, so it should not be escaped.. With other words, the following url is OK: http://localhost/dir1/dir2/ham%20%20eggs.jpg uri_for() generates the URI as it needs to be accessed on the server and not as it should be printed in an HTML page. In order to be printed correctly, the char must be HTML-encoded, so the html TT filter must be used: a href=[% c.uri_for('/path', 'eggs ham.jpg', {a=1, b=2}).path_query | html%]label/a It will give: a href=/path/eggs%20amp;%20ham.jpg?a=1amp;b=2label/a In contrast, the 'uri' filter in TT converting any characters outside of the permitted URI character set (as defined by RFC 2396) and that includes ||, |@|, |/|, |;|, |:|, |=|, |+|, |?| and |$|. The 'url' filter in TT is less aggressive, and does not include those. Those chars are not permitted in query strings but they are permitted in URLS. The ?, , =, +, ; signs are used for separating the path and the query string, to delimit the query string parts, to represent a space char... They can be also used in names of the files in path. For example, the following URL is valid: http://localhost/static/a%20%20@%20;%20$%20+%20=.txt If you want, you can escape these chars everywhere, not only in the query strings, but why would you want to do this? The '' is a Reserved Character according to §2.2 of RFC 2396. That is what the code sample you quoted notes: the set of reserved characters. They may have specific meanings as delimiters within the overall URI, so should be escaped. Just skimming, I see that it's reserved within the query component. Yes, but uri_for() escapes them in the query components (where they need to be escaped). For example: [% file = 'a+b = c $î @â'; a = 'a+b = c $î @â'; b= 'a+b = c $î @â' %] a href=[% c.uri_for('/path', file, {a=a, b=b}).path_query %]label/a will display: a href=/path/a+b%20=%20c%20%20$%C3%AE%20@%C3%A2?a=a%2Bb+%3D+c+%26+%24%C3%AE+%40%C3%A2b=a%2Bb+%3D+c+%26+%24%C3%AE+%40%C3%A2label/a Note that I didn't html-encoded the URL for beeing easier to see the result. As you may see, the reserved chars are escaped by uri_for() only where they need to be escaped. And of course, if you need to print this URL in an HTML document, you can add the TT html filter and the chars will be displayed as amp;. Anyway, using the TT 'uri' filter on the dynamic path component means I don't have to use the html filter also! Why would you like to need to escape every path component by using the TT uri filter for more times and escape the reserved chars even where they can be used as they are, instead of using the html filter once? If you want, you can uri-escape even the [a-zA-Z0-9] chars, but why would you want to escape chars where they don't need to be escaped? :-) Octavian ___ 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] Escaping of argument of private path
From: John M. Dlugosz wxju46g...@snkmail.com Consider this TT fragment: [% fname = rec.filename | uri %] img src=[% c.uri_for(${directory}/${fname}) %] alt=photo / There is no reason to suppose that the filename following URL naming conventions, and may be something like ham eggs.jpeg. This in fact works as written, but I'm wondering if it's quite correct. In fact, I'm surprised that uri_for doesn't do this for me! I pass in a file name and get a URL back, right? Munging the file name first doesn't make sense since that's no longer the file name and won't work in a call to Open, for example. But escaping each component, and not the component delimiters, after getting the perported uri back would be much more work. This should be simpler. What am I missing? uri_for() escapes each component, but I guess that it doesn't escape it if it contains a slash in it. For example, you can do: img src=[% c.uri_for('/static', 'ham and eggs.jpg').path %] It will print: img src=/static/ham%20and%20eggs.jpg Octavian ___ 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] Escaping of argument of private path
From: John M. Dlugosz wxju46g...@snkmail.com On 3/15/2011 1:38 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: uri_for() escapes each component, but I guess that it doesn't escape it if it contains a slash in it. For example, you can do: img src=[% c.uri_for('/static', 'ham and eggs.jpg').path %] It will print: img src=/static/ham%20and%20eggs.jpg Octavian I see... it wants you to pass separate arguments rather than building the path first. It just gets the path and the list of arguments, but it escapes the special characters only in the arguments, not the path. I was thinking that uri_for might be more trouble than it's worth since I don't like fully-qualified URLs in my generated source anyway. But if it escapes (sometimes?) then that is indeed more helpful. You don't need to use fully-qualified URLS if you don't like, even though it doesn't matter because they are dynamicly generated anyway. uri_for() returns a URI object, so you can use: c.uri_for(...).path This will return only the path, without the scheme, host and port. or: c.uri_for(...).path_query ...if the URL also contains a query string (?a=bc=d) img src=[% c.uri_for(/static/gallery,rec.dirname,rec.filename) %] alt=photo / That works (using Smart_URI settings to leave off the host). But it did not escape out the '' in the filename! Is that a bug? I notice you changes my example from '' to 'and' -- that's cheating! :-) img src=[% /static/gallery/${rec.dirname}/${ rec.filename | uri } %] alt=photo / gives the correct answer: ham%20%26%20eggs.jpeg uri_for() escapes only the chars which are not in the following list (from URI.pm): $reserved = q(;/?:@=+$,[]); $mark = q(-_.!~*'());#'; emacs $unreserved = A-Za-z0-9\Q$mark\E; The char is a valid char in the URI, so it should not be escaped.. With other words, the following url is OK: http://localhost/dir1/dir2/ham%20%20eggs.jpg uri_for() generates the URI as it needs to be accessed on the server and not as it should be printed in an HTML page. In order to be printed correctly, the char must be HTML-encoded, so the html TT filter must be used: a href=[% c.uri_for('/path', 'eggs ham.jpg', {a=1, b=2}).path_query | html%]label/a It will give: a href=/path/eggs%20amp;%20ham.jpg?a=1amp;b=2label/a Octavian ___ 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 and oracle database.
From: Rohan M Dear All, I'm trying to use Oracle database as a back-end database for Catalyst application. (I tried MySQL and its working properly for me ). At first, I tried the following command - perl script/testapp_create.pl model DB DBIC::Schema DB::Schema create=static 'dbi:Oracle:sid=TEST1;host=192.168.100.107; port=1521' 'user' 'pass' Have you tried with sid=test.abcd.com? perl script/testapp_create.pl model DB DBIC::Schema DB::Schema create=static dbi:Oracle:sid=test.abcd.com;host=192.168.100.107;port=1521 user pass Octavian ___ 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] Re: How to get uri_for something with a fragment?
From: Pedro Melo m...@simplicidade.org Hi, On Wed, Mar 9, 2011 at 6:11 AM, will trillich will.trill...@serensoft.com wrote: I can't see that the original question has been answered. I'm interested as well... I just opened Catalyst.pm ($VERSION = 5.80030) and read the code for uri_for. As far as I can tell, there is no support for #anchors. Bye, -- Pedro Melo Catalyst uses the module URI and that module supports fragments: [% uri = c.uri_for('/static/foo'); CALL uri.fragment('bar'); uri%] It will print something like: http://www.site.com/static/foo#bar Octavian ___ 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] Best form library?
From: Devin Austin devin.aus...@gmail.com On Sun, Mar 6, 2011 at 2:52 PM, Roger Horne ro...@hrothgar.co.uk wrote: On Sunday 06 March 2011 20:52:04 Devin Austin wrote: FormFu is pretty awful in my opinion. Rose::HTML stuff isn't much better. As an amateur I would be interested to know why. When I started learning about Catalyst about a year ago, the Tutorial at http://search.cpan.org/~zarquon/Catalyst-Manual-5.8005/lib/Catalyst/Manual/Tutorial/09_AdvancedCRUD.pod only described FormFu and so I used it. For the trivial stuff I deal with it works (most of the time) so I have not tried any of the others. (If it ain't broke ... :-) r. FormFu doesn't make it easy to do a lot of things. Things like modifying the form after it's been created aren't very easy, and there were quite a After you get the $form object you can do anything you like with it. Change the existing fields, add new fields... what have you tried to do that was difficult to do? few instances I had to add these sort of ludicrous call backs (recommended in the documentation) to get the functionality I wanted (populate a select box from the db, etc.) You can do this directly in the configuration file, without even needing to write Perl code, by adding a model_config hash as a key of the wanted select item, and under it you can specify the resultset, the columns that need to be selected, if the labels need to be localized, the conditions for searching, the aditional options for ordering the results, for selecting unique values only, for selecting only a certain number of records and so on. Octavian ___ 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] Best form library?
From: Steve st...@matsch.com In order of importance, my considerations when making the decision about a year ago (no existing Cat apps at that point) were: Adoption Rate: I subscribed to mailing lists for FormFu and HFH, and noticed more people talking about HFH. Moosiness: Since Catalyst was making the move to Moose, and Moose seemed to have quite a following, this made HFH look like the better long-term solution If we would care only about how much discussion about a piece of software we find, we would use PHP, or Ruby, or Python, because they are more discussed than Perl these days. :-) HTML::FormFu is pretty simple to use, so maybe that's why there are no very many discussions about it. Documentation/Community support: I personally thought HFH docs were somewhat better than FormFu, YMMV Yes you may be right, but have you found something you didn't understand how to do and didn't like to ask it on HTML::FormFu mailing list? YAML/config based approach: While I now understand (thanks to previous posters on this thread) that there are multiple formats for the configs with FF, the idea of using a config file for form declaration did not appeal to me. Who said that you need to use a config file for defining a form in H::FF? You can entirely define it in the Perl code if you like, and even if you define a form in a config file, you are able to change that form with Perl code. The biggest difference is not that H::FH uses Moose and H::FF does not, because probably H::FF would also start using Moose. The difference is that H::FH uses Moose-type attributes for defining the form fields, with specific H::FH properties, while H::FF defines the form fields as a simple Perl data structure with its specific properties. Octavian ___ 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] Best form library?
From: John M. Dlugosz wxju46g...@snkmail.com What's the best form-generating/processing library for Catalyst, assuming I don't need to worry about old baggage and can move forward with the latest and greatest stuff? --John It depends on what you prefer. The best and most used seem to be HTML::FormFu and HTML::FormHandler. Octavian ___ 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] Best form library?
From: Victor Churchill victorchurch...@gmail.com Speaking here as a novice with the same questions as the OP: I like the functionality of HTML::FormFu as deployed in the tutorial example but also find the YAML a bit strange at first; I am, too, a I have used HTML::FormFu a lot, but I have never used YAML because I also don't like YAML. HTML::FormFu can accept the forms to be created with any config type supported by Config::Any, like the Apache-style config format (Config::General), INI files, JSON, YAML or even a simple Perl hash. I prefer to use the Apache style configuration. The configuration style has nothing to do with HTML::FormFu. In my opinion HTML::FormFu is better than HTML::FormHandler because it doesn't require writing as much Perl code, and it better separates the Perl code and the HTML code. Octavian ___ 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] Cache of unchanging content
From: will trillich Here's our current dev-to-deploy approach -- we use mercurial and a three-step staging process: I think that it could be helpful to add a page to the Cat site that describe the workflow for deployment because it is not clear which are the possible/recommended methods. Octavian ___ 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] Simple literal Model
From: John M. Dlugosz wxju46g...@snkmail.com On 2/25/2011 9:30 AM, Ashley Pond V apv-at-sedition.com |Catalyst/Allow to home| wrote: What t0m suggested is perfectly fine but if you want to mimic the DBIC API with a different engine, this example does that (superficially and as a tutorial only): http://sedition.com/a/2739 Log file model–Apache access log. The reason that example makes sense is because the underlying model/data is similar: searchable, sortable rows. If you're trying to shoehorn in something dissimilar, you might be making a mistake. -Ashley I'm not sure to what extent it is wise or correct. The whole point of models is that it abstracts the model and I can change where the data comes from later, right? So don't they all have an underlying abstract interface regardless of how they are sourced? I can see that DBIC itself abstracts which database is used; e.g. SQL Lite for testing and MySQL on a dedicated server for deployment. But I was thinking that the Model, over all, did a similar level of abstraction: change from a database to a XML file or other representation, and the data is still presented the same way. For example, I currently have 8 items, and want to just list them in Perl so I don't have to worry about another data representation or parsing it. But if needs to become user-changable or grows to a few dozen items, a separate XML file would be better. And if it grows to a search result of a few thousand items, it should be in a database. Clearly there are differences in capabilities of a Model: to wit, all in or searchable. And a full database can return different results depending on selected columns, across joins, etc. So I think the level of abstraction is that of a list of records. The View is given a list of records, and the Controller knows to pull it by name directly, perform a search on a more complex model, or access an attribute of a more encompassing model. It obtains the list and passes it to the View via the stash. The examples I've read using DBIC use [% WHILE ( item = list.next) %] and I can imagine that in general we don't have efficient random access to the rows; in C++ I would characterize this as a forward iterator or even weaker, if I can't make a copy of the earlier state and go forward a second time. I would have hoped that the TT [% FOREACH %] directive would work here. That seems like the natural means of abstracting the list. That is, the controller can set anything into the stash that FOREACH knows how to handle, including a plain Perl array. So, is it an oversight of the documentation examples or of the framework that FOREACH isn't used on the DBIC result set? --John The resultset is an iterator and you need to use the next() method for getting its items. If you want you can get a list of items from the resultset using the all() method, then you can use FOREACH to loop that list. The iterator is prefered for performance reasons but when using DBIC for displaying data in web pages, you probably don't need to display very large lists of elements, so you can use FOREACH with no problems. my @list = $rs-search(...)-all; foreach my $item ( @list ) { print $item-column_name; } If you call the search() function on a resultset in list context, the result will be a list of items and not a resultset, so you don't need to use the all() method: my @list = $rs-search(...); Octavian ___ 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] Root page for site (my first attempt!)
From: John M. Dlugosz wxju46g...@snkmail.com ... And as Carl recommended, it is good to not hard-code the URLS in the templates because they won't work if you'll want to make some changes and want to put the whole application to listen to a different base than /, for example /old-site. So use $c-uri_for('/path/to/static/file'); or $c-uri_for_action('/path/to/action'); #for the dynamic pages I see, so do that for static files too, not just actions? Yes you should do this for static files too, because if you'll move the entire application, say from / to /old-app, then the static files will also move from /images to /old-app/images. Octavian ___ 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] Root page for site (my first attempt!)
From: John M. Dlugosz wxju46g...@snkmail.com I just started trying Catalyst. I went through the Packt Publishing book, but now want a more technical explanation with details. Any suggestions on what documentation to read? With the situation as set-up by default, I would write: img src=/static/images/bad_logo.png / to access a site image. How can I configure it so I can write src=foo/bad_logo.png instead? By default, Catalyst apps keep the static content in the /static directory. Usually you also want to configure the web server to not send the requests to /static to Catalyst, but to serve the files directly for performance reasons. If it wouldn't do so, think what might happen if you'll also make a controller named Foo that will use the /foo path... But you can create one or more directory with static files, for example /images, /js, /css. These directories must be created under the root directory. And of course, it is recommended to configure the web server to not send the requests to those directories to the Catalyst app. And as Carl recommended, it is good to not hard-code the URLS in the templates because they won't work if you'll want to make some changes and want to put the whole application to listen to a different base than /, for example /old-site. So use $c-uri_for('/path/to/static/file'); or $c-uri_for_action('/path/to/action'); #for the dynamic pages Octavian ___ 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/
[Catalyst] Deployment incompatibility
Hi, I have tried to build an app under Windows XP and then deploy the tarball under Ubuntu, using: catalyst MyFoo cd MyFoo perl Makefile.PL nmake nmake manifest nmake dist After this first step I loaded the file MyFoo-0.01.tar.gz on an Ubuntu server, unarchiving it, and ran: perl Makefile.PL The result was the following error: The path 'lib\MyFoo.pm' does not exist, or is not a file at inc/Module/Install/Metadata.pm line 194. I've seen that this problem appeared because the file Makefile.PL is created automaticly with the following line in it: all_from 'lib\MyFoo.pm'; instead of: all_from 'lib/MyFoo.pm'; I use Catalyst 5.80029. I couldn't install the newer version of Catalyst because I couldn't install MooseX::Role::WithOverloading, because I couldn't install the newer version of namespace::autoclean: Undefined subroutine namespace::autoclean::on_scope_end called at E:\usr\cpan\build\namespace-autoclean-0.11-bB3vbO\blib\lib/namespace/autoclean.pm line 57. BEGIN failed--compilation aborted at t/also.t line 7. Undefined subroutine namespace::autoclean::on_scope_end called at E:\usr\cpan\build\namespace-autoclean-0.11-bB3vbO\blib\lib/namespace/autoclean.pm line 57. BEGIN failed--compilation aborted at t/basic.t line 9. Undefined subroutine namespace::autoclean::on_scope_end called at E:\usr\cpan\build\namespace-autoclean-0.11-bB3vbO\blib\lib/namespace/autoclean.pm line 57. BEGIN failed--compilation aborted at t/cleanee.t line 20. Undefined subroutine namespace::autoclean::on_scope_end called at E:\usr\cpan\build\namespace-autoclean-0.11-bB3vbO\blib\lib/namespace/autoclean.pm line 57. BEGIN failed--compilation aborted at t/matchclean.t line 8. # Testing with Moose 1.21 Undefined subroutine namespace::autoclean::on_scope_end called at E:\usr\cpan\build\namespace-autoclean-0.11-bB3vbO\blib\lib/namespace/autoclean.pm line 57. BEGIN failed--compilation aborted at t/role.t line 18. Failed 5/7 test programs. 0/0 subtests failed. Thanks. --Octavian ___ 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] Weird problem with Catalyst::Authentication, and redirects
From: David Schmidt davew...@gmx.at On Wed, Jan 26, 2011 at 12:18 PM, Ben van Staveren benvanstave...@gmail.com wrote: Hi Denny list, Have you tried turning it off and then on again? ;) Repeatedly :) More seriously, I have found on multiple occasions that the Catalyst Auth stuff can seem to get itself into an inconsistent state, such that it starts behaving oddly (usually mine will successfully log in, but fail to keep track of that fact), and the only way to fix it is to delete the contents of the session store (database, in my case), delete all the cookies for the site, and possibly wipe the browser cache too. Other than that I'm not sure what to suggest. Where does the auto return to? Is it possible it's coming back from there to before the dashboard redirect, and so the redirect URL is getting overwritten before the output is constructed? (I've not used auto, so no idea if this is a stupid question or not.) On the off-hand of being wrong, as far as I know, auto is called before anything else is really done, so your dispatch chain ends up going auto - action - end I think. Anyways, I did clear the session store, zapped all the cookies, and the behaviour's still there. I did some Data::Dumper action, and even after the RenderView action class had it's way with things, the status is still set to 302, a Location header is present in the output, but it did render the template that it's not supposed to render. Even if I do a $c-detach('end') and return 0, it will render a template, which by all accounts, it's not supposed to be doing. Doing a telnet to the dev server and querying it does return the proper headers for a redirect as well; Status: 302 and Location: /login - but it also renders the output body, for some really freaky reason. The main issue for me is that this behaviour seems to be triggered by something I did in controller code somewhere, but I could swear up and down that I haven't done anything that touches even remotely near authentication or the Auth guts, so I'm totally and utterly stumped. And it's kind of important this works, deadlines and such things :( If all you want to do is redirecting the user to /login if he isn't logged in you could try CatalystX::SimpleLogin. Using auto for that stuff is kinda deprecated according to what I overheard in the irc channel. I thought that CatalystX::SimpleLogin can be used only in those apps that use HTML::FormHandler. What's the recommended way for the apps that use HTML::FormFu if using the auto private methods is deprecated? Thanks. Octavian ___ 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/
[Catalyst] Gearman
Hi, I have installed Gearman::Server and ran gearmand under Linux and tried to use the worker and the client from Windows, but I saw that Gearman is not very reliable. I have created a worker that sends email but for beeing sure that it is not a problem of the mail server I have put it to write a line in the log each time it was appealed. From 10 similar requests, the worker is called only 7 or 8 times. I have ran gearmand with no options. Do you have any idea if this is normal to happen or I am missing some important parameters? Thanks. --Octavian ___ 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] Gearman
Hi Devin, From: Devin Austin devin.aus...@gmail.com You might also want to create a job tracker that uses a database of some sort to mark jobs done when they complete, and just selects jobs that are incomplete and runs them. That way, if a job doesn't complete, the tracker picks it up and sends it to the worker again. I wrote an Advent article on this: http://www.catalystframework.org/calendar/2010/7 -- Devin Austin I read your article and it was very helpful. The client and worker I made were inspired from those I found in that article. I have also read at the end that Gearman is mainly used for speed and not for reliability but I thought that this may be because it doesn't use a permanent database and that the jobs might disappear if the Gearman server is killed. However, I see that the jobs disappear even if the server is running fine. I think that I actually need a job tracker for making sure the jobs are done correctly than executing those jobs faster. I have also taken a look at Beanstalk but I haven't seen a version for Windows. I don't like the idea to create my own job queue, so if I won't be able to patch TheSchwartz::Moosified to work with Oracle I think that I will have to use a MySQL DB only for holding the job queues. Octavian ___ 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/
[Catalyst] Job Queue recommendation
Hello, Can you recommend a job queue system that works under Windows (and which works with Oracle if it needs a database)? TheSchwartz can't be installed, TheSchwartz::Moosified doesn't work with Oracle and Gearman::Server can't be installed under Windows because of Danga::Socket. Thanks. --Octavian ___ 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] FormHandler -- pro or con?
From: Toby Corkindale t...@dryft.net On 9 December 2010 19:24, Octavian Rasnita orasn...@gmail.com wrote: Using Moose Roles for forms is awesome. I also agree with this idea, but the fact that the most used constraints, filters and validators should be also manually specified using Perl code is not so nice. It would be nice to have a form processor like H::FF that provides many default HTML elements, constraints, filters and validators, and to be able to create custom elements, constraints, filters and validators using Moose roles, then to specify that those roles are used... using config files. But.. That's what the custom fields, widgets, roles etc are there for. Eg. If you need a field that can, say, only accept four characters and they have to be a-d, then go in and make a custom field type that does the check.. Then tell your designers to just say type = 'mySpecialField' when they need to use it. Or even better, develop entire classes of grouped widgets and their validations, then get them to just incorporate those. (Eg. an Address role, which brings in street, suburb, borough, state, postcode, zip code, whatever.. and does all the validation.. You'll reuse that one a lot!) Yes, I wasn't very clear. The most important part is not the one that allow creating custom fields, constraints or filters, but the one that talks about using pre-defined very common fields. For example, if I just want to validate an email address, or some numbers, or other simple things like these, I don't want to write any kind of code if with H::FF I can just write a short code in a configuration file. It is more simple to write constraint type Email /constraint ...than to write Perl code and apply a Moose role to a certain field. Actually, I guess that is possible to create them using Moose with H::FF although I am not sure. Ideally, the web designers that don't know Perl at all should be able to change the design of the forms at least. Agreed, and this is where neither FormFu or FormHandler succeeds. True, but for simple layouts, H::FF requires less effort for coding. I became interested in H::FH for using it in the case of more complex forms, especially after I heard that it is faster than H::FF, but it is not acceptable at all to use html code as strings in Perl code. The development version of H::FF also uses Moose, so only the fact that H::FH uses moose is not a relevant advantage. FormFu's yaml syntax ends up being horribly complicated, and FormHandler's Perl code is not much clearer. True, but FormFu can also use Config::General code which is much clearer (or other config formats accepted by Config::Any). It would be OK if H::FH would allow creating custom elements and validators, filters... using Moose, but only generic elements, not related with any form, and then allow us to use configuration files for using those elements and constraints. It is not nice at all to need writing Perl code using Moose for just creating an HTML form, but each one with his preferences. :-) Octavian ___ 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] FormHandler -- pro or con?
From: Toby Corkindale t...@dryft.net On 7 December 2010 18:03, Octavian Rasnita orasn...@gmail.com wrote: From: Toby Corkindale t...@dryft.net On 1 December 2010 02:34, will trillich will.trill...@serensoft.com wrote: Anybody else *dissing* FormHandler? We've started developing based on FormHandler lately and haven't had troubles... yet? I'm running it, and have been very happy with it. It's nice that you can put all your common form elements into roles and then combine them. I'm familiar with Moose, so HFH's syntax came fairly naturally to me, but I guess it could be confusing to others? Performance is reasonable - and a lot faster compared to FormFu. Cheers, Toby Is there a way of making H::FH beeing more elegant? I mean, is there a way of doing something to not need using Perl code for creating the forms, but only using some configuration files like in H::FF's case? I guess there is more than one way to do everything.. I didn't like having to write YAML for H:FF, since YAML is ugly, and then one needed to take multiple YAML files and merge them a lot, and.. ugh. I agree. That's why I never use yaml. But H::FF can use other config formats. I use the Apache-style format... Using Moose Roles for forms is awesome. I also agree with this idea, but the fact that the most used constraints, filters and validators should be also manually specified using Perl code is not so nice. It would be nice to have a form processor like H::FF that provides many default HTML elements, constraints, filters and validators, and to be able to create custom elements, constraints, filters and validators using Moose roles, then to specify that those roles are used... using config files. Actually, I guess that is possible to create them using Moose with H::FF although I am not sure. Ideally, the web designers that don't know Perl at all should be able to change the design of the forms at least. Octavian ___ 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] FormHandler -- pro or con?
From: Toby Corkindale t...@dryft.net On 1 December 2010 02:34, will trillich will.trill...@serensoft.com wrote: Anybody else *dissing* FormHandler? We've started developing based on FormHandler lately and haven't had troubles... yet? I'm running it, and have been very happy with it. It's nice that you can put all your common form elements into roles and then combine them. I'm familiar with Moose, so HFH's syntax came fairly naturally to me, but I guess it could be confusing to others? Performance is reasonable - and a lot faster compared to FormFu. Cheers, Toby Is there a way of making H::FH beeing more elegant? I mean, is there a way of doing something to not need using Perl code for creating the forms, but only using some configuration files like in H::FF's case? Thanks. Octavian ___ 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] Which Form Validation Libs?
HTML::FormFu and also: Catalyst::Controller::HTML::FormFu HTML::FormFu::Model::DBIC Octavian - Original Message - From: Eric Berg eb...@bergbrains.com To: catalyst@lists.scsys.co.uk Sent: Tuesday, November 30, 2010 5:34 AM Subject: [Catalyst] Which Form Validation Libs? I see that there are a number of form validation libraries that purport to work with Catalyst. I've been using CGI::Formbuilder for years and have been relatively happy with it. I need something for my new Catalyst app. I have already created my forms in my TT templates, but I need validation for most of the regular stuff, including zip codes, states, credit card info, etc. You guys got any recommendations? Thanks. Eric ___ 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] Suggestions on how to handle 12 page form
Hi, Thanks for the example. I think that the following line could be improved: $form-load_config_filestem($c-config-{root}./forms/students/info$form_id); to be (untested): $form-load_config_filestem($c-uri_for(root/forms/students/info$form_id)); Octavian - Original Message - From: Rippl, Steve rip...@woodlandschools.org To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Wednesday, November 17, 2010 5:48 PM Subject: Re: [Catalyst] Suggestions on how to handle 12 page form On Tue, Nov 16, 2010 at 10:38 PM, Octavian Rasnita octavian.rasn...@ssifbroker.ro wrote: Hi Bill, I think the best approach is to create an action for each page of the form and after each form submission partially update one or more database tables, saving a marker that shows which was the last page completed. And after each form submission, depending on some options chosen by the user you can redirect to the next form or to display a certain form which is displayed only in some conditions. After the user submitted the first form, in which you may ask him/her for his/her email, you can automaticly send him/her an email with a link that can be used to access this wizard where he/her left it, maybe even from another computer. This way, it is not a problem if the user's computer has frozen after he/she completed 99% of the wizard or he/she should continue only after a certain period. You can also put previous links in every page that would display the previous filled form, pre-filled with the values this user already filled (which are taken from the database). For creating the forms you can use a tool like HTML::FormFu or manually-created forms... it doesn't matter. Octavian I use the same controller for the whole form but point to a different html::formfu .yml file for each page of the form. I then put tabs across the top of the form for each page so the user can go back and forth, each submission saving that part of the form, the tabs linking back to the same page with a different additional arg ($form_id) that links to the corrent .yml file. Something along the lines of... sub index : Path { my ( $self, $c, $id, $form_id, $hash ) = @_; [-- validation etc --] $form = $self-form; $form-load_config_filestem($c-config-{root}./forms/students/info$form_id); $form-process; $c-stash-{form} = $form; if ( $form-submitted_and_valid ) { [-- save stuff --] } [-- display stuff --] } The $hash variable is so I can email them a unique link back to the form so they can complete it later (for folks not authenticated into the system, ie. the public). -- Steve Rippl Technology Director Woodland Public Schools 360 841 2730 ___ 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] Suggestions on how to handle 12 page form
From: Bogdan Lucaciu bog...@sinapticode.ro On Wed, Nov 17, 2010 at 9:11 PM, Octavian Rasnita orasn...@gmail.com wrote: Thanks for the example. I think that the following line could be improved: $form-load_config_filestem($c-config-{root}./forms/students/info$form_id); to be (untested): $form-load_config_filestem($c-uri_for(root/forms/students/info$form_id)); Do you mean path_to instead of uri_for ? -- Bogdan Lucaciu Oh yes, I'm sorry. Of course path_to(). Thanks for correction. Octavian ___ 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] Suggestions on how to handle 12 page form
From: Hauck, William B. william.ha...@ibx.com Hi. I'm working on the project request section of our new project tracking system. The request form is broken up into 12 pages-yes, lots and lots of data to be submitted. Anyone have any experience / advice on how to handle that many fields? Should I use a single subroutine to handle it all based on a page variable? Or, should I simply have a subroutine per page? How about going back to correct something the user messed up during initial entry-we want to show a summary of the data before final submission. Any help is appreciated. Thanks, bill Hi Bill, I think the best approach is to create an action for each page of the form and after each form submission partially update one or more database tables, saving a marker that shows which was the last page completed. And after each form submission, depending on some options chosen by the user you can redirect to the next form or to display a certain form which is displayed only in some conditions. After the user submitted the first form, in which you may ask him/her for his/her email, you can automaticly send him/her an email with a link that can be used to access this wizard where he/her left it, maybe even from another computer. This way, it is not a problem if the user's computer has frozen after he/she completed 99% of the wizard or he/she should continue only after a certain period. You can also put previous links in every page that would display the previous filled form, pre-filled with the values this user already filled (which are taken from the database). For creating the forms you can use a tool like HTML::FormFu or manually-created forms... it doesn't matter. Octavian ___ 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] Re: Organizing link generators
I was also confused and that's why I added the following small piece of documentation in Catalyst.pm: Note that although the path looks like a URI that dispatches to the wanted action, it is not a URI, but an internal path to that action. For example, if the action looks like: package MyApp::Controller::Users; sub lst : Path('the-list') {} You can use: $c-uri_for_action('/users/lst') and it will create the URI /users/the-list. But just as Path::Class can also use dir('a', 'b', 'c') and dir('a/b/c'), uri_for_action could use the same syntax options... Octavian - Original Message - From: Aristotle Pagaltzis pagalt...@gmx.de To: catalyst@lists.scsys.co.uk Sent: Friday, November 12, 2010 7:37 PM Subject: [Catalyst] Re: Organizing link generators * Alexander Hartmaier alexander.hartma...@t-systems.at [2010-11-12 15:35]: To me company, lot and vin in the url look like arguments, not PathParts. That’s not how `uri_for_action` works. Regards, -- Aristotle Pagaltzis // http://plasmasturm.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/