Changeset 10561 for src/Pugs/Run

Show
Ignore:
Timestamp:
06/05/06 11:29:24 (2 years ago)
Author:
audreyt
svk:copy_cache_prev:
14011
Message:

* Pugs.Run.Args: support for the "=" variant of -M:

pugs -Mlib=foo

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Run/Args.hs

    r9309 r10561  
    174174--   "-e foo bar.p6" executes "foo" with @*ARGS[0] eq "bar.p6", 
    175175--   "-E foo bar.p6" executes "foo" and then bar.p6. 
    176 desugarDashE ((Opt "-M" mod):args) = desugarDashE ((Opt "-E" (";use " ++ mod ++ ";\n")):args) 
     176desugarDashE ((Opt "-M" mod):args) 
     177    | (mod', (_:args)) <- break (== '=') mod 
     178    = useWith $ mod' ++ " '" ++ escape args ++ "'.split(',')" 
     179    | otherwise 
     180    = useWith mod 
     181    where 
     182    useWith mod = desugarDashE ((Opt "-E" (";use " ++ mod ++ ";\n")):args) 
     183    escape [] = [] 
     184    escape ('\'':xs) = '\\':'\'':escape xs 
     185    escape ('\\':xs) = '\\':'\\':escape xs 
     186    escape (x:xs) = x:escape xs 
     187 
    177188 
    178189-- Preserve the curious Perl5 behaviour: