[Catalyst] Can't detach from root / create action object

2013-11-27 Thread Craig Chant
I seem to be going round in circles unable to understand how I create an action 
object so I can pass it to detach as the IRC has told me to pass in an action 
and not what I thought which was 'controller_name, subroutine'.

E.G.

$c-detach('my_controller_name','index');

But it seems that this signature is  ('class_name', 'subroutine')

I'm having a problem with Catalyst randomly deciding when it is OK to have a 
controller and a model called the same, as I have in the same root auto 
subroutine ,

$c-detach('splashscreen','index').

Where I have both a controller called 'SplashScreen' and a model called 
'SplashScreen', and the detach works fine.

However, for another controller / model pair called 'ComplianceUpdates',

This doesn't work

$c-detach('complianceupdates','index').

and errors with...

Couldn't forward to ComplianceUpdates. Does not implement process

Couldn't detach to command complianceupdates: Invalid action or component.
So If I am to use

$c-detach($action);

How do I create a Catalyst::Action object.

What attributes am I meant to be setting in the object before I pass it in, and 
where are the docs for this as I can't find them.

All help is appreciated.


Craig Chant
Information Technology Manager

[Description: Description: HLP_IT_Sig1]

  Direct Line: 01903 227 753   Main Line: 01903 602 664   Website: 
www.homeloanpartnership.comhttp://www.homeloanpartnership.com

[Description: Description: HLP_Sig2_variant]

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: Pharos House, 67 High Street, Worthing, West Sussex, BN11 1DN. H L 
Partnership Limited is authorised and regulated by the Financial Conduct 
Authority.
inline: image002.jpginline: image004.jpg___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread David Schmidt
You should tell us what you want to achieve.

I want to pass an action to detach() is not a proper problem description.


The documentation is pretty clear on what is expected.
https://metacpan.org/pod/Catalyst#c-detach-action-arguments

$c-detach( $action [, \@arguments ] )
$c-detach( $class, $method, [, \@arguments ] )
$c-detach()

Have you checked the Catalyst Tutorial. It should provide examples for detach()
There is also the test suite which you can grep for detach.





On 27 November 2013 13:00, Craig Chant cr...@homeloanpartnership.com wrote:
 I seem to be going round in circles unable to understand how I create an
 action object so I can pass it to detach as the IRC has told me to pass in
 an action and not what I thought which was ‘controller_name, subroutine’.



 E.G.



 $c-detach(‘my_controller_name’,’index’);



 But it seems that this signature is  (‘class_name’, ‘subroutine’)



 I’m having a problem with Catalyst randomly deciding when it is OK to have a
 controller and a model called the same, as I have in the same root auto
 subroutine ,



 $c-detach(‘splashscreen’,’index’).



 Where I have both a controller called ‘SplashScreen’ and a model called
 ‘SplashScreen’, and the detach works fine.



 However, for another controller / model pair called ‘ComplianceUpdates’,



 This doesn’t work



 $c-detach(‘complianceupdates’,’index’).



 and errors with…

 Couldn't forward to ComplianceUpdates. Does not implement process

 Couldn't detach to command complianceupdates: Invalid action or component.

 So If I am to use



 $c-detach($action);



 How do I create a Catalyst::Action object.



 What attributes am I meant to be setting in the object before I pass it in,
 and where are the docs for this as I can’t find them.



 All help is appreciated.





 Craig Chant

 Information Technology Manager





   Direct Line: 01903 227 753   Main Line: 01903 602 664   Website:
 www.homeloanpartnership.com





 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: Pharos House, 67 High
 Street, Worthing, West Sussex, BN11 1DN. H L Partnership Limited is
 authorised and regulated by the Financial Conduct 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/

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


Re: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread Hartmaier Alexander



On 2013-11-27 13:00, Craig Chant wrote:


I seem to be going round in circles unable to understand how I create an action object so I can pass it to detach as the IRC has told me to pass in an action and not what I thought which was controller_name, subroutine.







E.G. 

$c-detach(my_controller_name,index);

But it seems that this signature is (class_name, subroutine)

Im having a problem with Catalyst randomly deciding when it is OK to have a controller and a model called the same, as I have in the same root auto subroutine ,


$c-detach(splashscreen,index). 

Where I have both a controller called SplashScreen and a model called SplashScreen, and the detach works fine.


However, for another controller / model pair called ComplianceUpdates,


This doesnt work

$c-detach(complianceupdates,index). 

and errors with
Couldn't forward to ComplianceUpdates. Does not implement process
Couldn't detach to command complianceupdates: Invalid action or component.
So If I am to use 

$c-detach($action); 

How do I create a Catalyst::Action object.


Exactly like I just told you on IRC: $c-detach($c-controller('ComplianceUpdate')-action_for('index'));



What attributes am I meant to be setting in the object before I pass it in, and where are the docs for this as I cant find them.

All help is appreciated.


Craig Chant
Information Technology Manager



 Direct Line: 01903 227 753 Main Line: 01903 602 664 Website:
www.homeloanpartnership.com




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: Pharos House, 67 High Street, Worthing, West Sussex,
 BN11 1DN. H L Partnership Limited is authorised and regulated by the Financial Conduct 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/





***
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
***
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
***



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


RE: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread Craig Chant
No the documentation isn't clear, if I could understand it I wouldn’t be asking 
this question.

What is $action ?  And yes I've looked at  the manual.

Chapter 3 when you search for 'detach' states..

NOTE: If you use the default template technique, you will not be able to use 
either the $c-forward or the $c-detach mechanisms (these are discussed in 
Chapter 2 and Chapter 9 of the Tutorial).

So I go back to chapter 2 and search for detach and get zero results the same 
when I search chapter 9?

Not sure why you seem to think the tutorial is clear, when I seem to be going 
round in circles?


-Original Message-
From: David Schmidt [mailto:davew...@gmx.at]
Sent: 27 November 2013 12:24
To: The elegant MVC web framework
Subject: Re: [Catalyst] Can't detach from root / create action object

You should tell us what you want to achieve.

I want to pass an action to detach() is not a proper problem description.


The documentation is pretty clear on what is expected.
https://metacpan.org/pod/Catalyst#c-detach-action-arguments

$c-detach( $action [, \@arguments ] )
$c-detach( $class, $method, [, \@arguments ] )
$c-detach()

Have you checked the Catalyst Tutorial. It should provide examples for detach() 
There is also the test suite which you can grep for detach.





On 27 November 2013 13:00, Craig Chant cr...@homeloanpartnership.com wrote:
 I seem to be going round in circles unable to understand how I create
 an action object so I can pass it to detach as the IRC has told me to
 pass in an action and not what I thought which was ‘controller_name, 
 subroutine’.



 E.G.



 $c-detach(‘my_controller_name’,’index’);



 But it seems that this signature is  (‘class_name’, ‘subroutine’)



 I’m having a problem with Catalyst randomly deciding when it is OK to
 have a controller and a model called the same, as I have in the same
 root auto subroutine ,



 $c-detach(‘splashscreen’,’index’).



 Where I have both a controller called ‘SplashScreen’ and a model
 called ‘SplashScreen’, and the detach works fine.



 However, for another controller / model pair called
 ‘ComplianceUpdates’,



 This doesn’t work



 $c-detach(‘complianceupdates’,’index’).



 and errors with…

 Couldn't forward to ComplianceUpdates. Does not implement process

 Couldn't detach to command complianceupdates: Invalid action or component.

 So If I am to use



 $c-detach($action);



 How do I create a Catalyst::Action object.



 What attributes am I meant to be setting in the object before I pass
 it in, and where are the docs for this as I can’t find them.



 All help is appreciated.





 Craig Chant

 Information Technology Manager





   Direct Line: 01903 227 753   Main Line: 01903 602 664   Website:
 www.homeloanpartnership.com





 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: Pharos House, 67 High Street, Worthing, West
 Sussex, BN11 1DN. H L Partnership Limited is authorised and regulated by the 
 Financial Conduct 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 

RE: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread Craig Chant
Thanks Alexander,

I must have missed this :  
$c-detach($c-controller('ComplianceUpdate')-action_for('index'));

It's working as desired, much appreciated.

Craig.

From: Hartmaier Alexander [mailto:alexander.hartma...@t-systems.at]
Sent: 27 November 2013 12:25
To: catalyst@lists.scsys.co.uk
Subject: Re: [Catalyst] Can't detach from root / create action object

On 2013-11-27 13:00, Craig Chant wrote:

I seem to be going round in circles unable to understand how I create an action 
object so I can pass it to detach as the IRC has told me to pass in an action 
and not what I thought which was 'controller_name, subroutine'.

E.G.

$c-detach('my_controller_name','index');

But it seems that this signature is  ('class_name', 'subroutine')

I'm having a problem with Catalyst randomly deciding when it is OK to have a 
controller and a model called the same, as I have in the same root auto 
subroutine ,

$c-detach('splashscreen','index').

Where I have both a controller called 'SplashScreen' and a model called 
'SplashScreen', and the detach works fine.

However, for another controller / model pair called 'ComplianceUpdates',

This doesn't work

$c-detach('complianceupdates','index').

and errors with...

Couldn't forward to ComplianceUpdates. Does not implement process

Couldn't detach to command complianceupdates: Invalid action or component.
So If I am to use

$c-detach($action);

How do I create a Catalyst::Action object.
Exactly like I just told you on IRC: 
$c-detach($c-controller('ComplianceUpdate')-action_for('index'));

What attributes am I meant to be setting in the object before I pass it in, and 
where are the docs for this as I can't find them.

All help is appreciated.


Craig Chant
Information Technology Manager

[Description: Description: HLP_IT_Sig1]

  Direct Line: 01903 227 753   Main Line: 01903 602 664   Website: 
www.homeloanpartnership.comhttp://www.homeloanpartnership.com

[Description: Description: HLP_Sig2_variant]

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: Pharos House, 67 High Street, Worthing, West Sussex, BN11 1DN. H L 
Partnership Limited is authorised and regulated by the Financial Conduct 
Authority.


___

List: Catalyst@lists.scsys.co.ukmailto:Catalyst@lists.scsys.co.uk

Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst

Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

Dev site: http://dev.catalyst.perl.org/



***
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
***
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
***
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 

Re: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread André Walker

On Wed, Nov 27, 2013 at 12:36:54PM +, Craig Chant wrote:

No the documentation isn't clear, if I could understand it I wouldn’t be
asking this question.


I'm sorry you couldn't understand from the documentation. I'll try and explain
a little more here:

# lib/MyApp/Controller/A.pm
package MyApp::Controller::A;
...

sub my_action_1 :Local {
my ($self, $c) = @_;
$c-res-body('in action 1');
}

sub my_action_2 :Local {
my ($self, $c) = @_;
$c-detach('my_action_1');
}

# lib/MyApp/Controller/B.pm
package MyApp::Controller::A;
...

sub other_action :Local {
my ($self, $c) = @_;
$c-detach('/a/my_action_1');
# or
$c-detach('MyApp::Controller::A', 'my_action_1');
}

Is it clearer now?

Cheers!
André


___
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] Setting file handle as the response body generates warnings.

2013-11-27 Thread neil.lunn

On 27/11/2013 4:28 AM, John Napiorkowski wrote:

Awesome, send me a pull request :)

https://github.com/perl-catalyst/catalyst-runtime

John.
The pull is there along with another doc patch I noticed when playing 
around with downstream PSGI invocations. I think the change is sane as 
it worked for me in a trivial test.


What I mentioned regarding subclassing ( or rather what I tested was 
more of a Moose delegation ) for such a class as IO::Compress::Gunzip 
and applying an overload seems rather trivial, though perhaps something 
people may come accross. Perhaps a doc patch to Catalyst::Manual or an 
Advent entry just for documentation sake.


Also passing $c-res-body is something I have used on a few occasions 
as something providing a write for streaming responses (and possibly 
non blocking). So keen to share any thoughts re doing this non-blocking 
for read on a future release.


Should we really be documenting some of the newer catalyst features in 
Cookbook? Or at least putting recipes in Advent . Event loop things, 
response from PSGI and how about Pocket::IO seem relevant.



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.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/


RE: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread Craig Chant
Hi Andre,

That is clearer, and Alexander provided me with a working solution, but it 
doesn't make sense with your example.

$action is an action object isn't it?

So Alexander's example has :-

$c-detach($c-controller('ComplianceUpdate')-action_for('index'));

So I assume

$c-controller('ComplianceUpdate')-action_for('index');

is returning an action object that is passed to detach.

However, your example just has a string path '/a/my_action_1' , how is that an 
action object?

Are you  saying detach (for the single argument signature) takes a URL path and 
that $action is just a string scalar with a URL path in it and not an action 
object reference as I got the impression?

Or are there two single argument signatures to detach() one takes an Action 
object and one takes a URL path string?

Because I did a Data::Dumper of

die Dumper($c-controller('ComplianceUpdate')-action_for('index')) and I got 
an object!

$VAR1 = bless( {
 'namespace' = 'complianceupdates',
 'name' = 'index',
 'class' = 'HLP_Members::Controller::ComplianceUpdates',
 'attributes' = {
   'Path' = [
   'complianceupdates'
 ],
   'Args' = [
   '0'
 ]
 },
 'reverse' = 'complianceupdates/index',
 'code' = sub { DUMMY }
   }, 'Catalyst::Action' );


Having just tested with : -

$c-detach('/complianceupdates/index');

is working.

So the question now is which is better...

$c-controller('ComplianceUpdate')-action_for('index');

or

$c-detach('/complianceupdates/index');

Pass a string or a pass an object?

Thanks,

Craig.

-Original Message-
From: André Walker [mailto:an...@andrewalker.net]
Sent: 27 November 2013 13:04
To: The elegant MVC web framework
Subject: Re: [Catalyst] Can't detach from root / create action object

On Wed, Nov 27, 2013 at 12:36:54PM +, Craig Chant wrote:
 No the documentation isn't clear, if I could understand it I wouldn’t
 be asking this question.

I'm sorry you couldn't understand from the documentation. I'll try and explain 
a little more here:

# lib/MyApp/Controller/A.pm
package MyApp::Controller::A;
...

sub my_action_1 :Local {
 my ($self, $c) = @_;
 $c-res-body('in action 1');
}

sub my_action_2 :Local {
 my ($self, $c) = @_;
 $c-detach('my_action_1');
}

# lib/MyApp/Controller/B.pm
package MyApp::Controller::A;
...

sub other_action :Local {
 my ($self, $c) = @_;
 $c-detach('/a/my_action_1');
 # or
 $c-detach('MyApp::Controller::A', 'my_action_1'); }

Is it clearer now?

Cheers!
André


___
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: Pharos House, 67 High Street, Worthing, West Sussex, BN11 1DN. H L 
Partnership Limited is authorised and regulated by the Financial Conduct 
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] Can't detach from root / create action object

2013-11-27 Thread André Walker

On Wed, Nov 27, 2013 at 02:51:23PM +, Craig Chant wrote:

So I assume

$c-controller('ComplianceUpdate')-action_for('index');

is returning an action object that is passed to detach.


True.


However, your example just has a string path '/a/my_action_1' , how is that
an action object?


It's not :) Catalyst magically converts that for you.

See this:

https://metacpan.org/source/JJNAPIORK/Catalyst-Runtime-5.90051/lib/Catalyst/Dispatcher.pm#L148

It either gets an action object, or it translates the path to an object for
you.


Having just tested with:

$c-detach('/complianceupdates/index');

is working.

So the question now is which is better...

$c-controller('ComplianceUpdate')-action_for('index');

or

$c-detach('/complianceupdates/index');

Pass a string or a pass an object?


I like the string option better. It's cleaner to read. But you should be fine
with both.

Cheers,
André


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


RE: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread Craig Chant
Awesome, thanks for demystifying this for me!

# go to a string path (/foo/bar/gorch)
# or action object
if (blessed($command)  $command-isa('Catalyst::Action')) {
$action = $command;
}
else {
$action = $self-_invoke_as_path( $c, $command, \@args );
}

I'm still at a loss why when I was using the wrong syntax, it was working for 
SplashScreen, but the same syntax for ComplianceUpdates wasn't!

And I still can't find where in the docs/tutorial any of this is explained? (a 
section and page number would be helpful!)

Regards,

Craig.


-Original Message-
From: André Walker [mailto:an...@andrewalker.net]
Sent: 27 November 2013 15:46
To: The elegant MVC web framework
Subject: Re: [Catalyst] Can't detach from root / create action object

On Wed, Nov 27, 2013 at 02:51:23PM +, Craig Chant wrote:
 So I assume

 $c-controller('ComplianceUpdate')-action_for('index');

 is returning an action object that is passed to detach.

True.

 However, your example just has a string path '/a/my_action_1' , how is
 that an action object?

It's not :) Catalyst magically converts that for you.

See this:

https://metacpan.org/source/JJNAPIORK/Catalyst-Runtime-5.90051/lib/Catalyst/Dispatcher.pm#L148

It either gets an action object, or it translates the path to an object for you.

 Having just tested with:

 $c-detach('/complianceupdates/index');

 is working.

 So the question now is which is better...

 $c-controller('ComplianceUpdate')-action_for('index');

 or

 $c-detach('/complianceupdates/index');

 Pass a string or a pass an object?

I like the string option better. It's cleaner to read. But you should be fine 
with both.

Cheers,
André


___
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: Pharos House, 67 High Street, Worthing, West Sussex, BN11 1DN. H L 
Partnership Limited is authorised and regulated by the Financial Conduct 
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] Can't detach from root / create action object

2013-11-27 Thread Octavian Rasnita

From: Craig Chant cr...@homeloanpartnership.com


Hi Andre,

That is clearer, and Alexander provided me with a working solution, but it 
doesn't make sense with your example.


$action is an action object isn't it?

So Alexander's example has :-

$c-detach($c-controller('ComplianceUpdate')-action_for('index'));

So I assume

$c-controller('ComplianceUpdate')-action_for('index');

is returning an action object that is passed to detach.

However, your example just has a string path '/a/my_action_1' , how is 
that an action object?


Are you  saying detach (for the single argument signature) takes a URL 
path and that $action is just a string scalar with a URL path in it and 
not an action object reference as I got the impression?




Below is a piece of text I created for the Catalyst documentation a long 
time ago (perldoc Catalyst).
It tries to makes the things a little bit clearer for using uri_for_action() 
method, but it is the same in any case an action path is used.
The idea is that even though the action path looks like a URL, it is not an 
URL. It is not the URL that calls that action.



   Note that although the path looks like a URI that dispatches to the
   wanted action, it is not a URI, but an internal path to that action.

   For example, if the action looks like:

package MyApp::Controller::Users;

sub lst : Path('the-list') {}

   You can use:

$c-uri_for_action('/users/lst')

   and it will create the URI /users/the-list.


--Octavian


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


RE: [Catalyst] Can't detach from root / create action object

2013-11-27 Thread Charlie Garrison

Good morning,

On 27/11/13 at 2:51 PM -, Craig Chant 
cr...@homeloanpartnership.com wrote:


Or are there two single argument signatures to detach() one 
takes an Action object and one takes a URL path string?


Being pedantic here, but it doesn't accept a URL path; it 
accepts an action path. Often they are the same, but they don't 
need to be.


# in Root Controller
sub my_list :Path('list') { ... }

You would pass /my_list to detach, but the URL for that action 
would be /list.



Charlie

--
   Ꮚ Charlie Garrison ♊ garri...@zeta.org.au

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt


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