Re: [Catalyst] Re: Detach won't detach?

2009-01-29 Thread Jonathan Rockway
* On Thu, Jan 29 2009, Octavian Rasnita wrote:
 I see. In that case $_-[-1] could be used instead of $c, but it is not very 
 nice...

BTW, I thought I would reply to this thread and remind everyone that
this is just supposed to be funny at this point.  If you actually write
your code this way, you are crazy... and not in a good way.

Aristotle's code is the idiomatically correct version, so that's what
you should aim for in this case and in general.

Regards,
Jonathan Rockway

--
print just = another = perl = hacker = if $,=$

___
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] Re: Detach won't detach?

2009-01-29 Thread Octavian Rasnita
I thought that this discussion was about perl golf...

Octavian

- Original Message - 
From: Jonathan Rockway j...@jrock.us
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Thursday, January 29, 2009 1:33 PM
Subject: Re: [Catalyst] Re: Detach won't detach?


* On Thu, Jan 29 2009, Octavian Rasnita wrote:
 I see. In that case $_-[-1] could be used instead of $c, but it is not very 
 nice...
 
 BTW, I thought I would reply to this thread and remind everyone that
 this is just supposed to be funny at this point.  If you actually write
 your code this way, you are crazy... and not in a good way.
 
 Aristotle's code is the idiomatically correct version, so that's what
 you should aim for in this case and in general.
 
 Regards,
 Jonathan Rockway
 
 --
 print just = another = perl = hacker = if $,=$
 
 ___
 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] Re: Detach won't detach?

2009-01-28 Thread Octavian Rasnita
From: pie3...@comcast.net
 Why not 
 sub auto :Private { 
 my $c = pop; 
 return user_logged_in || $c-redirect( ... ); 
 } 

Why not:

sub auto :Private {
  return user_logged_in || pop-redirect( ... ) || 0;
}

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] Re: Detach won't detach?

2009-01-28 Thread Jonas Alves
-- 
Jonas


2009/1/28 Jonathan Rockway j...@jrock.us

 * On Tue, Jan 27 2009, pie3...@comcast.net wrote:
  Why not
 
  sub auto :Private {
  my $c = pop;
  return user_logged_in || $c-res-redirect( ... );
  }

 Because now the correctness of your application depends on undocumented
 behavior (the return value of $c-res-redirect).



With $c-res-redirect || 0 you are already depending on $c-res-redirect
return value. So what's the difference?

-- 
Jonas
___
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] Re: Detach won't detach?

2009-01-28 Thread Matthias Dietrich


On 28.01.2009 at 08:33 Octavian Rasnita wrote:

Why not:

sub auto :Private {
return user_logged_in || pop-redirect( ... ) || 0;
}


Because there used to be $c-req-base within the parentheses...   
Without that, this would work.


matt

--
rainboxx Matthias Dietrich
Freier Software Engineer

rainboxx  |  Tel.: +49 (0) 151 / 50 60 78 64
Tölzer Str. 19|  Mail: m...@rainboxx.de
70372 Stuttgart   |  WWW : http://www.rainboxx.de

XING: https://www.xing.com/profile/Matthias_Dietrich18
GULP: http://www.gulp.de/profil/rainboxx.html



PGP.sig
Description: Signierter Teil der Nachricht
___
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] Re: Detach won't detach?

2009-01-28 Thread Octavian Rasnita
I see. In that case $_-[-1] could be used instead of $c, but it is not very 
nice...

Octavian

- Original Message - 
From: Matthias Dietrich mdietr...@cpan.org
To: The elegant MVC web framework catalyst@lists.scsys.co.uk
Sent: Wednesday, January 28, 2009 7:58 PM
Subject: Re: [Catalyst] Re: Detach won't detach?


 ___
 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] Re: Detach won't detach?

2009-01-27 Thread Jonathan Rockway
* On Mon, Jan 26 2009, Aristotle Pagaltzis wrote:
 sub auto :Private {
   my ( $self, $c ) = @_;

   return 1 if user_logged_in;

   $c-redirect( $c-req-base );
   return 0;
 }

If we are playing golf, I submit:

sub auto :Private {
my $c = pop;
return user_logged_in || $c-redirect( ... ) || 0;
}

Now I have that much more disk space free for pr0n!

Regards,
Jonathan Rockway

--
print just = another = perl = hacker = if $,=$

___
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] Re: Detach won't detach?

2009-01-27 Thread pie3142


Why not 



sub auto :Private { 
        my $c = pop; 
        return user_logged_in || $c-redirect( ... ); 
    } 


Cheers. 

   --m 


- Original Message - 
From: Jonathan Rockway j...@jrock.us 
To: The elegant MVC web framework catalyst@lists.scsys.co.uk 
Sent: Tuesday, January 27, 2009 2:44:55 PM GMT -06:00 US/Canada Central 
Subject: Re: [Catalyst] Re: Detach won't detach? 

* On Mon, Jan 26 2009, Aristotle Pagaltzis wrote: 
     sub auto :Private { 
       my ( $self, $c ) = @_; 
 
       return 1 if user_logged_in; 
 
       $c-redirect( $c-req-base ); 
       return 0; 
     } 

If we are playing golf, I submit: 

    sub auto :Private { 
        my $c = pop; 
        return user_logged_in || $c-redirect( ... ) || 0; 
    } 

Now I have that much more disk space free for pr0n! 

Regards, 
Jonathan Rockway 

-- 
print just = another = perl = hacker = if $,=$ 

___ 
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] Re: Detach won't detach?

2009-01-27 Thread Jonathan Rockway
* On Tue, Jan 27 2009, pie3...@comcast.net wrote:
 Why not

 sub auto :Private {
 my $c = pop;
 return user_logged_in || $c-res-redirect( ... );
 }

Because now the correctness of your application depends on undocumented
behavior (the return value of $c-res-redirect).

--
print just = another = perl = hacker = if $,=$

___
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] Re: Detach won't detach?

2009-01-27 Thread Andrew Rodland
On Tuesday 27 January 2009 05:33:46 pm Jonathan Rockway wrote:
 * On Tue, Jan 27 2009, pie3...@comcast.net wrote:
  Why not
 
  sub auto :Private {
  my $c = pop;
  return user_logged_in || $c-res-redirect( ... );
  }

 Because now the correctness of your application depends on undocumented
 behavior (the return value of $c-res-redirect).

|| 0 doesn't fix that any. Did you want  0? :)

Andrew

___
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] Re: Detach won't detach?

2009-01-27 Thread Aristotle Pagaltzis
* Jonathan Rockway j...@jrock.us [2009-01-27 21:50]:
 If we are playing golf, I submit:

No, it was my way of saying that if I wanted to see Pascal,
I know where to find it.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.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] Re: Detach won't detach?

2009-01-26 Thread Aristotle Pagaltzis
* Lars Balker Rasmussen l...@balker.dk [2009-01-26 20:10]:
 sub auto :Private {
   my ( $self, $c ) = @_;

   if ( ! user_logged_in) {
 $c-redirect( $c-req-base );
 return 0;
   }

   return 1;
 }

sub auto :Private {
  my ( $self, $c ) = @_;

  return 1 if user_logged_in;

  $c-redirect( $c-req-base );
  return 0;
}

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1}
Just-another-Perl-hack;
#Aristotle Pagaltzis // http://plasmasturm.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/