Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier


On 10/29/2012 11:30 PM, Rob Brown wrote:

basically...

$sth->finish if you've finished with the results of that statement, ie,
you've looped through the rows and are now done.

$dbh->disconnect if you've finished with the database connection, tho
now you start to think about working in a persistent environment, where
you may never disconnect from the database, and/or have some connection
caching setup.

This is where DBIx::Class just takes of all this for you - it does sound
like you're re-inventing a lot here.

What was the reason for not using DBIC again?



Right.

If you need more help about DBI, dbi-us...@perl.org is a better place to 
ask.


Not that we catalyst users are not willing to help you, but most people 
here know much about Catalyst, and not-as-much about DBI.


Feel free to ask your DBI questions here, but if it comes to DBI 
details, the people reading dbi-us...@perl.org are, well, more 
qualified. The chance to get helpful answers (or any answers at all, for 
more special/difficult questions) is much higher if you post to the 
right list...


Lukas





On 10/29/2012 10:10 PM, Craig Chant wrote:

I finally got to grips with extending my own class with the inbuilt
$c->dbh.

But am unsure whether I am mean to issue either...

$sth->finish();

or

$dbh->disconnect();

Once I have prepared / executed the SQL and fetched the records I want.

so a little further guidance is appreciated.

Craig


From: Lukas Thiemeier [spamcatc...@thiemeier.net]
Sent: 29 October 2012 20:16
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Hi Craig,

Using C::M::DBI is straight forward. Install it from cpan, and run

script/yourapp.pl create model DBI DBI dsn user password

where "dsn" is sth like "dbi:mysql:dbname", depending on your backend.

If it doesn't work you most likely have some typo in your dsn, username
or password.

When this doesn't work, what error is printed?
What was your input (except passwd, of course)?

Something like $c->dbh doesn't exist. The database handler belongs to
the model, and you can create Cat applications with several models, or
without any model at all. (Or with a model which is not a
database-model, or, or ...)

$c->model('DBI')->dbh does the trick.

The name "DBI" is required by C::A::Store::DBI, but besides this, any
model name is fine.

Alternatively, add a shortcut to your main App.pm:

sub dbh{ shift->model("DBI")->dbh }

Now, $c->dbh is available.

Session timeouts et cetera are configurable in the session plugin.
The session keeps track of when it was created, and when it was updated.

Setting extra fields (in the session or in the database), which are not
automatically set by the authentication plugin, can easily be done by
you, even if you use a authentication plugin. You can do this in the
"auto" action, for example.

I can only suggest you to search for existing modules, and use them
whenever possible. Thanks to Moose, extending a catalyst module is easy
in most cases. And it is much less work than writing everything from
scratch.

In my opinion, the biggest benefit of catalyst is (besides its great
backwards compatibility), that it is very modular, dozens of modules
exist, and most modules are extendable and reusable.

If you try to write all your code by yourself, you will not get happy.

Another suggestion: Maybe you should first forget about your real
applicationfor now, and just work through the catalyst tutorial. You can
finish it in some hours (depending on your perl- and web knowledge).
It will give you a great overview about how Catalyst works, what is
possible (almost everything) and what isn't possible (almost nothing) :)

Or maybe you don't need a monster like catalyst? "Dancer" might be an
option.

Dancer is a perl MVC Framework, too. It is much smaller and simpler than
Catalyst, has less dependencies and less modules and (at least I was
told so) is easier to learn. It does not do as much for you as catalyst
does (in most cases, you have to write more code). But if you have to
reinvent the wheel again and again anyway, it might be a better choice.

Don't get me wrong. I don't suggest you to let catalyst go. Catalyst
rocks! But if most of the benefits are really not an option for you, you
should think about alternatives.


And finally: Don't make unpaid overtime: Go and get a beer! NOW!
Catalyst will be more fun tomorrow!


Ooops, I am writing this while making unpaid overtime. I will go and get
a beer :)

bye, Lukas




On 10/29/2012 08:25 PM, Craig Chant wrote:

Hi Lukas,

I tried to use C::Model::DBI , but I cannot get it to work?

I've ended up refactoring my own SQL module from the exisitng app as
OOP and then as an extension of Catayst::Model

I then create my own Model which extends my SQL module and I've got
it working.

No matter what I tried , I couldn't find $c->dbh , I really seem to
be struggling at the moment getting my head round Catalyst, but I 

Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Rob Brown

basically...

$sth->finish if you've finished with the results of that statement, ie, 
you've looped through the rows and are now done.


$dbh->disconnect if you've finished with the database connection, tho 
now you start to think about working in a persistent environment, where 
you may never disconnect from the database, and/or have some connection 
caching setup.


This is where DBIx::Class just takes of all this for you - it does sound 
like you're re-inventing a lot here.


What was the reason for not using DBIC again?




On 10/29/2012 10:10 PM, Craig Chant wrote:

I finally got to grips with extending my own class with the inbuilt $c->dbh.

But am unsure whether I am mean to issue either...

 $sth->finish();

 or

$dbh->disconnect();

Once I have prepared / executed the SQL and fetched the records I want.

so a little further guidance is appreciated.

Craig


From: Lukas Thiemeier [spamcatc...@thiemeier.net]
Sent: 29 October 2012 20:16
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm ->  'auto'

Hi Craig,

Using C::M::DBI is straight forward. Install it from cpan, and run

   script/yourapp.pl create model DBI DBI dsn user password

where "dsn" is sth like "dbi:mysql:dbname", depending on your backend.

If it doesn't work you most likely have some typo in your dsn, username
or password.

When this doesn't work, what error is printed?
What was your input (except passwd, of course)?

Something like $c->dbh doesn't exist. The database handler belongs to
the model, and you can create Cat applications with several models, or
without any model at all. (Or with a model which is not a
database-model, or, or ...)

   $c->model('DBI')->dbh does the trick.

The name "DBI" is required by C::A::Store::DBI, but besides this, any
model name is fine.

Alternatively, add a shortcut to your main App.pm:

   sub dbh{ shift->model("DBI")->dbh }

Now, $c->dbh is available.

Session timeouts et cetera are configurable in the session plugin.
The session keeps track of when it was created, and when it was updated.

Setting extra fields (in the session or in the database), which are not
automatically set by the authentication plugin, can easily be done by
you, even if you use a authentication plugin. You can do this in the
"auto" action, for example.

I can only suggest you to search for existing modules, and use them
whenever possible. Thanks to Moose, extending a catalyst module is easy
in most cases. And it is much less work than writing everything from
scratch.

In my opinion, the biggest benefit of catalyst is (besides its great
backwards compatibility), that it is very modular, dozens of modules
exist, and most modules are extendable and reusable.

If you try to write all your code by yourself, you will not get happy.

Another suggestion: Maybe you should first forget about your real
applicationfor now, and just work through the catalyst tutorial. You can
finish it in some hours (depending on your perl- and web knowledge).
It will give you a great overview about how Catalyst works, what is
possible (almost everything) and what isn't possible (almost nothing) :)

Or maybe you don't need a monster like catalyst? "Dancer" might be an
option.

Dancer is a perl MVC Framework, too. It is much smaller and simpler than
Catalyst, has less dependencies and less modules and (at least I was
told so) is easier to learn. It does not do as much for you as catalyst
does (in most cases, you have to write more code). But if you have to
reinvent the wheel again and again anyway, it might be a better choice.

Don't get me wrong. I don't suggest you to let catalyst go. Catalyst
rocks! But if most of the benefits are really not an option for you, you
should think about alternatives.


And finally: Don't make unpaid overtime: Go and get a beer! NOW!
Catalyst will be more fun tomorrow!


Ooops, I am writing this while making unpaid overtime. I will go and get
a beer :)

bye, Lukas




On 10/29/2012 08:25 PM, Craig Chant wrote:

Hi Lukas,

I tried to use C::Model::DBI , but I cannot get it to work?

I've ended up refactoring my own SQL module from the exisitng app as OOP and 
then as an extension of  Catayst::Model

I then create my own Model which extends my SQL module and I've got it working.

No matter what I tried , I couldn't find $c->dbh , I really seem to be 
struggling at the moment getting my head round Catalyst, but I am persevering!

I was hoping to use the built in DBI functionality, as it is meant to keep 
database handles / connections open etc..but $c->dbh didn't exits in my Model 
when I created it via myapp_create.pl MODEL DBI

I also appreciate there is a lot of stuff already written such as the 
authentication mechanism, but will that update my backend DB with the current 
location of the user?

Does it have a mechanism to enable 'heartbeat' to keep idle sessions open?

Will it keep up-to-date the date / time field so we can see

RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
I finally got to grips with extending my own class with the inbuilt $c->dbh.

But am unsure whether I am mean to issue either...

$sth->finish();

or

   $dbh->disconnect();

Once I have prepared / executed the SQL and fetched the records I want.

so a little further guidance is appreciated.

Craig


From: Lukas Thiemeier [spamcatc...@thiemeier.net]
Sent: 29 October 2012 20:16
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Hi Craig,

Using C::M::DBI is straight forward. Install it from cpan, and run

  script/yourapp.pl create model DBI DBI dsn user password

where "dsn" is sth like "dbi:mysql:dbname", depending on your backend.

If it doesn't work you most likely have some typo in your dsn, username
or password.

When this doesn't work, what error is printed?
What was your input (except passwd, of course)?

Something like $c->dbh doesn't exist. The database handler belongs to
the model, and you can create Cat applications with several models, or
without any model at all. (Or with a model which is not a
database-model, or, or ...)

  $c->model('DBI')->dbh does the trick.

The name "DBI" is required by C::A::Store::DBI, but besides this, any
model name is fine.

Alternatively, add a shortcut to your main App.pm:

  sub dbh{ shift->model("DBI")->dbh }

Now, $c->dbh is available.

Session timeouts et cetera are configurable in the session plugin.
The session keeps track of when it was created, and when it was updated.

Setting extra fields (in the session or in the database), which are not
automatically set by the authentication plugin, can easily be done by
you, even if you use a authentication plugin. You can do this in the
"auto" action, for example.

I can only suggest you to search for existing modules, and use them
whenever possible. Thanks to Moose, extending a catalyst module is easy
in most cases. And it is much less work than writing everything from
scratch.

In my opinion, the biggest benefit of catalyst is (besides its great
backwards compatibility), that it is very modular, dozens of modules
exist, and most modules are extendable and reusable.

If you try to write all your code by yourself, you will not get happy.

Another suggestion: Maybe you should first forget about your real
applicationfor now, and just work through the catalyst tutorial. You can
finish it in some hours (depending on your perl- and web knowledge).
It will give you a great overview about how Catalyst works, what is
possible (almost everything) and what isn't possible (almost nothing) :)

Or maybe you don't need a monster like catalyst? "Dancer" might be an
option.

Dancer is a perl MVC Framework, too. It is much smaller and simpler than
Catalyst, has less dependencies and less modules and (at least I was
told so) is easier to learn. It does not do as much for you as catalyst
does (in most cases, you have to write more code). But if you have to
reinvent the wheel again and again anyway, it might be a better choice.

Don't get me wrong. I don't suggest you to let catalyst go. Catalyst
rocks! But if most of the benefits are really not an option for you, you
should think about alternatives.


And finally: Don't make unpaid overtime: Go and get a beer! NOW!
Catalyst will be more fun tomorrow!


Ooops, I am writing this while making unpaid overtime. I will go and get
a beer :)

bye, Lukas




On 10/29/2012 08:25 PM, Craig Chant wrote:
> Hi Lukas,
>
> I tried to use C::Model::DBI , but I cannot get it to work?
>
> I've ended up refactoring my own SQL module from the exisitng app as OOP and 
> then as an extension of  Catayst::Model
>
> I then create my own Model which extends my SQL module and I've got it 
> working.
>
> No matter what I tried , I couldn't find $c->dbh , I really seem to be 
> struggling at the moment getting my head round Catalyst, but I am persevering!
>
> I was hoping to use the built in DBI functionality, as it is meant to keep 
> database handles / connections open etc..but $c->dbh didn't exits in my Model 
> when I created it via myapp_create.pl MODEL DBI
>
> I also appreciate there is a lot of stuff already written such as the 
> authentication mechanism, but will that update my backend DB with the current 
> location of the user?
>
> Does it have a mechanism to enable 'heartbeat' to keep idle sessions open?
>
> Will it keep up-to-date the date / time field so we can see at a glance the 
> length of time a user has been logged on via our admin system?
>
> Or does it simply keep a state of whether the user is loged in or not?
>
> I also know that I should look at ORM and DBIC, but one thing at a time, Rome 
> wasn't built in a day, and playing with Catalyst is simply something I want 
> to do, not a requirement of my Job.
>
> I start a 10 month SQL course in January, where I'm sure I will learn about 
> DB's in far more detail and can then consider ORM / DBIC.
>
> There is only so many hours in the day, then

RE: [Catalyst] Why is $c undefined?

2012-10-29 Thread Craig Chant
>>I'm not sure you'd really want $c->dbh anyway, since that's doesn't
>>sound like you would be encapsulating the Model very well, and sounds
>>like you'd have SQL in your controller code?

This was what I thought and am trying to avoid, I am doing my best to keep 
concern with SQL trot he Model and any action/method that requires data to use 
the Model and have the business logic kept in the Model, so that only 
actions->routes and the additional application helper methods are in the 
controller.

I have read and seen frameworks such as Mojolicious encourage a shrinkage of 
the Model and move alot of functionality to the Controller, so there is a 
paradigm which seems to imply it is ok to do more stuff in the Controller, but 
I am leaning towards having the main code in the Model and then bolting it 
together via the Controller.

So for example the authentication for the user is in the Controller but it 
simply utilises the Model

EG.

sub AuthenticateUser {

my ( $self, $c ) = @_;

$c->session;
if(!$c->model('Members')->LogCheck($c)){
$c->forward('/login/login');
}

}

Dunno, this is all new to me and I'm refactoring as I go, so I doubt I'll get 
it right first time! Does anyone?



From: Rob Brown [r...@intelcompute.com]
Sent: 29 October 2012 19:39
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Why is $c undefined?

Just a small FYI more than anything, which might help fill in a few gaps...

$c->dbh would need you to modify MyApp.pm, this is useful at times for
creating little helper methods that you want accessible via $c, or to
override existing $c methods.

The session plugin does this too, that's why $c->sessionid is available,
etc. or $c->check_user_roles() when using the Authorization::Roles plugin.

I'm not sure you'd really want $c->dbh anyway, since that's doesn't
sound like you would be encapsulating the Model very well, and sounds
like you'd have SQL in your controller code?



On 10/29/2012 07:28 PM, Craig Chant wrote:
> Cool, thanks.
>
> Reading the tutorial I got the impression $c was always passed.
>
> Thanks for clearing that up, which is why I guess $c->dbh doesn't exist.
>
> hmm, much for me to get my head round for sure!
>
> Regards,
>
> Craig.
>
> 
> From: Rob Brown [r...@intelcompute.com]
> Sent: 29 October 2012 19:11
> To: catalyst@lists.scsys.co.uk
> Subject: Re: [Catalyst] Why is $c undefined?
>
> There's no black-magic going on, so your AuthenticateUser() sub never
> "magically" gets $c.
>
> In short, you'll only get $c when using the method attributes, such as
> :Private, :Chained, etc.
>
>
>
>
> On 10/29/2012 07:07 PM, Craig Chant wrote:
>> Hi,
>>
>> I seem to be unable to work out why $c is never automatically passed to
>> any of my models or methods?
>>
>> I have in root.pm
>>
>> # always runs first!
>>
>> sub begin :Private {
>>
>> my ( $self, $c ) = @_;
>>
>> # Authenticate
>>
>> $self->AuthenticateUser();
>>
>> return 1;
>>
>> }
>>
>> I then have...
>>
>> sub AuthenticateUser {
>>
>> my ( $self, $c ) = @_;
>>
>> $c->session;
>>
>> if(!$c->model('Members')->LogCheck($c)){
>>
>> $c->uri_for_action('/login/login');
>>
>> }
>>
>> }
>>
>> However, $c is undefined and errors, it only works if I pass it $c from
>> 'begin'..
>>
>> $self->AuthenticateUser($c);
>>
>> I was under the impression that $c was the context (Catalyst) default
>> variable and was always passed to every method / subroutine.
>>
>> is this not the case?
>>
>> Thanks,
>>
>> Craig .
>>
>> This Email and any attachments contain confidential information and is
>> intended solely for the individual to whom it is addressed. If this
>> Email has been misdirected, please notify the author as soon as
>> possible. If you are not the intended recipient you must not disclose,
>> distribute, copy, print or rely on any of the information contained, and
>> all copies must be deleted immediately. Whilst we take reasonable steps
>> to try to identify any software viruses, any attachments to this e-mail
>> may nevertheless contain viruses, which our anti-virus software has
>> failed to identify. You should therefore carry out your own anti-virus
>> checks before opening any documents. HomeLoan Partnership will not
>> accept any liability for damage caused by computer viruses emanating
>> from any attachment or other document supplied with this e-mail.
>> HomeLoan Partnership reserves the right to monitor and archive all
>> e-mail communications through its network. No representative or employee
>> of HomeLoan Partnership has the authority to enter into any contract on
>> behalf of HomeLoan Partnership by email. HomeLoan Partnership is a
>> trading name of H L Partnership Limited, registered in England and Wales
>> with Registration Number 5011722. Registered office: 26-34 Old Street,
>> London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by
>> the Financial Services Authority.
>>
>>
>>
>> __

Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier
Hi Craig,

Using C::M::DBI is straight forward. Install it from cpan, and run

  script/yourapp.pl create model DBI DBI dsn user password

where "dsn" is sth like "dbi:mysql:dbname", depending on your backend.

If it doesn't work you most likely have some typo in your dsn, username
or password.

When this doesn't work, what error is printed?
What was your input (except passwd, of course)?

Something like $c->dbh doesn't exist. The database handler belongs to
the model, and you can create Cat applications with several models, or
without any model at all. (Or with a model which is not a
database-model, or, or ...)

  $c->model('DBI')->dbh does the trick.

The name "DBI" is required by C::A::Store::DBI, but besides this, any
model name is fine.

Alternatively, add a shortcut to your main App.pm:

  sub dbh{ shift->model("DBI")->dbh }

Now, $c->dbh is available.

Session timeouts et cetera are configurable in the session plugin.
The session keeps track of when it was created, and when it was updated.

Setting extra fields (in the session or in the database), which are not
automatically set by the authentication plugin, can easily be done by
you, even if you use a authentication plugin. You can do this in the
"auto" action, for example.

I can only suggest you to search for existing modules, and use them
whenever possible. Thanks to Moose, extending a catalyst module is easy
in most cases. And it is much less work than writing everything from
scratch.

In my opinion, the biggest benefit of catalyst is (besides its great
backwards compatibility), that it is very modular, dozens of modules
exist, and most modules are extendable and reusable.

If you try to write all your code by yourself, you will not get happy.

Another suggestion: Maybe you should first forget about your real
applicationfor now, and just work through the catalyst tutorial. You can
finish it in some hours (depending on your perl- and web knowledge).
It will give you a great overview about how Catalyst works, what is
possible (almost everything) and what isn't possible (almost nothing) :)

Or maybe you don't need a monster like catalyst? "Dancer" might be an
option.

Dancer is a perl MVC Framework, too. It is much smaller and simpler than
Catalyst, has less dependencies and less modules and (at least I was
told so) is easier to learn. It does not do as much for you as catalyst
does (in most cases, you have to write more code). But if you have to
reinvent the wheel again and again anyway, it might be a better choice.

Don't get me wrong. I don't suggest you to let catalyst go. Catalyst
rocks! But if most of the benefits are really not an option for you, you
should think about alternatives.


And finally: Don't make unpaid overtime: Go and get a beer! NOW!
Catalyst will be more fun tomorrow!


Ooops, I am writing this while making unpaid overtime. I will go and get
a beer :)

bye, Lukas




On 10/29/2012 08:25 PM, Craig Chant wrote:
> Hi Lukas,
> 
> I tried to use C::Model::DBI , but I cannot get it to work?
> 
> I've ended up refactoring my own SQL module from the exisitng app as OOP and 
> then as an extension of  Catayst::Model
> 
> I then create my own Model which extends my SQL module and I've got it 
> working.
> 
> No matter what I tried , I couldn't find $c->dbh , I really seem to be 
> struggling at the moment getting my head round Catalyst, but I am persevering!
> 
> I was hoping to use the built in DBI functionality, as it is meant to keep 
> database handles / connections open etc..but $c->dbh didn't exits in my Model 
> when I created it via myapp_create.pl MODEL DBI
> 
> I also appreciate there is a lot of stuff already written such as the 
> authentication mechanism, but will that update my backend DB with the current 
> location of the user?
> 
> Does it have a mechanism to enable 'heartbeat' to keep idle sessions open?
> 
> Will it keep up-to-date the date / time field so we can see at a glance the 
> length of time a user has been logged on via our admin system?
> 
> Or does it simply keep a state of whether the user is loged in or not?
> 
> I also know that I should look at ORM and DBIC, but one thing at a time, Rome 
> wasn't built in a day, and playing with Catalyst is simply something I want 
> to do, not a requirement of my Job.
> 
> I start a 10 month SQL course in January, where I'm sure I will learn about 
> DB's in far more detail and can then consider ORM / DBIC.
> 
> There is only so many hours in the day, then there are only so many I am paid 
> to work and then there is only so much information I can absorb in one go!
> 
> I'm already sitting here doing unpaid overtime, but I'm commited to getting 
> Catalyst working, so don't mind putting in the extra hours, sounds sad I 
> know, but I am enjoying it, even if I seem frustrated at times.
> 
> Thank for all the input.
> 
> Craig.
> 
> 
> From: Lukas Thiemeier [spamcatc...@thiemeier.net]
> Sent: 29 October 2012 19:03
> To: catalys

Re: [Catalyst] Why is $c undefined?

2012-10-29 Thread Rob Brown

Just a small FYI more than anything, which might help fill in a few gaps...

$c->dbh would need you to modify MyApp.pm, this is useful at times for 
creating little helper methods that you want accessible via $c, or to 
override existing $c methods.


The session plugin does this too, that's why $c->sessionid is available, 
etc. or $c->check_user_roles() when using the Authorization::Roles plugin.


I'm not sure you'd really want $c->dbh anyway, since that's doesn't 
sound like you would be encapsulating the Model very well, and sounds 
like you'd have SQL in your controller code?




On 10/29/2012 07:28 PM, Craig Chant wrote:

Cool, thanks.

Reading the tutorial I got the impression $c was always passed.

Thanks for clearing that up, which is why I guess $c->dbh doesn't exist.

hmm, much for me to get my head round for sure!

Regards,

Craig.


From: Rob Brown [r...@intelcompute.com]
Sent: 29 October 2012 19:11
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Why is $c undefined?

There's no black-magic going on, so your AuthenticateUser() sub never
"magically" gets $c.

In short, you'll only get $c when using the method attributes, such as
:Private, :Chained, etc.




On 10/29/2012 07:07 PM, Craig Chant wrote:

Hi,

I seem to be unable to work out why $c is never automatically passed to
any of my models or methods?

I have in root.pm

# always runs first!

sub begin :Private {

my ( $self, $c ) = @_;

# Authenticate

$self->AuthenticateUser();

return 1;

}

I then have...

sub AuthenticateUser {

my ( $self, $c ) = @_;

$c->session;

if(!$c->model('Members')->LogCheck($c)){

$c->uri_for_action('/login/login');

}

}

However, $c is undefined and errors, it only works if I pass it $c from
'begin'..

$self->AuthenticateUser($c);

I was under the impression that $c was the context (Catalyst) default
variable and was always passed to every method / subroutine.

is this not the case?

Thanks,

Craig .

This Email and any attachments contain confidential information and is
intended solely for the individual to whom it is addressed. If this
Email has been misdirected, please notify the author as soon as
possible. If you are not the intended recipient you must not disclose,
distribute, copy, print or rely on any of the information contained, and
all copies must be deleted immediately. Whilst we take reasonable steps
to try to identify any software viruses, any attachments to this e-mail
may nevertheless contain viruses, which our anti-virus software has
failed to identify. You should therefore carry out your own anti-virus
checks before opening any documents. HomeLoan Partnership will not
accept any liability for damage caused by computer viruses emanating
from any attachment or other document supplied with this e-mail.
HomeLoan Partnership reserves the right to monitor and archive all
e-mail communications through its network. No representative or employee
of HomeLoan Partnership has the authority to enter into any contract on
behalf of HomeLoan Partnership by email. HomeLoan Partnership is a
trading name of H L Partnership Limited, registered in England and Wales
with Registration Number 5011722. Registered office: 26-34 Old Street,
London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by
the Financial Services Authority.



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


--
IntelCompute
Web Design&  Online Marketing Experts

http://www.intelcompute.com

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partn

ership has the authority to enter 

RE: [Catalyst] Why is $c undefined?

2012-10-29 Thread Craig Chant
Thanks Will,



Appreciate you clarifying this for me.



CRaig.


From: will trillich [will.trill...@serensoft.com]
Sent: 29 October 2012 19:16
To: The elegant MVC web framework
Subject: Re: [Catalyst] Why is $c undefined?

On Mon, Oct 29, 2012 at 2:07 PM, Craig Chant 
mailto:cr...@homeloanpartnership.com>> wrote:
sub begin :Private {

my ( $self, $c ) = @_;

# Authenticate
$self->AuthenticateUser();

Note, you don't pass $c to AuthenticateUser here!


return 1;

}

I then have...

sub AuthenticateUser {

my ( $self, $c ) = @_;

$c->session;
if(!$c->model('Members')->LogCheck($c)){
$c->uri_for_action('/login/login');
}

}

However, $c is undefined and errors, it only works if I pass it $c from 
'begin'..

$self->AuthenticateUser($c);


I was under the impression that $c was the context (Catalyst) default variable 
and was always passed to every method / subroutine.

is this not the case?

Right, that's not the case. It only passes to the :Chained or :Args or 
:CaptureArgs methods. This leaves you free to create your own internal methods 
that don't get extra $c args interfering with your logic.


--
[http://www.serensoft.com/sites/all/themes/marinelli/img/serensoft_logo_screen.gif]
 Will Trillich :: 812.454.6431

“Grading takes away all the fun from failing. And a huge part of education is 
about failure.”  -- Shimon Schocken
This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Why is $c undefined?

2012-10-29 Thread Lukas Thiemeier
Hi again,

$c is automatically passed to Catalyst-actions  (not methods), but only
if you use Catalyst to do so.

If you call

 $self->someaction;

or

  $c->controller('SomeController')->someaction();

it is not passed. How can catalyst know if you are calling a catalyst
action, or any method on any object? And even if the object is a
catalyst controller, how can catalyst know if it is a action, which
requires the context, or just a helper, which doesn't use the context?

If you want catalyst to pass $c, use $c->forward, $c->detach, $c->visit
and $c->go instead:

  $c->forward("/someaction");

or

  $c->forward($c->controller('MyController')->action_for("someaction"));

or

  $c->forward("/somecontroller/someaction");

Read the main catalyst docs for details. (perldoc Catalyst)

Lukas

On 10/29/2012 08:07 PM, Craig Chant wrote:
> Hi,
> 
>  
> 
> I seem to be unable to work out why $c is never automatically passed to
> any of my models or methods?
> 
>  
> 
> I have in root.pm
> 
>  
> 
> # always runs first!
> 
> sub begin :Private {
> 
>
> 
> my ( $self, $c ) = @_;
> 
>  
> 
> # Authenticate
> 
> $self->AuthenticateUser();   
> 
> return 1;
> 
>
> 
> }
> 
>  
> 
> I then have...
> 
>  
> 
> sub AuthenticateUser {
> 
>
> 
> my ( $self, $c ) = @_;   
> 
> 
> 
> $c->session;
> 
> if(!$c->model('Members')->LogCheck($c)){
> 
> $c->uri_for_action('/login/login');
> 
> }   
> 
> 
> 
> }
> 
>  
> 
> However, $c is undefined and errors, it only works if I pass it $c from
> 'begin'..
> 
>  
> 
> $self->AuthenticateUser($c);   
> 
>  
> 
>  
> 
> I was under the impression that $c was the context (Catalyst) default
> variable and was always passed to every method / subroutine.
> 
>  
> 
> is this not the case?
> 
>  
> 
> Thanks,
> 
>  
> 
> Craig .
> 
> This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this
> Email has been misdirected, please notify the author as soon as
> possible. If you are not the intended recipient you must not disclose,
> distribute, copy, print or rely on any of the information contained, and
> all copies must be deleted immediately. Whilst we take reasonable steps
> to try to identify any software viruses, any attachments to this e-mail
> may nevertheless contain viruses, which our anti-virus software has
> failed to identify. You should therefore carry out your own anti-virus
> checks before opening any documents. HomeLoan Partnership will not
> accept any liability for damage caused by computer viruses emanating
> from any attachment or other document supplied with this e-mail.
> HomeLoan Partnership reserves the right to monitor and archive all
> e-mail communications through its network. No representative or employee
> of HomeLoan Partnership has the authority to enter into any contract on
> behalf of HomeLoan Partnership by email. HomeLoan Partnership is a
> trading name of H L Partnership Limited, registered in England and Wales
> with Registration Number 5011722. Registered office: 26-34 Old Street,
> London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by
> the Financial Services Authority.
> 
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Why is $c undefined?

2012-10-29 Thread Craig Chant
Cool, thanks.

Reading the tutorial I got the impression $c was always passed.

Thanks for clearing that up, which is why I guess $c->dbh doesn't exist.

hmm, much for me to get my head round for sure!

Regards,

Craig.


From: Rob Brown [r...@intelcompute.com]
Sent: 29 October 2012 19:11
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Why is $c undefined?

There's no black-magic going on, so your AuthenticateUser() sub never
"magically" gets $c.

In short, you'll only get $c when using the method attributes, such as
:Private, :Chained, etc.




On 10/29/2012 07:07 PM, Craig Chant wrote:
> Hi,
>
> I seem to be unable to work out why $c is never automatically passed to
> any of my models or methods?
>
> I have in root.pm
>
> # always runs first!
>
> sub begin :Private {
>
> my ( $self, $c ) = @_;
>
> # Authenticate
>
> $self->AuthenticateUser();
>
> return 1;
>
> }
>
> I then have...
>
> sub AuthenticateUser {
>
> my ( $self, $c ) = @_;
>
> $c->session;
>
> if(!$c->model('Members')->LogCheck($c)){
>
> $c->uri_for_action('/login/login');
>
> }
>
> }
>
> However, $c is undefined and errors, it only works if I pass it $c from
> 'begin'..
>
> $self->AuthenticateUser($c);
>
> I was under the impression that $c was the context (Catalyst) default
> variable and was always passed to every method / subroutine.
>
> is this not the case?
>
> Thanks,
>
> Craig .
>
> This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this
> Email has been misdirected, please notify the author as soon as
> possible. If you are not the intended recipient you must not disclose,
> distribute, copy, print or rely on any of the information contained, and
> all copies must be deleted immediately. Whilst we take reasonable steps
> to try to identify any software viruses, any attachments to this e-mail
> may nevertheless contain viruses, which our anti-virus software has
> failed to identify. You should therefore carry out your own anti-virus
> checks before opening any documents. HomeLoan Partnership will not
> accept any liability for damage caused by computer viruses emanating
> from any attachment or other document supplied with this e-mail.
> HomeLoan Partnership reserves the right to monitor and archive all
> e-mail communications through its network. No representative or employee
> of HomeLoan Partnership has the authority to enter into any contract on
> behalf of HomeLoan Partnership by email. HomeLoan Partnership is a
> trading name of H L Partnership Limited, registered in England and Wales
> with Registration Number 5011722. Registered office: 26-34 Old Street,
> London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by
> the Financial Services Authority.
>
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

--
IntelCompute
Web Design & Online Marketing Experts

http://www.intelcompute.com

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable arch

RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
Hi Lukas,

I tried to use C::Model::DBI , but I cannot get it to work?

I've ended up refactoring my own SQL module from the exisitng app as OOP and 
then as an extension of  Catayst::Model

I then create my own Model which extends my SQL module and I've got it working.

No matter what I tried , I couldn't find $c->dbh , I really seem to be 
struggling at the moment getting my head round Catalyst, but I am persevering!

I was hoping to use the built in DBI functionality, as it is meant to keep 
database handles / connections open etc..but $c->dbh didn't exits in my Model 
when I created it via myapp_create.pl MODEL DBI

I also appreciate there is a lot of stuff already written such as the 
authentication mechanism, but will that update my backend DB with the current 
location of the user?

Does it have a mechanism to enable 'heartbeat' to keep idle sessions open?

Will it keep up-to-date the date / time field so we can see at a glance the 
length of time a user has been logged on via our admin system?

Or does it simply keep a state of whether the user is loged in or not?

I also know that I should look at ORM and DBIC, but one thing at a time, Rome 
wasn't built in a day, and playing with Catalyst is simply something I want to 
do, not a requirement of my Job.

I start a 10 month SQL course in January, where I'm sure I will learn about 
DB's in far more detail and can then consider ORM / DBIC.

There is only so many hours in the day, then there are only so many I am paid 
to work and then there is only so much information I can absorb in one go!

I'm already sitting here doing unpaid overtime, but I'm commited to getting 
Catalyst working, so don't mind putting in the extra hours, sounds sad I know, 
but I am enjoying it, even if I seem frustrated at times.

Thank for all the input.

Craig.


From: Lukas Thiemeier [spamcatc...@thiemeier.net]
Sent: 29 October 2012 19:03
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Hi Craig,

You are NOT wrong. Catalyst allows you to do so. I think it is the right
choice.

For C::A::Store::DBI - What you need is to provide the user_table,
user_key and user_name, and the password_field and password_type for the
credential part. I guess you have this, haven't you?

All the "role" stuff is optional and only required if you want to use
Catalyst::Plugin::Authorization::Roles (which you don't want if I got
you right).

I would suggest you to use as much existing code as possible, and only
rewrite what you really need.

In your case:
Use C::A::Store::DBI for authentication and C::Model::DBI to access your
database.
If you do so, you only have to write your own authorization code (roles
etc) and your CRUD stuff. You can access your db using DBI, without ORM
or any  assumptions to the db layout.

If you can not use C::A::Store::DBI for any reasons, I would still
recommend you to either write your own Catalyst::Authentication::Store
and/or Catalyst::Authentication::Credential modules (I guess a
Store-module will do the trick). You will not have to deal with
user-sessions and related stuff. Just tell Catalyst how to authenticate
the user, and let catalyst itself deal with the session.

Catalyst::Plugin::Authentication::Internals tells you how to write your
own store and credential modules. You will have to read the docs first,
but I am sure that this is less work than writing ALL your
authentication, session handling and authorization code by yourself.

When it comes to reusability, Catalyst is unbeatable :)

If you want or need to write your own authentication code in your
controller classes, you should still use $c->session directly. Don't
fiddle with the session id. Doing so is error-prone, and not required.
You can do it like this:

  unless(defined $c->session->{user}){;
my $user = your_auth_code(\%data);
$c->session(user => $user);
  }

You can later access it in any controller by saying:

  my $user = $c->session->{user}

You can even make a shortcut in your App.pm:

  sub is_authenticated{ defined( shift->session->{user}) }

And later check if the user is authenticated like this:

  if($c->is_authenticated){
do_some_privileged_stuff();
  }


You should consider using DBIx::Class anyway. It doesn't require
normalized databases. Automated model generation might not work
correctly, but in general you can use it on any database. DBIx::Class is
well documented, easy to learn, and it makes database access simple and
safe. Without ORM, you will most likely have to write 10 times more
database-code, and you will have to double check it to ensure that you
are not vulnerable to sql injections.

You are not forced to use DBIC relationships et cetera. You can just use
it to update your tables, and only use the rels where you have them in
your db layout.

In my opinion, the reasons not to use DBIC are:

1: it takes some time to install, but you only have to do it once.

2: it s

Re: [Catalyst] Why is $c undefined?

2012-10-29 Thread will trillich
On Mon, Oct 29, 2012 at 2:07 PM, Craig Chant
wrote:

>  sub begin :Private {
>
>
>
> my ( $self, $c ) = @_;
>
>
>
> # Authenticate
>
> $self->AuthenticateUser();
>

*Note, you don't pass $c to AuthenticateUser here!*



>  return 1;
>
>
>
> }
>
>
>
> I then have...
>
>
>
> sub AuthenticateUser {
>
>
>
> my ( $self, $c ) = @_;
>
>
>
> $c->session;
>
> if(!$c->model('Members')->LogCheck($c)){
>
> $c->uri_for_action('/login/login');
>
> }
>
>
>
> }
>
>
>
> However, $c is undefined and errors, it only works if I pass it $c from
> 'begin'..
>
>
>
> $self->AuthenticateUser($c);
>
>
>
>
>
> I was under the impression that $c was the context (Catalyst) default
> variable and was always passed to every method / subroutine.
>
>
>
> is this not the case?
>

*Right, that's not the case. It only passes to the :Chained or :Args or
:CaptureArgs methods. This leaves you free to create your own internal
methods that don't get extra $c args interfering with your logic.*
*
*

-- 
 Will Trillich :: 812.454.6431

“Grading takes away all the fun from failing. And a huge part of education
is about failure.”  -- Shimon Schocken
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Why is $c undefined?

2012-10-29 Thread Rob Brown
There's no black-magic going on, so your AuthenticateUser() sub never 
"magically" gets $c.


In short, you'll only get $c when using the method attributes, such as 
:Private, :Chained, etc.





On 10/29/2012 07:07 PM, Craig Chant wrote:

Hi,

I seem to be unable to work out why $c is never automatically passed to
any of my models or methods?

I have in root.pm

# always runs first!

sub begin :Private {

my ( $self, $c ) = @_;

# Authenticate

$self->AuthenticateUser();

return 1;

}

I then have...

sub AuthenticateUser {

my ( $self, $c ) = @_;

$c->session;

if(!$c->model('Members')->LogCheck($c)){

$c->uri_for_action('/login/login');

}

}

However, $c is undefined and errors, it only works if I pass it $c from
'begin'..

$self->AuthenticateUser($c);

I was under the impression that $c was the context (Catalyst) default
variable and was always passed to every method / subroutine.

is this not the case?

Thanks,

Craig .

This Email and any attachments contain confidential information and is
intended solely for the individual to whom it is addressed. If this
Email has been misdirected, please notify the author as soon as
possible. If you are not the intended recipient you must not disclose,
distribute, copy, print or rely on any of the information contained, and
all copies must be deleted immediately. Whilst we take reasonable steps
to try to identify any software viruses, any attachments to this e-mail
may nevertheless contain viruses, which our anti-virus software has
failed to identify. You should therefore carry out your own anti-virus
checks before opening any documents. HomeLoan Partnership will not
accept any liability for damage caused by computer viruses emanating
from any attachment or other document supplied with this e-mail.
HomeLoan Partnership reserves the right to monitor and archive all
e-mail communications through its network. No representative or employee
of HomeLoan Partnership has the authority to enter into any contract on
behalf of HomeLoan Partnership by email. HomeLoan Partnership is a
trading name of H L Partnership Limited, registered in England and Wales
with Registration Number 5011722. Registered office: 26-34 Old Street,
London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by
the Financial Services Authority.



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


--
IntelCompute
Web Design & Online Marketing Experts

http://www.intelcompute.com

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Why is $c undefined?

2012-10-29 Thread Craig Chant
Hi,

I seem to be unable to work out why $c is never automatically passed to any of 
my models or methods?

I have in root.pm

# always runs first!
sub begin :Private {

my ( $self, $c ) = @_;

# Authenticate
$self->AuthenticateUser();
return 1;

}

I then have...

sub AuthenticateUser {

my ( $self, $c ) = @_;

$c->session;
if(!$c->model('Members')->LogCheck($c)){
$c->uri_for_action('/login/login');
}

}

However, $c is undefined and errors, it only works if I pass it $c from 
'begin'..

$self->AuthenticateUser($c);


I was under the impression that $c was the context (Catalyst) default variable 
and was always passed to every method / subroutine.

is this not the case?

Thanks,

Craig .
This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier
Hi Craig,

You are NOT wrong. Catalyst allows you to do so. I think it is the right
choice.

For C::A::Store::DBI - What you need is to provide the user_table,
user_key and user_name, and the password_field and password_type for the
credential part. I guess you have this, haven't you?

All the "role" stuff is optional and only required if you want to use
Catalyst::Plugin::Authorization::Roles (which you don't want if I got
you right).

I would suggest you to use as much existing code as possible, and only
rewrite what you really need.

In your case:
Use C::A::Store::DBI for authentication and C::Model::DBI to access your
database.
If you do so, you only have to write your own authorization code (roles
etc) and your CRUD stuff. You can access your db using DBI, without ORM
or any  assumptions to the db layout.

If you can not use C::A::Store::DBI for any reasons, I would still
recommend you to either write your own Catalyst::Authentication::Store
and/or Catalyst::Authentication::Credential modules (I guess a
Store-module will do the trick). You will not have to deal with
user-sessions and related stuff. Just tell Catalyst how to authenticate
the user, and let catalyst itself deal with the session.

Catalyst::Plugin::Authentication::Internals tells you how to write your
own store and credential modules. You will have to read the docs first,
but I am sure that this is less work than writing ALL your
authentication, session handling and authorization code by yourself.

When it comes to reusability, Catalyst is unbeatable :)

If you want or need to write your own authentication code in your
controller classes, you should still use $c->session directly. Don't
fiddle with the session id. Doing so is error-prone, and not required.
You can do it like this:

  unless(defined $c->session->{user}){;
my $user = your_auth_code(\%data);
$c->session(user => $user);
  }

You can later access it in any controller by saying:

  my $user = $c->session->{user}

You can even make a shortcut in your App.pm:

  sub is_authenticated{ defined( shift->session->{user}) }

And later check if the user is authenticated like this:

  if($c->is_authenticated){
do_some_privileged_stuff();
  }


You should consider using DBIx::Class anyway. It doesn't require
normalized databases. Automated model generation might not work
correctly, but in general you can use it on any database. DBIx::Class is
well documented, easy to learn, and it makes database access simple and
safe. Without ORM, you will most likely have to write 10 times more
database-code, and you will have to double check it to ensure that you
are not vulnerable to sql injections.

You are not forced to use DBIC relationships et cetera. You can just use
it to update your tables, and only use the rels where you have them in
your db layout.

In my opinion, the reasons not to use DBIC are:

1: it takes some time to install, but you only have to do it once.

2: it slows down the startup time for your application, but unless you
are using plain CGI, this doesn't really matter. (If you use
plain-old-CGI, STOP doing so. Use FastCGI instead.)

3: It sometimes generates more SQL statements than it is required to
fulfill a certain task, but this is only relevant if you are running a
high performance, high traffic site. And IF this is the case, you can
still optimize it.

If you compare it to the benefits I described above, the benefits are
dominant in most cases.

I know that this is not the universal truth (which doesn't exist
anyway). It is my personal opinion. Just think about it.

Additionally: DBIC makes moving from one database system to another very
very easy. You have a SQLite DB, and want to move to Portgresql?
no problem. With DBIC, you are already done :)

Ok. I hope I could help.

Sorry for the DBIC-praising at the end. It is just that I first didn't
want to use DBIC, too. And now I see how much easier my life is with
DBIC, and I think I should have moved to DBIC earlier.

 Lukas







On 10/29/2012 06:00 PM, Craig Chant wrote:
> Hi Luka,
> 
> Perhaps I miss-read the info on 
> http://search.cpan.org/~janus/Catalyst-Authentication-Store-DBI-0.01/lib/Catalyst/Authentication/Store/DBI.pm
> 
> But from what I can see it expects you to map specific fields in a table as 
> well as have a user role table with specific data mapping?
> 
> [quote] __PACKAGE__->config->{'authentication'} = {
> 'default_realm' => 'default',
> 'realms' => {
>   'default' => {
> 'credential' => {
>   'class'   => 'Password',
>   'password_field'  => 'password',
>   'password_type'   => 'hashed',
>   'password_hash_type'  => 'SHA-1',
> },
> 'store' => {
>   'class'  => 'DBI',
>   'user_table' => 'login',
>   'user_key'   => 'id',
>   'user_name'  => 'name',
>   'role_table' => 'authority',
>   'role_key'   => '

RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
Hi Luka,

Perhaps I miss-read the info on 
http://search.cpan.org/~janus/Catalyst-Authentication-Store-DBI-0.01/lib/Catalyst/Authentication/Store/DBI.pm

But from what I can see it expects you to map specific fields in a table as 
well as have a user role table with specific data mapping?

[quote] __PACKAGE__->config->{'authentication'} = {
'default_realm' => 'default',
'realms' => {
  'default' => {
'credential' => {
  'class'   => 'Password',
  'password_field'  => 'password',
  'password_type'   => 'hashed',
  'password_hash_type'  => 'SHA-1',
},
'store' => {
  'class'  => 'DBI',
  'user_table' => 'login',
  'user_key'   => 'id',
  'user_name'  => 'name',
  'role_table' => 'authority',
  'role_key'   => 'id',
  'role_name'  => 'name',
  'user_role_table'=> 'competence',
  'user_role_user_key' => 'login',
  'user_role_role_key' => 'authority',
},
  },
},
  };[/quote]

Have I read the above incorrectly?

I have a non-normalised DB , with an application that functions in a particular 
way, I deal with user roles and other such stuff in my own way and I cannot 
refactor to use catalyst without ensuring all sections of the system function 
the same along with the back end admin system, I can't rewrite both parts at 
the same time, this is a live app in production that works currently, I'm 
simply trying to learn Catalyst & MVC cuteness, not start from scratch.

>From what I can see using any of those authentication modules expects certain 
>data I don't have or use nor want.

Please correct  me if I'm reading the CPAN documentation incorrectly.

I want to refactor my app to be MVC using Catalyst without being forced to do 
any other than MVC cuteness and work the way I want to with the a database that 
already exists, I got the feeling Catalyst allows this unlike ROR or other MVC 
frameworks.

Again, have I got this wrong?

If to use Catalyst I have to have a normalised DB, use specific modules with 
data in a particular format, then I will just refactor our systems myself using 
my own modules and such, best to find this out now before I spend any more time 
on something that isn't suitable.

Thanks,

Craig.


-Original Message-
From: Lukas Thiemeier [mailto:spamcatc...@thiemeier.net]
Sent: 29 October 2012 16:42
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'


Hey Craig,

I got it. You want to store your credentials in a database, but you don't want 
to use DBIx::Class?

What about Catalyst::Authentication::Storage::DBI?

If this doesn't help, you might me right. Maybe you have to write your own 
authentication module. In that case, consider making it a 
Catalyst::Authentication::Store module, and publish it on cpan. It might be 
useful for others, too...

By the way: Catalyst::Model::DBI is a ORM-less, raw DBI model for catalyst. So 
"... whenever I look at how it implements anything to do with DB access, it 
forces ORM upon you ..." is not correct. There are very few things which are 
really forced by catalyst. Using DBIx::Class is just considered "good 
practice". A lot of people use it, thats why it is used in most tutorials and 
examples.

Lukas



On 10/29/2012 05:09 PM, Craig Chant wrote:
> Yes, but I need to keep a backed DB up-to-date with current logins, where in 
> the system they are etc...
>
> So local server disk won't help in this situation.
>
> -Original Message-
> From: Denny [mailto:2...@denny.me]
> Sent: 29 October 2012 15:50
> To: The elegant MVC web framework
> Subject: RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'
>
> On Mon, 2012-10-29 at 15:43 +, Craig Chant wrote:
>> "By the way, what do you need the session-id for? Catalyst handles sessions 
>> in a transparent way"
>>
>> To authenticate users, I don't want to store authentication in the hash and 
>> it seems the only other way to do this is via ORM, which I don't want to use 
>> either.
>>
>> I find catalyst whenever I look at how it implements anything to do with DB 
>> access, it forces ORM upon you, so I need to write my own authentication 
>> code don't I ?
>
> I'm pretty sure the default storage for session stuff is disk-based.
>
>
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/ This Email and any attachments
> contain confidential information and is intended solely for the
> individual to whom it is addressed. If this Email has been
> misdirected, please notify the author as soon as possible. If you are
> not the intended recipient you must not disclose, distribute

Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier

Hey Craig,

I got it. You want to store your credentials in a database, but you
don't want to use DBIx::Class?

What about Catalyst::Authentication::Storage::DBI?

If this doesn't help, you might me right. Maybe you have to write your
own authentication module. In that case, consider making it a
Catalyst::Authentication::Store module, and publish it on cpan. It might
be useful for others, too...

By the way: Catalyst::Model::DBI is a ORM-less, raw DBI model for
catalyst. So "... whenever I look at how it implements anything to do
with DB access, it forces ORM upon you ..." is not correct. There are
very few things which are really forced by catalyst. Using DBIx::Class
is just considered "good practice". A lot of people use it, thats why it
is used in most tutorials and examples.

Lukas



On 10/29/2012 05:09 PM, Craig Chant wrote:
> Yes, but I need to keep a backed DB up-to-date with current logins, where in 
> the system they are etc...
> 
> So local server disk won't help in this situation.
> 
> -Original Message-
> From: Denny [mailto:2...@denny.me]
> Sent: 29 October 2012 15:50
> To: The elegant MVC web framework
> Subject: RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'
> 
> On Mon, 2012-10-29 at 15:43 +, Craig Chant wrote:
>> "By the way, what do you need the session-id for? Catalyst handles sessions 
>> in a transparent way"
>>
>> To authenticate users, I don't want to store authentication in the hash and 
>> it seems the only other way to do this is via ORM, which I don't want to use 
>> either.
>>
>> I find catalyst whenever I look at how it implements anything to do with DB 
>> access, it forces ORM upon you, so I need to write my own authentication 
>> code don't I ?
> 
> I'm pretty sure the default storage for session stuff is disk-based.
> 
> 
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
> This Email and any attachments contain confidential information and is 
> intended solely for the individual to whom it is addressed. If this Email has 
> been misdirected, please notify the author as soon as possible. If you are 
> not the intended recipient you must not disclose, distribute, copy, print or 
> rely on any of the information contained, and all copies must be deleted 
> immediately. Whilst we take reasonable steps to try to identify any software 
> viruses, any attachments to this e-mail may nevertheless contain viruses, 
> which our anti-virus software has failed to identify. You should therefore 
> carry out your own anti-virus checks before opening any documents. HomeLoan 
> Partnership will not accept any liability for damage caused by computer 
> viruses emanating from any attachment or other document supplied with this 
> e-mail. HomeLoan Partnership reserves the right to monitor and archive all 
> e-mail communications through its network. No representative or employee of 
> HomeLoan Partn
 ership ha
s the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.
> 
> 
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
Yes, but I need to keep a backed DB up-to-date with current logins, where in 
the system they are etc...

So local server disk won't help in this situation.

-Original Message-
From: Denny [mailto:2...@denny.me]
Sent: 29 October 2012 15:50
To: The elegant MVC web framework
Subject: RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

On Mon, 2012-10-29 at 15:43 +, Craig Chant wrote:
> "By the way, what do you need the session-id for? Catalyst handles sessions 
> in a transparent way"
>
> To authenticate users, I don't want to store authentication in the hash and 
> it seems the only other way to do this is via ORM, which I don't want to use 
> either.
>
> I find catalyst whenever I look at how it implements anything to do with DB 
> access, it forces ORM upon you, so I need to write my own authentication code 
> don't I ?

I'm pretty sure the default storage for session stuff is disk-based.



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier
On 10/29/2012 04:43 PM, Craig Chant wrote:
> "By the way, what do you need the session-id for? Catalyst handles sessions 
> in a transparent way"
> 
> To authenticate users, I don't want to store authentication in the hash and 
> it seems the only other way to do this is via ORM, which I don't want to use 
> either.
> 
> I find catalyst whenever I look at how it implements anything to do with DB 
> access, it forces ORM upon you, so I need to write my own authentication code 
> don't I ?
> 

There are lots of authentication modules on cpan. I guess there is
something for you:

Examples:
Catalyst::Authentication::Credential::Remote
-> let the webserver do authenticaion

Catalyst::Authentication::Credential::HTTP
-> basic and digest authentication

Catalyst::Authentication::Store::Htpasswd
-> use catalyst authentication with htpasswd-files

Or you use Catalyst::Authentication::Store::Minimal, and populate the
config hash within "finalize_config" (If you want to store accounts and
passwords in a file, which has no standard-format. Is this what you
meant with "i don't want to store the autentication in the hash? In that
case: Take a look at Config::Any. It might help you parsing your file.)

https://metacpan.org is your friend :)




___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Denny
On Mon, 2012-10-29 at 15:43 +, Craig Chant wrote:
> "By the way, what do you need the session-id for? Catalyst handles sessions 
> in a transparent way"
> 
> To authenticate users, I don't want to store authentication in the hash and 
> it seems the only other way to do this is via ORM, which I don't want to use 
> either.
> 
> I find catalyst whenever I look at how it implements anything to do with DB 
> access, it forces ORM upon you, so I need to write my own authentication code 
> don't I ?

I'm pretty sure the default storage for session stuff is disk-based.



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
"By the way, what do you need the session-id for? Catalyst handles sessions in 
a transparent way"

To authenticate users, I don't want to store authentication in the hash and it 
seems the only other way to do this is via ORM, which I don't want to use 
either.

I find catalyst whenever I look at how it implements anything to do with DB 
access, it forces ORM upon you, so I need to write my own authentication code 
don't I ?

-Original Message-
From: Lukas Thiemeier [mailto:spamcatc...@thiemeier.net]
Sent: 29 October 2012 15:39
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Hi again,

about the missing sessionid:

I don't know much about the internals of Catalyst::Plugin::Session, but I guess 
that the session is a lazy attribute, and only created if used.
This means: unless you put something in the session, you will not have one, and 
therefore have no session-id.

This is very handy, because the overhead related to creating and restoring a 
session is only executed if the session is really needed.
If your app has a session-less interface without authentication, and extra 
functionality for authenticated users, the session will only be created for 
authenticated users.

If you touch your session object before fetching the session-id, it will
work:

$c->session;
$c->res->body("SESSIONID " . $c->sessionid);

As soon as you implemented authentication, the session will be used and the 
session-id will be set.

By the way, what do you need the session-id for? Catalyst handles sessions in a 
transparent way. In most cases, you don't need to access the session-id in your 
code. And if it is only for debugging: The session plugin writes the session-id 
to $c->log when a session is created or restored. This means: the code showed 
above will result in the session-id being printed twice :)

Lukas

On 10/29/2012 04:04 PM, Craig Chant wrote:
> Oh I also tried changing it to 'begin' instead of 'auto', still
> doesn't work?
>
>
>
> I also thought that all calls to ANY method / sub will always be
> passed $self & $c , only it doesn't seem to be passing in $c and I've
> had to manually do it?
>
>
>
> I've tried...
>
>
>
> # always runs first!
>
> sub begin :Private {
>
> my ( $self, $c ) = @_;
>
>
>
> # Authenticate
>
> $self->AuthenticateUser($c);
>
> return 1;
>
>
>
> }
>
>
>
> sub AuthenticateUser {
>
>
>
> my ( $self, $c ) = @_;
>
>
>
> die 'Session ID = ' . $c->sessionid;
>
>
>
> }
>
>
>
> But there is no session ID.
>
>
>
> I am still getting the "Use of uninitialized value in concatenation
> (.) or string"  error.
>
>
>
> I've read
> http://search.cpan.org/~mramberg/Catalyst-Plugin-Session-0.14/lib/Cata
> lyst/Plugin/Session/Tutorial.pod
>
>
>
> Where it states :  These plugins will automatically set
> |$c->sessionid|at the begining of the request, and automatically cause
> |$c->sessionid|to be saved by the client at the end of the request.
>
> So why is $c->sessionid uninitialized?
>
>
>
> Any ideas where my session info is?
>
>
>
> Thanks,
>
>
>
> Craig
>
>
>
> *From:*Craig Chant [mailto:cr...@homeloanpartnership.com]
> *Sent:* 29 October 2012 14:54
> *To:* The elegant MVC web framework
> *Subject:* RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'
>
>
>
> Nope, no change; same warning in the devel output and all that happens
> is the  welcome screen loads?
>
>
>
> *From:*Ben Vinnerd [mailto:ben+catal...@vinnerd.com]
> 
> *Sent:* 29 October 2012 14:48
> *To:* The elegant MVC web framework
> *Subject:* Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'
>
>
>
> Private methods have to return a true value to continue processing.
>
> Try adding "return 1" at the end of the method.
>
> Ben
>
> On 29 October 2012 14:23, Craig Chant  > wrote:
>
> Hi,
>
>
>
> I seem to be going round in circles unable to get Catalyst to output
> anything via 'auto'?
>
>
>
> I made a change to the Root.pm to try to add authentication via the
> 'auto' method, but it does nothing?
>
>
>
> # always runs first!
>
> sub auto :Private {
>
> my ( $self, $c ) = @_;
>
>
>
> # Authenticate
>
> $c->response->body('Matched Members::Controller::Auto in Root.' .
> $c->sessionid);
>
>
>
> }
>
>
>
> This doesn't output anything and I simply get the welcome screen, plus
> there is a warning in the devel server output of
>
>
>
> "Use of uninitialized value in concatenation (.) or string"
>
>
>
> I have ..
>
>
>
> use Catalyst qw/
>
> -Debug
>
> ConfigLoader
>
> Static::Simple
>
> StackTrace
>
> Session
>
> Session::Store::FastMmap
>
> Session::State::Cookie
>
> /;
>
>
>
> In my main MyApp.pm
>
>
>
> Why is $c->response->body not working and why is the sessionid empty?
>
>
>
> Thanks
>
>
>
> */Craig Chant/*
>
> I.T. Manager
>
> Description: cid:image001.png@01CD5F4A.17E848D0
>
> Main Line01903 602664 
>
> Direct Line

Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier
Hi again,

about the missing sessionid:

I don't know much about the internals of Catalyst::Plugin::Session, but
I guess that the session is a lazy attribute, and only created if used.
This means: unless you put something in the session, you will not have
one, and therefore have no session-id.

This is very handy, because the overhead related to creating and
restoring a session is only executed if the session is really needed.
If your app has a session-less interface without authentication, and
extra functionality for authenticated users, the session will only be
created for authenticated users.

If you touch your session object before fetching the session-id, it will
work:

$c->session;
$c->res->body("SESSIONID " . $c->sessionid);

As soon as you implemented authentication, the session will be used and
the session-id will be set.

By the way, what do you need the session-id for? Catalyst handles
sessions in a transparent way. In most cases, you don't need to access
the session-id in your code. And if it is only for debugging: The
session plugin writes the session-id to $c->log when a session is
created or restored. This means: the code showed above will result in
the session-id being printed twice :)

Lukas

On 10/29/2012 04:04 PM, Craig Chant wrote:
> Oh I also tried changing it to ‘begin’ instead of ‘auto’, still doesn’t
> work?
> 
>  
> 
> I also thought that all calls to ANY method / sub will always be passed
> $self & $c , only it doesn’t seem to be passing in $c and I’ve had to
> manually do it?
> 
>  
> 
> I’ve tried…
> 
>  
> 
> # always runs first!
> 
> sub begin :Private {
> 
> my ( $self, $c ) = @_;
> 
>  
> 
> # Authenticate
> 
> $self->AuthenticateUser($c);   
> 
> return 1;
> 
>
> 
> }
> 
>  
> 
> sub AuthenticateUser {
> 
>
> 
> my ( $self, $c ) = @_;
> 
>
> 
> die 'Session ID = ' . $c->sessionid;
> 
>
> 
> }
> 
>  
> 
> But there is no session ID.
> 
>  
> 
> I am still getting the “Use of uninitialized value in concatenation (.)
> or string”  error.
> 
>  
> 
> I’ve read
> http://search.cpan.org/~mramberg/Catalyst-Plugin-Session-0.14/lib/Catalyst/Plugin/Session/Tutorial.pod
> 
>  
> 
> Where it states :  These plugins will automatically set
> |$c->sessionid|at the begining of the request, and automatically cause
> |$c->sessionid|to be saved by the client at the end of the request.
> 
> So why is $c->sessionid uninitialized?
> 
>  
> 
> Any ideas where my session info is?
> 
>  
> 
> Thanks,
> 
>  
> 
> Craig
> 
>  
> 
> *From:*Craig Chant [mailto:cr...@homeloanpartnership.com]
> *Sent:* 29 October 2012 14:54
> *To:* The elegant MVC web framework
> *Subject:* RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'
> 
>  
> 
> Nope, no change; same warning in the devel output and all that happens
> is the  welcome screen loads?
> 
>  
> 
> *From:*Ben Vinnerd [mailto:ben+catal...@vinnerd.com]
> 
> *Sent:* 29 October 2012 14:48
> *To:* The elegant MVC web framework
> *Subject:* Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'
> 
>  
> 
> Private methods have to return a true value to continue processing.
> 
> Try adding "return 1" at the end of the method.
> 
> Ben
> 
> On 29 October 2012 14:23, Craig Chant  > wrote:
> 
> Hi,
> 
>  
> 
> I seem to be going round in circles unable to get Catalyst to output
> anything via ‘auto’?
> 
>  
> 
> I made a change to the Root.pm to try to add authentication via the
> ‘auto’ method, but it does nothing?
> 
>  
> 
> # always runs first!
> 
> sub auto :Private {
> 
> my ( $self, $c ) = @_;
> 
>  
> 
> # Authenticate
> 
> $c->response->body('Matched Members::Controller::Auto in Root.' .
> $c->sessionid);   
> 
>  
> 
> }
> 
>  
> 
> This doesn’t output anything and I simply get the welcome screen, plus
> there is a warning in the devel server output of
> 
>  
> 
> “Use of uninitialized value in concatenation (.) or string”
> 
>  
> 
> I have ..
> 
>  
> 
> use Catalyst qw/
> 
> -Debug
> 
> ConfigLoader
> 
> Static::Simple
> 
> StackTrace
> 
> Session 
> 
> Session::Store::FastMmap 
> 
> Session::State::Cookie   
> 
> /;
> 
>  
> 
> In my main MyApp.pm
> 
>  
> 
> Why is $c->response->body not working and why is the sessionid empty?
> 
>  
> 
> Thanks
> 
>  
> 
> */Craig Chant/*
> 
> I.T. Manager
> 
> Description: cid:image001.png@01CD5F4A.17E848D0
> 
> Main Line01903 602664 
> 
> Direct Line   01903 227753 
> 
> Visit our website http://www.homeloanpartnership.com
> 
> *HomeLoan Partnership have been named the Best Mortgage Network, 2012,
> at the myintroducer.com  Industry Awards*
> 
>  
> 
> This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this
> Email has been misdirected, please notify the author as soon as
> possible. If you are not the intended

RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
OK, thanks.

I assume you meant 'comment' not 'uncomment' , which I did and it now outputs 
what I wanted!

Though $c->sessionid is still blank?


-Original Message-
From: Lukas Thiemeier [mailto:spamcatc...@thiemeier.net]
Sent: 29 October 2012 15:16
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Hi Craig,

Take a look at the default "index" method in Controller/Root.pm.
If you look at the debug output, you will see that "index" is called after 
"auto". Index sets, and therefore overwrites $c->res->body.

If you use a template system, the default "end" action
(ActionClass:RenderView) will only render the template if $c->res->body is not 
set. But setting the body directly, as in "index", will overwrite any 
previously added content.

Uncomment the line '$c->response->body( $c->welcome_message );' in 'sub index 
...', and you will see whatever you write to $c->res->body in "auto".

Cheers, Lukas


On 10/29/2012 04:04 PM, Craig Chant wrote:
> Oh I also tried changing it to 'begin' instead of 'auto', still
> doesn't work?
>
>
>
> I also thought that all calls to ANY method / sub will always be
> passed $self & $c , only it doesn't seem to be passing in $c and I've
> had to manually do it?
>
>
>
> I've tried...
>
>
>
> # always runs first!
>
> sub begin :Private {
>
> my ( $self, $c ) = @_;
>
>
>
> # Authenticate
>
> $self->AuthenticateUser($c);
>
> return 1;
>
>
>
> }
>
>
>
> sub AuthenticateUser {
>
>
>
> my ( $self, $c ) = @_;
>
>
>
> die 'Session ID = ' . $c->sessionid;
>
>
>
> }
>
>
>
> But there is no session ID.
>
>
>
> I am still getting the "Use of uninitialized value in concatenation
> (.) or string"  error.
>
>
>
> I've read
> http://search.cpan.org/~mramberg/Catalyst-Plugin-Session-0.14/lib/Cata
> lyst/Plugin/Session/Tutorial.pod
>
>
>
> Where it states :  These plugins will automatically set
> |$c->sessionid|at the begining of the request, and automatically cause
> |$c->sessionid|to be saved by the client at the end of the request.
>
> So why is $c->sessionid uninitialized?
>
>
>
> Any ideas where my session info is?
>
>
>
> Thanks,
>
>
>
> Craig
>
>
>
> *From:*Craig Chant [mailto:cr...@homeloanpartnership.com]
> *Sent:* 29 October 2012 14:54
> *To:* The elegant MVC web framework
> *Subject:* RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'
>
>
>
> Nope, no change; same warning in the devel output and all that happens
> is the  welcome screen loads?
>
>
>
> *From:*Ben Vinnerd [mailto:ben+catal...@vinnerd.com]
> 
> *Sent:* 29 October 2012 14:48
> *To:* The elegant MVC web framework
> *Subject:* Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'
>
>
>
> Private methods have to return a true value to continue processing.
>
> Try adding "return 1" at the end of the method.
>
> Ben
>
> On 29 October 2012 14:23, Craig Chant  > wrote:
>
> Hi,
>
>
>
> I seem to be going round in circles unable to get Catalyst to output
> anything via 'auto'?
>
>
>
> I made a change to the Root.pm to try to add authentication via the
> 'auto' method, but it does nothing?
>
>
>
> # always runs first!
>
> sub auto :Private {
>
> my ( $self, $c ) = @_;
>
>
>
> # Authenticate
>
> $c->response->body('Matched Members::Controller::Auto in Root.' .
> $c->sessionid);
>
>
>
> }
>
>
>
> This doesn't output anything and I simply get the welcome screen, plus
> there is a warning in the devel server output of
>
>
>
> "Use of uninitialized value in concatenation (.) or string"
>
>
>
> I have ..
>
>
>
> use Catalyst qw/
>
> -Debug
>
> ConfigLoader
>
> Static::Simple
>
> StackTrace
>
> Session
>
> Session::Store::FastMmap
>
> Session::State::Cookie
>
> /;
>
>
>
> In my main MyApp.pm
>
>
>
> Why is $c->response->body not working and why is the sessionid empty?
>
>
>
> Thanks
>
>
>
> */Craig Chant/*
>
> I.T. Manager
>
> Description: cid:image001.png@01CD5F4A.17E848D0
>
> Main Line01903 602664 
>
> Direct Line   01903 227753 
>
> Visit our website http://www.homeloanpartnership.com
>
> *HomeLoan Partnership have been named the Best Mortgage Network, 2012,
> at the myintroducer.com  Industry Awards*
>
>
>
> This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this
> Email has been misdirected, please notify the author as soon as
> possible. If you are not the intended recipient you must not disclose,
> distribute, copy, print or rely on any of the information contained,
> and all copies must be deleted immediately. Whilst we take reasonable
> steps to try to identify any software viruses, any attachments to this
> e-mail may nevertheless contain viruses, which our anti-virus software
> has failed to identify. You should therefore carry out your own
> anti-virus checks before opening any doc

Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Lukas Thiemeier
Hi Craig,

Take a look at the default "index" method in Controller/Root.pm.
If you look at the debug output, you will see that "index" is called
after "auto". Index sets, and therefore overwrites $c->res->body.

If you use a template system, the default "end" action
(ActionClass:RenderView) will only render the template if $c->res->body
is not set. But setting the body directly, as in "index", will overwrite
any previously added content.

Uncomment the line '$c->response->body( $c->welcome_message );' in
'sub index ...', and you will see whatever you write to $c->res->body in
"auto".

Cheers, Lukas


On 10/29/2012 04:04 PM, Craig Chant wrote:
> Oh I also tried changing it to ‘begin’ instead of ‘auto’, still doesn’t
> work?
> 
>  
> 
> I also thought that all calls to ANY method / sub will always be passed
> $self & $c , only it doesn’t seem to be passing in $c and I’ve had to
> manually do it?
> 
>  
> 
> I’ve tried…
> 
>  
> 
> # always runs first!
> 
> sub begin :Private {
> 
> my ( $self, $c ) = @_;
> 
>  
> 
> # Authenticate
> 
> $self->AuthenticateUser($c);   
> 
> return 1;
> 
>
> 
> }
> 
>  
> 
> sub AuthenticateUser {
> 
>
> 
> my ( $self, $c ) = @_;
> 
>
> 
> die 'Session ID = ' . $c->sessionid;
> 
>
> 
> }
> 
>  
> 
> But there is no session ID.
> 
>  
> 
> I am still getting the “Use of uninitialized value in concatenation (.)
> or string”  error.
> 
>  
> 
> I’ve read
> http://search.cpan.org/~mramberg/Catalyst-Plugin-Session-0.14/lib/Catalyst/Plugin/Session/Tutorial.pod
> 
>  
> 
> Where it states :  These plugins will automatically set
> |$c->sessionid|at the begining of the request, and automatically cause
> |$c->sessionid|to be saved by the client at the end of the request.
> 
> So why is $c->sessionid uninitialized?
> 
>  
> 
> Any ideas where my session info is?
> 
>  
> 
> Thanks,
> 
>  
> 
> Craig
> 
>  
> 
> *From:*Craig Chant [mailto:cr...@homeloanpartnership.com]
> *Sent:* 29 October 2012 14:54
> *To:* The elegant MVC web framework
> *Subject:* RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'
> 
>  
> 
> Nope, no change; same warning in the devel output and all that happens
> is the  welcome screen loads?
> 
>  
> 
> *From:*Ben Vinnerd [mailto:ben+catal...@vinnerd.com]
> 
> *Sent:* 29 October 2012 14:48
> *To:* The elegant MVC web framework
> *Subject:* Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'
> 
>  
> 
> Private methods have to return a true value to continue processing.
> 
> Try adding "return 1" at the end of the method.
> 
> Ben
> 
> On 29 October 2012 14:23, Craig Chant  > wrote:
> 
> Hi,
> 
>  
> 
> I seem to be going round in circles unable to get Catalyst to output
> anything via ‘auto’?
> 
>  
> 
> I made a change to the Root.pm to try to add authentication via the
> ‘auto’ method, but it does nothing?
> 
>  
> 
> # always runs first!
> 
> sub auto :Private {
> 
> my ( $self, $c ) = @_;
> 
>  
> 
> # Authenticate
> 
> $c->response->body('Matched Members::Controller::Auto in Root.' .
> $c->sessionid);   
> 
>  
> 
> }
> 
>  
> 
> This doesn’t output anything and I simply get the welcome screen, plus
> there is a warning in the devel server output of
> 
>  
> 
> “Use of uninitialized value in concatenation (.) or string”
> 
>  
> 
> I have ..
> 
>  
> 
> use Catalyst qw/
> 
> -Debug
> 
> ConfigLoader
> 
> Static::Simple
> 
> StackTrace
> 
> Session 
> 
> Session::Store::FastMmap 
> 
> Session::State::Cookie   
> 
> /;
> 
>  
> 
> In my main MyApp.pm
> 
>  
> 
> Why is $c->response->body not working and why is the sessionid empty?
> 
>  
> 
> Thanks
> 
>  
> 
> */Craig Chant/*
> 
> I.T. Manager
> 
> Description: cid:image001.png@01CD5F4A.17E848D0
> 
> Main Line01903 602664 
> 
> Direct Line   01903 227753 
> 
> Visit our website http://www.homeloanpartnership.com
> 
> *HomeLoan Partnership have been named the Best Mortgage Network, 2012,
> at the myintroducer.com  Industry Awards*
> 
>  
> 
> This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this
> Email has been misdirected, please notify the author as soon as
> possible. If you are not the intended recipient you must not disclose,
> distribute, copy, print or rely on any of the information contained, and
> all copies must be deleted immediately. Whilst we take reasonable steps
> to try to identify any software viruses, any attachments to this e-mail
> may nevertheless contain viruses, which our anti-virus software has
> failed to identify. You should therefore carry out your own anti-virus
> checks before opening any documents. HomeLoan Partnership will not
> accept any liability for damage caused by computer viruses emanating
> from any attachment or other document supplied with this e-mail.
> HomeLoan Par

RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
Oh I also tried changing it to ‘begin’ instead of ‘auto’, still doesn’t work?

I also thought that all calls to ANY method / sub will always be passed $self & 
$c , only it doesn’t seem to be passing in $c and I’ve had to manually do it?

I’ve tried…

# always runs first!
sub begin :Private {
my ( $self, $c ) = @_;

# Authenticate
$self->AuthenticateUser($c);
return 1;

}

sub AuthenticateUser {

my ( $self, $c ) = @_;

die 'Session ID = ' . $c->sessionid;

}

But there is no session ID.

I am still getting the “Use of uninitialized value in concatenation (.) or 
string”  error.

I’ve read 
http://search.cpan.org/~mramberg/Catalyst-Plugin-Session-0.14/lib/Catalyst/Plugin/Session/Tutorial.pod


Where it states :  These plugins will automatically set $c->sessionid at the 
begining of the request, and automatically cause $c->sessionid to be saved by 
the client at the end of the request.
So why is $c->sessionid uninitialized?

Any ideas where my session info is?

Thanks,

Craig

From: Craig Chant [mailto:cr...@homeloanpartnership.com]
Sent: 29 October 2012 14:54
To: The elegant MVC web framework
Subject: RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Nope, no change; same warning in the devel output and all that happens is the  
welcome screen loads?

From: Ben Vinnerd 
[mailto:ben+catal...@vinnerd.com]
Sent: 29 October 2012 14:48
To: The elegant MVC web framework
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Private methods have to return a true value to continue processing.

Try adding "return 1" at the end of the method.

Ben
On 29 October 2012 14:23, Craig Chant 
mailto:cr...@homeloanpartnership.com>> wrote:
Hi,

I seem to be going round in circles unable to get Catalyst to output anything 
via ‘auto’?

I made a change to the Root.pm to try to add authentication via the ‘auto’ 
method, but it does nothing?

# always runs first!
sub auto :Private {
my ( $self, $c ) = @_;

# Authenticate
$c->response->body('Matched Members::Controller::Auto in Root.' . 
$c->sessionid);

}

This doesn’t output anything and I simply get the welcome screen, plus there is 
a warning in the devel server output of

“Use of uninitialized value in concatenation (.) or string”

I have ..

use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
StackTrace
Session
Session::Store::FastMmap
Session::State::Cookie
/;

In my main MyApp.pm

Why is $c->response->body not working and why is the sessionid empty?

Thanks

Craig Chant
I.T. Manager
[Description: cid:image001.png@01CD5F4A.17E848D0]
Main Line01903 602664
Direct Line   01903 227753
Visit our website http://www.homeloanpartnership.com
HomeLoan Partnership have been named the Best Mortgage Network, 2012, at the 
myintroducer.com Industry Awards

This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reaso

RE: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
Nope, no change; same warning in the devel output and all that happens is the  
welcome screen loads?

From: Ben Vinnerd [mailto:ben+catal...@vinnerd.com]
Sent: 29 October 2012 14:48
To: The elegant MVC web framework
Subject: Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

Private methods have to return a true value to continue processing.

Try adding "return 1" at the end of the method.

Ben

On 29 October 2012 14:23, Craig Chant 
mailto:cr...@homeloanpartnership.com>> wrote:
Hi,

I seem to be going round in circles unable to get Catalyst to output anything 
via ‘auto’?

I made a change to the Root.pm to try to add authentication via the ‘auto’ 
method, but it does nothing?

# always runs first!
sub auto :Private {
my ( $self, $c ) = @_;

# Authenticate
$c->response->body('Matched Members::Controller::Auto in Root.' . 
$c->sessionid);

}

This doesn’t output anything and I simply get the welcome screen, plus there is 
a warning in the devel server output of

“Use of uninitialized value in concatenation (.) or string”

I have ..

use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
StackTrace
Session
Session::Store::FastMmap
Session::State::Cookie
/;

In my main MyApp.pm

Why is $c->response->body not working and why is the sessionid empty?

Thanks

Craig Chant
I.T. Manager
[Description: cid:image001.png@01CD5F4A.17E848D0]
Main Line01903 602664
Direct Line   01903 227753
Visit our website http://www.homeloanpartnership.com
HomeLoan Partnership have been named the Best Mortgage Network, 2012, at the 
myintroducer.com Industry Awards

This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.
<>___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Ben Vinnerd
Private methods have to return a true value to continue processing.

Try adding "return 1" at the end of the method.

Ben


On 29 October 2012 14:23, Craig Chant  wrote:

>  Hi,
>
>
>
> I seem to be going round in circles unable to get Catalyst to output
> anything via ‘auto’?
>
>
>
> I made a change to the Root.pm to try to add authentication via the ‘auto’
> method, but it does nothing?
>
>
>
> # always runs first!
>
> sub auto :Private {
>
> my ( $self, $c ) = @_;
>
>
>
> # Authenticate
>
> $c->response->body('Matched Members::Controller::Auto in Root.' .
> $c->sessionid);
>
>
>
> }
>
>
>
> This doesn’t output anything and I simply get the welcome screen, plus
> there is a warning in the devel server output of
>
>
>
> “Use of uninitialized value in concatenation (.) or string”
>
>
>
> I have ..
>
>
>
> use Catalyst qw/
>
> -Debug
>
> ConfigLoader
>
> Static::Simple
>
> StackTrace
>
> Session
>
> Session::Store::FastMmap
>
> Session::State::Cookie
>
> /;
>
>
>
> In my main MyApp.pm
>
>
>
> Why is $c->response->body not working and why is the sessionid empty?
>
>
>
> Thanks
>
>
>
> *Craig Chant*
>
> I.T. Manager
>
> [image: Description: cid:image001.png@01CD5F4A.17E848D0]
>
> Main Line01903 602664
>
> Direct Line   01903 227753
>
> Visit our website http://www.homeloanpartnership.com
>
> *HomeLoan Partnership have been named the Best Mortgage Network, 2012, at
> the myintroducer.com Industry Awards*
>
>
>  This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this Email
> has been misdirected, please notify the author as soon as possible. If you
> are not the intended recipient you must not disclose, distribute, copy,
> print or rely on any of the information contained, and all copies must be
> deleted immediately. Whilst we take reasonable steps to try to identify any
> software viruses, any attachments to this e-mail may nevertheless contain
> viruses, which our anti-virus software has failed to identify. You should
> therefore carry out your own anti-virus checks before opening any
> documents. HomeLoan Partnership will not accept any liability for damage
> caused by computer viruses emanating from any attachment or other document
> supplied with this e-mail. HomeLoan Partnership reserves the right to
> monitor and archive all e-mail communications through its network. No
> representative or employee of HomeLoan Partnership has the authority to
> enter into any contract on behalf of HomeLoan Partnership by email.
> HomeLoan Partnership is a trading name of H L Partnership Limited,
> registered in England and Wales with Registration Number 5011722.
> Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership
> Limited is authorised and regulated by the Financial Services Authority.
>
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
<>___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Unable to output anything in Root.pm -> 'auto'

2012-10-29 Thread Craig Chant
Hi,

I seem to be going round in circles unable to get Catalyst to output anything 
via 'auto'?

I made a change to the Root.pm to try to add authentication via the 'auto' 
method, but it does nothing?

# always runs first!
sub auto :Private {
my ( $self, $c ) = @_;

# Authenticate
$c->response->body('Matched Members::Controller::Auto in Root.' . 
$c->sessionid);

}

This doesn't output anything and I simply get the welcome screen, plus there is 
a warning in the devel server output of

"Use of uninitialized value in concatenation (.) or string"

I have ..

use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
StackTrace
Session
Session::Store::FastMmap
Session::State::Cookie
/;

In my main MyApp.pm

Why is $c->response->body not working and why is the sessionid empty?

Thanks

Craig Chant
I.T. Manager
[Description: cid:image001.png@01CD5F4A.17E848D0]
Main Line01903 602664
Direct Line   01903 227753
Visit our website http://www.homeloanpartnership.com
HomeLoan Partnership have been named the Best Mortgage Network, 2012, at the 
myintroducer.com Industry Awards

This Email and any attachments contain confidential information and is intended 
solely for the individual to whom it is addressed. If this Email has been 
misdirected, please notify the author as soon as possible. If you are not the 
intended recipient you must not disclose, distribute, copy, print or rely on 
any of the information contained, and all copies must be deleted immediately. 
Whilst we take reasonable steps to try to identify any software viruses, any 
attachments to this e-mail may nevertheless contain viruses, which our 
anti-virus software has failed to identify. You should therefore carry out your 
own anti-virus checks before opening any documents. HomeLoan Partnership will 
not accept any liability for damage caused by computer viruses emanating from 
any attachment or other document supplied with this e-mail. HomeLoan 
Partnership reserves the right to monitor and archive all e-mail communications 
through its network. No representative or employee of HomeLoan Partnership has 
the authority to enter into any contract on behalf of HomeLoan Partnership by 
email. HomeLoan Partnership is a trading name of H L Partnership Limited, 
registered in England and Wales with Registration Number 5011722. Registered 
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is 
authorised and regulated by the Financial Services Authority.
<>___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Use of uninitialized value in delete

2012-10-29 Thread Will Crawford
On 19 October 2012 18:37, Bill Moseley  wrote:
> delete $c->stash->{foo};

Is there a function / method called "foo" anywhere in scope?

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/