my $ak = '7111ac873c9dcd5fc335ded47630d050';my $st = '1523451601875';my $ifo = 'true';my $uu = "15778787898988090";class Stay { has $.ak is rw = '7111ac873c9dcd5fc335ded47630d050'; has $.uu is rw; has $.ifo is rw; has $.st is rw; method gist() { #return qqww/{"ev":"app","ak":"$!ak","uu":"$!uu","ifo":"$!ifo","st":"$!st"}/; return qqww:to「EOF」; {"ev":"app","st":"$!st"} EOF }}say Stay.new(uu => $uu,ifo => $ifo,st => $st);
但失败了:
===SORRY!=== Error while compiling /Users/ohmycloud/Desktop/stay.pl6Confusedat /Users/ohmycloud/Desktop/stay.pl6:18------> {"ev":⏏"app","ifo":"$!i expecting any of: colon pair
我想要的是:
{"ev":"app","ak":"7111ac873c9dcd5fc335ded47630d050","uu":"15778787898988090","ifo":"true","st":"1523451601875"}解决方法 你可以使用 unquoting:
method gist() { return '{"ev":"app","ak":"\qq[$!ak]","uu":"\qq[$!uu]","ifo":"\qq[$!ifo]","st":"\qq[$!st]"}':}
将返回
{"ev":"app","st":"1523451601875"}
如果你使用qqww或类似的话,冒号会妨碍你.
总结以上是内存溢出为你收集整理的perl6 – 不能在`qqww`或`qqww:to`结构中使用冒号对全部内容,希望文章能够帮你解决perl6 – 不能在`qqww`或`qqww:to`结构中使用冒号对所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)