Re: [Catalyst] Deep Recusion error

2012-05-31 Thread Kenneth S Mclane
Well it returns "1" when I change it to that.

Dimitar Petrov  wrote on 05/31/2012 04:00:31 PM:

> From:
> 
> Dimitar Petrov 
> 
> To:
> 
> The elegant MVC web framework 
> 
> Date:
> 
> 05/31/2012 04:02 PM
> 
> Subject:
> 
> Re: [Catalyst] Deep Recusion error
> 
> Hello Kenneth,
> 
> actually many_to_many helpers are not considered as relationships. 
> It's just a helper.
> What are you trying to achieve? Get all roles for given user? Does 
> $c->model('authdb::User')->find({username => $username})->roles do the 
trick?
> 
> Cheers,
> Dimitar
> 
> On Thu, May 31, 2012 at 10:38 PM, Kenneth S Mclane  > wrote:
> Ok, I found that the recursion error is happening when trying to 
> store the role in the session. 
> 
> my $roles = $c->model('authdb::User')->find( { 'username' => $username 
}, { 
> prefetch => 'roles', 
> columns => 'roles.role', 
> }); 
> #$c->session(role => $roles); 
> 
> When I comment it out the error goes away. I switched back to the 
> above code. I am getting "No such relationship roles on User" error 
> but I have this in my User.pm: 
> 
> __PACKAGE__->many_to_many("roles", "user_roles", "role"); 
> 
> I do not understand why it refuses to acknowledge it. 
> 
> Regards 
> 
> Kenneth McLane 
> 
>  700 Locust St 
> 
> Systems Compliance Services 
> 
>  Dubuque, 52001-6838 
> 
> I1OB 
> 
>  USA 
> 
> [image removed] 
> 
> GTS Services Delivery 
> 
>   
> 
> Phone: 
> 
> +1-563-845-4674 
> 
>   
> 
> Tie-Line: 
> 
> 946-4674 
> 
>   
> 
> Mobile: 
> 
> +1-563-940-7147 
> 
>   
> 
> e-mail: 
> 
> ksmcl...@us.ibm.com 
> 
>   
> 
> "Ideas come from everything" -- Alfred Hitchcock 
> 
>   
> 
>  
> 
> 
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: 
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

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


Re: [Catalyst] Deep Recusion error

2012-05-31 Thread Dimitar Petrov
Hello Kenneth,

actually many_to_many helpers are not considered as relationships. It's
just a helper.
What are you trying to achieve? Get all roles for given user? Does
$c->model('authdb::User')->find({username => $username})->roles do the
trick?

Cheers,
Dimitar

On Thu, May 31, 2012 at 10:38 PM, Kenneth S Mclane wrote:

> Ok, I found that the recursion error is happening when trying to store the
> role in the session.
>
> my $roles = $c->model('authdb::User')->find( { 'username' => $username }, {
> prefetch => 'roles',
> columns => 'roles.role',
> });
> #$c->session(role => $roles);
>
> When I comment it out the error goes away. I switched back to the above
> code. I am getting "No such relationship roles on User" error but I have
> this in my User.pm:
>
> __PACKAGE__->many_to_many("roles", "user_roles", "role");
>
> I do not understand why it refuses to acknowledge it.
>
> Regards
>   --
>   *Kenneth McLane*  700 Locust St
>  Systems Compliance Services  Dubuque, 52001-6838 I1OB  USA GTS Services
> DeliveryPhone: +1-563-845-4674Tie-Line: 946-4674Mobile:
> +1-563-940-7147e-mail: ksmcl...@us.ibm.com
> --
> "Ideas come from everything" -- Alfred Hitchcock
>
> ___
> 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] Deep Recusion error

2012-05-31 Thread Kenneth S Mclane
Ok, I found that the recursion error is happening when trying to store the 
role in the session.

my $roles = $c->model('authdb::User')->find( { 'username' => $username }, 
{
prefetch => 'roles',
columns => 'roles.role',
});
#$c->session(role => $roles);

When I comment it out the error goes away. I switched back to the above 
code. I am getting "No such relationship roles on User" error but I have 
this in my User.pm:

__PACKAGE__->many_to_many("roles", "user_roles", "role");

I do not understand why it refuses to acknowledge it. 

Regards



Kenneth McLane
 700 Locust St

Systems Compliance Services
 Dubuque, 52001-6838
I1OB
 USA
GTS Services Delivery
 

Phone:
+1-563-845-4674
 

Tie-Line:
946-4674
 

Mobile:
+1-563-940-7147
 

e-mail:
ksmcl...@us.ibm.com
 

"Ideas come from everything" -- Alfred Hitchcock
 
 
<>___
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] Deep Recursion error and then connection reset

2012-05-31 Thread Kenneth S Mclane
I am getting this error "Deep recursion on subroutine "Storable::nfreeze" 
at /usr/local/share/perl5/DBIx/Class/ResultSourceHandle.pm line 95." in my 
debug output and then the connection is reset after the authentication 
while getting the user role with this sql:

SELECT role.role, user.id, user.username, role.id, role.role FROM 
user_role me  JOIN users user ON user.id = me.user_id  JOIN role role ON 
role.id = me.role_id WHERE ( user.username = ? ): 'ksmcl...@us.ibm.com'

Geberated by this code:

my $roles = $c->model('authdb::UserRole')->find( { 'user.username' => 
$username }, {
prefetch => ['user', 'role'],
columns => 'role.role',
});
$c->session(role => $roles);

It was working and then stopped. I had to change the model, I was using 
'authdb::User' but the nested relationships in my prefetch quit working so 
I switched to the chid table. Both those relationships are 'belong_to'. 
I'm not sure what is going on.

___
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] Catalyst/Starman server Cache::FastMmap problems when running with --background option on CentOS 6

2012-05-31 Thread Robert Rothenberg
I've changed a Catalyst application to use FastMmap session stores instead
of Files, because I am using OpenID which already requires it.

All tests pass, and the server runs fine manually:

  sudo -u myappuser /opt/perl/bin/perl -I /opt/myapp/lib/perl5
/opt/myapp/bin/myapp_server.pl -d --host 127.0.0.1 --port 3001 --keepalive
--fork --pidfile /var/opt/myapp/run/starman.pid

But when run it with the --background option, it fails with the error:

  Caught exception in engine "Lock failed: Bad file descriptor at
/opt/myapp/lib/perl5/i686-linux/Cache/FastMmap.pm line 1189." 

I am using CentOS 6.2 (2.6.32-220.el6.i686).

I can't seem to find anything about this error by Googling. Any idea what
the problem could be?


___
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] Invitation to the "Moving to Moose" hackathon 2012

2012-05-31 Thread Salve J Nilsen

Hei, #catalyst! :)

I hope I don't intrude with this (somewhat) tangential invitation, but 
I assume there might be one or two people on the Catalyst mailing list 
who might consider coming the hackathon...


--->8

Oslo Perl Mongers are organizing a hackathon we're calling "Moving to 
Moose" - We'd love to see you there! :)


Details about this hackathon, including dates, travel information, the 
venue, and registration/booking can be found here:


  http://act.yapc.eu/mtmh2012/

The hackathon will feature 4 full days of hacking, with food and 
lodging organized - and if the weather is nice, a hike to the 
"Preikestolen" viewpoint - one of Norway's most dramatic tourist 
attractions.


We have invited core members of the #p5-mop and #perlrdf crowds, and 
intend to spend the time working on converting CPAN modules to use 
whatever Moosy goodness is appropriate, and to get stuff done towards 
putting a proper MOP (Meta Object Protocol) into Perl core.


While we realize we're a bit late in Catalyst's case, I still hope 
there are some people here interested in the tasks and would consider 
coming anyway. :)


To cover expenses for the venue and food, we're selling commercial 
tickets to companies who would like to support the effort. We are also 
giving rebate promo codes to members of Perl and CPAN communities, so 
they can attend while just covering basic expenses. We're not 
expecting any profit from this event - but if we get any it'll be 
spent on further activities in the Oslo.pm community.


If this hackathon seems like something you'd like to attend, here's 
how to go about it:



*** Get in touch with us ***

 - We'd love to hear if you're coming! :)
 - We hang out on IRC, on the #oslo.pm channel on irc.perl.org.
 - Register yourself here: 


*** Air travel to Stavanger ***

 - Book your own plane ticket to Stavanger Sola Airport (SVG)
   immediately!
 - Make sure to arrive in Stavanger on August 25th *before* 14:00
   local time (CET DST). This is so we can reach the ferry and bus
   connections on our way to the venue. :)
 - If you are planning on going to YAPC::EU, there is a direct flight
   from Frankfurt (FRA) to Stavanger (SVG), and several more during
   the day.
 - Feel free to arrive early or leave late, but in that case you'll
   have to organize your own accommondation.

 - More info can be found here:
   - 


*** Bus travel between Stavanger and the venue ***

 - We'll organize group travel from the airport to Stavanger and from
   Stavanger with a ferry onward to Tau and further with bus to the
   venue.
 - If you arrive very early or late, you may have to organize your own
   bus transport.
 - Bus and ferry itinerary can be found on the website linked at the
   beginning of this mail.


*** Lodging and food at the venue ***

 - We'll stay at the Preikestolen Mountain Lodge. We have 20 rooms
   reserved, so we'll have to share rooms!
 - If enough people sign up, we'll have the cabin (the smaller, older
   building located next to the mountain lodge) all for ourselves.
 - We have done our best to make the stay as cheap as possible, but
   this is after all in Norway. Apologies for the high prices.
 - The cheapest option (3 people sharing a 4-bed room) costs about
   4800 NOK/563 EUR, using the appropriate community promo code below.
 - We'll do our best to find room for everyone, but we reserve the
   right to close registration for certain room types when those
   aren't available any more.
 - If you NEED a separate room (e.g. if you have a serious snoring
   problem), then register for a single-room; Otherwise, please
   register for 2-person or 3-person room only!
 - The rooms go at a first-come-first-served basis. DO NOT DELAY
   REGISTERING.

 - More details can be found here:
   - 


*** Registration ***

 - Register at 
 - When registering, use one of the following codes:

   Community653cabin3   (Share a 3-bed room, cabin, 653 EUR)
   Community782cabin2   (Share a 2-bed room, cabin, 782 EUR)
   Community938cabin1   (Your own room, cabin, 938 EUR)
   Community955hotel3   (Share a 3-bed room, hotel, 955 EUR)
   Community1040hotel2  (Share a 2-bed room, hotel, 1040 EUR)
   Community1300hotel1  (Your own room, hotel, 1300 EUR)

 - Or register as a commercial attendee (no codes required, and you'll
   support the the hackathon with 2500 EUR).
 - Feel free to share these promo codes with others in the community!

 - More details can be found here:
   - 


*** Questions ***

 - If you have questions, please drop by on IRC or send us a mail to
   .
 - If you want to learn more about what we're thinking, check out our
   sponsor page!
   - 


Hope to see you there! :)


Kind regards,

- The hack

Re: [Catalyst] $c->user and session questions

2012-05-31 Thread Kenneth S Mclane
I found that I can simply reference $c->user->hrfirstname. 

As to the role info, that comes from a different source (an sqlite db just 
for this info). I found that $c->session(role => $role); works to insert 
the value in the session, so I just need to pull the data from the table 
into the variable and then I'm good. Thanks for the suggestions.

Tomas Doran  wrote on 05/31/2012 08:31:31 AM:

> From:
> 
> Tomas Doran 
> 
> To:
> 
> The elegant MVC web framework 
> 
> Date:
> 
> 05/31/2012 08:32 AM
> 
> Subject:
> 
> Re: [Catalyst] $c->user and session questions
> 
> 
> On 31 May 2012, at 14:00, Kenneth S Mclane wrote:
> 
> > I have an LDAP server authenticating my users. The look up returns
> a ton of fields in a hash. My questions are as follows: 
> > 
> > 1. What happens to this data/information? Is it stored in the 
> $c->user object? 
> 
> Yes
> 
> > 2. If it is, how do I access it? 
> 
> https://metacpan.org/module/Catalyst::Authentication::Store::LDAP::User
> 
> Like that. Specifically the ->ldap_entry method is probably what you're 
after.
> 
> > 3. Is there a simple way to look at what is stored in the user object? 

> 
> Data::Dumper::Dumper($c->user) ?
> 
> > 4. I would like to store the users role in the session object so 
> it can be accessed for authorization purposes. The docs only have an
> example of storing stuff in a shopping cart, which is a bit more 
> than I need, but there isn't enough there for me to figure out how 
> to store just one thing, and retrieve it, of course. Can someone 
> show me how to do this? 
> > 
> 
> You need to override the user class, and implement the for_session 
> and from_session methods to get additionally stuff serialized.
> 
> Cheers
> t0m
> 
> 
> ___
> 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] $c->user and session questions

2012-05-31 Thread Tomas Doran

On 31 May 2012, at 14:00, Kenneth S Mclane wrote:

> I have an LDAP server authenticating my users. The look up returns a ton of 
> fields in a hash. My questions are as follows: 
> 
> 1. What happens to this data/information? Is it stored in the $c->user 
> object? 

Yes

> 2. If it is, how do I access it? 

https://metacpan.org/module/Catalyst::Authentication::Store::LDAP::User

Like that. Specifically the ->ldap_entry method is probably what you're after.

> 3. Is there a simple way to look at what is stored in the user object? 

Data::Dumper::Dumper($c->user) ?

> 4. I would like to store the users role in the session object so it can be 
> accessed for authorization purposes. The docs only have an example of storing 
> stuff in a shopping cart, which is a bit more than I need, but there isn't 
> enough there for me to figure out how to store just one thing, and retrieve 
> it, of course. Can someone show me how to do this? 
> 

You need to override the user class, and implement the for_session and 
from_session methods to get additionally stuff serialized.

Cheers
t0m


___
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] $c->user and session questions

2012-05-31 Thread Kenneth S Mclane
I have an LDAP server authenticating my users. The look up returns a ton 
of fields in a hash. My questions are as follows:

1. What happens to this data/information? Is it stored in the $c->user 
object?

2. If it is, how do I access it? 

3. Is there a simple way to look at what is stored in the user object?

4. I would like to store the users role in the session object so it can be 
accessed for authorization purposes. The docs only have an example of 
storing stuff in a shopping cart, which is a bit more than I need, but 
there isn't enough there for me to figure out how to store just one thing, 
and retrieve it, of course. Can someone show me how to do this?

Here is a sample of what comes back from the ldap lookup:

SEQUENCE {
051D   11: STRING = 'hrFirstName'
052A9: SET {
05307:   STRING = 'KENNETH'
0539 : }
0539 :   }

I would like to use this as a greeting string in my site wrapper, but I'm 
not sure how to reference it, or if it is even in the object.

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