Your code should work fine if you put the module in a directory that can be 
accessed.  
If you running julia in the directory where the module is located, you can 
recall the full path with:

    joinpath(pwd(), "TestModule.jl")

*j*ulia> using TestModule

julia> println(LOAD_PATH)

Union(UTF8String,ASCIIString)["/Users/maximilianosuster/julia/usr/local/share/julia/site/v0.3","/Users/maximilianosuster/julia/usr/share/julia/site/v0.3"]

julia> test_func

test_func (generic function with 1 method)

julia> test_func("TestVal")

TestVal





On Tuesday, September 30, 2014 11:45:38 AM UTC+2, Gerry Weaver wrote:
>
> Hello All,
>
> I am trying to define and use a module. I have the following code.
>
>
> module TestModule
>
> export test_func
>
> function test_func(val)
>   println(val)
> end
>
> end
>
>
> -----------------------------------
>
>
> #!/usr/bin/julia
>
> using TestModule
>
> println(LOAD_PATH)
>
> test_func("TestVal")
>
>
> I have put the module source file under the path 
> <LOAD_PATH>/TestModule/src/TestModule.jl. I've tried a variety of other 
> variations, but to no avail. Is there something that I am doing wrong? I 
> get "Warning: requiring "TestModule" did not define a corresponding 
> module." when I try to use (using)  the module.
>
> Thanks,
> Gerry
>

Reply via email to