Skip to main content

module_path_to_name

Function module_path_to_name 

Source
pub fn module_path_to_name(module_path: &str) -> String
Expand description

Convert a module path/key into a module name.

Handles both / and \\ separators and strips .pm/.pl suffixes.

ยงExamples

use perl_module_path::module_path_to_name;

assert_eq!(module_path_to_name("Foo/Bar.pm"), "Foo::Bar");
assert_eq!(module_path_to_name(r"Foo\Bar.pm"), "Foo::Bar");
assert_eq!(module_path_to_name("script.pl"), "script");