Commits

Anonymous committed 1f55c46

http://code.google.com/p/mochiweb/issues/detail?id=36 Compiler warnings in mochiweb_skel about deprecation of the regexp module in Erlang R15

This was a patch we got for webmachine's project generator, which is basically a copy of mochiweb's. Just spreading the love downstream.

Comments (0)

Files changed (1)

src/mochiweb_skel.erl

     "skel".
 
 skelcopy(Src, DestDir, Name, LDst) ->
-    {ok, Dest, _} = regexp:gsub(filename:basename(Src), skel(), Name),
+    Dest = re:replace(filename:basename(Src), skel(), Name,
+                      [global, {return, list}]),
     case file:read_file_info(Src) of
         {ok, #file_info{type=directory, mode=Mode}} ->
             Dir = DestDir ++ "/" ++ Dest,
         {ok, #file_info{type=regular, mode=Mode}} ->
             OutFile = filename:join(DestDir, Dest),
             {ok, B} = file:read_file(Src),
-            {ok, S, _} = regexp:gsub(binary_to_list(B), skel(), Name),
+            S = re:replace(binary_to_list(B), skel(), Name,
+                           [{return, list}, global]),
             ok = file:write_file(OutFile, list_to_binary(S)),
             ok = file:write_file_info(OutFile, #file_info{mode=Mode}),
             io:format("    ~s~n", [filename:basename(Src)]),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.