-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "we can catch this earlier now that we optimize out unused att…
…ributes" This reverts commit 50d8ed5. this actually doesn't work, because a method might look like method wrap ($app, @Args) { if (ref $self) { $!app = $app; } else { $self = $self->new({ app => $app, @Args }); } return $self->to_app; }
- Loading branch information
Showing
3 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env perl | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
|
||
use mop; | ||
|
||
# this comes up in, for instance, Plack::Middleware::wrap | ||
|
||
class Foo { | ||
has $!bar is ro; | ||
|
||
method baz ($bar) { | ||
if (ref($self)) { | ||
$!bar = $bar; | ||
} | ||
else { | ||
$self = __CLASS__->new(bar => $bar); | ||
} | ||
|
||
return $self->bar; | ||
} | ||
} | ||
|
||
is(Foo->baz('BAR-class'), 'BAR-class'); | ||
is(Foo->new->baz('BAR-instance'), 'BAR-instance'); | ||
|
||
done_testing; |