Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Run Package vs Needs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110653] Re: Run Package vs Needs
  • From: "David Park" <djmpark at comcast.net>
  • Date: Wed, 30 Jun 2010 08:05:59 -0400 (EDT)
  • References: <8622256.1277877387594.JavaMail.root@n11>

1) Evaluate $UserBaseDirectory and look for the Applications folder there.

2) In the Applications folder create a folder for your package application,
MyApplication for example.

3) Say that your package is saved as MyPackage.m. (You might also have a
MyPackage.nb if you are using that method to create the .m file.) Put these
files in the MyApplication folder.

4) Write the BeginPackage statement as:

BeginPackage["MyApplication`MyPackage`", {dependent packages if any}]

Notice that the first argument of BeginPackage gives a kind of file path
from the Applications folder to the package file.

5) Load the package with:

Needs["MyApplication`MyPackage`"]

or 

<<MyApplication`MyPackage`

6) But you say that some routines don't load with your Needs statement. All
that I can think is that they are not mentioned in the public section of the
package with usage statements. Use a

MyRoutine::usage = "MyRoutine[args...] with a description."; 

for each routine that you want exported by the package. Put these statements
after the BeginPackage statement but before the Begin["`Private`"]
statement.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: Miguel Galrinho [mailto:miguel at galrinho.com] 


I have a package in Mathematica that works fine when I open the .m file and
click "Run Package". However, when I type Needs[.] in a notebook, the
package doesn't load 100%, only some functions do. The file begins with

 

                BeginPackage[".", {.}]

 

like I think it was supposed to. I don't know what might be wrong.

 

Can anyone help?

 

Thanks.

 

Miguel Galrinho




  • Prev by Date: Re: SFTP
  • Next by Date: Re: Absolute value
  • Previous by thread: Run Package vs Needs
  • Next by thread: A modified StyleSheet results in FontSize fluctuations in the pdf