Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make URI::DefaultPort::default-port a method
By making URI::DefaultPort a class and default-port a method it overcomes the problem when URI is used in a module which is subsequently 'require'd Fixes #30
- Loading branch information
1 parent
2e78b6c
commit 1101ec0
Showing
6 changed files
with
34 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.precomp |
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
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,10 @@ | ||
use v6.c; | ||
|
||
use URI; | ||
|
||
class TestURIRequire { | ||
method test(Str $uri) { | ||
my $u = URI.new($uri); | ||
$u.port; | ||
} | ||
} |
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,18 @@ | ||
#!/usr/bin/env perl6 | ||
|
||
use v6.c; | ||
|
||
use Test; | ||
plan 2; | ||
|
||
use lib $*PROGRAM.parent.child('lib').Str; | ||
|
||
require TestURIRequire; | ||
|
||
my $port; | ||
|
||
lives-ok { $port = ::("TestURIRequire").test('http://example.com'); }, "can use URI in a module that is itself required rather than used"; | ||
is $port, 80, "and got the right thing back"; | ||
|
||
|
||
done-testing; |