[Catalyst] Working a Solr Model -- Follow Up
After trying to work with Apache::Solr and running into a brick wall there, I went back to WebService::Solr and reread the documentation and looked at the source code and decided to give it another try and start over. This time it worked, and I was able to return a WebServer::Solr::Response object and pass it to the view. Comparing my failed experiment with the working one I figured out what caused the Unicode errors. I was even able to propose a patch to implement a minor feature request that was sitting in the rt.cpan queue. Summary of the 3 modules I looked at for implementing a Solr Model. Rejected: Apache::Solr Returned a resultset that didn't work in Template::Toolkit, had write ugly code to convert to array of hashrefs. I could not figure out how to use a filter query (they are absolutely required for how I intend to use Solr). Rejected: SolrBeam Must download from GitHub instead of CPAN. Despite the oddness of feeling like I was reading Ruby I was able to do some debugging in the module, but still didn't get it to work. Selected: WebService::Solr You must read all of the submodule documentation, everything I needed to figure out was somewhere in the documentation, but often not in the main module's documentation. Has its' own Model Adaptor, but it also works if you just extend Catalyst::Model. The code itself was comprehensible and I was able to logically trace a request through it, and also to submit a very minor feature patch. Implements the features I've tried to use so far. I plan to write a how-to, which I'll post on my blog, if there is going to be an Advent Calendar this year, let me know who is collecting submissions for it and I'll submit the article in POD. ___ 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] Working a Solr Model -- Follow Up
More important than the ugly code to get output to display is that I couldn't figure out how to use a necessary solr feature. Equivalent to a DBD for a SQL database that doesn't support subqueries in a select. Unfortunately, not all of my unicode woes have not been resolved, I have a description field that is causing IO::Handle to throw a wide character error on template rendering, and a bug reported for WebService::Solr since there does after all appear to be a real unicode issue. As a workaround I wrote a macro in Template::Toolkit. [% MACRO utfclean(field) PERL %] use utf8; my $field = $stash-get('field'); utf8::encode($field); print $field ; [% END %] On 10/06/2013 05:57 AM, Kieren Diment wrote: On 06/10/2013, at 6:27 PM, John Karr brain...@brainbuz.org mailto:brain...@brainbuz.org wrote: Rejected: Apache::Solr Returned a resultset that didn't work in Template::Toolkit, had write ugly code to convert to array of hashrefs. I could not figure out how to use a filter query (they are absolutely required for how I intend to use Solr). Probably could have sorted this by passing the Solr resultset to a subref set to $c-stash. so you end up with something like [% SET data = handle_stupid_resultset(data); WHILE (x = data.iterate); 'do stuff with ' _ x ; END; %] in your template. It's the poor man's approach to putting new object models in the template rendering engine. ___ 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] Calling controller/action based on parameter
I'd try a regexp in my begin action. But I'd first look at something more properly restful http://www.pausetosee.com/prn/n7ivdbdq8808p You can also do pre-dispatching with rewrite rules on your webserver. in apache Rewrite Engine On RewriteRule ^/prn(.*) /http://localhost:3003/controllers/people/n7ivdbdq8808p [P] On 10/03/2013 09:41 PM, bill hauck wrote: I've been struggling with the best way to accomplish a somewhat simple task: direct to a specific controller/action based on a code in the uri. ___ 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] Calling controller/action based on parameter
Hit send too soon RewriteRule ^/prn(.*) /http://localhost:3003/controllers/people/$1 [P] On 10/03/2013 10:13 PM, John Karr wrote: I'd try a regexp in my begin action. But I'd first look at something more properly restful http://www.pausetosee.com/prn/n7ivdbdq8808p You can also do pre-dispatching with rewrite rules on your webserver. in apache Rewrite Engine On RewriteRule ^/prn(.*) /http://localhost:3003/controllers/people/n7ivdbdq8808p [P] On 10/03/2013 09:41 PM, bill hauck wrote: I've been struggling with the best way to accomplish a somewhat simple task: direct to a specific controller/action based on a code in the uri. ___ 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] Working a Solr Model
Thanks for the suggestion, but I just spent some time looking at SolarBeam, and found that the example code did not work. A little time debugging it confirmed that it internally constructed a valid query url string which when pasted into a browser resulted in multiple found documents, but SolarBeam was getting 0 documents found. Since the last release was a year ago, it is quite possible that something changed to break it (I'm using SOLR 4.4, was the author working with the 3.x series?). I also noticed that you (Marcus R) started a fork. Since I've been able to work-around the issues with Apache::Solr I'm starting my project with it. We have been using SolarBeam - https://github.com/judofyr/solarbeam It uses Mojo::UserAgent, and will allow parallel requests, even if you use catalyst. We found this very useful when writing search intensive apps. Marcus. On Sunday, September 29, 2013, John Karr wrote: I'm commencing a project that is going to use Solr because it will be search intensive. My research hasn't turned up a lot in terms of discussion and how tos for either Solr and Perl or Solr and Catalyst. There are two CPAN modules which I've been experimenting with, WebService::Solr and Apache::Solr. WebService::Solr only implements the LWP agent part of working with Solr, which still leaves one to extract the actual JSON what LWP gives you, plus it has fatal wide-character issues that use utf8::all isn't able to fix, and also does not support xml and csv (other formats solr can provide). Apache::Solr is much nicer in that it provides something resumbling a dbic result set, but I've already encountered a few things that seem like bugs and sending the resultsetlike object to the stash in the same way as a dbic resultset doesn't seem to work the same way. Are other people using Solr based models? if so are you using either of the two CPAN modules or something else? Do you have examples and or notes you can share? ___ 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/ -- --- Marcus Ramberg Chief Yak Shaver Nordaaker Consulting +47-93417508 ___ 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] Working a Solr Model
I'm commencing a project that is going to use Solr because it will be search intensive. My research hasn't turned up a lot in terms of discussion and how tos for either Solr and Perl or Solr and Catalyst. There are two CPAN modules which I've been experimenting with, WebService::Solr and Apache::Solr. WebService::Solr only implements the LWP agent part of working with Solr, which still leaves one to extract the actual JSON what LWP gives you, plus it has fatal wide-character issues that use utf8::all isn't able to fix, and also does not support xml and csv (other formats solr can provide). Apache::Solr is much nicer in that it provides something resumbling a dbic result set, but I've already encountered a few things that seem like bugs and sending the resultsetlike object to the stash in the same way as a dbic resultset doesn't seem to work the same way. Are other people using Solr based models? if so are you using either of the two CPAN modules or something else? Do you have examples and or notes you can share? ___ 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] Advent 2012 -- Catalyst in Nine Steps -- Kudos to Octavian
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. ___ 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? Errata to Starman-apache article
There is some important errata to the advent Calendar article posted at: http://brainbuz.org/techinfo/2011/12/deploying-catalyst-with-starman-and-apache/ Unfortunately I have some frustration with upstart, I’m hoping to have better luck with the newest version in Ubuntu Precise. I will post a follow up article if I make progress with the new version of upstart. You may want to consider using the rc.local method if upstart is too problematic. From: Dimitar Petrov [mailto:mita...@gmail.com] Sent: Wednesday, May 16, 2012 6:00 AM To: The elegant MVC web framework Subject: Re: [Catalyst] upstart script for Starman-based app? There was an article about Starman and Apache into the last year Advent Calendar. Here is the link: http://www.catalystframework.org/calendar/2011/16 Cheers On Tue, May 15, 2012 at 3:20 PM, Bill Moseley mose...@hank.org wrote: 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, -- Bill Moseley mose...@hank.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] Application Testing, Mocking Apache Headers/Environment
I am trying to test an application that is deployed behind a proxy and which is dependent on obtaining information from the request through $c-engine-env this information includes the logged in user and client ip address. I've been using the config file to provide override values, however, this is not helpful for testing multiple values. ___ 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] Resources to learn catalyst
The best resource out there is the Tutorial. I would recommend that you spend some time on Moose and Template Toolkit before getting serious with the Tutorial, and also you definitely need to understand the material in the OReilly Intermediate Perl book. The biggest drawback to the Tutorial is that it is more about DBIx::Class than Catalyst, the only DBI Models for beginners documentation I know of is what I put on my own technical blog (http://brainbuz.org/techinfo/Catalyst-Model-Simple-Tutorial.html). If you're learning programming you should learn DBI/SQL before coming to terms with any ORM. From: Chankey Pathak [mailto:chankey...@gmail.com] Sent: Thursday, March 01, 2012 12:28 PM To: catalyst@lists.scsys.co.uk Subject: [Catalyst] Resources to learn catalyst I am new to catalyst. I know Perl at beginner level (finished reading Learning Perl). I am following the catalyst tutorial at CPAN. Let me know some more resources to learn catalyst. Thanks :) -- Regards, Chankey Pathak ___ 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 best not to use the system perl
I recently put up an article on my technical blog (brainbuz.org/techinfo). Here's the cut and paste: Installing an Alternate Perl with perlbrew put a current Perl at /usr/bin/perl5. I prefer this solution to the env perl approach many others have chosen. It does require that for your scripts you change the #! line by appending the 5, but it is much easier to append a 5 to the line than remember where your alternate perl is buried in the file system (for scripts run outside your environment). To begin, you’ll need to fire up your system CPAN for its first and only ever run. But even before that you may need to install a few things like gcc. On ubuntu it is as simple as (sudo) apt-get install build-essential. You also need to decide which user is going to maintain perlbrew, it is not unreasonable to choose root, it is also quite reasonable to choose a different user. (sudo) cpan App:perlbrew Say yes to installing dependincies 89 times. There are two tricks you can use to make this a little easier: install App::cpanminus first, it has fewer dependencies and can install perlbrew quietly, alternately Ubuntu Oneric has a perlbrew package, install it and then use perlbrew’s self update option. If installation of perlbew fails, open up a cpan session and type force notest install App::perlbrew. From this point onwards we consider ourselfs to have 2 perls, our real Perl (perl5) the system perl which we will never touch, but which is a dependency for packages needing perl we might have installed. export PERLBREW_ROOT=/opt/perlbrew (/usr/perlbrew and /usr/local/perlbrew are also good choices) perlbrew init /opt/perlbrew/bin/perlbrew available /opt/perlbrew/bin/perlbrew install Using Perl 5.14.1 as an example, type the following two lines ln /opt/perlbrew/perls/perl-5.14.1/bin/perl /usr/bin/perl5 ln /opt/perlbrew/perls/perl-5.14.1/bin/perl5.14.1 /usr/bin/perl5.14.1 This will make Perl5.14.1 your default perl5, and it will give you a specific alias to perl5.14.1 if in the future you need to invoke it specifically you can type perl5.14.1 from anywhere without having to remember the full path. Install cpanminus Now that you have your new perl installed, even though perlbrew has an option to do this I recommend using the cpan in your new perlbrew directory. ./cpan App::cpanminus, configure cpan and answer the prompts. When this is done go to /usr/bin, if you don’t have links there for cpan and cpanm copy them from your new perl’s directory, if you do, they’re just wrappers, edit the #! line to /usr/bin/perl5, so that if in the future you have a newer perl5, you won’t need to touch them. Special case: Padre. Padre requires a multi-threaded Perl, Perlbrew does not build a multi-threaded Perl by default. I update Padre about once a month. You have a two choices, you can tell Perlbrew to build a threaded Perl, or you can leave Padre on your system Perl, which means that you need to make sure that you update it in your system Perl, not your real Perl. If you don’t want a threaded perl a third option would be to build a special threaded perl for Padre (but as long as it works with system perl, why bother?). /opt/perlbrew/bin/perlbrew install \ perl-5.xx.x -Dusethreads -Duselargefiles \ -Dcccdlflags=-fPIC -Doptimize=-O2 \ -Duseshrplib -Dcf_by=Your_name_here \ -Dcf_email=Your_email@here -Original Message- From: Dermot [mailto:paik...@googlemail.com] Sent: Friday, September 30, 2011 10:39 AM To: The elegant MVC web framework Subject: [Catalyst] How best not to use the system perl Hi, I have got a new server that I want to put into production. To comply with the manufacturer, I have installed RedHat 6.1 on it. Up till now we have used Debian based machines and have been using the system perl. That worked ok because all the necessay libperl*.deb could be installed via the package manager. That's not an option with yum. I know using the system perl is frowned upon by some so I'd like to do the right thing before the server is deployed. AFAIK, there are two options; 1) install a perl from source into somewhere like /usr/local and set-up the environment so that's the perl that's used or 2) use the system perl (5.10.1) and local::lib. I'm sure there are others with my hardware set-up and I'd be interested in hearing what approached they've taken. Similarly if there are other options to consider or there are strong reasons for using one approach over an other, I'd appreciate hearing them. Thanks, Dermot. ___ 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] fastcgi script returns 404
I recommend Starman over fastcgi. I never had an easy time with fastcgi, and when I finally gave starman a shot it was surprisingly painless, it was pretty easy to make an upstart job out of, and I can ditch mod_perl. I have no experience with lighthttpd, but with Apache a simple ProxyPass or ReWriteRule[P] is the only non-boilerplate directive needed. From: Robert Dormer [mailto:rdor...@myartplot.com] Sent: Thursday, September 22, 2011 4:51 PM To: catalyst@lists.scsys.co.uk Subject: [Catalyst] fastcgi script returns 404 Hello all, I have a catalyst installation that I'm bringing up from scratch in a new environment. I've decided to go with lighttpd / fastcgi as the web server. When running the server script (the project is named map, so it's the map_server.plhttp://map_server.pl script), pages seem to come up just fine. However, when I start lighttpd, and run the map_fastcgi.plhttp://map_fastcgi.pl script with the following command line: ./script/map_fastcgi.plhttp://map_fastcgi.pl --listen 127.0.0.1:9000http://127.0.0.1:9000 --nproc 5 --keeperr 2 It seems that only the index page of the site is served properly - any other link that I click on just results in a 404. So it seems that I am doing something wrong with fastcgi. Can anyone recommend what I need to do differently? For informational purposes - I run lighttpd with the following configuration file: server.document-root = /home/mapper/artplot/root/ server.modules += ( mod_fastcgi ) server.port = 80 server.username = mapper server.groupname = mapper mimetype.assign = ( .htm = text/html, .html = text/html, .txt = text/plain, .jpg = image/jpeg, .png = image/png ) static-file.exclude-extensions = ( .pm, .pl, .conf ) fastcgi.server = ( = (( host = 127.0.0.1, port = 9000, )) ) -- -- Main Number - (617) 752-1714 http://www.MyArtPlot.com All-in-one empowerment platform for the art industry and profession - complete with social, professional, and commercial power. MyArtPlot, LLC Attn: General Mail P.O. Box 960812 Boston, MA 02196 Please note that this e-mail contains information that may be confidential and proprietary. It is to be read and used solely by the intended recipient(s). MyArtPlot, LLC and its affiliates retain all proprietary rights that they may have in the information. If you are not an intended recipient, please notify us immediately by reply e-mail and please delete this e-mail (including any attachments hereto) immediately without reading, disseminating, distributing or copying. Cheers Thank you. ___ 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 tutorials
I strongly recommend the Catalyst Tutorial. It is denser than I would have liked when figuring Catalyst out, and sometimes digresses about outdated versions of Catalyst, other than that my biggest gripe is that it completely ignores DBI Models, which means that if you don't know DBIx::Class coming in, prefer another ORM, or prefer SQL to ORM you have to put a lot of effort into DBIx::Class which is very distracting from understanding the rest of Catalyst. I also recommend becoming familiar with TemplateToolkit and Moose before starting work on Catalyst, just so that you have less to grasp while working through the Catalyst/DBIx::Class Tuturial. I've written an auxilliary document on using DBI models (the version up is about half complete. A new version should be going up by the end of the month), you can find it at http://brainbuz.org/techinfo/Catalyst-Model-Simple-Tutorial.htmlhttp://brainbuz.org/techinfo/Catalyst-Model-Simple-Tutorial.html or on github at https://github.com/brainbuz/Catalyst--Model--Simple--Tutorial. From: Chris Stinemetz [chrisstinem...@gmail.com] Sent: Sunday, September 11, 2011 4:52 PM To: catalyst@lists.scsys.co.uk Subject: [Catalyst] Simple tutorials Hello, I just finished installing catalyst along with strawberry perl. Would someone please recommend a good tutorial to get my feet wet? Thank you, Chris ___ 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] Model Testing Problems.
Thanks Eric -- I had found and posted the solution when the mailing list server was behaving erratically and people may have missed the message. When I set the problem aside and looked at it after a few days my mistake was obvious. http://lists.scsys.co.uk/pipermail/catalyst/2011-August/027503.html -Original Message- From: Eden Cardim [mailto:edencar...@gmail.com] Sent: Monday, September 05, 2011 7:38 AM To: The elegant MVC web framework Subject: Re: [Catalyst] Model Testing Problems. .. use MyApp; is( MyApp-model('DBI::Flock')-CountSheep(), 3 , 'CountSheep. There are 3 sheep in BoPeeps flock' ) ; The above snippet should work, assuming the CountSheep() method is in place. ___ 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] Model Testing Problems.
I have a catalyst application that I've been working on for some time (it is pretty big now), and am finally trying to write tests for it. The application runs error free when run in its entirety. But I can't get Model Tests to run. My Model is DBI based, where each DSN has a MyApp::Model::DSN parent module and then there are MyApp::Model::DSN::Table child modules which contain the methods relevant to each table. I would like to access my model methods in a manner similar to how I do in an application: is( $BoPeep-model('DBI::Flock')-CountSheep(), 3 , 'CountSheep. There are 3 sheep in BoPeeps flock' ) ; ___ 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] DBI Models Question.
Thanks Hans, that answered the question! Here is some proof of concept code: === Model package DBIS::Model::RSVP; use strict; use warnings; use DBIx::Simple; use parent 'Catalyst::Model::DBI'; __PACKAGE__-config( dsn = 'DBI:Pg:dbname=rsvp;host=joomla.brain.buz', user = 'joomla', password = '007drupal', on_connect_do = q{PRAGMA foreign_keys = ON}, ); use Moose ; #use Moose immediately before calling on Moose to extend the object. has db=( is ='ro', isa='DBIx::Simple', lazy_build= 1, # If we don't want to handle all dbis methods, specify those that we want. # handles= [qw/query flat /], ); sub _build_db { my $self = shift ; return DBIx::Simple-connect($self-dbh); } sub Count { my $self = shift ; my $q = 'SELECT COUNT (*) FROM guest' ; ( my $count ) = $self-db-query( $q )-flat ; return $count ; } 1; === Controller === package DBIS::Controller::Root; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller' } __PACKAGE__-config(namespace = ''); sub index :Path :Args(0) { my ( $self, $c ) = @_; my $msg = preDemonstration of a DBIx::Simple based Model!\n ; # Use the count method for maximum re-usability. my $guests = $c-model('RSVP')-Count() ; $msg .= We have $guests guests!\n ; # Directly access the DBIx::Simple object in your controller for trivial queries. my $q = 'SELECT COUNT (*) FROM guest' ; ( my $guests2 ) = $c-model('RSVP')-db-query( $q )-flat ; $msg .= We still have $guests2 guests!\n ; $c-response-body( $msg/pre ); } 1; From: Hans Staugaard [h.stauga...@tweakker.com] Sent: Friday, June 10, 2011 2:15 AM To: catalyst@lists.scsys.co.uk Subject: Re: [Catalyst] DBI Models Question. Hi John I think I would just add something like this to the model: has db = ( is ='ro', isa = 'DBIx::Simple', lazy_build= 1, handles = [qw/query select insert delete/], # Etc. ); sub _build_db { my $self = shift; return DBIx::Simple-connect($self-dbh); } then you should be able to use $self-db, $self-query etc in your subs. Regards, Hans On 2011-06-10 02:39, John Karr wrote: I've been dabbling with catalyst for a while and working with Model::DBI. There are a few issues that I haven't figured out to my satisfaction. loading the dbi connection strings from myapp.conf extending the dbi model with DBIx::Simple. My current method is to create a new dbixsimple object from $self-dbh in every subroutine, I would like to get to a point where this is set up in setup of each dbi model and accessible in a manner like either: my $db = $self-db or $self-do_some_dbixsimple_method( @arguments ). I'd also be happy to hear some views on: pointers on good coding for dbi models -- the balance between reusability and not ending up with a method in your model for every possible query. = The discussion I am attempting to start is about DBI models and not the merits of ORM vs DBI, but about doing DBI models well. ___ 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] DBI Models Question.
The mistake in my code brings up the other question (which applies to ORM models as well): How to get the model to take its parameters from appname.conf instead of having to input them directly in the model. Fortunately that was just a test server and no big deal to change its passwords, but nearly every time I copy a catalyst application from one server to another server I need to edit the model. And the problem is obvious (and as shown by my post easy to mess up) if you are sharing some model code via irc or a mailing list. -Original Message- From: John Karr [mailto:brain...@brainbuz.org] Sent: Saturday, June 11, 2011 6:46 PM To: The elegant MVC web framework Subject: RE: [Catalyst] DBI Models Question. Thanks Hans, that answered the question! Here is some proof of concept code: === Model package DBIS::Model::RSVP; use strict; use warnings; use DBIx::Simple; use parent 'Catalyst::Model::DBI'; __PACKAGE__-config( dsn = 'DBI:Pg:dbname=rsvp;host=joomla.brain.buz', user = 'joomla', password = '007drupal', on_connect_do = q{PRAGMA foreign_keys = ON}, ); use Moose ; #use Moose immediately before calling on Moose to extend the object. has db=( is ='ro', isa='DBIx::Simple', lazy_build= 1, # If we don't want to handle all dbis methods, specify those that we want. # handles= [qw/query flat /], ); sub _build_db { my $self = shift ; return DBIx::Simple-connect($self-dbh); } sub Count { my $self = shift ; my $q = 'SELECT COUNT (*) FROM guest' ; ( my $count ) = $self-db-query( $q )-flat ; return $count ; } 1; === Controller === package DBIS::Controller::Root; use Moose; use namespace::autoclean; BEGIN { extends 'Catalyst::Controller' } __PACKAGE__-config(namespace = ''); sub index :Path :Args(0) { my ( $self, $c ) = @_; my $msg = preDemonstration of a DBIx::Simple based Model!\n ; # Use the count method for maximum re-usability. my $guests = $c-model('RSVP')-Count() ; $msg .= We have $guests guests!\n ; # Directly access the DBIx::Simple object in your controller for trivial queries. my $q = 'SELECT COUNT (*) FROM guest' ; ( my $guests2 ) = $c-model('RSVP')-db-query( $q )-flat ; $msg .= We still have $guests2 guests!\n ; $c-response-body( $msg/pre ); } 1; From: Hans Staugaard [h.stauga...@tweakker.com] Sent: Friday, June 10, 2011 2:15 AM To: catalyst@lists.scsys.co.uk Subject: Re: [Catalyst] DBI Models Question. Hi John I think I would just add something like this to the model: has db = ( is ='ro', isa = 'DBIx::Simple', lazy_build= 1, handles = [qw/query select insert delete/], # Etc. ); sub _build_db { my $self = shift; return DBIx::Simple-connect($self-dbh); } then you should be able to use $self-db, $self-query etc in your subs. Regards, Hans On 2011-06-10 02:39, John Karr wrote: I've been dabbling with catalyst for a while and working with Model::DBI. There are a few issues that I haven't figured out to my satisfaction. loading the dbi connection strings from myapp.conf extending the dbi model with DBIx::Simple. My current method is to create a new dbixsimple object from $self-dbh in every subroutine, I would like to get to a point where this is set up in setup of each dbi model and accessible in a manner like either: my $db = $self-db or $self-do_some_dbixsimple_method( @arguments ). I'd also be happy to hear some views on: pointers on good coding for dbi models -- the balance between reusability and not ending up with a method in your model for every possible query. = The discussion I am attempting to start is about DBI models and not the merits of ORM vs DBI, but about doing DBI models well. ___ 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
RE: [Catalyst] long poll AJAX
I've been dabbling with catalyst for a while and working with Model::DBI. There are a few issues that I haven't figured out to my satisfaction. loading the dbi connection strings from myapp.conf extending the dbi model with DBIx::Simple. My current method is to create a new dbixsimple object from $self-dbh in every subroutine, I would like to get to a point where this is set up in setup of each dbi model and accessible in a manner like either: my $db = $self-db or $self-do_some_dbixsimple_method( @arguments ). I'd also be happy to hear some views on: pointers on good coding for dbi models -- the balance between reusability and not ending up with a method in your model for every possible query. = The discussion I am attempting to start is about DBI models and not the merits of ORM vs DBI, but about doing DBI models well. ___ 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] DBI Models Question.
I've been dabbling with catalyst for a while and working with Model::DBI. There are a few issues that I haven't figured out to my satisfaction. loading the dbi connection strings from myapp.conf extending the dbi model with DBIx::Simple. My current method is to create a new dbixsimple object from $self-dbh in every subroutine, I would like to get to a point where this is set up in setup of each dbi model and accessible in a manner like either: my $db = $self-db or $self-do_some_dbixsimple_method( @arguments ). I'd also be happy to hear some views on: pointers on good coding for dbi models -- the balance between reusability and not ending up with a method in your model for every possible query. = The discussion I am attempting to start is about DBI models and not the merits of ORM vs DBI, but about doing DBI models well. ___ 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] Has anyone read the book Catalyst 5.8 : The Perl MVC Framework yet?
It came out just as I was trying to learn catalyst. From a beginner perspective it wasn't of any value -- thankfully Kennedy Clark has been doing an excellent job with the Tutorial on CPAN, because that's how I figured most things out. I was severely disappointed with the book, and not the least concerned with LOLCats and Kitty Pidgin. The people who wrote the book are a very knowledgeable group and sometimes their book works as a reference, but overall doesn't seem add a lot to what's already in the documentation, while being of no value to beginners whatsoever. It would be nice to have a good beginner book and a more advanced book. If any of the more advanced programmers on this list would like someone to help with writing the beginner book, don't hesitate to get in touch! From: Philip Medes [mailto:pmedes_2...@yahoo.com] Sent: Friday, October 01, 2010 5:33 PM To: The elegant MVC web framework Subject: Re: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl MVC Framework yet? I actually read the first 2 chapters and tried the examples. I haven't had time to finish the book. I haven't read any other books on Catalyst, but I do like the Sitepoint books better (Build Your Own Ruby On Rails Web Applications). _ From: Kiffin Gish kiffin.g...@planet.nl To: catalyst@lists.scsys.co.uk Sent: Fri, October 1, 2010 3:15:47 PM Subject: [Catalyst] Has anyone read the book Catalyst 5.8 : The Perl MVC Framework yet? I recently received a copy of the book Catalyst 5.8 : The Perl MVC Framework for review, have read it and tried out the examples. Before I make my judgments public, I'd first be curious to hear from others in the Catalyst Community about what their views are on the book. Those that have actually read the book, that is. I've already seen a couple blog entries and they tend to be fairly negative (we sure prefer to rant). -- Kiffin Gish kiffin.g...@planet.nl Gouda, The Netherlands ___ 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/
Follow Up: [Catalyst] Alternatives to DBIx:Class?
Most of the responses to this thread seem to say that DBIC is worth the effort. I looked at Fey:SQL and SQL::DB and concluded that they also require some effort, and suffer (along with DBIC) from what is for me a huge issue -- the documentation focuses on telling you how each piece works rather than on how to drive the darn thing. At this point for everything I'm working on, I have the luxury that I can write all of my joins and complex statements into a view or stored_procedure, but in the real world programmers are too frequently denied this, so even though right now I would like something that just wrapped the DBI up in a manner that made it easy to write and keep the DRY principle, it would be potentially more valuable to learn DBIC or Fey. DBIC is the more widely adapted solution, while Fey seems to offer most of the same capability with a syntax that draws on SQL (which is a lot of points in its' favor), but has less momentum and lacks equivalents of some of the helper scripts that are available for DBIC. So let me ask a follow up: What materials would you provide to an Intermediate Level Programmer to help them learn either Fey or DBIC? Materials could be working code, articles, things in documentation, documentation for other things that happens to explain it well, chapters in books, etc. Afternote. There is a tutorial in Fey::ORM's documentation, but it is more of a quick run-through. DBIx::Class has a better introduction in its' documentation, but that hasn't helped me much. The tutorial Kennedy Clark wrote for the Catalyst Manual was how I figured out Catalyst. Again developer isn't my normal job title, I will probably never get paid for knowing anything about ORM, time I spend learning it is only a benefit if it gives me pleasure (not so far) or saves me time in the long run (the clock is running the other way). -Original Message- From: Hakim Cassimally [mailto:hakim.cassima...@gmail.com] Sent: Monday, April 19, 2010 7:59 AM To: The elegant MVC web framework Subject: Re: [Catalyst] Alternatives to DBIx? On 19 April 2010 12:34, Carl Johnstone catal...@fadetoblack.me.uk wrote: kevin montuori wrote: DBIC code has proven trivial to maintain and augment. ...how much better things are with DBIC - especially when it comes to adding new features into the existing code base. Absolutely! When you are doing complicated reporting rollups (multiple joins, subqueries, aggregate functions) that can be arbitrarily tweaked, sorted, paged etc. then modifying with DBIC is often just a case of tweaking a single hash declaration... (Whereas updating a dynamic SQL codegen may well involve an hour of headscratching... Not to mention the other hour of debugging later, because you forgot to add a space or comma that kicks in with some rarely used set of parameters...) osfameron ___ 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] Alternatives to DBIx?
Thanks Lyle and Ovid for your responses, both SQL::DB and Fey::SQL look like saner approaches, and I will take them both for a test drive. I also liked the article Lyle referenced. -Original Message- From: Lyle [mailto:webmas...@cosmicperl.com] Sent: Saturday, April 17, 2010 9:36 AM To: The elegant MVC web framework Subject: Re: [Catalyst] Alternatives to DBIx? Personally I think DBIx::Class is the biggest load of crock out there. It's much slower, awkward to use, time consuming to learn, and as soon as you try to do some complicated queries you'll end up dropping it anyway. ORMs simply cannot work in the long run:- http://www.codinghorror.com/blog/2006/06/object-relational-mapping-is-the-vi etnam-of-computer-science.html I found SQL::DB recently, which looks interesting to me, but haven't had chance to work with it yet. It might be what you are looking for. Lyle Ovid Wrote: Given what you've described, perhaps you want to take a look at Fey::SQL: http://search.cpan.org/perldoc?Fey::SQL The related Fey::ORM can be used with Catalyst: http://search.cpan.org/perldoc?Fey::ORM::Manual::Intro John Karr wrote: I'm still learning Catalyst and find that I don't like DBIx. As a counter example I love Template Toolkit, for exactly the same reason I hate DBIx. With TT html is in html, while DBIx seperates the database from SQL, if I were capable of writing an ORM (which I am not) it would be much more like Template Toolkit. Also I'm primarily a sysadmin working on some volunteer programming projects while out of work, so even though it might well be worth coming to terms with DBIx if I did more development, crawling through DBI seems a more efficient way for me to get working code written. The alternatives I've been able to discover are DBI and RoseDB. Is there any case (given why I've already stated I dislike DBIx) for RoseDB, and are there any other alternatives that work well with Catalyst that I have not found? ___ 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] Alternatives to DBIx?
I think there's a very important difference of approach, much as Template Tool Kit and Template Declare, radically different approaches, that are both far superior to the classic CGI Module. Working in raw DBI is the opposite of the DRY principle which underlies having a framework in the first place, so I am seeking an alternative. Just as Catalyst uses MVC, DBIx chooses ORM, but that paradigm is not the only way to be effective PERL==SQL glue. From the Manpage Fey::SQL looks like what I want: neatly wrapped and sweetened SQL, without the repetition and overhead inherent in working from DBI. I'm going to spend some time working with it and also with SQL::DB, when I have a more educated opinion I will share it. Both Fey and SQLDB are a nativist approach to SQL (much like TT is to html), and I would argue that in keeping the PERL paradigm of many ways to accomplish a task, the choice between a SQL-native DBI wrapper and an ORM wrapper should be up to the individual, the issue seems to be finding a worthy SQL-native wrapper. In my own analysis the Time and Effort to learn DBIx is greater than the Time wasted writing repetitious DBI code, the time I've already invested on DBIx has shown that there is a better way than DBI, but for me it isn't DBIx. -Original Message- From: Octavian Rasnita [mailto:orasn...@gmail.com] Sent: Saturday, April 17, 2010 3:58 PM To: The elegant MVC web framework Subject: Re: [Catalyst] Alternatives to DBIx? From: Kiffin Gish kiffin.g...@planet.nl I'd say that rather than spending time studying SQL::DB, which I found complicated and hard to tackle, you might as well invest the same time and energy anyway in figuring out DBIx::Class. BTW, is there a comparison among the ORMs in Perl somewhere? It would be interesting and definitely helpful for the ORM newbies. 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] Redirecting Catalyst's Log to a File
I'm having a problem with deploying a Catalyst application (I'm learning Catalyst and this is the first application I've tried to put on the web, and it works on my test machine which has a similar configuration to my ISP, but just times-out at my isp returning nothing), and need to capture the logging output from the fastcgi script to a file instead of the apache log. I already tried plugging in Catalyst::Plugin::Log4perl::Simple, while it redirects cgi and Catalyst's internal server to a file it does not work under fastcgi. I would think to replace the Catalyst::Log method _send_to_log which just dumps an array of messages to STDERR with one that dumped to a file instead. Or capturing STDERR to a Filehandle might be an even easier hack. In a simpler environment either of these methods should work, but with Catalyst there are issues that are beyond me. One is persistence of a Filehandle (either a log file or a captured STDERR), the other is overriding a method of an ancestor object throughout the sequence of scripts. Finally there is the question of insertion point. ___ 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] Check session expiry without extending it
Even simpler put a refresh tag in the page with a refresh a little over the session timeout value, then the site's handler for expired sessions can do the rest. -Original Message- From: Alexander Hartmaier [mailto:alexander.hartma...@t-systems.at] Sent: Wednesday, March 03, 2010 10:03 AM To: The elegant MVC web framework Subject: Re: [Catalyst] Check session expiry without extending it Why not return the datetime when the session expires with every page and have a client-side js that does the redirect without hammering the server? -- Best regards, Alex Am Dienstag, den 02.03.2010, 21:43 +0100 schrieb Steve Kleiman: Using Catalyst::Plugin::Session with Session::State::Cookie. Would like to be able to poll server if the user's session has expired WITHOUT extending the session itself. The objective is to have a javascript periodical executor check if a session is expired and redirect user to a Your session has expired page if appropriate. Could do it in javascript but would prefer doing it on server. Anyone tried this? Thanks in advance. -Steve Kleiman ___ 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/ *** T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *** Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *** ___ 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] Check session expiry without extending it
Never mind, that's too simple. It breaks if users open up multiple pages unless you increase the refresh to just over twice the timeout, which may be an issue since presumably you don't want your user's expired sessions hanging around in their browser. Even simpler put a refresh tag in the page with a refresh a little over the session timeout value, then the site's handler for expired sessions can do the rest. -Original Message- From: Alexander Hartmaier [mailto:alexander.hartma...@t-systems.at] Sent: Wednesday, March 03, 2010 10:03 AM To: The elegant MVC web framework Subject: Re: [Catalyst] Check session expiry without extending it Why not return the datetime when the session expires with every page and have a client-side js that does the redirect without hammering the server? -- Best regards, Alex Am Dienstag, den 02.03.2010, 21:43 +0100 schrieb Steve Kleiman: Using Catalyst::Plugin::Session with Session::State::Cookie. Would like to be able to poll server if the user's session has expired WITHOUT extending the session itself. The objective is to have a javascript periodical executor check if a session is expired and redirect user to a Your session has expired page if appropriate. Could do it in javascript but would prefer doing it on server. Anyone tried this? Thanks in advance. -Steve Kleiman ___ 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/ *** T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *** Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *** ___ 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] Check session expiry without extending it
The more I think about this, the more problems I see with my idea, you need to either restrict your users to one browser window (possibly with a secondary page key of some sort) or have the refresh bounce to an alternate uri that refreshes the page without updating the server's session timer. Never mind, that's too simple. It breaks if users open up multiple pages unless you increase the refresh to just over twice the timeout, which may be an issue since presumably you don't want your user's expired sessions hanging around in their browser. Even simpler put a refresh tag in the page with a refresh a little over the session timeout value, then the site's handler for expired sessions can do the rest. -Original Message- From: Alexander Hartmaier [mailto:alexander.hartma...@t-systems.at] Sent: Wednesday, March 03, 2010 10:03 AM To: The elegant MVC web framework Subject: Re: [Catalyst] Check session expiry without extending it Why not return the datetime when the session expires with every page and have a client-side js that does the redirect without hammering the server? -- Best regards, Alex Am Dienstag, den 02.03.2010, 21:43 +0100 schrieb Steve Kleiman: Using Catalyst::Plugin::Session with Session::State::Cookie. Would like to be able to poll server if the user's session has expired WITHOUT extending the session itself. The objective is to have a javascript periodical executor check if a session is expired and redirect user to a Your session has expired page if appropriate. Could do it in javascript but would prefer doing it on server. Anyone tried this? Thanks in advance. -Steve Kleiman ___ 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/ *** T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *** Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *** ___ 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/