From 2b157d2d8d40107b8ad88d5c208604d49471e087 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 10 Sep 2015 16:05:44 +0100 Subject: better coercion of lang for File --- lib/WebCoso/File.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/WebCoso/File.pm b/lib/WebCoso/File.pm index 764cf2f..1a75e98 100644 --- a/lib/WebCoso/File.pm +++ b/lib/WebCoso/File.pm @@ -8,7 +8,9 @@ class WebCoso::File { $self.bless(:$path); } - submethod BUILD(Str(Cool) :$!lang, Str(Cool) :$!path) {} + submethod BUILD(:$lang, Str(Cool) :$!path) { + $!lang = $lang.Str if $lang.defined; + } multi method contents() { return $!contents //= $.parse(); -- cgit v1.2.3