Help for this page

Select Code to Download


  1. or download this
      my subtype NonNegativeNumber of Num where { not $^a < 0 };
    
      my NonNegativeNumber $x =  3; # works
      my NonNegativeNumber $y = -3; # dies
    
  2. or download this
      my subtype HTTP::Request::Method of Str where {
        $^method eq any <GET POST HEAD ...>;
    ...
        # Note: You don't have to manually check for $method
        # not being a valid HTTP method :).
      }