Re: [Catalyst] Re: XML MIME types

2007-09-25 Thread Ash Berlin
A. Pagaltzis wrote:
> * Ash Berlin <[EMAIL PROTECTED]> [2007-09-25 19:20]:
>> Since its XUL and this is Firefox only, thats okay. But as a
>> general point, ISTR application/xml is hideously broken with IE
> 
> Do you remember anything about how that would be? I know of no
> such problem.
> 
> Regards,

Its more when you try to serve XHTML1.1 properly with the
appliction/xhtml+xml mime type. IE just does "What do you want to do
with this xml file?"

Sorry - mis-leading on my behalf.

___
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] XML MIME types

2007-09-25 Thread Ash Berlin
A. Pagaltzis wrote:
> * Javier E. Perez P. <[EMAIL PROTECTED]> [2007-09-23 10:20]:
>> i already change the http header content_type to text/xml
> 
> Don’t use `text/xml`, it is broken for numerous esoteric reasons,
> mostly to do with encodings. The easiest completely correct thing
> you can do is to use `application/xml` without a charset parameter
> in the HTTP header, making sure you specify the document encoding
> in the XML preamble instead.
> 
> Regards,

Since its XUL and this is Firefox only, thats okay. But as a general
point, ISTR application/xml is hideously broken with IE - depends if
that is a problem to your application or not.



___
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] Mojomojo installation

2007-09-17 Thread Ash Berlin
Bernhard Graf wrote:
> Hi all,
> 
> I wanted to check out latest Mojomojo from CPAN, but got several 
> failures in the installation:

[snip]
> - t/c/page_edit.t fails test #4 and #6 because the order of the expected
>   HTML attributes is not the same (expects 
>  
>   but gets
>  )
[snip]

That is the very reason why i wrote WWW::Mechanize::TreeBuilder:
http://search.cpan.org/dist/WWW-Mechanize-TreeBuilder-1.2/lib/WWW/Mechanize/TreeBuilder.pm

>From the synopsis (altered to show specific example as above):

 use Test::More tests => 2;
 use Test::WWW::Mechanize::Catalyst 'MyApp';

 my $mech = Test::WWW::Mechanize::Catalyst->new;
 WWW::Mechanize::TreeBuilder->meta->apply($mech);

 $mech->get_ok('/');
 ok( $mech->look_down(
   _tag => 'input',
   name => 'parent',
   type => 'hidden',
   value => '' ), 'Found expected tag.' );

___
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] Some guidance needed please

2007-09-13 Thread Ash Berlin
Simon Wilcox wrote:
> Matt S Trout wrote:
>> On Thu, Sep 13, 2007 at 03:14:58PM +0100, Ian Docherty wrote:
>>> Almost, if I do my $used_password = 
>>> $c->model('DBIC::UsedPassword')->result_class->create_limited();
>>>
>>> it works. So that should do for now, thanks Simon and Will for your help ;)
>> No. Don't do that.
>>
>> Really don't.
>>
>> It's utterly broken.
> 
> Thanks. I'm not as familiar with the interaction of DBIx::Class and 
> Catalyst::Model::* as you are (obviously, I didn't write 'em :) but from 
> here:
> 
> http://search.cpan.org/~ash/DBIx-Class-0.08007/lib/DBIx/Class/ResultSet.pm#result_class
> 
> I find:
> 
> result_class
> 
>  Arguments: $result_class?
>  Return Value: $result_class
> 
>  An accessor for the class to use when creating row objects. 
> Defaults
>  to result_source->result_class - which in most cases is the name of
>  the "table" class.
> 
> This seems to be the right behaviour to me. Can you summarise why it is 
> not ?
> 
> Yet over here:
> 
> http://search.cpan.org/~blblack/Catalyst-Model-DBIC-Schema-0.20/lib/Catalyst/Model/DBIC/Schema.pm
> 
> I find:
> 
> class
> 
>  Shortcut for ->schema->class
> 
> 
> So would the original be better written as:
> 
> $c->model('DBIC::UsedPassword')->class->create_limited(); # ?
> 

Wouldn't it just be nicer if you could do:

$c->model('DBIC::UsedPassword')->create

Create a new class that inherits from DBIx::Class::ResultSet. then do

__PACKAGE__->resultset_class('...::ResultSet::UsedPassword');

In your source class.

Nicer, no?

___
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] + in GET param

2007-09-11 Thread Ash Berlin
[EMAIL PROTECTED] wrote:
>> That's what uri_for is already doing (I forgot to mention I'd checked
>> already).
>>
>> uri_for:
>>
>> http://myserver.com/blah/?username=first.last%2Bme%40gmail.com
>>
>> URI::Escape:
>>
>> perl -MURI::Escape -e "print uri_escape('[EMAIL PROTECTED]')";
>>
>> first.last%2Bme%40gmail.com
>>
>> Same either way.
> 
> 
> perl -MURI::Escape -e "print uri_unescape('first.last%2Bme%40gmail.com');"
> [EMAIL PROTECTED]
> 
> Looks like it is a problem with the debug printing code or the some
> unescape code somewhere.  That is the proper escape for +.

Yes. and the problem is Catalyst is unescaping it to early, so its
seeing it as a literal +, which then gets converted to a space according
to the HTTP RFC. It shouldn't. There is a bug in the catalyst param
handling somewhere I suspect.

___
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] DBIx question

2007-08-24 Thread Ash Berlin

1) DBIx is a namespace, not a project.
2) You are talking about DBIx::Class
3)
http://search.cpan.org/~ash/DBIx-Class-0.08006/lib/DBIx/Class.pm#DESCRIPTION
4) Here come the Men in Black
5) Sorry for #4

Will Smith wrote:
> Hi, I know this is not the room for DBIx, I tried to post in DBIx, but
> did not go through, so, if you don't mind, please do not bounce me out.
> my question is:
> I have a multiple join, and trying to sort the dataset using oder_by,
> and get either error, or do not sort.
> my code is:
> # table: calls,property,city . property has many calls, city has
> many property,   calls belong to property, property belong to city
> my $rs = [$c->model('myappDB::City')->search(
> {
>   'calls.CallerID' => '1',
>   'calls.CallStatusID' => '0'
> },
> {
>order_by => 'city.CityName'
> },
> {
>   join => { 'property' => 'calls'
>}
> }
> )];
> 
> How can I sort by CityName ?
> 
> Thank you.
> 
> 
> Park yourself in front of a world of choices in alternative vehicles.
> Visit the Yahoo! Auto Green Center.
> 
> 
> 
> 
> 
> 
> ___
> 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/


___
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] A Perl Message Queue?

2007-08-23 Thread Ash Berlin
Don't use a DB as the backing store for a message queue if you will ever
need to pass a lot of messages thought it - you're just asking for
trouble doing it that way.

Hartmaier Alexander wrote:
> Database table?
> 
> -Alex
> 
> 
>> -Original Message-
>> From: Jesper Krogh [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, August 23, 2007 3:44 PM
>> To: [EMAIL PROTECTED]; "
>> "@shrek.krogh.cc
>> Subject: [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] [Semi OT] HTTP DELETEs

2007-08-08 Thread Ash Berlin

Jonathan Tweed wrote:

Hi

Sorry if this is too off topic but I can't think of anywhere else to 
ask. Plus the system in question is a Catalyst app ;-)


Can an HTTP DELETE have an entity body? I have looked in the HTTP spec 
and as far as I can see it doesn't say.


The use case is when someone deletes a resource they want to be able to 
specify the reason why they deleted it. If it's legal for a DELETE to 
have a body they could put the reason in there. If not, is it a 
reasonable use of a custom header?


Thanks
Jonathan

As far as I am aware, _all_ HTTP requests can have bodies, with the 
possible exception of GET...


ash

___
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] Canonical address changes from rawmode.org -> scsys.co.uk

2007-08-08 Thread Ash Berlin

Matt S Trout wrote:

I'm sick of having to interrupt gabb in .cz every time the list server moves
IP so I'm centralising stuff under an SC domain.

The lists.scsys.co.uk URLs and mail acceptors -should- already work and I'm
not going to turn lists.rawmode.org off just yet but people seem to have
missed the announce on the DBIC list and keep complaining their sieve
configs don't work, so can you all get this done -now- and I'll cut it over
later please :)

Also, somebody get the cat docs changed and a new manual release ready.


Done: http://bowser.firemirror.com/~ash/Catalyst-Manual-5.700704.tar.gz

___
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] overload/override sub? (Session::PerUser)

2007-08-06 Thread Ash Berlin
Fernan Aguero wrote:
> Hi,
> 
> I'd like to overload (or would it be override?) the
> merge_session_to_user sub in
> Catalyst::Plugin::Session::PerUser to be able to guide the
> hash merge (i.e. create new hash value keys for conflicting
> keys).
> 
> Now, where and how should I do the overriding? Excuse my ignorance
> ... but I've never done this and searching for 'Perl
> overload' always gets me to instructions on how to overload
> built-in operators ...
> 
> Thanks in advance,
> 
> Fernan

Redefine is the term in perl-lingua.


In MyApp.pm:

{
  no warnings 'redefine';

  sub merge_session_to_user {
# your new sub

# ...

# To call the previous implementation if you should want it:
# $self->NEXT::merge_session_to_user(@args);
  }
}

The key thing to remember here is that all Cat plugins 'pollute' the $c
namespace, which isa Myapp.

HTH
Ash

___
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] accessing methods in another controller?

2007-08-05 Thread Ash Berlin
Alan Spector wrote:
> Hi all,
> 
> I had a quick question, what is the best way within a Controller to  
> access  a method in another controller?  or is it better to put the  
> method (it's a fetch for data in a particular format) in my Model?
> 
> tia,
> 
> alan
> 

$c->controller('OtherController')->foo($c)

Its that simple. There is a $c->forward method (look in Catalyst.pm for
docs) but most of the time you don't need to use it.

___
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] YAML Config

2007-07-24 Thread Ash Berlin
Oleg Pronin wrote:
> >I don't even know what those do. Why do you want them? 
> 
>  
> &anchors are used to define an anchor on variable.
> *aliases are used to insert previously defined anchor's value.
>  
> For example,
> root_dir: &root /very/long/path/to/root/dir
> root_dir2: *root
>  
> print MyApp->config->{root_dir2}; # /very/long/path/to/root/dir
> 
>  

Good reason for using them.

Shame it appears nothing in perl supports them. If you want to use them
i suggest you submit a patch against the YAML module of your choice.


___
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] YAML Config

2007-07-24 Thread Ash Berlin
Oleg Pronin wrote:
> Hi.
>  
> I would like to use references to variables that have been defined in my
> yaml config.
>  
> Something like this:
>  
> var_dir: &var __path_to(var)__
>  
> log_dir: &log *var/log
> log_file: *log/file.txt
>  
> This is a feature of YAML 1.0.
> But it seems that only *pure* aliases (*var) work only in YAML::Syck &&
> YAML::XS
> log_dir: &log *var
>  
> YAML dies with "YAML Error: Can't define both an anchor and an alias".
>  
> And it is not clear for me how to modify *var to say: (this is a syntax
> error in all parsers)
> log_dir: &log *var/log
>  
> How to use other variables' values in yaml config?
> 
>

"Don't?"

I don't even know what those do. Why do you want them? whats wrong with
just text values?

___
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] Suggestion for FastMmap related plugin handling

2007-07-21 Thread Ash Berlin
Seems like a bug in Cache::FastMmap. I'll get round to fixing it in my
fork (Cache::FastMmap::With::Win32) - that or get co-maint on the proper
one.

Fancy writing a me a failing test case against either CPAN'd modules?

apv wrote:
> I got a small bite by unexpected behavior when setting the storage  
> source for CP::Session::Store::FastMmap with path_to().
> 
> I went from using a static string to a path_to representing the  
> identical path and it broke the storage. It also, I think, fails  
> silently in the case of CP::Cache::FastMmap.
> 
> It took a minute to realize that path_to is returning a Class::Path  
> object. This stringifies fine most of the time but I think b/c  
> FastMmap has underlying C code it doesn't know what to do with the  
> path_to object (just a guess).
> 
> This is broken silently:
>  cache => {
>  backend => {
>  store => 'FastMmap',
>  share_file => __PACKAGE__->path_to('tmp', 'another_cache'),
>  },
>  },
> 
> This is broken fatally:
>  session  => {
>  storage => __PACKAGE__->path_to('tmp', 'cache_name'),
>  },
> 
> While these work fine:
>  cache => {
>  backend => {
>  store => 'FastMmap',
>  share_file => __PACKAGE__->path_to('tmp',  
> 'another_cache')->stringify,
>  },
>  },
>  session  => {
>  storage => __PACKAGE__->path_to('tmp', 'cache_name')- 
>  >stringify,
>  },
> 
> Would it be a good idea to change the  
> Catalyst::Plugin::Session::FastMmap::setup() to quote sources?
> I couldn't easily see where it *might* benefit from a change in  
> CP::Cache.
> 
> sub setup {
>  my $self = shift;
> ###$self->config->{session}->{storage} ||= '/tmp/session';
>  my $storage = $self->config->{session}->{storage} || '/tmp/ 
> session'; # NEW
>  $self->config->{session}->{expires} ||= 60 * 60 * 24;
>  $self->config->{session}->{rewrite} ||= 0;
> 
>  $self->_session(
>  Cache::FastMmap->new(
>   ### share_file  => $self->config->{session}->{storage},
>  share_file  => "$storage", # NEW
>  expire_time => $self->config->{session}->{expires}
>  )
>  );
>  return $self->NEXT::setup(@_);
> }
> 
> -Ashley
> 
> ___
> 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/


___
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] accessing ResultSet function from a related object

2007-07-04 Thread Ash Berlin

John Goulah wrote:
I am having some trouble in both controller and template code accessing 
resultset functions off of chained/related objects (because from what 
I'm seeing they are not ResultSets but of the type 
MyApp::Model::MyAppDB::Tablename). 


For example I can create a ResultSet object directly like:
my $owner = $c->model('MyDB::User')->search({ user_id => $owner_id } );

and then I can do for example:

$owner->some_result_set_method()

but I can't do this if I want to chain off another object, such as:

#not ok
my $owner_id = 
$photo_details_rs->first()->owner->some_result_set_method();


but...

#this is fine, just accessing a field
my $owner_id = $photo_details_rs->first()->owner->user_id;   

and if I have some relation such as 'primary_photo' defined, then in my 
template this is also ok on this model type object:


   comment.user.primary_photo.asset.url

but if I wanted to call a method defined in my ResultSet, its not working:

comment.user.some_result_set_method
   

I understand this is because comment.user is of type Model, but it seems 
there would be some way to call these functions since in this case I 
need to get at the user object from each comment since thats whats being 
iterated-


Thanks,
John



Wrong list entirely. You are asking what appears to be a DBIx::Class 
question: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class


___
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] Sending email from Catalyst and scripts

2007-05-23 Thread Ash Berlin

mark wrote:

Exactly; sending the email in end() after the page has been sent off would
not delay the page loading...

Mark



Except that end is before the page has been sent back to the browser.

You would need some kind of hook in what ever engine you are using to 
support that. Not a bad idea mind, but I dont think anything exists 
currently.


-ash

___
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] C:P:Session::Store::FastMmap

2007-05-08 Thread Ash Berlin

Octavian Rasnita wrote:
I also thought that, but I was able to install Cache-FastMmap-1.15 under 
Windows. (I found about this version on this list).


http://perlitist.com/static/Cache-FastMmap-1.15.tar.gz

The author has been in touch with me, and I've made the changes he asked 
for, so hopefully it should be avaiable to CPAN soon.


Ash

___
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] FastMmap.pm

2007-05-02 Thread Ash Berlin

RA Jones wrote:

Dmitri Pissarenko wrote:

I couldn't find FastMmap.pm via ppm.

How can I fix this error?

You will probably get more authoritative answers, but the problem is
that FastMmap doesn't work under Win32. You can get round it by using 
  Session::State, Session::Store and Session::Store::DBIC plugins. 
Everything in the tutorial (and real world) does work (eventually) on 
Win32.


Incorrect - it has just no been released to cpan yet (i have to refactor 
it before the author will accept the patch)


http://perlitist.com/articles/Cache::FastMmap%20and%20Win32.pod

___
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] Hats off and some Clarifications.

2007-04-18 Thread Ash Berlin
Please sort out your email client to not use such a small font if you 
insist on sending html emails.


Ta
Ash

___
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] unit testing Chuck Norris style

2007-04-17 Thread Ash Berlin

Andrew Strader wrote:
[snip]

I see no round house kicks

___
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] YAPC::Europe Call for Hackathons

2007-04-04 Thread Ash Berlin

Thomas Klausner wrote:

Hi!

YAPC::Europe 2007 is looking for people who would like to moderate a ~3
hour hackathon on e.g. Catalyst.

You can find more information on what we're looking for and what we can 
offer to moderators (eg travel funding) on our website:

  http://vienna.yapceurope.org/ye2007/cfh.html

We're also still looking for regular talks:
  http://vienna.yapceurope.org/ye2007/cfp.html

Hope to see you in Vienna,
Thomas Klausner
on behalf of Vienna.pm



What is involved in moderating such a beast?

___
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] Catalyst Exception received by e-mail?

2007-03-27 Thread Ash Berlin

Dylan Vanderhoof wrote:

I'm sure there's a better way to do it, but I have some code in
Root->end() that effectivly does (pseudocode):

If( $error && !$debug ) {
   email_stacktrace();
   clear_error();
   template = 'default_error.tt';
}

The one problem with doing it like that is that if you die in the view
somewhere, you don't get emailed.  I haven't had time to look into it
much further since we almost never have a failure in the view.

-D


-Original Message-
From: Igor Longagnani [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 27, 2007 8:12 AM

To: catalyst@lists.rawmode.org
Subject: [Catalyst] Catalyst Exception received by e-mail?


Hi,
still a rookie here; some time has passed since my last question,
because i had many other things to do,
but now I am back with many questions and really few answers :) 
Iam sure You can help, let's say you almost always did :)


 I should force my Catalyst based app to send an e-mail on every
exception/error,
 just before sending it (the exception) out on the video when 
the app dies.
I mean I'd like to see the exception both on the screen and 
on e-mail. I

like those complete scrolling screens
when something bad happens ...

Well Catalyst helps me a lot in not making errors but ... 
thats why I'd

love to be notified when it happens
I thought someone had already put something to extend Catalyst
Exception, but i wasnt able to find nothing appropriate.

Any clue?

Thanks in advance,
Igor


--
Igor Longagnani c/o Synervis
---
e-mail: [EMAIL PROTECTED] phone : +39 059 558442

sede operativa: via Pirandello, 49/51 - 41043 Formigine (Mo) Italia



Look at finazlie_error(s?) in Catalyst (you'd create a sub 
finalize_error in MyApp.pm) for a better place to do this


ash

___
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] html escaping question

2007-03-21 Thread Ash Berlin



Mario Minati wrote:

Hello @all,

as you could help me that fast and excellent yesterday I have an other 
question to you ;)


What is the best/common practice to get text that might containt html 
escapable characters (e. g. '&', '<') from a form field to catalyst to db and 
back to form field?


At the moment I'm thinking of not doing any html escaping at all and believe 
in unicode to handle the encoding correctly, but I would ran into problems 
with ''. 

So if I escape a string and send it back to the form the content of the 
textfield is ''. Why is that?


Again every thought is allmost welcome.

Greets,
Mario Minati


I'll asume you are using TT since you didn't say otherwise'

[% '' | html %]

___
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] Catalyst::Plugin::ConfigLoader::Environment on windows

2007-02-10 Thread Ash Berlin

Jonathan Rockway wrote:

On Friday 09 February 2007 21:03, Greg McAlpin wrote:

Hi.

  Trying to install Angerwhale and running into a problem with one of the
tests for Catalyst::Plugin::ConfigLoader::Environment.  I hope that it's
okay to post this to this list.  I would appreciate any help.


I suggest installing it under Cygwin -- you're going to have lots of trouble 
with the dependencies (Cache::FastMmap isn't going to work, probably) on 
plain Windows.  I know for a fact that Angerwhale works fine under Cygwin, 
though; I occasionally do development there.


http://perlitist.com/articles/Cache::FastMmap%20and%20Win32.pod

It works fine now



___
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] CGI::State style Plugin?

2007-02-09 Thread Ash Berlin

Jim Spath wrote:

I was considering using the following module in my Catalyst app.

http://search.cpan.org/~dkubb/CGI-State-0.02/State.pm

Until I saw that it does a "use CGI;", the only purpose of which is for 
the creation of a CGI object if you don't pass one in.


So I went ahead and wrote a plugin for Catalyst that provides the same 
functionality using $c->request.  This was partially because I want the 
functionality that CGI::State provides and partially to learn a little 
more about Catalyst.


I had a few questions about it:

- Should I call it Catalyst::Plugin::CGI::State or something else?  I 
was thinking of something like Catalyst::Plugin::StructureParams, but I 
wasn't sure since it's based so heavily off CGI::State.  On the other 
hand, it doesn't use CGI or CGI::State anymore.


- It would most likely provide two methods
my $structure = $c->params_to_structure;
$c->structure_to_params($structure)
  Do these names make sense?  Are they acceptable?

- Does anyone think this plugin is worth releasing publicly?

Thanks!
- Jim


Have you looked at Catalyst::Plugin::Params::Nested to see if that does 
what you want first?


Ash

___
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] Using $c->view('TT')->render for emails

2007-02-06 Thread Ash Berlin

Jim Spath wrote:
In the docs for Catalyst::View::TT and Catalyst::Plugin::Email, it 
suggests using $c->view('TT')->render() for the rendering of email 
templates.


My issue is that I created my Catalyst view with TTSite as described in 
the CatalystBasics tutorial, and when I call the render method on the 
email template, all of the site templates (header, footer, etc) are 
pulled in, when all I really want is the email template by itself.


What is the right solution?  Should I create a new view just for email 
templates?  Should I modify my existing view in some way to allow it to 
output both normal site templates and one-off templates?  


Any of the above ( tho modify the templates, not the View)


Should I not use render() for email templates?


No - thats what I and a lot of others use

Ash


___
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] uri_for() and Chained endpoints: a proposed convenience method

2007-01-26 Thread Ash Berlin

Jason Gottshall wrote:

In using chained dispatch, I found that getting URIs for specific
endpoints felt a bit clumsy:

  package MyApp::C::Foo;

  sub get_foo : Chained('/')   PathPart('foo') CaptureArgs(0) {}
  sub do_bar  : Chained('foo') PathPart('bar') Args(2) {}

  package MyApp::C::Qux

  sub index: Private {
my ( $self, $c ) = @_;
my $query = { search => 'something' };

# redirect to "/foo/bar/baz/qux?search=something"
$c->res->redirect( 
  $c->uri_for->( 
$c->controller('Foo')->action_for('do_bar'), [qw/baz qux/],

$query
  ) 
);

  }

I wanted a way to condense the fairly wordy call to
$c->controller()->action_for(), so I added the following convenience
method to MyApp.pm:

  sub uri_for_endpoint {
my ( $c, $endpoint, @args ) = @_;
my ( $controller, $action ) = ( split m[/], $endpoint, 2 )[ -2, -1
];
return $c->uri_for( 
  $c->controller($controller)->action_for($action), 
	@args

);
  }

Now I can rewrite the call to uri_for() like this:

  #   $c->uri_for->( 
  # $c->controller('Foo')->action_for('do_bar'), [qw/baz qux/],

$query
  #   )
  $c->uri_for_endpoint( 'foo/do_bar', [qw/baz qux/], $query )

My questions to the list are as follows:

1) Is my convenience method a sensible approach, or is there a "better"
way to do this?
2) The method I wrote seems to work correctly. Did I miss anything?
3) Is this useful enough to other folks to be worth adding to the dist
somewhere?

All feedback (including things like "You're too lazy") appreciated!
  
I made an attempt at this before - my code is in 
http://dev.catalyst.perl.org/browser/branches/Catalyst-Runtime-ctx-uri_for_action


See inparticular 
http://dev.catalyst.perl.org/browser/branches/Catalyst-Runtime-ctx-uri_for_action/t/unit_core_uri_for_action.t 
(I think)


Ash

___
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] info basic stash problem...maybe i am too tired this sunday

2007-01-14 Thread Ash Berlin

Igor Longagnani wrote:

Hi, newbie here...
i thought i had understood stash behaviour... but prolly not :)

I can use it together with DBIx::Class resultsets and so on, BUT now i
would like to put  such an hashref

$chiavi= {
  'ka-111-234-586' => '0',
  'ka-90-85-349' => '0',
  'ka-5-21-629' => '0',
  'ka-1-406-194' => '0',
  'ka-111-194-479' => '1',
  'ka-1-451-540' => '0',
  'ka-1-254-610' => '0',
  'ka-1-216-571' => '0',
  ... more data...
};

into the stash  e.g.   $c->stash->{allegati} = $chiavi;
then  i would like to use something like


[ FOREACH ... %]
...

[% currentkey = ...%]


[% allegati.currentkey %]


The problem is this last [% allegati.currentkey %]  is always empty even
if i am sure i am asking for an existing key of the hash ref.
What am i doing wrong?
I know it is something silly ... but still makes me doubt about my
comprehension of the stash

Any wise suggestion?


Yes - show us the code for the action and the full template - the info 
you've given isn't enough do divine the problem.


Ash

___
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] Reaction Authentication

2007-01-14 Thread Ash Berlin

Jonas Alves wrote:

Hi all,
I was starting to put authentication in a Reaction application that i'm 
developing when I saw that Reaction has this classes:


Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques;
Reaction::InterfaceModel::Action::DBIC::User::ChangePassword;
Reaction::InterfaceModel::Action::DBIC::User::ResetPassword;
Reaction::InterfaceModel::Action::DBIC::User::Role::SetPassword;
Reaction::InterfaceModel::Action::User::ChangePassword;
Reaction::InterfaceModel::Action::User::ResetPassword;
Reaction::InterfaceModel::Action::User::SetPassword;

It appears that Reaction already has some facilities to do auth stuff. 
How can I use this classes to help me?


Thanks a lot,
--
Jonas



Not having used Reaction myself BUT I suspect that these are for 
updating existing profile info in the DB.


Do the authentication the same way you would in a normal Catalyst app.

Ash

___
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] faking $c->user in tests

2007-01-13 Thread Ash Berlin

Daniel McBrearty wrote:

heh ... cheers ... think I've sussed it :

my $ue = 1;
my $username = 'NotAnAdmin';
use Test::MockObject;
my $user = Test::MockObject->new;

$user->mock( 'id',
sub {return $username} );

package MyApp;

sub user {
 return $user;
}

sub user_exists {
 return $ue;
}

package main;
...

at least it looks sane at the mo ...


On 1/13/07, Ash Berlin <[EMAIL PROTECTED]> wrote:

Daniel McBrearty wrote:
> in test scripts I am able to (for instance) mess with the config my 
doing

>
> my $config = MyApp->config;
> $config->{some_val} = 'test value';
>
>
> given that I am happy that my Authentication code is well tested in
> some other test script, is there a way to somehow bypass it, forcing
> calls to $c->user_exists and $c->user in the module I'm testing to
> return values which I directly control in the test script?
>
> thanks
>
> Daniel
>
>

Slightly hacky but something like:

{
   no warnings 'redefine'; # Not sure if this will be needed in this case
   *MyApp::user = sub { return bless {id=>'foo'}, MyApp::UserClass };
}

Might work. Or it might blow up in your face cos you looked at it funny
- YMMV.

-ash



Yeah that looks reasonable enough

___
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] faking $c->user in tests

2007-01-13 Thread Ash Berlin

Daniel McBrearty wrote:

in test scripts I am able to (for instance) mess with the config my doing

my $config = MyApp->config;
$config->{some_val} = 'test value';


given that I am happy that my Authentication code is well tested in
some other test script, is there a way to somehow bypass it, forcing
calls to $c->user_exists and $c->user in the module I'm testing to
return values which I directly control in the test script?

thanks

Daniel




Slightly hacky but something like:

{
  no warnings 'redefine'; # Not sure if this will be needed in this case
  *MyApp::user = sub { return bless {id=>'foo'}, MyApp::UserClass };
}

Might work. Or it might blow up in your face cos you looked at it funny 
- YMMV.


-ash

___
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] C::V::PDF? (Anybody have one?)

2007-01-10 Thread Ash Berlin

[EMAIL PROTECTED] wrote:

[snip]


which unfortunately Template::Latex does not yet do!


Have you emailed the author with a patch?

___
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] Modifying a value returned with DBIC

2007-01-05 Thread Ash Berlin

Octavian Rasnita wrote:

Hi,

I want to get some messages from a database using DBIx::Class, then to 
pass them to TT, but I also want to make some preformatting before 
sending to TT.

(I don't know if TT can do what I want).

I did:

@messages = $c->model("Db::Forum")->search({
id_room => $id_room,
},
{
join => "id_user",
prefetch => "id_user",
rows => $c->user->nr_messages || 10,
order_by => 'date desc, time desc',
});

$c->stash->{messages} = [EMAIL PROTECTED];

But I want to replace \n in the body of the messages with , and 
who knows, maybe other such format changes.


Which is the recommended way of doing this?
Should I loop @messages in the program, get each value, modify it and 
store it into another array then send it to TT, or there is another more 
elegant method?


Thank you.

Octavian


Look at TT's Filters - chances are it will have one to do what you want.

Ash

___
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] How safe are database transactions?

2007-01-04 Thread Ash Berlin

Xavier Robin wrote:

Hello all,

I'm sorry if it is the wrong list, but I thought it was more a 
Catalyst-specific issue than a DBIx::Class one, as it is about the way 
Catalyst uses DBIx::Class.


I would like to use transactions in Catalyst.

my $transaction = $c->model('MyAppDB')->storage;
$transaction->txn_begin;
eval {
# Do some insertions with $c->model('MyAppDB::Table')->create()
};
if ($@) {
$transaction->txn_rollback;
}
else {
$transaction->txn_commit;
}




$c->model('MyAppDB')->txn_do(sub {
  # Do some insertions here
});


That will handle rollback/commit for you - I've never noticed any 
problems, but them I've not done much multiuser testing yet.


Ash

___
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] RFC $c->uri_to

2007-01-03 Thread Ash Berlin

Michael Reece wrote:
$c->uri_for() is great and all, but i usually am more interested in 
getting a uri for an action rather than a uri to a template (or public 
path).


(incidentally, i feel uri_for would be better named uri_to, and the sub 
below named uri_for, but i digress.)


the following code is what i have come up with.  i present it here for 
feedback, comments, etc.


## my $uri = $c->uri_to( $controller_path, @path_args );
## my $uri = $c->uri_to( $controller_path, @path_args, \%query_args );
## my $uri = $c->uri_to( $controller_path, @path_args, [EMAIL PROTECTED] );
# for :Regex() actions
#   $controller_path is '/controller/method' (preferred) or 'method' (in 
current $c->controller)

sub uri_to {
my $c = shift;
my $namespace = shift;
my @args  = @_;

my @path_args;
my $snippets;
my $query;
foreach (@args) {
if (ref eq 'ARRAY') {
$snippets = $_;
} elsif (ref eq 'HASH') {
$query = $_;
} else {
push @path_args, $_;
}
}

my $path = $namespace;
unless ($path =~ m{^/}) {
my $ns = $c->namespace;# get current namespace
if ($ns eq '') {
$path = "/$path";  # Root controller has namespace=''
} else {
$path = "/$ns/$path";
}
}

my $action = $c->dispatcher->get_action_by_path($path);
unless ($action) {
$c->log->error("uri_to cannot get_action_by_path($path)");
return undef;
}

my @action_args = (defined $snippets) ? @$snippets : ();
my $uri = $c->dispatcher->uri_for_action($action, @action_args);
unless ($uri) {
$c->log->error("uri_to cannot find uri_for_action $action");
return undef;
}

my @uri_args = (defined $query) ? ($query) : ();
$uri = $c->uri_for("$uri", @path_args, @uri_args);# "stringify" 
important here

return $uri;
}

there is a good chance i am re-inventing a wheel here!



Take a look at uri_for_aciton in 
http://dev.catalystframework.org/browser/branches/Catalyst-Runtime-ctx-uri_for_action 
(see t/unit_core_uri_for_action.t) and tell me if that does what you 
wanted or not.


Ash


___
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] iterating twice over the same resultset in the template?

2007-01-03 Thread Ash Berlin

Fernan Aguero wrote:

[ or perhaps 'is it possible to clone a resultset?' ]

Hi!

I'm building a form whose elements are items taken from the
db.  And I need these items to show up in different elements
(fieldsets) of the form. More or less something like this:

With items similar to:
 'checkbox' - Item 1
 'checkbox' - Item 2
 'checkbox' - Item 3

with parts that belong to:
 'checkbox' - Item 1
 'checkbox' - Item 2
 'checkbox' - Item 3


In my controller:
my $rs = $model->search( ... );
$c->stash->{items} = $rs;

In my template (TT):


[% WHILE ( it = items.next() ) -%]
 [% it.name -%]
[% END -%]



[% WHILE ( it = items.next() ) -%]
 [% it.name -%]
[% END -%]



The problem is that the resultset is empty when I try to
iterate over it the second time. 


So far the only way I've found to make this work is
to do N separate searches, fill N stash elements, et cetera 


$rs1 = $model->search( ... ); $c->stash->{rs1} = $rs1;
$rs2 = $model->search( ... ); $c->stash->{rs2} = $rs2;
...

[% WHILE ( it = rs1.next() ) -%] ...
[% WHILE ( it = rs2.next() ) -%] ...

Is there any other way to do this? Is it possible to clone a
resultset?

Thanks,

Fernan


___
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/


1) WRONG MAILING LIST
2) RTFM
3) rs.reset.

___
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] Getting the result of the template processing

2007-01-03 Thread Ash Berlin

Marc Logghe wrote:

-Original Message-
From: Xavier Robin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 03, 2007 10:46 AM

To: catalyst@lists.rawmode.org
Subject: [Catalyst] Getting the result of the template processing

Hello all,

How to get the result of the processing of a template ?

I would like to do someting like that:

$c->stash->{template} = 'display.tt2';
my $result = $c->process_template;
# put $result in database

The processing of display.tt2 is quite long (a couple of 
seconds to go through nearly the whole database), so I would 
like to do it only once.


I'm using a TTSite view. I don't want to get the complete 
page, only the HTML code generated by the template. What 
command should I use in place of "$c->process_template"? I 
couldn't find any plugin to do that, but not sure I looked 
deeply enough to find it, though...


Hi Xavier,
I did something similar like you are trying to do. Only difference is
that the result was written to a file instead of being stored in a
database.
First you have to make sure that the output of your template is not
wrapped, because you are not interested in the complete HTML.
In order to achieve that, this thread might be of help:
http://thread.gmane.org/gmane.comp.web.catalyst.general/9823/

Second, to get your hands on the result after rendering you could do it
like this:

# only want the output from the template,
# no wrapping wanted
$c->stash->{nowrap} = 1;

$c->stash->{template} = 'display.tt2';
# force rendering
# by doing that, the body is set
$c->forward($c->view);
# get the rendered result from the body
my $result = $c->response->body;
# store $result in the database
# ...



No no no no - don't forward to the view and mess about with resetting 
stash params/body. Look at the docs on View::TT in the section about 
"CAPTURING TEMPLATE OUTPUT"


Ash

___
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] debugging the login

2006-12-29 Thread Ash Berlin

Octavian Rasnita wrote:

From: "Ash Berlin" <[EMAIL PROTECTED]>

"Something else" is the case here. If you try "$c->user;" in a 
controller I suspect it will give you same error as from the template.


As to the exact cause, hard to say, but its something to do with 
authentication setup.



Aha, so it is a known issue? Does it happends all the time, or $c->user 
works well in some cases?


It would be helpful if we could know the recommended way, for beeing 
able to use it right, because otherwise we might think that something's 
wrong in the code...


Thanks.

Octavian



The problem lies somewhere in your config - without more info (config 
and startup logs with debug enabled) i cant say anything more.


Ash

___
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] debugging the login

2006-12-28 Thread Ash Berlin

Octavian Rasnita wrote:

From: "Hermida, Leandro" <[EMAIL PROTECTED]>


Are you using IE?  Run your test server with the -k switch (i.e.
script/myapp_server.pl -k).  You can read in previous Catalyst threads
that IE has a cookie setting problem and won't login properly if you
don't enable keep-alive connections.



Leandro


Finally I have solved that issue, but I have another one that might 
because Of Catalyst::Plugin::Authentication bug, or something else, 
because if I have [% c.user %] in a template, the application gives an 
error, even though there is a logged user. (I've verified that using 
$c->user_exists).


Thank you.

Octavian


"Something else" is the case here. If you try "$c->user;" in a 
controller I suspect it will give you same error as from the template.


As to the exact cause, hard to say, but its something to do with 
authentication setup.


Ash

___
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] What to use ? HTML::Widget ? Data::FormValidator ? etc...

2006-12-28 Thread Ash Berlin

Alexandre Jousset wrote:

Hello dear list,

I'm currently in the early stage of writing a Catalyst application 
(in fact redesigning a non-Catalyst one) and I'm wondering what plugins 
to use.


I've already written Catalyst applications successfully but for this 
one I've decided those constraints :


- Use TT as view
- Use a form validator
- Not necessarily use a widget creation plugin
- I18n
- Reuse the most possible code / templates and be very modular

In fact I have some precise questions, but advices are welcome:

1) I've searched the HTML::Widget docs and ML archives to look for 
i18n stuff but found nothing :-( I subscribed to the ML but before 
asking them the question, can you tell me if HTML::Widget is the Right 
Plugin (new TM) for my application?


If its possible to localize strings in a controller: $c->loc('foo') then 
you can localize labels/constraints etc.




2) Doesn't HTML::Widget break the MVC model by putting part of the 
view creation in the code?


Yes, basically. (Saying that i still use it cos I only use it in a few 
places and its not annoyed me enough to replace it)


3) If HTML::Widget is not the Right Plugin to use, what other plugin 
should I use?


You should also look at Data::FormValidator (i think thats the name) and 
Catalyst::Controller::FormBuilder (its a base class for you controllers, 
not a plugin)


4) And, more generally, what is the best practice to use i18n with 
the constraints above? What could you counsel me?


Pass - I've not had to do any L10n yet

I understand that some questions could seem OT but this is really a 
Catalyst design problem.


Thanks!


Ash


___
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] Accessing $c from Model

2006-12-27 Thread Ash Berlin

Mark Zealey wrote:

Hi there,

I'm basically wanting to write a simple log function which logs hits on my 
website as entries in a database (automatically adding $c->user->{id} and 
$c->req->referrer etc), but to do so I want to use a model (I think). Any 
ideas how I can just say $c->model('Log')->info("foo") and automatically get 
$c passed in? I think I could have sth like:


package MyApp::Model::Log;
use base 'Catalyst::Model';

my $last_c;

sub ACCEPT_CONTEXT {
my ($self, $c) = @_;
$last_c = $c;
}

sub info {
my ($self, $msg) = @_
my $c = $last_c;
...
}

but this seems pretty messy...

Mark



Very very *VERY* bad idea.

__PACKAGE__->mk_accessors(context);

sub ACCEPT_CONTEXT {
  my ($self, $c, @args) = @_;

  my $new = bless({ %$self }, ref $self);
  $new->context($c);
  return $new;
}


Something like the above instead.

Ash

___
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] creating a model

2006-12-22 Thread Ash Berlin

Octavian Rasnita wrote:

Hi,

I have tried creating a model using:

perl script/tranzactiibursiere_create.pl model Intranet DBIC
DBI:mysql:database=intranet root

The result shown was:

exists "E:\web\TranzactiiBursiere\lib\TranzactiiBursiere\Model"
exists "E:\web\TranzactiiBursiere\t"


This module has been deprecated in favor of 
Catalyst::Model::DBIC::Schema at


How about you pay attention to what it tells you and use a more up to 
date model first?


___
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] using 'config' in a partpath

2006-12-21 Thread Ash Berlin

Ian Docherty wrote:

if I want a URI like

/config/34/display

Then I can create a PartPath similar to:-

package MyApp::Controller::Config;

use strict;
use warnings;

use base 'Catalyst::Controller';

sub Config : PartPath('/config') Chained('/') CaptureArgs(1) {
   my ($self, $c, $config_id) = @_;
   # do something
}

But actually I can't, because this example gives me a URI of

/Config/32/display

(note the uppercase 'C')
because if I try to use lowercase 'config' it conflicts with 
Catalyst::Controller::config


Any ideas on how I can have a lower-case 'config/32/xxx' in my PartPath?


By using PathPart instead ;)

___
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] Directory with Catalyst::Model::File

2006-12-21 Thread Ash Berlin

Xavier Robin wrote:

Hello,

I want to save uploaded files in a directory specific for the user (using the 
user_id). For example, the files of user 326 would be saved in 
directory /root/files/3/2/6/.


I use Catalyst::Model::File to do this. It's really great!
I configured it to store files in /root/files/ by default (root_dir). Now I 
use the following code for a specific file:



my @path = split('', $c->user->user_id);
my $file_obj = $c->model('File')->file(@path , $filename);


But the file "test.txt" for user "326" is saved as /root/files/3 instead 
of /root/files/3/2/6/test.txt.


It looks like C::M::File uses only the first argument and ignores all the 
others, unlike Path::Class::File that allows to define the path with a list 
of arguments.


I could fix the problem by using the following code where I pass a single 
argument with the complete path: 


my @path = split('', $c->user->user_id);
my $path = join ('/', @path);
my $file_obj = $c->model('File')->file($path . '/' . $filename);


But I find the Path::Class::File syntax looks much smarter and more 
platform-independant. Is there an different syntax for C::M::File?


Thanks for this great framework !

Xavier



Nope - I just forgot to do that. If you could make a patch containing a 
failing test I'll go ahead and implement that.


Cheers
Ash

___
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] Couldn't forward to "vdc::View::tt". Does not implement "process"

2006-12-18 Thread Ash Berlin

package vdc::View::TT; # I suspect this is why

Alejandro Imass wrote:
Actually, all controllers are failing at the time of rendering the 
template.

I have now attached startup debug log, other relevant files. I can put
the whole app for download if required.

The complete Catalyst debug screen can be seen at:

http://vdc.cc.com.ve/piloto


On 12/17/06, Matt S Trout <[EMAIL PROTECTED]> wrote:


On 17 Dec 2006, at 18:33, Alejandro Imass wrote:

> Hi,
>
> I developed a Catalyst app in 5.7001 and am trying to deploy on a
> server with 5.7007
>
> I am getting this error:
>
> Couldn't forward to "vdc::View::tt". Does not implement "process"
>
> Couldn't forward to command "vdc::View::tt": Invalid action or
> component.

The attachment with the startup debug logs and the relevant
controller and view class files seems to have gone missing; could you
re-send please?

--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +



___
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/





___
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/



___
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] C::P::Email and testing

2006-12-16 Thread Ash Berlin

Daniel McBrearty wrote:

if you have an action that sends an email, how do you write tests for it?

perhaps print the email to a temp file in test mode? what do you guys do?



Send it to a locally delivered address and check the mbox? use Net::IMAP 
module.


It depends what you want to check - but I'd avoid testing other ppls 
code - assume they are right unless you have a good reason not to.


Ash

___
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] WAP FrameWork

2006-12-11 Thread Ash Berlin

luke devon wrote:

Hi ,

Does catalyst act as a mobile - wap frame work ? I've found very 
interesting java frame work which handle a wap portal's functions very well.

http://www.morfeo-project.net/index.php?option=com_content&task=view&id=25&Itemid=43&lang=en
but , i'm still searching for a perl or php WAP frame work . can sombody 
give me some informatin on it please .


Thank you,
luke.


Luke

From what little I remember WAP is nothing special - the user agent
still sends HTTP requests. If you think of Catalyst as just a dispatcher
from URL to actions - you can do ``anything'' with it - WAP if that so
pleases you

Ash


___
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] RFC: file/path writing sub-class of Catalyst::Plugin::Static::Simple

2006-11-26 Thread Ash Berlin

apv wrote:
I'm probably about to write a sub-class of 
Catalyst::Plugin::Static::Simple which writes the file to disk on the 
first request. The reason is I like to have all my extra static files 
(images, media, css, etc) in the same bundle as the application but I 
also want to let Apache serve them, obviously. So I can either try to 
keep a tree sync'd between my app path and my webserver path or do this 
so the authoritative versions in the app path are written to disk on 
first request. (Semi-)Permanent cache.


Do you think this is something useful enough to also put on the CPAN? 
Other feedback?


Name? Catalyst::Plugin::Static::DiskWrite? The idea is not to be able to 
check for freshness or other cache-like behavior but to write it if it's 
not there and leave it at that. Used with things like:


  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*) /index.fcgi/$1 [QSA,L]





Can you not just do:

Alias /static /path/to/my/app/static

In your Apache (or whatever) config?

___
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] setting up files and namespace for utilizing different models in the same catalyst app

2006-11-23 Thread Ash Berlin

Matt S Trout wrote:

Hermida, Leandro wrote:
What would people recommend as a naming convention and namespace setup 
if one wanted to

eventually use more than one model inside of the same Catalyst app?


I tend to use

MyApp::Library -> book+author DB
MyApp::Forum -> forum DB
MyApp::Web -> Catalyst app





In that situation I'd go for

MyApp::Schema::Library
MyApp::Schema::Forum

then MyApp or MyApp::Web


(Or rather that's the kind of thing I've used for my current project)

Ash

___
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] Null values in DBIx::Class

2006-11-23 Thread Ash Berlin

Xavier Robin wrote:

Hello,

I have the following table defined in a PostgreSQL database:

CREATE TABLE test_table (
  id  SERIAL PRIMARY KEY,
  column1 INTEGER REFERENCES test_table2,
  column2 INTEGER UNIQUE NOT NULL REFERENCES test_table3
);

I have set up MYAPPDB::TestTable with the unique key test_table_column2.
Now in my controller I do that:

$->model(MYAPPDB::TestTable)->update_or_create({
   'column1' => $value1,
   'column2' => $value2
}, {key => 'test_table_column2'}
);

If $value1 is null, I get the following error:

Caught exception in 
MYAPP::Controller::Root->test_action "DBIx::Class::ResultSet::update_or_create(): 
Error executing 'UPDATE test_table SET column1 = ? WHERE ( column2 = ? )': 
ERROR:  invalid input syntax for integer: "NULL""


I tried with $value1 = 'NULL', $value1 = '' or undef $value1, but none of them 
worked.


How can I enter a null value in a foreign key column?
Note: it works fine in PostgreSQL when I do UPDATE test_table SET column1 = 
NULL WHERE column2 = $value2.


Can you help me?

Thanks in advance !

Xavier


First wrong list - you want dbix-class

The answer two your problems: undef


___
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] uri_for (or lack thereof) in static pages

2006-11-16 Thread Ash Berlin

Cédric Bouvier wrote:

I have a ѕimple yet thorny problem, which I expect most of you also have
or had. It has several possible solutions, but I'm chiefly interested in
knowing how *you* would solve it and why.

We're developing a Catalyst application. It serves HTML, CSS,
JavaScript, and images. HTML is the output of TT2, but CSS, images and
JavaScript are static. We have them served by C::P::Static::Simple on
the built-in server, and we use a  the have them directly
served by Apache/mod_perl, one the production server. Under mod_perl,
the application's root is not the server's root, i.e., it is
http://server/myapp, whereas it is http://localhost:3000 on the built-in
test server.

This would not be a problem if the CSS were not linking to images. And
because CSS pages are static, they cannot make use of uri_for(), and
therefore get the links to the pictures wrong.



Are the images static? If so then your problem isn't a problem. Judging 
on your possible suggestions I'd guess not, but just checking.


Ash


___
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] IDE/editor

2006-11-14 Thread Ash Berlin

[EMAIL PROTECTED] wrote:

I hesitate to ask this question because it seems to often result in
some juvenille flame war.  Everyone is different, with different needs
and preferences.  That's why we have choices.  It's Perl after all,
right? [grin]

With that out of the way, what IDE or editor works well for you?

My default has been VIM since I'm really comfortable in it and can
edit text really fast with it.  However, as a very visual person, I
find it cumbersome when having to flip back and forth between all of
the files.  This is especially true since I'm new to Catalyst and
don't have everything solidified in my head.

As a side note, I work on OS X, so any references to Windows-only
programs won't really be useful but may be for others who come accross
this thread.

I'm mostly just interested in what has worked for you (and will take
everything with that grain of salt), not what is crappy about other
programs.

Many thanks in advance,

Conan.


For vim I use the MiniBuffExplorer plugin and split windows - give you 
tab like interface, and is faster than gvim7's own tabs IMO.


Ash

___
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] Catalyst::View::TT

2006-11-13 Thread Ash Berlin

Ivan Wills wrote:

Hi,

I'm using Catalyst::View::TT to display my pages. I'm having trouble
removing excess blank lines appearing at the top of my files.

I realise this is not normally a problem but I am playing with mixing
SVG and XHTML (with content-type=text/xhtml) but Firefox considers the
extra blank lines to be an error when in XML rendering mode if they
appear before the  deceleration.

Any one know how to remove those blank lines?

Thanks
Ivan

___
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/



[% END -%]

also known as RTFM ;)

___
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] Programmatic way to determine the needed number of captures for an action?

2006-11-04 Thread Ash Berlin

John Napiorkowski wrote:

--- Ash Berlin <[EMAIL PROTECTED]> wrote:


This has been discussed before, tho a fully
satisfactory solution never 
appeared. Something that we touched upon that could
work was to have a 
stack of actions which been used/hit in the chain -
though this wouldn't 
help when going cross controller.


But yes, its something that has been niggling me as
well.

Ash


I came up with this hack that worked for my client,
but it's dependent on the order of the captures unless
you are using some sort of named parameter system for
them:

my $uri = $c->uri_for(

   $c->controller->action_for('list'), 
   $c->request->query_parameters

);

my @captures = ();

foreach my $capture ( @{$c->request->captures} )
{
   last if $uri;

   push @captures, $capture;

   $uri = $c->uri_for(

  $c->controller->action_for('list'), 
  [EMAIL PROTECTED], 
  $c->request->query_parameters

   );
}

As you can see it far from elegant.  Basically it
takes advantage of the fact that $c->uri_for will
always return false if it can't make a uri and just
walks through your current capture list.

I could probably rewrite this more cleanly, but it was
the best I could come up with on a friday late
afternoon :)

--john



Evil yes, but it looks like it works better than anything we have 
currently ;)



___
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] Programmatic way to determine the needed number of captures for an action?

2006-11-04 Thread Ash Berlin

John Napiorkowski wrote:

Hi,

I have a question about $c->uri_for and chained
actions.

I've really enjoyed having this feature to
programmatically create urls for me in the code.  It's
one of the greatest things about Catalyst I think. 
However one thing that is a bit tricky is that when

using $c->uri_for with chained actions you have to be
careful to supply the correct number of captures.  If
you give too few or too many then $c->uri_for will
return an undef.

So something I am trying to figure out is how to
determine in code (without knowing in advance) how
many captures a given chained action will expect so
that I can supply it correctly.

You can look at the Args and CaptureArgs attribute for
a single action, but if that action is an endpoint in
a chain, and actions earlier in the chain require
Args, I can't find a straightforward way to get the
total number of required Args for a given Chain
endpoint.

Here's an example of my issue:

Let's say I have a controller with two actions 'base'
and 'item'.  item is chained to base, with base as the
root and item requires an argument:

Controller One;

sub base Chained('/') CaptureArgs(0) {}

sub item (Chained('base') Args(1) {}

Now in my second controller I have:

Controller Two

sub base Chained('/') CaptureArgs(1) {}

sub item (Chained('base') Args(1) {}

For controller one I can get the URL with:

$c->uri_for($->controller(..)->action_for('base'));

But for the second controller I'd need:

$c->uri_for($->controller(..)->action_for('base'),
[$capture]);

What I am trying to do is to write some code that
looks at the number of arguments a given action needs
and automatically supplies that number off the current
captures list.

I can see that I could do this by adding some
additional metadata fields to my custom Action
Classes, but I was trying to see if there was a
canonically correct way to do this in Catalyst.

Anyone know?

Thanks!

John



This has been discussed before, tho a fully satisfactory solution never 
appeared. Something that we touched upon that could work was to have a 
stack of actions which been used/hit in the chain - though this wouldn't 
help when going cross controller.


But yes, its something that has been niggling me as well.

Ash

___
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] regexes and auto actions

2006-10-31 Thread Ash Berlin

Carl Johnstone wrote:

Hi,

Got a question regarding the best way of setting up handlers.

The site is split into many areas (and subareas) defined by URL path, 
the same types of content appear in each area of the site.


There's stuff that needs setting up that's specific to the area of the 
site, this appears around the main part of the content of the page and 
includes stuff like latest articles for that area.


At the same time the actual appearance of the article within the 
template is always the same, so we don't want to duplicate all the code 
every time we're dealing with a standard article.


So we have:

/news/
/news/story/1
/news/comments/1
/sport/
/sport/story/2
/sport/comments/2
/sport/football/
/sport/football/story/3
/sport/football/comments/3

etc

Our plan was to use auto actions in the various Controllers to define 
all the area specific stuff. Then use a Regex action in another 
Controller to actually generate the article.


In practice however only /article/auto and /auto get called.

Any other solution we've come up with has involved adding a story action 
in every Controller. This will be a drag as for each new type of content 
we'll need to add an action in every controller.


Anybody got a neater way of doing it?

Thanks

Carl



Use a controller base class that implements the story/comments actions, 
and just set the relevant section (i.e. news, sport, football) in an 
auto or a begin action.


Make sense?

Ash

___
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] catalyst + embedded systems?

2006-10-30 Thread Ash Berlin

Jonathan Rockway wrote:

Anyone try anything like this:

http://bec-systems.com/web/content/view/46/9/

with Perl5 and Catalyst?  I'd be interested in hearing how it performs.

Regards,
Jonathan Rockway



I've got an embedded nix device that i've been doing some other work 
for, and will have to put together a web config for it, so timer 
permitting i'll give it a go


Ash

___
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] Testers Wanted: Cache::FastMmap 1.15 (w/Win32 Support)

2006-10-29 Thread Ash Berlin

Ash Berlin wrote:

Nilson Santos Figueiredo Junior wrote:


..\blib\arch\auto\Cache\FastMmap\CImpl\CImpl.exp
mmap_cache.obj : error LNK2019: unresolved external symbol _vsnprintf 
referenced

in function __mmc_set_error
..\blib\arch\auto\Cache\FastMmap\CImpl\CImpl.dll : fatal error 
LNK1120: 1 unreso

lved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Arquivos de programas\Microsoft Visual 
Studio .N

ET 2003\VC7\BIN\nmake.exe"' : return code '0x2'
Stop.



Hmmm okay. Could you try editing Win32.c and including varargs.h and 
changing line 467 to one of the following:


_vsnprintf(errbuf, 1023, error_string, ap);
_vsprintf(errbuf, error_string, ap);
vsprintf(errbuf, error_string, ap);
vsnprintf_s(errbuf, 1023, _TRUNCATE, error_string, ap);

You might have to re `perl Makefile.PL` to get it to updated properly.

Let me know if any of the above make any difference.

Ash


Failing any of the above, open up a Visual Studio command prompt and run 
"dumpbin /exports msvcrt.lib", redirect the output somewhere and look 
for anything matching vsnprintf


Ash


___
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] Testers Wanted: Cache::FastMmap 1.15 (w/Win32 Support)

2006-10-29 Thread Ash Berlin

Nilson Santos Figueiredo Junior wrote:


..\blib\arch\auto\Cache\FastMmap\CImpl\CImpl.exp
mmap_cache.obj : error LNK2019: unresolved external symbol _vsnprintf 
referenced

in function __mmc_set_error
..\blib\arch\auto\Cache\FastMmap\CImpl\CImpl.dll : fatal error LNK1120: 
1 unreso

lved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Arquivos de programas\Microsoft Visual 
Studio .N

ET 2003\VC7\BIN\nmake.exe"' : return code '0x2'
Stop.



Hmmm okay. Could you try editing Win32.c and including varargs.h and 
changing line 467 to one of the following:


_vsnprintf(errbuf, 1023, error_string, ap);
_vsprintf(errbuf, error_string, ap);
vsprintf(errbuf, error_string, ap);
vsnprintf_s(errbuf, 1023, _TRUNCATE, error_string, ap);

You might have to re `perl Makefile.PL` to get it to updated properly.

Let me know if any of the above make any difference.

Ash

___
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] Testers Wanted: Cache::FastMmap 1.15 (w/Win32 Support)

2006-10-29 Thread Ash Berlin

Nilson Santos Figueiredo Junior wrote:

On 10/29/06, Ash Berlin <[EMAIL PROTECTED]> wrote:

If you could all run it through its paces on both Win and *nix and let
me know if there are any problems that would be great.


Unfortunately, it doesn't compile under Win32 with AS Perl 5.8.8
(build 817) using MSVC.



mmap_cache
.c
mmap_cache.c
mmap_cache.c(26) : fatal error C1083: Cannot open include file:
'win32.c': No such file or directory
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Arquivos de programas\Microsoft Visual
Studio .NET 2003\VC7\BIN\nmake.exe"' : return code '0x2'
Stop.

-Nilson Santos F. Jr.



My bad - it didn't take the updated MANIFEST file (somewhere I messed up 
clearly) so it didn't include all the right files. Please try again, 
same url as before.


Ash

___
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] Re: template comparison

2006-10-29 Thread Ash Berlin

Hermida, Leandro wrote:

Hello,
 
Its great to read how fundamentally different in their approach catalyst views are (TT, Mason, ClearSilver, TAL, etc.).
 
I seem to be leaning on the side of Mason so far because I would like to stick with one powerful language (Perl), even though there is the potential danger abusing it in the view.  But my question is: Is there a reason that Catalyst::View::Mason hasn't been updated for over a year (19 Aug 2005)?  Could it be missing important integration to new Catalyst features that have come out since?  Or is it not important at all that it hasn't been updated?
 
Thank you for your feedback,
 
Leandro Hermida
 
 





___
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/


The only major update (that i know of) to View::TT in the last few 
months was to split out the render code from process sub so that it 
could be called separately so that the output from a template could be 
used for sending to email etc.


So no, seems unlikely that View::Mason not being updated means anything.

Ash

___
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] Testers Wanted: Cache::FastMmap 1.15 (w/Win32 Support)

2006-10-29 Thread Ash Berlin

Right then:

http://callisto.firemirror.com/Cache-FastMmap-1.15.tar.gz

I've written the memory mapping code for Win32 and it all seems to check 
out (well the test suites pass).


Systems I've tested on: Vanilla Perl 5.8.8, Debian build of perl, also 
5.8.8.


If you could all run it through its paces on both Win and *nix and let 
me know if there are any problems that would be great.


Cheers
Ash

___
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] template comparison (was: why not mason (was: somethingelse unrelated))

2006-10-27 Thread Ash Berlin

And the prize for FotW goes to:

Joe Landman

All joking aside, I couldn't agree more - not that i know that first 
thing about Masonic rituals, er. Mason. As to my reason why I think more 
people mention TT, its because the Tutorial shows how to use TT, so if 
you don't know of anything else, why look if TT does what you need?


(Thats a subtle hint saying maybe someone should contribute a Mason 
section to the tutorial just so people don't get the idea that Catalyst 
has to use TT)


/me fans the flames

Ash

___
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] Dispatching question: same path but different args attributes

2006-10-17 Thread Ash Berlin
Marc Logghe wrote:
>   
>> -Original Message-
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] On Behalf Of Matt S Trout
>> Sent: Tuesday, October 17, 2006 10:20 AM
>> To: The elegant MVC web framework
>> Subject: Re: [Catalyst] Dispatching question: same path but 
>> different args attributes
>>
>> Marc Logghe wrote:
>> 
>>> Hi all,
>>>
>>> It seems that you cannot do something like (in 'controller1'):
>>>
>>> action1 :Path('action') :Args(0) { .. }
>>> action2 :Path('action') :Args(1) { .. }
>>>   
>> What version of Catalyst have you got? This definitely didn't 
>> work pre-5.70 and it's entirely possible I got something 
>> wrong when I implemented it, since I was mostly worrying 
>> about Chained and uri_for($action) at the time.
>>
>> 
> I have, which I thought was the latest CPAN version, 5.6902. Think I
> know what happened: at search.cpan.org I searched for catalyst.
> The first match is a link to Catalyst::Manual::Cookbook of version
> 5.6902. So I downloaded from there. Not the latest version indeed.
> I'll try out the *really* latest version, pretty sure it will work out
> as expected.
> Thanks and apologies for the fuzz !
> Marc 
>   
You downloaded it directly from search.cpan.org?  Whats wrong with using 
`cpan Catalyst`?

___
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] Configuring Catalyst::Model::DBIC::Schema from YAML

2006-09-28 Thread Ash Berlin
Jon Warbrick wrote:
> Can a Catalyst::Model::DBIC::Schema model be configured from a YAML 
> file via Catalyst::Plugin::Config::YAML? If so, how? Apologies if it's in 
> the documentation somewhere, but if so I've yet to find it...
>
> Jon.
>
>   
The answer is yes. Strip off "Catalyst::" from the component name. e.g.

name: MyApp
Model::MyModel:
  arg1: foo
  arg2:
- bar
- baz
View::TT
  DEBUG: 1

As to where it's documented, I cant seem to find it, but I'm sure it is 
somewhere, tho its clearly not obvious enough since I know its there and 
cant find it.

Ash


___
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] Rails-like form helpers

2006-09-20 Thread Ash Berlin
Jon Warbrick wrote:
> I've always admired the form helpers used by Rails (see [1]) - essentially 
> helpers for use in templates for creating form controls that are linked to 
> underlying model objects so that they can be pre-populated and so that the 
> controls can be named to make subsequent update of the objects easy. It 
> strikes me that something like this could be useful when creating forms 
> that are more complex then solutions like HTMLWidget can conveniently cope 
> with.
>
> Catalyst-Plugin-Params-Nested already provides support for something very 
> like the Rails naming scheme, but I can't see anything that provides 
> anything like the helpers themselves. Before I start creating something, 
> probably as a DBIx::Class component, please can anyone tell me if I'm 
> re-inventing the wheel?
>
> Jon.
>
> [1] 
> http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000389
>
>   
Maybe look at FormBuilder. (?)

Also suggest a situation that is "complex then solutions like HTMLWidget 
can conveniently cope with" and I'll tell you if it is (or will be - 
refactor is coming)

Ash Berlin


___
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] $c->res->redirect and $c->detach

2006-09-18 Thread Ash Berlin
John Napiorkowski wrote:
> --- Matt S Trout <[EMAIL PROTECTED]> wrote:
>
>   
>> John Napiorkowski wrote:
>> 
>>> Hi,
>>>
>>> I have a controller with some chained actions. 
>>>   
>> One of
>> 
>>> the actions (not an endpoint) will redirect given
>>>   
>> a
>> 
>>> certain value for the arguments.  However I find
>>>   
>> that
>> 
>>> this doesn't stop the chain from completing.  I
>>>   
>> still
>> 
>>> get a line about the redirect in the log, but the
>>> endpoint in that chain still activates.
>>>
>>> I find that this doesn't happen when I use
>>>   
>> $c->detach,
>> 
>>> although in this circumstance detach is not the
>>>   
>> best
>> 
>>> use for me.
>>>
>>> Has anyone run into this before and found a way
>>>   
>> around
>> 
>>> it?
>>>   
>> Calling $c->res->redirect never stops anything from
>> completing, all it does is 
>> set the appropriate data on the response. $c->detach
>> is the correct thing to 
>> do here.
>>
>> Perhaps you need to rephrase your question in terms
>> of why you feel detach 
>> isn't ideal and how that interacts with the way your
>> architecture is put together?
>> 
>
> It is probably more a case of my not understanding the
> best way to do this.  I'm still a bit stuck in my old
> way of putting these types of applications together. 
> Let me explain a little more what I am doing and
> perhaps this is solvable with a more catalyst-think
> solution.
>
> I'm using chained actions as part of a wiki system. 
> Basically I have actions that descend down a url which
> first finds a wiki (I have multiply wikis in the
> system) and then a wiki page and then an action
> associated, such as create, view or edit.  Now when I
> run the action associated with finding the page in the
> database based on the page title what I'd like to do
> is redirect to the create action when we don't find
> that a  page exists.  I think this is the best action
> for a wiki and what is expected (as long as you have
> create rights).
>
> Now I'd like the URL to actually change to represent
> that you are on an edit page, which is why the detach
> doesn't do it for me.  If this is really the best
> thing to do I guess I can bend my head around it, but
> I find in not so intuitive to have a give url show
> both content or a form.
>
> I find it easier to write the tests for this if I can
> detect the redirect action.
>
> Doing a $c->detach('/end') after the redirect was
> suggested to me, although I find this can give an
> error since my default end action looks for a template
> which is this case doesn't exist.
>
> Maybe I should do both a redirect and a detach?
>
> I can show you some code for this if that would help
> you understand my thinking, although it's in two
> different modules (I'm using the :Chained('.') feature
> to help organize the code and it works fantastically).
>
> Let me know what you think.  Thank you for your
> feedback and suggestions.  --john
>
>   
I think the problem here is that you're expecting redirect to do more 
for you than it does:

   $res->redirect( $url, $status )

   Causes the response to redirect to the specified URL.

   $c->response->redirect( 'http://slashdot.org' );
   $c->response->redirect( 'http://slashdot.org', 307 );

Thats all it does. It doesn't stop the chain. Try this instead

$c->res->redirect($url); return 0;

Although I'm not sure if the `return 0' will dwim in chained dispatch. 
Try it and see.

Ash


___
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] Trouble with Chained Actions and Redirects?

2006-09-18 Thread Ash Berlin
John Napiorkowski wrote:
> Hi,
>
> I have a controller with some chained actions.  One of
> the actions (not an endpoint) will redirect given a
> certain value for the arguments.  However I find that
> this doesn't stop the chain from completing.  I still
> get a line about the redirect in the log, but the
> endpoint in that chain still activates.
>
> I find that this doesn't happen when I use $c->detach,
> although in this circumstance detach is not the best
> use for me.
>
> Has anyone run into this before and found a way around
> it?
>
> Thanks!
>
> --john
>
>   
Just how are you redirecting?

And whats wrong with:

$c->res->redirect($url);
$c->detach('/end');

Ash


___
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] problem with FormBuilder + TT2

2006-09-18 Thread Ash Berlin
Moritz Sisenop wrote:
> Hello!
> I am using FormBuilder, CGI::FormBuilder::Source::File, and TT2.
> I set the template in the source file:
>
> template:
> type: TT2
> template: customers/signup.tt2
>
> And get the following error:
>
> undef error - Fatal: file error - customers/signup.tt2: not found at 
> /usr/local/share/perl/5.8.7/CGI/FormBuilder/Util.pm line 149 
> CGI::FormBuilder::Util::puke('Template::Exception=ARRAY(0x94b5b90)') 
> called at /usr/local/share/perl/5.8.7/CGI/FormBuilder/Template/TT2.pm 
> line 66
>
> Might it be that FormBuilder doesn't find the Catalyst template dir, 
> and if yes, how do I let FB know?
> Any help is greatly appreciated.
>
> Best regards,
>
> Moritz
> 
>
> ___
> 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/
>   
What i think you want is $c->path_to(qw/root customers signup.tt2/)

Ash




___
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] Bug in URI ?!

2006-09-10 Thread Ash Berlin
Paul Makepeace wrote:
> [+catalyst]
>
> On 8/16/06, Matt S Trout <[EMAIL PROTECTED]> wrote:
>   
>> Dominic Mitchell wrote:
>> 
>>> David Dorward wrote:
>>>   
 Paul Makepeace wrote:
 
> URI::_query::query_form() which makes query strings:
>
>  $self->query(@query ? join('&', @query) : undef);
>
> Now as anyone in web standards knows, that ought to be '&'.
>   
 Only if the URI is being written in HTML. Since, to judge from the
 module name, it is just a URL there shouldn't be any markup language
 specific encoding going on. Once you have the URI you should run it
 though a suitable encoding method before using it in markup though.
 
>>> Once again, this highlights how poor our tools our...  If templating
>>> systems did HTML escaping by default, this wouldn't be an issue (i.e.
>>> having to remember to html encode all strings that could possibly
>>> contain user input).  When will our frameworks grow up?
>>>   
>> They already did, you just weren't looking.
>>
>> package MyApp::View::HTML
>>
>> use base qw/Catalyst::View::TT/;
>>
>> __PACKAGE__->config(
>>STASH => Template::Stash::EscapeHTML->new
>> );
>>
>> 1;
>> 
>
> Has anyone actually used this? Apart from it not passing its own POD
> coverage tests (and thus requiring a force install), it seems to
> simply result in the whole template output being escaped, HTML 'n all.
> Admittedly I haven't looked into this very much but since it wasn't
> even passing tests and that people cite modules on lists without
> trying them I thought I'd ask first.
>
> (Nice idea though.)
>
> I think a less heavyweight solution would simply be to be able to
> configure c.uri_for to produce HTML-escaped URLs (or not), which IMO
> it ought to be default. It's a _web_ app framework after all... Even
> Template's own URL plugin does this, putting correctness aside for
> pragmatism.
>
> P
>
>   
Am I missing something, or does

$c->uri_for( $path, @args?, \%query_values? )

not do what you are asking for?

Or is the problem that any ampersands in there don't get escaped?

Ash


___
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] Catalyst::Model::FileSystem? Anybody who's using their own wanna make one? =)

2006-08-09 Thread Ash Berlin

Catalyst::Model::File: 
http://search.cpan.org/~ash/Catalyst-Model-File-0.02/lib/Catalyst/Model/File.pm

Based on Path::Class, so its platform independent.

Any features missing from that that you think you'd want?

Ash

Dylan Vanderhoof wrote:
> I've noticed a few people posting about fielsystem models under their
> Catalyst applications lately, which makes a good deal of sense for many
> applications.
>
> However, when I look at code, each one has the filesystem calls fairly
> integrated with the model portion of the application.
>
> I'll admit I'm being lazy, since I'd like to write a fs-based catalyst
> application relativly soon, but has anybody considered using their
> groundwork here to write a Catalyst::Model::FileSystem module for CPAN?
>
>
> Obviously, it would need to be more generic and more full-featured than
> what's being used in the fs-based applications I've seen so far, but it
> needn't start with everything available.
>
> Any interest?  I'd be happy to help out, since I'd like to use it, but I
> figure I'd see if somebody who's been doing this would be willing to lay
> some of the groundwork.
>
> -Dylan Vanderhoof
>
> ___
> 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/
>   



___
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] patches for View::TT

2006-08-06 Thread Ash Berlin
Jonathan Rockway wrote:
> I noticed that View::TT isn't in the dev.catalyst.perl.org svn
> repostory.  Any reason for that?
>
> Also, can we do a s{Coldn't}{Couldn't}g in there?  That's actually why I
> was looking for the code ;)
>
> Regards,
> Jonathan Rockway
>
>   
> 
>
> ___
> 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/
>   
Thats because it was sri's module: 
http://oook.de/svn/trunk/Catalyst-View-TT/

Ash


___
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] Making pages within pages

2006-08-01 Thread Ash Berlin
Paul Makepeace wrote:
> On 8/1/06, Ted Carnahan <[EMAIL PROTECTED]> wrote:
>   
>> Have a look at Catalyst::Plugin::SubRequest.
>> 
>
> Ah, great, thanks, that looks like what my snippet was trying to achieve.
>
>   
>> That will allow you to
>> make a completely separate request to a different action, and it returns
>> the finished result in a variable.  Then it's up to you to write that
>> out to a file or do whatever with it.  You can even do the subrequest
>> call from your TT view and skip the writing to disk entirely if it suits
>> you better.
>> 
>
> What example would it be used from a view? At least for what I'm doing
> seems more like a controller activity.. Also, if I were trying to link
> to the generated page from the main result how could I not save it to
> disk? Aside from chicanery storing huge blobs in the session or
> whatever.
>
> Cheers, Paul
>
>   
>> - Ted Carnahan
>>
>> On Tue, 2006-08-01 at 04:18 +0100, Paul Makepeace wrote:
>> 
>>> I have an ordinary Cat app that needs to generate some subsidiary
>>> status output to a file that's then linked to in the main page's
>>> output. Originally I was going to do all the Template process etc
>>> myself but then wondered if there was a 'blessed' way of exploiting
>>> the catalyst machinery. Here's what I came up with,
>>>
>>>   my ($self, $c) = @_;
>>>   my $template = $c->stash->{template};
>>>   $c->stash->{template} = 'news/subpage';
>>>   $c->forward('View::TT');
>>>   render_somewhere('news/status' => $c->response->out);
>>>   $c->response->output(''); # so the view is re-rendered
>>>   $c->stash->{template} = $template;
>>> $c->stash->{status_page} = 'news/status';
>>>
>>> What's nice about this is that news/subpage is found by catalyst - I'm
>>> wondering how much of render_somewhere() cat could help with. Doesn't
>>> have to follow that API, I just include that as an example; anything
>>> that gets the data down on disk will do.
>>>
>>>
>>>
>>> Paul
>>>   
If you just want to render another template and don't want a full other 
request  (sub-requests behaves as if the user hit them in the browser) 
look at 
http://search.cpan.org/~sri/Catalyst-View-TT-0.23/lib/Catalyst/View/TT.pm#CAPTURING_TEMPLATE_OUTPUT

Ash


___
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] ::Model::SomeTable->some_method() problem

2006-07-13 Thread Ash Berlin
Chisel Wright wrote:
> On Tue, Jul 11, 2006 at 10:51:15AM +0100, Chisel Wright wrote:
>   
>> Do I have a corrupt install after upgrading, or is this a bug?
>> 
>
> OK, I've tried this on:
>
>   Ubuntu, upgraded catalyst
>   Gentoo, upgraded catalyst
>   Ubuntu, totally fresh install, fresh catalyst
>
> All three fail to locate the ::Model::Class object method running under
> the Catalyst server/test scripts.
>
> Is anyone else using 5.7 and models with extra user-defined functions?
>
> I'm just surprised that this seems to be happening everywhere for me,
> and no-one else seems to have any problem.
>
>
> Does anyone have 5-10 minutes to try the test(s) I outlined in my
> previous message?
>
> Chisel
>   
I haven't actually run your test since I don't have Pg installed.

A few things tho:

1) You should really think about converting to DBIC::Schema instead.
2) What version were you upgrading from?
3) Did you also upgrade anything else?

And the key thing here:

4) You probably want some_method to be a method on the result_set: i.e. 
something like the following: 
http://search.cpan.org/~jrobinson/DBIx-Class-0.06003/lib/DBIx/Class/ResultSetManager.pm

Ash


___
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] sub default :Private versus sub xxx :Path

2006-07-11 Thread Ash Berlin
John Napiorkowski wrote:
> With Catalyst we now have three ways to hook an action to the package 
> namespace (That I know of)
>
> package myapp::Controller::demo
>
> 1) sub default :Private {...}
> 2) sub index :Private {...}
> 3) sub x :Path {...}
>
> All the above match /demo and 1,3 match /demo/arg1/arg2, etc while 2 doesn't.
>
> Now I know from the documentation that the primary function difference are in 
> execution precedence 
> and in the way they capture arguments.  I can see an advantage to the sub 
>  :Path way over sub default
> because this way I can give my root actions a meaningful private name.  
> However I was wondering what
> other reasons might people use sub  :Path over sub default?  I'm just 
> trying to put together a best
> practices guide for new developers and this one I've been scratching my head 
> over. Maybe we haven't figured 
> out the best way to use all these great new features yet but I just wanted to 
> here what other people thought.
>
> -john
>
>
>
> ___
> 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/
>   
All for /controller/foo/bar

sub default : Private {
my ($self, $c, @args) = @_;
# args = qw/controller foo bar/

}

sub  : Path {
my ($self, $c, @args) = @_;
# args = qw/foo bar/;
}

I personally only use default for 404 handlers.

Also you should take a look at the :Chained attribute.

Ash


___
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] ::Model::SomeTable->some_method() problem

2006-07-11 Thread Ash Berlin
Chisel Wright wrote:
> On Mon, Jul 10, 2006 at 02:42:22PM +0100, Chisel Wright wrote:
>   
>> The only thing that's changed since I got off the train this morning is
>> my upgrade to 5.7. Any ideas?
>> 
>
> This morning I decided to boil my problem down to a simpler test-case
> (attached), to make it easier to demonstrate/test my problem.
>
> This morning I copied the test across to another box, running 5.61,
> where they pass.
>
> I then did:
>
>   cpan Catalyst::Devel
>   cpan Catalyst
>
> and re-ran the test, which failed, the same as on my laptop.
>
> Do I have a corrupt install after upgrading, or is this a bug?
>
>
> I've attached the files that should be required for testing.
>
>
> Chisel
>   
What about Catalyst::Runtime?


___
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] Problem with 'login' method in tutorial

2006-06-22 Thread Ash Berlin
Peter Traub wrote:
>
> On 6/22/06, *Ash Berlin* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
> Peter Traub wrote:
> > Hi Ash,
> >
> > Thanks for the reply. I should've mentioned that the top of my app
> > (tutorial.pm <http://tutorial.pm> <http://tutorial.pm
> <http://tutorial.pm>>) follows the tutorial directions to
> > the letter, and thus has:
> >
> > use Catalyst qw/-Debug Static::Simple Authentication
> >  Authentication::Store::Minimal
> >  Authentication::Credential::Password
> >  Session Session::Store::File Session::State::Cookie/;
> >
> > All those modules have been installed with CPAN. It should just
> > complain if it can't find any of those modules whenever the app is
> > called, right? But it doesn't (which implies that it sees them
> doesn't
> > it?), it only complains about the 'login' method call. Thanks.
> >
>
> Check what:
>
> perl -MCatalyst::Plugin::Authentication -e1
>
> give? (If nothing then it means that it found the module okay)
>
> Ash
>
>
> yep, it returns nothing, so it finds the plugin ok. Is it possible 
> that it checks the first Catalyst directory (the Ubuntu one), and when 
> it doesn't find it there, fails to look in the other directory even 
> though both directories are in @INC?
>
> peter
>  
Very much doubt it - I'm using it on Ubuntu fine. Try what Matt 
suggested in his post

Ash


___
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] Problem with 'login' method in tutorial

2006-06-22 Thread Ash Berlin
Peter Traub wrote:
> Hi Ash,
>
> Thanks for the reply. I should've mentioned that the top of my app 
> (tutorial.pm ) follows the tutorial directions to 
> the letter, and thus has:
>
> use Catalyst qw/-Debug Static::Simple Authentication
>  Authentication::Store::Minimal
>  Authentication::Credential::Password
>  Session Session::Store::File Session::State::Cookie/;
>
> All those modules have been installed with CPAN. It should just 
> complain if it can't find any of those modules whenever the app is 
> called, right? But it doesn't (which implies that it sees them doesn't 
> it?), it only complains about the 'login' method call. Thanks.
>

Check what:

perl -MCatalyst::Plugin::Authentication -e1

give? (If nothing then it means that it found the module okay)

Ash


___
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] Problem with 'login' method in tutorial

2006-06-22 Thread Ash Berlin
Peter Traub wrote:
> Hello,
>
> I'm a Catalyst newbie stuck on the tutorial with following problem. In 
> the Users.pm  file, the login function fails, as the 
> call to $c->login() gets the following error:
>
> [Thu Jun 22 15:57:00 2006] [catalyst] [error] Caught exception "Can't 
> locate object method "login" via package "tutorial" at 
> /home/peter/public_html/tutorial/script/../lib/tutorial/Controller/Users.pm 
> line 82."
>
> This would normally imply that I'm missing modules, however, I have 
> installed all the necessary plugins through CPAN (as far as I can 
> tell). One possible cause, but I don't think it is normally an issue, 
> is that the Catalyst plugins on my machine (running Ubuntu 'dapper 
> drake'), are in two directories. One directory 
> (/usr/share/perl5/Catalyst/) has a few plugins provided by Ubuntu's 
> apt repository. The other directory 
> (/usr/local/share/perl/5.8.7/Catalyst/) has the new plugins installed 
> with CPAN. Both directories are in @INC when printed from the tutorial 
> app. I tried copying the CPAN installed plugins 
> (Authentication::Credential::Password, Authentication::Simple, etc.) 
> to the Ubuntu perl dir, but it made no difference. I did restart the 
> test server on each change.
>
> At this point, I'm not quite sure what else to do to get the app to 
> see Authentication::Credential::Password which apparently provides the 
> 'login' method. A search of Google and the list archives hasn't turned 
> up anyone with the same problem. Any suggestions/help would be greatly 
> appreciated. Also, at the end of this email I've included a dump of my 
> $c object from right before the login call fails. Many thanks.
>
> Peter
In MyApp.pm

use Catalyst qw/-Debug Authentication/;

That tells Catalyst to enable debug, and load 
Catalyst::Plugin::Authentication - you will also need to load the 
backend authentication stores in a similar manner.

HTH
Ash


___
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] TT2 list context and DBIx::Class resultsets: solved?

2006-06-22 Thread Ash Berlin
Mark Blythe wrote:
> Hey, Template::Stash::Context is an interesting find.  That would 
> certainly solve the problem, even for situations other than DBIC 
> result sets.  The pod does state that it "adds a little overhead to 
> each stash call" and that the TT author is "a little wary of applying 
> that to the core default stash without investigating the effects first."
>
> It would make for an interesting profiling experiment.
>
>
> On 6/22/06, *Matt S Trout* <[EMAIL PROTECTED] 
> > wrote:
>
> Michele Beltrame wrote:
> > Hello!
> >
> > While investigating the (usual) problem that I always get arrays
> instead
> > of ResultSet objects when exploring DBIx::Class related tables
> in TT2, I
> > came across the Template::Stash::Context module, which is
> bundled in TT.
> > By using a view defined this way:
> >
> > [% my_rs = album.songs.scalar %]
>
> As of DBIC 0.07 you'll be able to do [% my_rs = album.songs_rs %]
>
> --
>   Matt S Trout   Offering custom development, consultancy
> and support
>Technical Directorcontracts for Catalyst, DBIx::Class and
> BAST. Contact
> Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk
>  for more information
>
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/
>  +
>
>
The solution i came up with was to write an iterator plugin:

https://dev.firemirror.com:8080/svn/YourPreferences/trunk/YourPreferences/lib/DBIx/Class/TTPlugin/RSIter.pm

Ash



___
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] Debugging DBIC inside a catalyst app

2006-06-22 Thread Ash Berlin
Kevin Old wrote:
> On 6/21/06, Eric W. Bates <[EMAIL PROTECTED]> wrote:
>   
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> I have read in the new Catalyst/Manual/Tutorial/CatalystBasics.pod (the
>> whole tutorial is very nice, btw) that you can invoke DBIC's debugging
>> inside your code thusly:
>>
>> $class->storage->debug(1);
>>
>> However, I cannot figure out where to get "$class".  I have tried in a
>> controller:
>>
>>
>> as a fully named model class method:
>>
>> HG::Model::HorshamDB::Plants->storage()->debug(1);
>>
>>
>> as an abbreviated model class method:
>>
>> HorshamDB::Plants->storage()->debug(1);
>>
>>
>> from the Catalyst object:
>>
>> $c->model('HorshamDB::Plants')->storage()->debug(1);
>> 
>
> Eric,
>
> It also states above that Note that you can use the following
> environmental variable to achieve the same effect.
>
> export DBIX_CLASS_STORAGE_DBI_DEBUG=1
>
> Kevin
>   
FYI Eric

You'd need to do it on the schema object directly, so 
$c->model('HorshamDB')->storage->debug(1);

Ash


___
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] PHP::View and Template::Toolkit

2006-06-20 Thread Ash Berlin
Jess Robinson wrote:
> I suspect your problem is that views tend to expect data in one place 
> (i.e. the stash, and a template file), and output it to another 
> ($c->res->body usually), if you want to run through one and then the 
> other, you'll need to retrieve the result of the TT view from 
> $c->res->body, and put it whereever the PHPView is expecting it..
>
> Jess
>
>   
The latest version of View::TT has a render function that will return
the output of the template - use that instead of $c->res->body

Ash



___
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] HTML::Widget - AllOrNone with Select and empty values

2006-06-20 Thread Ash Berlin
Adam Sjøgren wrote:
> On Fri, 5 May 2006 15:19:33 +0100, Carl wrote:
>
>   
>> Select elements automatically get an "In" contraint added, containing
>> the keys from the element's options().
>> 
>
>   
>> This probably ought to be over-rideable.
>> 
>
> Attached is a patch that makes it so.
>
> Let me know if it should be done differently and I will be happy to
> make another patch :-)
>
>
>   Best regards,
>
> Adam
>
>   
> 
>
> --- /usr/share/perl5/HTML/Widget/Element/Select.pm.orig   2006-06-20 
> 14:07:14.0 +0200
> +++ /usr/share/perl5/HTML/Widget/Element/Select.pm2006-06-20 
> 14:17:20.0 +0200
> @@ -7,7 +7,7 @@
>  
>  *value = \&selected;
>  
> -__PACKAGE__->mk_accessors(qw/comment label multiple options selected/);
> +__PACKAGE__->mk_accessors(qw/comment label multiple options selected 
> no_constraint/);
>  __PACKAGE__->mk_attr_accessors(qw/size/);
>  
>  =head1 NAME
> @@ -69,12 +69,21 @@
>  A list of keys (unique option ids) which will be pre-set to "selected".
>  Can also be addressed as value for consistency with the other elements
>  
> +=head2 no_constraint
> +
> +  $widget->element('Select', 'foo')->no_constraint(1);
> +
> +Override - turn off - the adding of the implicit L +Constraint|HTML::Widget::Constraint::In>.
> +
>  =head2 $self->prepare( $widget, $value )
>  
>  =cut
>  
>  sub prepare {
>  my ( $self, $w, $value ) = @_;
> +
> +return if $self->no_constraint;
>  
>  my $name = $self->name;
>  
>   
Wrong list - there is a HTML::Widget maling list (also on lists.rawmode.org)

Ash



___
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] Wrrite your own Model-class

2006-06-19 Thread Ash Berlin
[EMAIL PROTECTED] wrote:
>
>
> Dear List-members,
>
> Having made already a few Catalyst web-sites for our office and our
> clients, I now want to embark on writing a Catalyst application for myself!
> As I run my own IMAP-mail server, I thought of writing a web-based
> front-end so I can look at the mails on my IMAP-server from anywhere in the
> world.
>
> Unfortunately there is (yet) no Catalyst::Model::IMAP available, so I
> considered --most audaciously-- to start writing such a model myself. I had
> a look at various models (such as DBIC) but could not easily re-engineer
> the rules I must follow to write such a model-class.
>
> I did find the "Writing plug-ins" tutorial and wonder whether a "Model is
> just a kind of "Plugin" with another name. If not, is there somewhere a
> handy guide to start writing Models? I do agree to keep a log of my
> wanderings on the path of writing a Model and make it available once the
> Catalyst::Model::IMAP is finished.
>
> Karl
> aka CountZero on Perlmonks
You are essentially right when you say "Model is just a kind of "Plugin" 
with another name".

Theres not much more to it than swiping the skeleton from another model 
and then extending it - thats what I did.

Ash


___
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/