| ||||||||||||||
| ||||||||||||||
Using CPAN Posted by ratnerd0 (ratnerd0), 21 October 2004 I'm a perl novice, and I'm having trouble trying to install a module from CPAN. I'd like my program to output sound at some point, so I wanted to use AUDIO:![]() ![]() I'm not a terribly sophisticated programmer and don't know the first thing about installing modules, so if anyone has an answer, please start from the beginning. Thanks. Posted by admin (Graham Ellis), 22 October 2004 I would tend to install from CPAN by running the following from the command line:perl -MCPAN -e shell and then going into individual install commands .... but (being Perl) There's more than one way of doing it. You could also download, unpack, configure, make, make test and make install, or you could run specific CPAN commands in place of "shell" in the line above. Suggestion: a) Try the first option listed above b) If you run into problems, post up something much more specific (i.e. the module you were trying to load when you had the problem, where in the process the problem occurred, exactly what the messages were) and that'll give me and other readers here a chance of being able to see what's going wrong. Posted by ratnerd0 (ratnerd0), 25 October 2004 Thanks for the reply.First, I should clarify that I am not just a perl novice, but also a programming novice. I'm fine with writing basic programs, but I'm hopeless when it comes to compiling, installing, etc. I tried your first method, but when I tried to run install audio::play it didn't know what I was looking for. (That's what the error said.) I also tried install audio-1.029::play and other variations, with the same result. Next I tried following the advice on cpan.org, downloading and unzipping the file, and then installing it. However, I don't know how to do the 3rd step. The Audio-1.029 folder has a number of makefiles -- do I have to run all of them? Should the makefiles create an executable that I can stick in my library? Should all of this go in my library? Is there any easy way to do this for which I, computer-idiot, have any hope of success? Thanks. Posted by admin (Graham Ellis), 26 October 2004 Once you've unpacked the distribution, you should find a file called README and/or a file called INSTALL which will include the installation instructions. Usually, you would runperl Makefile.PL make make test make install in that order, but it can vary slightly so I really would strongly suggest that you read the install file for each package you install as it may vary slightly. Have a look (for example) at the instructions at http://search.cpan.org/src/NI-S/Audio-1.029/INSTALL A thought struck me as I was writing this - what platform (operating system) are you running on? If you're on Windows, running ActiveState's Perl, then you should really look at ppm. * Get a command shell * run ppm * type in "search audio" to find appropriate packages * type "install xxxxxx" where xxxxxx is the name of the package you have chosen Posted by John_Moylan (jfp), 27 October 2004 As a sidenote here you will probably find that most users are not installing on thier own box, they probably have userspace on a shared machine.using "perl Makefile.PL" on its own will try and install the module in an administrators area and result in permssion denied. By adding a prefix to the Makefile.PL you can tell Perl to install it in your own module directory. Code:
Then: make make test make install **added** Note that you will have to let Perl know to look in your personal module directory, this can be done easily in your script by adding: Code:
Posted by Custard (Custard), 27 October 2004 footnote & gotcha to the PREFIX method above is setting the PERL5LIB environment variable to the path to the libraries too.This gets round problems with modules that have dependencies on other modules you may have installed in your local lib. Setting PERL5LIB fixed the problems I had during configure & make. hth Posted by ratnerd0 (ratnerd0), 28 October 2004 First, I'm not logged in as an administrator, but I do have administrator privileges, so I don't think that's a problem.Yes, I am using ActiveState Perl with Windows, but when I tried to use ppm I got the following error: Error: neither 'HKEY_LOCAL_MACHINE/SOFTWARE/ActiveState/PPM//InstallLocation' nor 'HKEY_CURRENT_USER/SOFTWARE/ActiveState/PPM//InstallLocation' found in registry at C:\Perl\bin\ppm.bat line 29. I suppose that means I have to add these things to my registry, but I have no idea how to do that (or even where the registry is). Is there an easier fix? Now, the install file says to use perl makefile.pl When I run that, I get the following: C:\Perl\site\lib\Audio-1.029>perl makefile.pl Checking if your kit is complete... Looks good Error: Unable to locate installed Perl libraries or Perl source code. It is recommended that you install perl in a standard location before building extensions. Some precompiled versions of perl do not contain these header files, so you cannot build extensions. In such a case, please build and install your perl from a fresh perl distribution. It usually solves this kind of problem. (You get this message, because MakeMaker could not find "C:\p4view\Apps\Gecko\MS I\data\ActivePerl\Perl\lib\CORE\perl.h") Any idea what's going on here? I put the Audio folder into perl\site\lib, which is where other modules are (like LWP, etc.). Is that correct? Should I follow it's advice and reinstall perl. (Which I'm a little loathe to do, lest all of perl stops working...) Thanks for your help everyone. Posted by Custard (Custard), 28 October 2004 Show us your 'perl -V'.From that, you should be able to determine where it thinks the libraries ought to have been put at compile time.. Then compare with where they actually are. If they are different, you can either: Move them to where it thinks they should be, OR set PERL5LIB to point to where they are.. Since you're on Windows, and I only have UNIX experience of this, your milage may vary.. Perhaps jfp or gje could comment on the Windows subtleties. B (jfp & Graham, sorry, didn't mean to take over, I really only wanted to put the PERL5LIB gotcha up) Posted by ratnerd0 (ratnerd0), 28 October 2004 This is what I get from 'perl -v':C:\>perl -v This is perl, v5.8.3 built for MSWin32-x86-multi-thread (with 8 registered patches, see perl -V for more detail) Copyright 1987-2003, Larry Wall Binary build 809 provided by ActiveState Corp. http://www.ActiveState.com ActiveState is a division of Sophos. Built Feb 3 2004 00:28:51 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. However, I'm pretty sure that the libraries are correct. I did the following: C:\Perl>perl -e "print @INC" C:/Perl/libC:/Perl/site/lib. It seems to be looking in two places -- C:/perl/lib and C:/perl/site/lib. I've tried both, and get the same result. Posted by Custard (Custard), 28 October 2004 Gosh, the subtle nuances of perl library paths...It is a bit confusing, and it catches me sometimes, but roughly.. perl/lib would be where the standard perl libraries are kept. and perl/site/lib would be where any modules that you installed would live. So they both have to be on the path. It looks like they are though. BTW. I think you did perl -v instead of perl -V The V needs to be uppercase. It should print out lots of useful information like the paths perl has compiled in. I just looked at this line you wrote. > C:\Perl\site\lib\Audio-1.029>perl makefile.pl Did you unpack the Audio package there? Usually you would unpack the perl module in a temp dir, and run the install steps from there, as the last step (make install) would install it in the correct place. Unless this is the way to do it with ActiveState.. I also noted that there are very few test passes for this module http://testers.cpan.org/show/Audio.html#Audio-1.029 So perhaps installing this is breaking some ground... Occasionally with a tricky module install, you have to get your hands dirty a bit and dig around in the Makefile.PL to see what it is expecting to find and where, so you could do a quick text search for those files it thought it was looking for. The Makefile.PL can be a bit scary looking though. Don't know if I have helped much here. B Posted by ratnerd0 (ratnerd0), 28 October 2004 Ahhh... right you are. Here's perl -VI did indeed unpack it in the site\lib folder, but only because I didn't know better. However, I tried it in a separate file, with the same result. C:\>perl -V Summary of my perl5 (revision 5 version 8 subversion 3) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=def ine useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE - DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPL ICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksi ze=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C: \p4view\Apps\Gecko\MSI\data\ActivePerl\Perl\lib\CORE" -machine:x86' libpth=C:\PROGRA~1\MICROS~3\VC98\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32 .lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsoc k32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comd lg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf - libpath:"C:\p4view\Apps\Gecko\MSI\data\ActivePerl\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_ CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 809 22218 Remove the caveat about detached threads crashing on Windows 22201 Avoid threads+win32 crash by freeing Perl interpreter slightly lat er 22169 Display 'out of memeory' errors using low-level I/O 22159 Upgrade to Time::Hires 1.55 22120 Make 'Configure -Dcf_by=...' work 22051 Upgrade to Time::HiRes 1.54 21540 Fix backward-compatibility issues in if.pm Built under MSWin32 Compiled at Feb 3 2004 00:28:51 @INC: C:/Perl/lib C:/Perl/site/lib . Posted by Custard (Custard), 28 October 2004 Ok,Thanks. One thing that sticks out is that in your second post, there is mention of >(You get this message, because MakeMaker could not find "C:\p4view\Apps\Gecko\MSI\data\ActivePerl\Perl\lib\CORE\perl.h") And in your -V output, the libpath perl was compiled against appears. Because this is (probably) a binary distribution it doesn't look like the perl source and C header files are present. (You don't have a c:\p4view directory do you?). And also on Windows, do you have a C compiler available? It looks (from a great distance) like this module wants to compile some C code (could be wrong, but...) If you have no C compiler, perhaps you could find a binary GCC distro? As I said earlier, I don't have a great deal of experience with Windows, and it looks like you have opened a smallish can of worms. B Posted by ratnerd0 (ratnerd0), 28 October 2004 I feel like I'm getting in way over my head here. Is there another module you would use? I actually have another computer for which ppm is working, but I can't find the audio-1.029 module. Is there another module I should use? All I need is for my module to sound an alarm at a certain point in my program. The alarm can be anything -- I just need my computer speakers to make noise that will catch the user's attention. What's the easiest way to do that?Posted by Custard (Custard), 28 October 2004 Have you tried sending a BELL character to the terminal?It's ascii 07, so print( chr(7) ); worked for me.... Unless you're not using a terminal of course.. To be honest, I've never tried 'doing sound' with perl (yet) Some of the modules look like fun though.. B Posted by ratnerd0 (ratnerd0), 28 October 2004 Well, my oh my, that certainly was easier.Thanks! (I'd still like to learn how to use modules though, so if someone sees what I'm doing wrong, please do let me know. But this will work for now...) Posted by Custard (Custard), 28 October 2004 To make you feel better, it doesn't look like _you_ have done anything wrong.jfp's few simple steps are all it should take. It looks like the particular module you found is one of the more tricky ones. And Windows probably doesn't help a lot. If you're sticking with ActiveState, then take some time to learn how to use ppm. It should be fairly simple, and ought to help with module installation. HTH B Posted by Luckasoft (Luckasoft), 10 December 2004 Hello, friends! As an answer to the thread we have issued beta-version of Visual Perl Module Manager. This is a freeware program wich helps to manage (download, compile, install and uninstall) Perl Modules. Available for Win32 only. Waiting for you comments! http://www.enginsite.com/Download/PerlModM.exe Posted by John_Moylan (jfp), 9 February 2005 Well it seemed mad to create another thread with this name, but it is related to some posts that have gone before.How to use CPAN when not root user on a Linux/Unix box. This is a frequently asked question, unfortunately it an unfrequently answered question. First create your own CPAN directories I use these on my Virtual Private Server /usr/local/lib/CPAN /usr/local/lib/CPAN/man/man1 /usr/local/lib/CPAN/man/man3 Now launch CPAN from the command line Code:
Now tell CPAN you want to update your install paths. Code:
Note that this change is temporary, to make it permanent you need to commit it Code:
lastly you need to add your local/private CPAN path to Perl's @INC (The @INC array is populated with paths that Perl look in when locating modules) Do this by adding the following to your profile. I think this is distribution dependent, I add it to .bash_profile, others may have to add it to .profile or perhaps .bash_rc or whatever shell you use. Code:
Now you can start adding you own modules without root access or pestering the sys admin. Have I missed anything? please post if so Edit: This is as I state for Linux/Unix or Mac OSX (which is a flavour of Unix, and a fine flavour it is too) For Windows I cannot comment but try the post below which is for Windows, mind you, i seem to recall that there was the PPM (Perl Package Manager from Active State) Posted by Luckasoft (Luckasoft), 9 February 2005 Perl Module Manager: http://www.enginsite.com/Perl.htmThis page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| |||||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |