Re: [Catalyst] A Perl Message Queue?
I don't know if you can do Queing but from Jesper's description it didn't seem like order was important. Seemed to me that he just wanted to stash something away and grok it later on. Thats pretty much the requirement. But it needs to be fail-tolerant and survive a reboot of the computer without loosing messages. Jesper -- Jesper Krogh ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] A Perl Message Queue?
Hi. This is quite off-topic related to Catalyst but my googling didn't reveal anything. Has anyone seen stuff like a Messages Queue (I dont have other words for it) But a more generic implementation of a thing where you can put in messages and pick them out in some other part of the program. It would be nice when you have stuff that takes longer that people usually can wait for. Jesper -- Jesper Krogh ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Reference to the connected Model::DBIC schema for testing?
Matt S Trout wrote: Drew Taylor wrote: On 10/10/06, Matt S Trout [EMAIL PROTECTED] wrote: my $model_dbic_schema_object = MyApp-model('Foo'); Shouldn't the name actually be $model_dbic_resultset_object? I'm still trying to wrap my head around _all_ of DBIC, so I'm not just being pedantic. :-) No. MyApp::Model::Foo isa C::M::DBIC::Schema If you had a Bar class in the relevant schema, MyApp-model('Foo::Bar') would give you a DBIx::Class::ResultSet though. What if you want to access the ResultSource ? Situation: I sometimes find that I need create-logic and I would really like to put it into the schema-definitions classes (ResultSource if I'm not wrong), but I cannot seem to get direct access to those from within Catalyst? Jesper -- Jesper Krogh, [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Executing external applications from catalyst.
Hi Jesper, I found your entries about Catalyst and Open3 stepping on each others' toes. Do you know, is there a workaround or solution? I ended up redirecting it to a file: use File::Slurp; my @cmd = (signalp,-t,$self-{sigporganism},$seqf); my $cmd = join( ,@cmd) . 2 $seqerr $seqout; `$cmd`; my $stdout = read_file($seqout); my $stderr = read_file($seqerr); I can get stdout on the fly, as open FILE,command |; Otherwise I found that I neede the temporary files. Jesper -- Jesper Krogh ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Testserver dies under IE - patch
Hi all. This is a small patch that makes the testserver survive Internet Explorer.. This is probably not the correct fix.. since that would be to find out what the problem is.. Somehow it seems that the socket dissapears earlier when IE it in the other end. patch --- /usr/share/perl5/Catalyst/Engine/HTTP.pm2006-07-19 23:45:16.0 +0200 +++ lib/Catalyst/Engine/HTTP.pm 2006-10-03 11:43:42.0 +0200 @@ -305,13 +305,14 @@ my ( $self, $handle ) = @_; my $remote_sockaddr = getpeername($handle); -my ( undef, $iaddr ) = sockaddr_in($remote_sockaddr); +my $iaddr; + ( undef, $iaddr ) = sockaddr_in($remote_sockaddr) if $remote_sockaddr; my $local_sockaddr = getsockname($handle); my ( undef, $localiaddr ) = sockaddr_in($local_sockaddr); my $data = { -peername = gethostbyaddr( $iaddr, AF_INET ) || localhost, -peeraddr = inet_ntoa($iaddr) || 127.0.0.1, +peername = $iaddr ? gethostbyaddr( $iaddr, AF_INET ) || localhost/Uknown, +peeraddr = $iaddr ? inet_ntoa($iaddr) : 127.0.0.1/Unknown, localname = gethostbyaddr( $localiaddr, AF_INET ) || localhost, localaddr = inet_ntoa($localiaddr) || 127.0.0.1, }; Stacktrace: Use of uninitialized value in subroutine entry at Socket::sockaddr_in(/usr/lib/perl/5.8/Socket.pm:198) at Catalyst::Engine::HTTP::_socket_data(/usr/share/perl5/Catalyst/Engine/HTTP.pm:308) at Catalyst::Engine::HTTP::_handler(/usr/share/perl5/Catalyst/Engine/HTTP.pm:220) at Catalyst::Engine::HTTP::run(/usr/share/perl5/Catalyst/Engine/HTTP.pm:172) at Catalyst::run(/usr/share/perl5/Catalyst.pm:1754) at main::(./script/nzdb_server.pl:54) Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16 at Socket::sockaddr_in(/usr/lib/perl/5.8/Socket.pm:198) at Catalyst::Engine::HTTP::_socket_data(/usr/share/perl5/Catalyst/Engine/HTTP.pm:308) at Catalyst::Engine::HTTP::_handler(/usr/share/perl5/Catalyst/Engine/HTTP.pm:220) at Catalyst::Engine::HTTP::run(/usr/share/perl5/Catalyst/Engine/HTTP.pm:172) at Catalyst::run(/usr/share/perl5/Catalyst.pm:1754) at main::(./script/nzdb_server.pl:54) -- Jesper Krogh ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Testserver dies under IE - patch
Hi all. This is a small patch that makes the testserver survive Internet Explorer.. This one even works.. --- /usr/share/perl5/Catalyst/Engine/HTTP.pm2006-07-19 23:45:16.0 +0200 +++ lib/Catalyst/Engine/HTTP.pm 2006-10-03 12:02:25.0 +0200 @@ -305,13 +305,14 @@ my ( $self, $handle ) = @_; my $remote_sockaddr = getpeername($handle); -my ( undef, $iaddr ) = sockaddr_in($remote_sockaddr); +my $iaddr; +( undef, $iaddr ) = sockaddr_in($remote_sockaddr) if $remote_sockaddr; my $local_sockaddr = getsockname($handle); my ( undef, $localiaddr ) = sockaddr_in($local_sockaddr); my $data = { -peername = gethostbyaddr( $iaddr, AF_INET ) || localhost, -peeraddr = inet_ntoa($iaddr) || 127.0.0.1, + peername = $iaddr ? gethostbyaddr( $iaddr, AF_INET ) : localhost/Unknown, + peeraddr = $iaddr ? inet_ntoa($iaddr) : 127.0.0.1/Unknown, localname = gethostbyaddr( $localiaddr, AF_INET ) || localhost, localaddr = inet_ntoa($localiaddr) || 127.0.0.1, }; Jesper -- Jesper Krogh ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] -render for Catalyst::View::Mason
Hi all catalyst/mason users. This patch implements the -render method on Catalyst::View::Mason (should work the excact same way as -render on Catalyst::View::TT) my $doc = $c-view(Mason)-render($c,/path/to/template,{arg = value}); Jesper -- Jesper Krogh--- /usr/share/perl5/Catalyst/View/Mason.pm 2005-11-09 16:14:58.0 +0100 +++ lib/Catalyst/View/Mason.pm 2006-09-27 14:51:51.0 +0200 @@ -122,7 +122,31 @@ $component_path = '/' . $component_path; } -$c-log-debug(qq/Rendering component $component_path/) if $c-debug; +my $doc = $self-render($c,$component_path); +unless ( $c-response-content_type ) { +$c-response-content_type('text/html;charset=utf8'); +} + +$c-response-body($doc); + +return 1; +} + +=head3 render($c,$template,\%args) + +This method is inspired from Catalyst::View::TT it allows to render a +template at get it back into Catalyst. If %args isn't supplied +the $c-stash is used instead. + + +my $doc = $c-view(Mason)-render($c,/path/to/template,{data = value}); + +=cut + +sub render { +my ($self, $c, $template, $args) = @_; + +$c-log-debug(qq/Rendering template $template/) if $c-debug; # Set the URL base, context and name of the app as global Mason vars # $base, $c and $name @@ -136,28 +160,20 @@ eval { $self-template-exec( -$component_path, -%{ $c-stash },# pass the stash +$template, +%{ $args || $c-stash },# pass the stash ); }; if ( my $error = $@ ) { chomp $error; -$error = qq/Couldn't render component $component_path - error was $error/; +$error = qq/Couldn't render component $template - error was $error/; $c-log-error($error); $c-error($error); return 0; } - -unless ( $c-response-content_type ) { -$c-response-content_type('text/html;charset=utf8'); -} - -$c-response-body( $self-{output} ); - -return 1; +return $self-{output}; } - =head3 config This allows your view subclass to pass additional settings to the___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Need example of Catalyst with Mason View
Kevin Old wrote: In the actual Mason view treat it just like any other Mason page. The $c object is available and the stash can be called like % $c-stash %. Its even easier.. $c-stash-{name} directly matches: %args $name /%args No need to fiddle around with $c for that. Jesper -- Jesper Krogh, [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/