Re: Modules
What modules and/or libraries are you using? Before you code do you block diagram and flowchart your programs? On Tue, Oct 24, 2023, 12:06 PM Levi Elias Nystad-Johansen via beginners < beginners@perl.org> wrote: > I use modules for complex things that I might get wrong. To re-use other > people's code is often better than to re-invent their solutions. > > https://metacpan.org/pod/WWW::Mechanize::Examples has some good examples > of useful scripts that are short and simple. > Imagine how hard it would be to write the same scripts without the module. > > When I have an issue that I think others must also have faced, I look for > a module to solve the issue. > > But I am critical to modules that are outdated/abandoned, heavy with many > dependencies, or unproven with few downloads etc. > > I also remove modules when I no longer need them. I find this easier with > App::cpanminus > > - L > > > > > > > Original Message > On 24. okt. 2023, 17:31, William Torrez Corea < willitc9...@gmail.com> > wrote: > > > When I must use modules and when I don't must use? > > I am working without modules, only i use: > >1. Subroutines >2. Control flow > > My programs are short and simple, they do not exceed 15 lines. I think > that I need more practice and learn more about Perl. I have limited > knowledge in Perl. > > -- > > With kindest regards, William. > > ⢀⣴⠾⠻⢶⣦⠀ > ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system > ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org > ⠈⠳⣄ > > >
Re: Modules
I use modules for complex things that I might get wrong. To re-use other people's code is often better than to re-invent their solutions. https://metacpan.org/pod/WWW::Mechanize::Examples has some good examples of useful scripts that are short and simple. Imagine how hard it would be to write the same scripts without the module. When I have an issue that I think others must also have faced, I look for a module to solve the issue. But I am critical to modules that are outdated/abandoned, heavy with many dependencies, or unproven with few downloads etc. I also remove modules when I no longer need them. I find this easier with App::cpanminus - L Original Message On 24. okt. 2023, 17:31, William Torrez Corea wrote: > When I must use modules and when I don't must use? > > I am working without modules, only i use: > > - Subroutines > - Control flow > > My programs are short and simple, they do not exceed 15 lines. I think that I > need more practice and learn more about Perl. I have limited knowledge in > Perl. > > -- > > With kindest regards, William. > > ⢀⣴⠾⠻⢶⣦⠀ > ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system > ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org > ⠈⠳⣄
Re: modules
Hi Jim, thanks for replying to Ray. See below for my comments. On Mon, 3 Jun 2013 16:18:53 -0700 Jim Gibson jimsgib...@gmail.com wrote: On Jun 3, 2013, at 4:01 PM, Rahim Fakir wrote: Iam using win 7 64bits, and i downloaded Strawberry, and I use Perl PAckage Manager to install modules, insted of Cpan command. I know how to install them, but I need instrucions how to use them, step by step, how-to run the modules. Each module is used differently. Almost all modules can be included in your program with the statement (usually near the beginning of your program): use Module; where you substitute the name of the module you are going to use for Module. This statement imports the module's program statements into your program. This happens at compile time, no matter where in your program you actually put the 'use' statement. You can also import modules using 'do' or 'require', but you need to know what those do and why to use them before you use them instead of 'use'. Modules come in two flavors: procedural and object-oriented. Some modules support both flavors. Most modules come with built-in documentation that describes how to use them, usually including some sample code statements. To access the documentation, you can do the following on a command-line: perldoc Module Strawberry Perl may afford another way of accessing documentation. Procedural modules will import functions into your namespace, so you can just call these functions as if they were part of built-in Perl or part of your own program. Well, it is a good idea to explicitly import these subroutines to avoid having to hunt where these subroutines are coming from: So you do: use Module qw( func1 func2 func3 ); Instead of: use Module; Object-oriented modules allow you to create objects of the module class, and call methods of those objects. To create an object instance of the Module class: my $object = Module-new(); The new() method is a convention. It could be called anything, but most OO modules use a new() method for object creation, Some new() methods take arguments. To call a method on the object: $object-method(); See the documentation for each module to find out what functions and methods are available. There are Perl tutorials for using modules and doing object-oriented programming: perldoc perlmod perldoc perlmodlib perldoc perlmodstyle perldoc perlmodinstall perldoc perlboot perldoc perltoot perldoc perltooc perlboot, perltoot and perltooc have been deprecated and deleted from the Perl documentation. See: http://perldoc.perl.org/perlboot.html You should use http://perldoc.perl.org/perlootut.html and http://perldoc.perl.org/perlobj.html instead. For more resources see: http://perl-begin.org/topics/object-oriented/ (a link to my site) Thanks again. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Chuck Norris/etc. Facts - http://www.shlomifish.org/humour/bits/facts/ When Chuck Norris uses Gentoo, “emerge kde” finishes in under a minute. A computer cannot afford to keep Chuck waiting for too long. — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: modules
Hi Michael, On Mon, 3 Jun 2013 16:38:25 -0700 Michael Rasmussen mich...@jamhome.us wrote: On Tue, Jun 04, 2013 at 12:01:09AM +0100, Rahim Fakir wrote: Iam using win 7 64bits, and i downloaded Strawberry, and I use Perl PAckage Manager to install modules, insted of Cpan command. I know how to install them, but I need instrucions how to use them, step by step, how-to run the modules. Best regards Ray Hi Ray, So, I assume you downloaded whatever modules you chose to because you wanted the whatever functionality they provide. Since I don't know _what_ modules you chose I'll give an imaginary example and then a specific example from a favorite module I use. Having said that: The CPAN page for a module always includes a SYNOPSIS - this gives a very terse example of using the module. Check there. For our example I'll use the fictional raspberry.pm. It's synopsis reads; use raspberry; my $answer = raspberry(); Just a note - you should not call your modules or packages with an initial lowercase letter, as this is reserved for pragmas: http://perl-begin.org/tutorials/bad-elements/#lowercase_modules_and_pkgs (link to a page I created). The description says: raspberry returns a line from the raspberry wisdom list. In your code then it might be used: #!/usr/bin/perl use warnings; use strict; use raspberry; # the use line incorporates the module code into your program my $answer = raspberry(); # the function call uses code from the module that you didn't write print $answer, $/; and the output might be something like Raspberries are delicious! Eat some soon to feel good! Now for a specific, real world example: #!/usr/bin/perl use Data::Dumper; You forgot strict and warnings. [ imagine a bunch of code that does something, but you don't quite know what] [ someone else wrote it, and it's now time for you to fix a problem ] [ there's a huge complex data structure that hash of arrays or a hash of hashes or ...? ] print Dumper( \%my_hash_with_who_knows_what ): Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Free (Creative Commons) Music Downloads, Reviews and more - http://jamendo.com/ One thing I could never understand is why in Microsoft Word, it often happens that I press enter… and the font changes. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: modules
On Jun 3, 2013, at 4:01 PM, Rahim Fakir wrote: Iam using win 7 64bits, and i downloaded Strawberry, and I use Perl PAckage Manager to install modules, insted of Cpan command. I know how to install them, but I need instrucions how to use them, step by step, how-to run the modules. Each module is used differently. Almost all modules can be included in your program with the statement (usually near the beginning of your program): use Module; where you substitute the name of the module you are going to use for Module. This statement imports the module's program statements into your program. This happens at compile time, no matter where in your program you actually put the 'use' statement. You can also import modules using 'do' or 'require', but you need to know what those do and why to use them before you use them instead of 'use'. Modules come in two flavors: procedural and object-oriented. Some modules support both flavors. Most modules come with built-in documentation that describes how to use them, usually including some sample code statements. To access the documentation, you can do the following on a command-line: perldoc Module Strawberry Perl may afford another way of accessing documentation. Procedural modules will import functions into your namespace, so you can just call these functions as if they were part of built-in Perl or part of your own program. Object-oriented modules allow you to create objects of the module class, and call methods of those objects. To create an object instance of the Module class: my $object = Module-new(); The new() method is a convention. It could be called anything, but most OO modules use a new() method for object creation, Some new() methods take arguments. To call a method on the object: $object-method(); See the documentation for each module to find out what functions and methods are available. There are Perl tutorials for using modules and doing object-oriented programming: perldoc perlmod perldoc perlmodlib perldoc perlmodstyle perldoc perlmodinstall perldoc perlboot perldoc perltoot perldoc perltooc Good luck! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: modules
On Tue, Jun 04, 2013 at 12:01:09AM +0100, Rahim Fakir wrote: Iam using win 7 64bits, and i downloaded Strawberry, and I use Perl PAckage Manager to install modules, insted of Cpan command. I know how to install them, but I need instrucions how to use them, step by step, how-to run the modules. Best regards Ray Hi Ray, So, I assume you downloaded whatever modules you chose to because you wanted the whatever functionality they provide. Since I don't know _what_ modules you chose I'll give an imaginary example and then a specific example from a favorite module I use. Having said that: The CPAN page for a module always includes a SYNOPSIS - this gives a very terse example of using the module. Check there. For our example I'll use the fictional raspberry.pm. It's synopsis reads; use raspberry; my $answer = raspberry(); The description says: raspberry returns a line from the raspberry wisdom list. In your code then it might be used: #!/usr/bin/perl use warnings; use strict; use raspberry; # the use line incorporates the module code into your program my $answer = raspberry(); # the function call uses code from the module that you didn't write print $answer, $/; and the output might be something like Raspberries are delicious! Eat some soon to feel good! Now for a specific, real world example: #!/usr/bin/perl use Data::Dumper; [ imagine a bunch of code that does something, but you don't quite know what] [ someone else wrote it, and it's now time for you to fix a problem ] [ there's a huge complex data structure that hash of arrays or a hash of hashes or ...? ] print Dumper( \%my_hash_with_who_knows_what ): Because you're using Data::Dumper you didn't have to write a bunch of code to figure out how to interpret Perl data structures, Gurusamy Sarathy did all the hard work. All you need to do is include is module and call it on the hash of convoluted origins to see what it really is. Generically: use module_name; # code that calls on the modules functions or OO interfaces as documented. -- Michael Rasmussen, Portland Oregon Be Appropriate Follow Your Curiosity Other Adventures: http://www.jamhome.us/ or http://gplus.to/MichaelRpdx A special random fortune cookie fortune: A sadist is a masochist who follows the Golden Rule. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
Hi, CPAN::Mini can be used to create/update local mirrors. minicpan script (http://search.cpan.org/perldoc?minicpan) which uses CPAN::Mini will be helpful in maintaining a local CPAN mirror. Regards, Alan Haggai Alavi. -- The difference makes the difference. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
Alan Haggai Alavi wrote: Hi, CPAN::Mini can be used to create/update local mirrors. minicpan script (http://search.cpan.org/perldoc?minicpan) which uses CPAN::Mini will be helpful in maintaining a local CPAN mirror. If you're going to working on CPAN, you should sign up for the CPAN mailing lists: http://lists.perl.org/tag/cpan.html -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
Open Source wrote: I would like to download all the modules (atleast important ones) from cpan website and keep them in my local disk rather going into www everytime. Can someone tell how to download all of them? Cheers Sorry, you have to decide which ones are the important ones first. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
On Apr 9, 2010, at 4:19 PM, Open Source wrote: I would like to download all the modules (atleast important ones) from cpan website and keep them in my local disk rather going into www everytime. Can someone tell how to download all of them? Cheers Sorry, my previous email was a little too short. What I ought to have said was look at the minicpan module on CPAN, it will allow you to do what you want. regards, Jeremiah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
Shawn, actually I would setup something like mirror site (locally) so all the modules. - Original Message - From: Shawn H Corey Sent: 04/09/10 08:04 PM To: Open Source Subject: Re: Modules download from CPAN Open Source wrote: I would like to download all the modules (atleast important ones) from cpan website and keep them in my local disk rather going into www everytime. Can someone tell how to download all of them? Cheers Sorry, you have to decide which ones are the important ones first. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
On Fri, Apr 9, 2010 at 11:04 AM, Open Source open.sou...@gmx.com wrote: Shawn, actually I would setup something like mirror site (locally) so all the modules. http://www.cpan.org/misc/cpan-faq.html#How_mirror_CPAN ??? -- Brandon McCaig bamcc...@gmail.com V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl. Castopulence Software http://www.castopulence.org/ bamcc...@castopulence.org -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules download from CPAN
Open Source wrote: Shawn, actually I would setup something like mirror site (locally) so all the modules. If you want to mirror CPAN, why didn't you say so? BTW, that is hardly a beginners question. You should take your advance questions to PerlMonks http://www.perlmonks.org/ -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. Eliminate software piracy: use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Modules for parsing emails
On 5/30/07, Robert Hicks [EMAIL PROTECTED] wrote: I need to parse email headers and the body of the email. The emails are supposed to be plain text only but sometimes someone goofs and sends one in HTML. I need to strip away the HTML elements and/or covert it to plain text to process. That reminds me of this: http://www.stonehenge.com/merlyn/UnixReview/col37.html Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Modules for parsing emails
Tom Phoenix wrote: On 5/30/07, Robert Hicks [EMAIL PROTECTED] wrote: I need to parse email headers and the body of the email. The emails are supposed to be plain text only but sometimes someone goofs and sends one in HTML. I need to strip away the HTML elements and/or covert it to plain text to process. That reminds me of this: http://www.stonehenge.com/merlyn/UnixReview/col37.html Hope this helps! Thanks Tom! Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Modules inter-relay ?
On 12/4/06, Mug [EMAIL PROTECTED] wrote: BEGIN { unshift (@INC, /special); unshift (@INC, /special/packages); } use strict; use InitGlobal; And if I didn't get mis-understood on what I've studied, 'use' still comes earlier than 'BEGIN{}', so what is the mystery why this method can do that ? In this particular case BEGIN comes first and simply tells Perl to look at /special and /special/packages BEFORE looking anywhere else for the packages you wish to use in your various projects. You still need to make sure the proper functions/sub-routines are exported so that your code is called in preference over the Perl code. However, if you wish to control what is required -- say branch logic, you will need to stick with te 'require' directive as use packages referenced will always be brought in even if they are not called. HTH/-Sx- -- WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules inter-relay ?
From: Mug [EMAIL PROTECTED] Say I have 2 modules ( below pseudo codes ) , which the first package ( InitGlobal ) will be used through out the other project modules. However, InitGlobal itself would relay on some other modules, which the modules using InitGlobal too. This sometimes caused some weir problem, or perhaps it just runable with luck. So I have to fix it one by on with to cutting some shareable code to another .pl file with require() to call them, but sound quite terrible enough. Not sure how do Perl handle this, or is that any standard way for module inter-relay ( or Is that any formal term to call this ? ) So you have two interdependend modules, right? A uses stuff from B, B uses stuff from A. You should reorder your code to prevent this. And if the two are too intertwined to do that, put them both into the same file. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules inter-relay ?
On 12/4/06, Mug [EMAIL PROTECTED] wrote: Say I have 2 modules ( below pseudo codes ) , which the first package ( InitGlobal ) will be used through out the other project modules. However, InitGlobal itself would relay on some other modules, which the modules using InitGlobal too. You can place the special packages in their own directory and point to it: BEGIN { unshift (@INC, /special); unshift (@INC, /special/packages); } use strict; use InitGlobal; HTH/-Sx- -- WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules inter-relay ?
Bill Jones wrote: On 12/4/06, Mug [EMAIL PROTECTED] wrote: Say I have 2 modules ( below pseudo codes ) , which the first package ( InitGlobal ) will be used through out the other project modules. However, InitGlobal itself would relay on some other modules, which the modules using InitGlobal too. You can place the special packages in their own directory and point to it: BEGIN { unshift (@INC, /special); unshift (@INC, /special/packages); } use strict; use InitGlobal; HTH/-Sx- Thank you very much Bill, But may I ask a bit further because a bit can't get what should in terms of 'special' and what should in terms of 'their' and this piece of code should put to where ? ( self use or in the other all packages ) And if I didn't get mis-understood on what I've studied, 'use' still comes earlier than 'BEGIN{}', so what is the mystery why this method can do that ? Thank you for more hints, =) Mug -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules for printing the content of an array
Mumia W. a écrit : On 10/11/2006 10:42 AM, Sami FANTAR wrote: [...] I have read the Data::Dumper related doc. Including the part where it tells you how to substitute the correct variable names for $VAR1,$VAR2,... ? But, after having written your example, the output seems quite weird. I got $VAR1,$VAR2, and so on. Is it possible to personalize this output? use Data::Dumper; my @myarray = qw(blah blahblah blllah); print Data::Dumper-Dump([EMAIL PROTECTED],[qw(myarray)]); WARNING: UNTESTED CODE Thanks for your help and your solutions. I found what I was looking for. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules not found
Can somebody give me a hint if there's some general problem with perl when not resided in /usr Hello, Do you know where your modules are installed?Given the path for installed modules is /your/path,you can add the path to Perl's @INC by putthing this statement at the begin of your scripts: use lib qw(/your/path); Then the script or other modules should find the installed modules correctly. -- Jeff Pang NetEase AntiSpam Team http://corp.netease.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules not found
On Wed, 11 Oct 2006 21:39:22 +0800 (GMT+08:00) Jeff Pang [EMAIL PROTECTED] wrote: Can somebody give me a hint if there's some general problem with perl when not resided in /usr Hello, Do you know where your modules are installed?Given the path for installed modules is /your/path,you can add the path to Perl's @INC by putthing this statement at the begin of your scripts: use lib qw(/your/path); Then the script or other modules should find the installed modules correctly. As written, the @INC path is set correctly already. Is there some environment variable I can try? Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules for printing the content of an array
Hi Sami, Yes Data::Dumper is your friend when it comes to dumping data (how strange is that :-) Simply do this in your perl script: *use Data::Dumper;* *print Dumper @huge_array;* And be amazed ;-) On 10/11/06, Sami FANTAR [EMAIL PROTECTED] wrote: Hello everybody I would like to know if there is any module which can display in a enjoyable way the content of an array with about 200 values. Could Data::Dumper be a solution for my problem? Any help or example will be very appreciated. Thanks in advance. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules for printing the content of an array
Rob Coops a écrit : Hi Sami, Yes Data::Dumper is your friend when it comes to dumping data (how strange is that :-) Simply do this in your perl script: *use Data::Dumper;* *print Dumper @huge_array;* And be amazed ;-) On 10/11/06, Sami FANTAR [EMAIL PROTECTED] wrote: Hello everybody I would like to know if there is any module which can display in a enjoyable way the content of an array with about 200 values. Could Data::Dumper be a solution for my problem? Any help or example will be very appreciated. Thanks in advance. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response What do you mean by dumping data? I have read the Data::Dumper related doc. But, after having written your example, the output seems quite weird. I got $VAR1,$VAR2, and so on. Is it possible to personalize this output? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Modules for printing the content of an array
Rob Coops wrote: : Simply do this in your perl script: : *use Data::Dumper;* : *print Dumper @huge_array;* For the archives: Those asterisks (*) are for emphasis. They are not actually in the code. Arrays and hashes can also be dumped using a reference. I find a reference more aesthetically pleasing. use Data::Dumper 'Dumper'; print Dumper [EMAIL PROTECTED]; HTH, Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate Web Programmer 254 968-8328 Don't tread on my bandwidth. Trim your posts. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules for printing the content of an array
On 10/11/2006 10:42 AM, Sami FANTAR wrote: [...] I have read the Data::Dumper related doc. Including the part where it tells you how to substitute the correct variable names for $VAR1,$VAR2,... ? But, after having written your example, the output seems quite weird. I got $VAR1,$VAR2, and so on. Is it possible to personalize this output? use Data::Dumper; my @myarray = qw(blah blahblah blllah); print Data::Dumper-Dump([EMAIL PROTECTED],[qw(myarray)]); WARNING: UNTESTED CODE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules breaking?
On 10/11/06, Jesse Engel [EMAIL PROTECTED] wrote: i'm getting an error in an installed module, not in my script. invalid top directory at /System/Library/Perl/5.8.1/File/Find.pm line 568. Yes; but do you see what it's trying to tell you? Some top directory that you're passing to find() isn't a valid directory name. my @folders_to_get = $ftp-ls($dir); find(\get_mp3s, @folders_to_get); It looks as if your find locations are the directory names on the remote machine. Do those same names already exist on your machine? (That would be necessary for find() to use them, of course.) Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Modules aiming at displaying mathematical functions on screen?
After searching the cpan.org site for mathematical modules, I did not find a module which can display graphically the result of a function. I want to see a function curve displayed in a graphical window? How can I make it possible in Perl? Thanks in advance for your help. Module names in quotes: You could build a perl Tk application - it comes with an example related to your query. You could use GD or Imager or Image::Magick to plot pixels and save as various graphics formats. (The latter also exports LaTex, I believe). You could look up the mailing list for PDL, the Perl Data Language subset, where people who *really* know about maths hang around. You could make a PDF using PDF::API2 but that's probably a little trickier than most things above. You could look under Graph on CPAN Hth Lee -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules aiming at displaying mathematical functions on screen?
On 09/20/2006 05:24 AM, SFantar wrote: Hello After searching the cpan.org site for mathematical modules, I did not find a module which can display graphically the result of a function. I want to see a function curve displayed in a graphical window? How can I make it possible in Perl? Thanks in advance for your help. Install PDL (perl data language). On Debian when I installed 'pdl' I got PDL::Graphics::PLplot which is a rather nice, perl-native way to generate graphs. use strict; use warnings; use PDL; use PDL::Graphics::PLplot; my $pl = PDL::Graphics::PLplot-new (DEV = pbm, FILE = test.pbm); my $x = sequence(10); my $y = $x**2; $pl-xyplot($x, $y); $pl-close; test.pbm.gz Description: GNU Zip compressed data -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules aiming at displaying mathematical functions on screen?
SFantar schreef: After searching the cpan.org site for mathematical modules, I did not find a module which can display graphically the result of a function. I want to see a function curve displayed in a graphical window? Beyond that: http://maxima.sourceforge.net/ (Lisp) http://symaxx.sourceforge.net/ (Perl) (from a recent integrate() thread on clpm). -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Modules to extract calendar info from Exchange
Hi, I've looked at cpan, nothings coming up. What I need to do is just extract calendar information from MS Exchange. Sending SMS I've already completed that. Just hoping maybe there's some help out there. William -Original Message- From: D. Bolliger [mailto:[EMAIL PROTECTED] Sent: 15 September 2006 10:24 PM To: beginners@perl.org Subject: Re: Modules to extract calendar info from Exchange William Paulsen (W) am Freitag, 15. September 2006 13:36: Hi, Hi Is there a perl module(s) that can extract calendar infrom from an MS Exchange server. I need to extract appmnts, meetings, etc such that I can SMS these message to a person(s) cellphone. Which modules are available, and how easy is it? No idea (and no other answers), but you could search on http://search.cpan.org with one of the keywords you're interested in. Maybe somethings shows up... Hope this helps Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response ~~ This e-mail and its contents are subject to the Telkom SA Limited e-mail legal notice available at http://www.telkom.co.za/TelkomEMailLegalNotice.PDF ~~ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules to extract calendar info from Exchange
On 9/15/06, William Paulsen (W) [EMAIL PROTECTED] wrote: Is there a perl module(s) that can extract calendar infrom from an MS Exchange server. I need to extract appmnts, meetings, etc such that I can SMS these message to a person(s) cellphone. Which modules are available, and how easy is it? Have you checked CPAN yet? http://search.cpan.org Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules to extract calendar info from Exchange
William Paulsen (W) am Freitag, 15. September 2006 13:36: Hi, Hi Is there a perl module(s) that can extract calendar infrom from an MS Exchange server. I need to extract appmnts, meetings, etc such that I can SMS these message to a person(s) cellphone. Which modules are available, and how easy is it? No idea (and no other answers), but you could search on http://search.cpan.org with one of the keywords you're interested in. Maybe somethings shows up... Hope this helps Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Modules to extract calendar info from Exchange
Sorry: Is there a perl module(s) that can extract calendar infrom from an MS Exchange server. I need to extract appmnts, meetings, etc such that I can SMS these message to a person(s) cellphone. Which modules are available, and how easy is it? No idea (and no other answers) [...] ... to your *second* post Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Modules to extract calendar info from Exchange
Can't answer the first, but on the second: I send text messages to my ATT cingular phone using sendmail to send the text. This gives me heads up when I have problems. Now I am also starting sending to another phone number using cingular, but it is a blackberry. This user receives the text, but it is messed up. I never got around to correcting. For cinuglar node in my location, it is @mmode.net and the other cingular is in Colorado and has a completely different node ( @mobile.mycingular.com ). It can be done and I have been running in this mode for 5 or more years at least. If you have any problems or questions, please let me know. Thanks. Wags ;) David R Wagner Senior Programmer Analyst FedEx Freight 1.408.323.4225x2224 TEL 1.408.323.4449 FAX http://fedex.com/us -Original Message- From: D. Bolliger [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 13:26 To: beginners@perl.org Subject: Re: Modules to extract calendar info from Exchange Sorry: Is there a perl module(s) that can extract calendar infrom from an MS Exchange server. I need to extract appmnts, meetings, etc such that I can SMS these message to a person(s) cellphone. Which modules are available, and how easy is it? No idea (and no other answers) [...] ... to your *second* post Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: modules maillist
Is there a maillist talking about or seeking a module to a specific requirement? There are some lists about CPAN,maybe that's you wanted. For example: cpan-discuss A general, non-technical list for talking about any issue of CPAN. cpan-interface A list for people interested in developing a user-friendly web interface to CPAN. cpan-metadata A focused list for the discussion and implementation of Metadata for CPAN. cpan-testers This list is for those interested in the organised testing of CPAN modules. cpan-update An announce only list for new module update information. cpan-workers A closed list for people working on issues with CPAN, but lurkers may surf the archive. Also pls see: http://lists.cpan.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules - lost again
Examine your concept of reside in. You appear to be confused with modules that use the Exporter. You don't. I believe you'll find that you use SomeOther::Module *before* using Configuration in the main program, which means that the assignments haven't taken place yet. A-ha! Some days I am dumber than other days :) Everything was exactly as you described. In this light I have a couple of additional questions. This one is about my Tools.pm which uses Exporter and delivers a set of 5- 10 line subroutines for stupud tasks (number rounder, strip commas from numbers, commify them back, customized html entity decoder etc etc etc). What I am currently doing is automatically exporting ALL these subroutines (using fairly descriptive names to avoid clashes) and use Tools; in all modules that might benefit from them. Pretty standard. However I do not understand if importing just a subset of just the necessary functions is beneficial in terms of speed. What I am thinking is that since every single function IS going to be used sooner or later by at least one of the modules, and since EVERY module is called at least once from the main program over its runtime - the entire Tools.pm is being processed anyway and wether I import all functions or just a few makes no difference on the entire picture. Or am I wrong? And if I am, and specifying explicit imports for each module is beneficial - is Autoloader applicable to this situation? I've seen tons of examples of how OO can benefit from calls to non-existent instances, but I didn't see a single usage of Autoloader in a non-OO envirnoment which leads me to believe that it is not applicable. Thank you. Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules - lost again
On Sat, 02 Apr 2005 09:23:53 -0500, Peter Rabbitson wrote: This one is about my Tools.pm which uses Exporter and delivers a set of 5- 10 line subroutines for stupud tasks (number rounder, strip commas from numbers, commify them back, customized html entity decoder etc etc etc). What I am currently doing is automatically exporting ALL these subroutines (using fairly descriptive names to avoid clashes) and use Tools; in all modules that might benefit from them. Pretty standard. However I do not understand if importing just a subset of just the necessary functions is beneficial in terms of speed. What I am thinking is that since every single function IS going to be used sooner or later by at least one of the modules, and since EVERY module is called at least once from the main program over its runtime - the entire Tools.pm is being processed anyway and wether I import all functions or just a few makes no difference on the entire picture. Or am I wrong? Confused. The first use Tools will load Tools.pm and cause *all* of the subroutines to be compiled. Subsequent use Tools won't load Tools.pm because it's in %INC; but, like the first time, *will* call Tools-import(). That call will result in the names being exported. Observe: % cat foo #!/usr/bin/perl -l use Bar; use Foo; % cat Foo.pm package Foo; use Bar; 1; % cat Bar.pm package Bar; sub import { print Bar import } print Bar load; 1; % ./foo Bar load Bar import Bar import And if I am, and specifying explicit imports for each module is beneficial - Not for reason of speed. For reason of maintainability. You should only import names you are going to use, and then do so explicitly, so that a maintenance programmer doesn't look at the program wondering where thunk_widgets() has come from. The exceptions to this rule are few and far between. is Autoloader applicable to this situation? I've seen tons of examples of how OO can benefit from calls to non-existent instances, but I didn't see a single usage of Autoloader in a non-OO envirnoment which leads me to believe that it is not applicable. I think you're confused again. If AUTOLOAD() exists in a package it will be called when a non-existent function is called in that package. Doesn't matter whether or not it's O-O. It isn't going to help you. I assume you meant non-existent methods, because non-existent instances is an oxymoron. Autoloader.pm allows you to put subroutines in a data block so they are only compiled when needed (the autosplit function must be used to copy them to individual files). I've never used it with the Exporter and don't know what would happen; at worst, though, you might need to declare stubs in the main body and then suppress redefinition warnings in the individual definitions. Given the case you describe though, I can't see it making any measurable difference in performance. If you really need to speed things up there are more appropriate ways of doing it. If you don't know you need to speed things up yet, don't throw wacky devices at the code thinking they're doing any good :-) There's more I could say, but I already wrote large parts of a book about it :-) -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules - lost again
And if I am, and specifying explicit imports for each module is beneficial - Not for reason of speed. For reason of maintainability. You should only import names you are going to use, and then do so explicitly, so that a maintenance programmer doesn't look at the program wondering where thunk_widgets() has come from. The exceptions to this rule are few and far between. Yep... this says it right there, and makes perfect sense. I am glad I asked before I converted what I have so far to modules. Thank you! Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules - lost again
On Fri, 01 Apr 2005 07:29:17 -0500, Peter Rabbitson wrote: [...] I decided to create a central Configuration.pm which will hold different hashes with configuration sections e.g.: package Configuration; %Configuration::auth = ( [...]... You get the idea. Now I am able to access them from Main by doing: use Configuration; my $whatever_reference = $Configuration::auth{mmv}{tbt}; however if in main I have another module: use SomeOther::Module; then from within this module the same variable returns undef. I suspect I can not do this since the scopes differ, Not the problem. but I am using fully qualified variable names. Another way would be to use Configuration in the very same module, however then Configuration.pm got to reside in the main dir AND a copy in ./SomeOther/... False. I am lost. True :-) Is what I am trying to do even right from a good programming point of view? Probably the total amount of modules accessing these Configuration variables will be around 10. I would highly appreciate any input on this. Examine your concept of reside in. You appear to be confused with modules that use the Exporter. You don't. I believe you'll find that you use SomeOther::Module *before* using Configuration in the main program, which means that the assignments haven't taken place yet. What you're doing is reasonable. And you can 'use Configuration' from all of the other modules if you want; it will only be loaded once, after that, its name in %INC will prevent it from being loaded unnecessarily. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules
[snip] If you want to do as the Romans do, maybe you can sign up for a Gmail account or something that would be more flexible... Do u want to be one of the Romans? :-) Its hell good being Roman.. Amongst many other things just to name a few advantage of being Roman are u almost never might need to delete messages and the contacts are pretty easy to get around, short cut key etc.. 1000 mb to use as ur own sec storage space. Its pretty good. I feel great! That pretty much explains why Romans ruled this world once. :) [snip] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- Cheers, SanoBabu -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules
On Thu, 30 Sep 2004 [EMAIL PROTECTED] wrote: I am unsure if I pissed everyone off, b/c no one responded??? Some (all?) of us have jobs and lives that occasionally prevent us from giving out free advice to strangers on the internet immediately. It happens. It isn't meant personally. I am reading Object Oriented Perl pages 52 and 53 for setting up a module. It is telling me in order to use a routine from a different file you have to 1) choose a lib directory 2) export PERL5LIB=.../.../.../ use lib /usr/local/perl/my.pl 3) created nested subdirs for each component of the module name 4) create a text file in the last directory 5) Insert you code. 6) add 1; at then end of the perl program file. NOTE: is says in the footer that I can use h2xs to combine steps 3 and 4. My quesiton is can't I just use step 2 and then in my program where I want to use this code, make a routine call? What, and omit the other steps? Are they really that onerous? If you choose to put your module somewhere in the current @INC, then steps 1 2 are taken care of, steps 3 4 are simply cd /usr/local/lib/perl mkdir -p Path/For/My/Deepest/Sub/Module echo 1; Path/For/My/Deepest/Sub/Module/stub.txt and then just write your code. Does this answer the question? I'm not clear what you're confused about. I then looked into Perl Cookbook ch 12_02 and it discussed : [] Is one autoloader and self loader? It seems to me I am getting conflicting info of just that I am not understanding? _Perl Cookbook_ is giving you the cookbook answer, suitable for cutting, pasting, and editing as needed. On the other hand, _Object Oriented Perl_ is trying to teach you to understand how OO *works* in Perl, including what steps are mandatory and which are optional and how different aspects can be implemented. Once you've digested Conway's book -- and you should finish with it, it's excellent -- then the section of the Cookbook should be clearer. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules
Yes it does great thank you! But a few more things. Once I create my code, how do I pass a data file in a different program to a specific routine that lives in a different file? am I supposed to respond and post at the bottom of you answer? Derek B. Smith OhioHealth IT Chris Devers [EMAIL PROTECTED] 09/30/2004 11:04 PM Please respond to Perl Beginners List To: [EMAIL PROTECTED] cc: Perl Beginners List [EMAIL PROTECTED] Subject:Re: modules On Thu, 30 Sep 2004 [EMAIL PROTECTED] wrote: I am unsure if I pissed everyone off, b/c no one responded??? Some (all?) of us have jobs and lives that occasionally prevent us from giving out free advice to strangers on the internet immediately. It happens. It isn't meant personally. I am reading Object Oriented Perl pages 52 and 53 for setting up a module. It is telling me in order to use a routine from a different file you have to 1) choose a lib directory 2) export PERL5LIB=.../.../.../ use lib /usr/local/perl/my.pl 3) created nested subdirs for each component of the module name 4) create a text file in the last directory 5) Insert you code. 6) add 1; at then end of the perl program file. NOTE: is says in the footer that I can use h2xs to combine steps 3 and 4. My quesiton is can't I just use step 2 and then in my program where I want to use this code, make a routine call? What, and omit the other steps? Are they really that onerous? If you choose to put your module somewhere in the current @INC, then steps 1 2 are taken care of, steps 3 4 are simply cd /usr/local/lib/perl mkdir -p Path/For/My/Deepest/Sub/Module echo 1; Path/For/My/Deepest/Sub/Module/stub.txt and then just write your code. Does this answer the question? I'm not clear what you're confused about. I then looked into Perl Cookbook ch 12_02 and it discussed : [] Is one autoloader and self loader? It seems to me I am getting conflicting info of just that I am not understanding? _Perl Cookbook_ is giving you the cookbook answer, suitable for cutting, pasting, and editing as needed. On the other hand, _Object Oriented Perl_ is trying to teach you to understand how OO *works* in Perl, including what steps are mandatory and which are optional and how different aspects can be implemented. Once you've digested Conway's book -- and you should finish with it, it's excellent -- then the section of the Cookbook should be clearer. -- Chris Devers
Re: modules
On Thu, 30 Sep 2004 [EMAIL PROTECTED] wrote: Yes it does great thank you! But a few more things. Once I create my code, how do I pass a data file in a different program to a specific routine that lives in a different file? That's really up to you. You can have a way to pass the name of the file to that subroutine, which would then open operate on it, or you could read in the file and pass the relevant contents to your routine. Which approach to take depends on how you want to design your system. I think I'd tend towards passing the file name and letting the method handle getting the data, but it's not a strong conviction, and in some cases I'd go about it in other ways. am I supposed to respond and post at the bottom of you answer? It's preferred, but I see that you're using Lotus Notes, and I've been forced to use Notes long enough -- about 90 seconds before I cried uncle -- to realize that it makes it really annoying to compose conventionally formatted emails. So in your case, from this account, don't worry about it too much. Getting Notes to do the right thing is too painful, and I sympathize. If you want to do as the Romans do, maybe you can sign up for a Gmail account or something that would be more flexible... -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules
I think so I am using Perl 5.8 and I never installed those modules manualy, but my scripts which uses those modules work just fine that means they comes with Perl. LRMK - Original Message - From: aditi gupta [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 7:46 AM Subject: modules hi to all, do LWP and HTTP::Request modules come alongwithh perl (activeperl 5.8) or one has to separately install them? Yahoo! India Matrimony: Find your partner online. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules and _DATA_
On Jan 23, 2004, at 3:27 PM, Eric Walker wrote: I have some code I want to add a package in the same file. I already have some _DATA_ in the file. Currently, the code is not seeing the _DATA_. How can I add a package in the same file then. I believe your DATA tag at the end is the problem. It's supposed to be __DATA__. That's underscore underscore D A T A underscore underscore. Hope that helps. James example: while DATA{ do something } _DATA_ this is my data section -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules and _DATA_
On Fri, 2004-01-23 at 14:34, James Edward Gray II wrote: On Jan 23, 2004, at 3:27 PM, Eric Walker wrote: I have some code I want to add a package in the same file. I already have some _DATA_ in the file. Currently, the code is not seeing the _DATA_. How can I add a package in the same file then. I believe your DATA tag at the end is the problem. It's supposed to be __DATA__. That's underscore underscore D A T A underscore underscore. Hope that helps. James example: while DATA{ do something } _DATA_ this is my data section sorry I was typing to fast, it is __DATA__ This program was working before but when I tried to add a package to it, I did some test and its not reading the DATA anymore. Is there a certain order?
Re: modules and _DATA_
On Jan 23, 2004, at 1:27 PM, Eric Walker wrote: I have some code I want to add a package in the same file. I already have some _DATA_ in the file. Currently, the code is not seeing the _DATA_. How can I add a package in the same file then. [..] since the __DATA__ vice _DATA_ has been addressed, my pet favorite way to include a package inside of a piece of code is BEGIN { package Foo::Bar; } That way it will be compiled early and so you can place it above the __DATA__ section since it is not 'data'. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules and _DATA_
On 1/23/2004 4:36 PM, Eric Walker wrote: when I tried to add a package to it, I did some test and its not reading the DATA anymore. Is there a certain order? __DATA__ must be in package main; #!perl use strict; use warnings; while (DATA) { print; } package Test; sub a {} 1; package main; # DATA must be in main __DATA__ this is my data section -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules and _DATA_
On Jan 23, 2004, at 1:36 PM, Eric Walker wrote: [..] when I tried to add a package to it, I did some test and its not reading the DATA anymore. Is there a certain order? [..] How did you put the package in? ciao drieux --- #!/usr/bin/perl -w use strict; my $foo = new Foo::Bar; while(DATA){ $foo-showMe($_); } BEGIN { package Foo::Bar; use 5.006; use strict; use warnings; our $VERSION = '0.01'; #- # Our Stock Constructor # note: http://www.perlmonks.org/index.pl?node_id=52089 sub new { my $class = shift; my $self = {}; bless $self, $class; } # end of our simple new #- # so that AUTOLOAD finds one here sub DESTROY {} # # sub showMe { my ($me,$line) = @_; print $line; } # end of showMe 1; # so that the 'use Foo::Bar' # will know we are happy } # end begin __DATA__ This line and then the world. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules and _DATA_
On Fri, 2004-01-23 at 14:43, Randy W. Sims wrote: On 1/23/2004 4:36 PM, Eric Walker wrote: when I tried to add a package to it, I did some test and its not reading the DATA anymore. Is there a certain order? __DATA__ must be in package main; #!perl use strict; use warnings; while (DATA) { print; } package Test; sub a {} 1; package main; # DATA must be in main __DATA__ this is my data section worked like a charm thanks, now its working but correctly time to get my handy dandy print statement out... Thanks..
Re: modules and _DATA_
On Fri, 2004-01-23 at 14:46, drieux wrote: On Jan 23, 2004, at 1:36 PM, Eric Walker wrote: [..] when I tried to add a package to it, I did some test and its not reading the DATA anymore. Is there a certain order? [..] How did you put the package in? ciao drieux --- #!/usr/bin/perl -w use strict; my $foo = new Foo::Bar; while(DATA){ $foo-showMe($_); } BEGIN { package Foo::Bar; use 5.006; use strict; use warnings; our $VERSION = '0.01'; #- # Our Stock Constructor # note: http://www.perlmonks.org/index.pl?node_id=52089 sub new { my $class = shift; my $self = {}; bless $self, $class; } # end of our simple new #- # so that AUTOLOAD finds one here sub DESTROY {} # # sub showMe { my ($me,$line) = @_; print $line; } # end of showMe 1; # so that the 'use Foo::Bar' # will know we are happy } # end begin __DATA__ This line and then the world. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response while DATA{ do something;} package ONE package stuff; 1; package main __DATA__ data stufff
Re: modules and _DATA_
On Jan 23, 2004, at 2:47 PM, Eric Walker wrote: [..] while DATA{ do something;} package ONE package stuff; 1; package main __DATA__ data stufff yes, one can do the reset back to package main. part of the reason I opt for the BEGIN { package } approach is so that I know that the compiler will deal with the BEGIN { BLOCK } before worrying about anything else in the code. That way I know that my objects will be sorted out foist. As a general rule of thumb, though, once I have played out an idea then it is going off to it's own Monkey.pm file where it is a fully externalized perl module... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: modules
On Wednesday, Sep 10, 2003, at 12:14 US/Pacific, Rodrigo Daniel de Lira wrote: [..] Can I to call a function that is in another script? sorry interrupted. Allow me to illustrate a bit better /dir_for_cgi script1.cgi script2.cgi /lib/ OurModule.pm So we start the Module off with package OurModule VERSION = 1.01; # since you will have finished beta on it sub new { my $type = shift; my $class = ref($type) || $type; my $self = {}; bless $self, $class; } # end of our simple new # # the subs go here # sub my_first_sub { my $me = shift; # to get the reference ... } . 1; # so that the use will see a happy return Then each of the two cgi scripts can do the simpler use lib ../lib/; use OurModule; ... my $obj = new OurModule; ... my $first_thingie = $obj-my_first_sub(@arglist); and one is out and away... No Mus, No Fuss. Ok, so you COULD have done the Dilbert Class Solution of use lib ../lib/; use OurModule; ... my $first_thingie = OurModule-my_first_sub(@arglist); ... Which ever makes you feel happier. I would of course HIGHLY RECOMMEND that you get Schwartz's Learning Perl Objects, References Modules. cf: http://www.oreilly.com/catalog/lrnperlorm/ for all the detail clarifications that are useful above the standard perldoc perlsub, perlmod, perlmodlib The alternative to that is to have some funky interface into the script with the function that will understand that it is being called in some weird way that it should pass the data to the function, and then return it out, oh, say STDOUT. Trust me it can be done, but it is such an ugly path that it should be left for the strictly obfuscatory Perl Contest. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modules Question
I googles Julian and came up with two email addresses from this page: http://www.monkey.org/openbsd/archive/misc/9904/msg00077.html If that fails I'm not sure. The FAQ on CPAN doesn't help much with this specific case since the mails are bouncing: http://www.cpan.org/misc/cpan-faq.html#How_maintain_module Perhaps Randal will pop his head in and have some advice. Rob -Original Message- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 6:11 PM To: [EMAIL PROTECTED] Subject: Modules Question I use Text::Bastardize off of the CPAN from time to time. I find it mildly amusing, if not terribly practical. However, today when I was working with it, I basically fed it some text that overwhelmed it. What I fed it really wasn't too crazy, so I took a look under the hood. While I was in there, I basically saw a lot of general improvements I would like to make, so I fired off a message to the author. Of course, it bounced. Looking at the CPAN, it looks like it's been around three years since the author contributed anything. So, if memory serves, there is a proper protocol for taking control of an abandoned module, which is what I would like to do. However, I'm having trouble finding it. Could someone point me in the right direction? Thanks. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules Question
On Wednesday, September 10, 2003, at 05:43 PM, Hanson, Rob wrote: I googles Julian and came up with two email addresses from this page: http://www.monkey.org/openbsd/archive/misc/9904/msg00077.html Thank you. I have no idea why, but it never occurred to me to Google for a person, though it seems so obvious now. I have tried the second address and will see what that nets me. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
Ismar Dupanovic wrote: Got 2 modules and a driver script that uses both. Both modules require Exporter and export their functions. However in my driver script I have to fully qualify the function names of the SECOND module(module-function), while the functions of the first module become part of my main:: package namespace and are called without any mention of the module name. I know the modules are good since I have no problems calling their methods if I use them individually. But whenever I use both in my driver script one of them has to have its functions proceeded by the module name. There is no name clashing in variables or function names. May we see your initialisation code please? Just that up to the run-time stuff. Otherwise I can't guess why it's behaving this way. Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
On Friday, July 5, 2002, at 09:17 , John Almberg wrote: What's an easy way to tell if a particular module is installed on my server? I'm sure I read this somewhere, but can't find it. Thanks! -- John [jeeves:~] drieux% perl -MFoo::Bob -e 'use Foo::Bob' Can't locate Foo/Bob.pm in @INC (@INC contains: /System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin /Library/Perl /Library/Perl /Network/Library/Perl/darwin /Network/Library/ Perl /Network/Library/Perl .). BEGIN failed--compilation aborted. [jeeves:~] drieux% perl -MNet::SMTP -e 'use Net::SMTP' [jeeves:~] drieux% looks like I do have Net::SMTP, but for some reason the Foo::Bob module is not in any of the standard libraries ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
on Sat, 06 Jul 2002 14:44:52 GMT, Drieux wrote: [jeeves:~] drieux% perl -MFoo::Bob -e 'use Foo::Bob' Why are you trying to load Foo::Bob twice? -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
On Sat, 6 Jul 2002 00:17:04 -0400, [EMAIL PROTECTED] (John Almberg) wrote: What's an easy way to tell if a particular module is installed on my server? I'm sure I read this somewhere, but can't find it. Thanks! I'm guessing you mean remote server , and you want it via a browser. #!/usr/bin/perl print Content-type: text/html\n\npre; for (@INC){ opendir(LIB, $_) || die Can't open $_\n$!; my @modules = grep { /\.pm$|\.pl$/ } readdir(LIB); closedir LIB; print \n$_\n; for (@modules) { print $_\n; } } # -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modules
Now that is a handy little script. Thanks! I have a related question . . . where does @INC come from? I guess there is a configuration file somewhere? -- John # -Original Message- # From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of # zentara # Sent: Saturday, July 06, 2002 12:10 PM # To: [EMAIL PROTECTED] # Subject: Re: Modules # # # On Sat, 6 Jul 2002 00:17:04 -0400, [EMAIL PROTECTED] (John Almberg) # wrote: # # What's an easy way to tell if a particular module is installed # on my server? # I'm sure I read this somewhere, but can't find it. Thanks! # # I'm guessing you mean remote server , and you want it via a # browser. # # # #!/usr/bin/perl # # print Content-type: text/html\n\npre; # for (@INC){ # opendir(LIB, $_) || die Can't open $_\n$!; # my @modules = grep { /\.pm$|\.pl$/ } readdir(LIB); # closedir LIB; # print \n$_\n; # for (@modules) { # print $_\n; # } # } # # # # # # # # -- # To unsubscribe, e-mail: [EMAIL PROTECTED] # For additional commands, e-mail: [EMAIL PROTECTED] # -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
John == John Almberg [EMAIL PROTECTED] writes: John Now that is a handy little script. Thanks! I have a related John question . . . where does @INC come from? I guess there is a John configuration file somewhere? It's compiled into perl itself, I believe. You can manipulate it in script with the use lib ; pragma or changing the bang-line to include -Idir. Outside of your script, you can manipulate the PERLLIB or PERL5LIB environment variables. - Chris. -- $a=printf.net; Chris Ball | chris@void.$a | www.$a | finger: chris@$a Blessings to the chap who invented ice cream, ginger-pop and the rest! I'd rather invent things like that any day than rockets and bombs. -- Julian, Five on Finniston Farm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
On Saturday, July 6, 2002, at 10:00 , John Almberg wrote: I have a related question . . . where does @INC come from? I guess there is a configuration file somewhere? -- John more info available at perldoc perlvar a quick deconstruction: @: this is an array INC:short for include hence the array of thing we may need to go to for includes, eg: all the default -Iinc_dir stuff. Try to remember that the use FOO::BAR merely 'reads the include' as it were and 'imports' any reference to things in the FOO::BAR module As is noted - the base @INC is compiled into perl - and there is a reasonably standard hierarchy about how things should hang below that level. As also noted the traditional ways of manipulating it are a) the use lib token; pragma b) the '-Idir' command line option for fun tried to programme that in #!/usr/bin/perl -I'path_to_lib' -w but that did not work c) set the Environmental variable LIB5PERL which is useful if you find that you are installing into non-standard directories such as $ENV{HOME}/lib/perl ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
Shishir K. Singh [[EMAIL PROTECTED]] quoth: *Wanted to know the modules that are already present in the standard stable.tar.gz distribution. I had a Active Perl distribution. Now I need to install the stable.tar.gz and wanted to know the additional modules that I may have to install. http://www.cpan.org/misc/cpan-faq.html e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modules
Thanks!! -Original Message- From: Elaine -HFB- Ashton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 2:48 PM To: Shishir K. Singh Cc: [EMAIL PROTECTED] Subject: Re: Modules Shishir K. Singh [[EMAIL PROTECTED]] quoth: *Wanted to know the modules that are already present in the standard stable.tar.gz distribution. I had a Active Perl distribution. Now I need to install the stable.tar.gz and wanted to know the additional modules that I may have to install. http://www.cpan.org/misc/cpan-faq.html e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
On Thursday, May 2, 2002, at 12:31 , Jackson, Harry wrote: I am attempting to write a module and trying to follow the guidelines etc on how it should be done. [..] I can help as time allows... { just tag it B/C so I see that we are taking this 'Back Channel' ... hey old habits. } for what it is worth: http://www.wetware.com/drieux/CS/lang/Perl/PM/ is where I hide stuff on that subject.. if you do the perldoc h2xs and start that way you will probably get MOST of the stuff to fire up correctly in the main. It all works OK and does what I expect it to do but I want to find out where I have not adhered to the rules about modules before I start to write any more. I'm not going to ask, I'm Not going to ask. fsckIt - if it works the problem here is What? Smell the Coffee - If you are Orthodox and have started from the h2xs - and filled in the POD - then what is the concern??? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules install
Eric R. Jones [[EMAIL PROTECTED]] quoth: *I had problem installing mods and getting them noticed. Since you didn't mention anything at all about the problem, I'll suggest you read the FAQ at http://www.cpan.org/misc/cpan-faq.html e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules needed for Validation
You can use regular expressions to verify them. --- Connie Chan [EMAIL PROTECTED] wrote: Hi all, Is there any module can use to verify data type (String, Integer, floating, Hex, valid email address, valid url etc.) ? Thank you very much. = Yeung Siu [EMAIL PROTECTED] __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
Does it matter what version of perl is currently running (I am on 5.61), and are there any concerns on using the automatic installation process against a production environment? Does the automatic process pick the right version of the module based on what is already installed? Thanks Carlin Original Message Follows From: [EMAIL PROTECTED] To: TS [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: modules Date: Fri, 5 Oct 2001 12:27:27 +0200 (CEST) On Fri, 5 Oct 2001, TS wrote: I use perl 5.005_03. how do I find out what modules are installed ? $perl -MCPAN -e autobundle This will first search for all installed module. Then it will search the cpan archive for updates... Perhaps you need answere a few question if this is the very first time you connect to CPAN. But it's easy. Just do it:-) and how do I add new modules ?(where are they available?). $perl -e MCPAN -e 'install MODUL_NAME::xxx' this will search the archive after module namedd MODUL_NAME::xxx and install it. If this module need other modules to work ok. The installation prossess will automatic fix this. Karl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
We choose to manually install our modules for all of our environments. The CPAN module has a tendency to grab the latest and greatest of everything. One nice thing is to use the CPAN.pm to make a 'snapshot' of your modules and make a bundle out of them. Then just install your custom bundle. You'll need to edit the list it makes, as it will bundle all of your standard shipped modules as well. HTH Matt --- Carlin Anderson [EMAIL PROTECTED] wrote: Does it matter what version of perl is currently running (I am on 5.61), and are there any concerns on using the automatic installation process against a production environment? Does the automatic process pick the right version of the module based on what is already installed? Thanks Carlin Original Message Follows From: [EMAIL PROTECTED] To: TS [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: modules Date: Fri, 5 Oct 2001 12:27:27 +0200 (CEST) On Fri, 5 Oct 2001, TS wrote: I use perl 5.005_03. how do I find out what modules are installed ? $perl -MCPAN -e autobundle This will first search for all installed module. Then it will search the cpan archive for updates... Perhaps you need answere a few question if this is the very first time you connect to CPAN. But it's easy. Just do it:-) and how do I add new modules ?(where are they available?). $perl -e MCPAN -e 'install MODUL_NAME::xxx' this will search the archive after module namedd MODUL_NAME::xxx and install it. If this module need other modules to work ok. The installation prossess will automatic fix this. Karl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules for creating graphics and images
On Tue, 11 Dec 2001 17:37:16 -0500, [EMAIL PROTECTED] (Pankaj Warade) wrote: GlacierHi Group, I had been working on generating graphic images (want to plot some graphs like pie-chart, bar-graph). Is there any-way of getting this done in perl. Came to know about GD module. Is there any other modules which works in getting graphs. Request suggestion. I stumbled across ploticus. It is wriiten in C , but integrates easily with perl. It is quite easy , fast and powerful for creating a wide assortment of graphs. Comes with some perl web interfaces. http://ploticus.sourceforge.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules installed with default install on IRIX 6.x
maarten hilgenga [[EMAIL PROTECTED]] quoth: *Hi all, * *After installing Perl 5.005.03 from the CPAN port on a Silicon Graphics *running IRIX 6.3 without any problems, I tried installing an openssl library. *During this installation I found two errors: * *can't locate module strict.pm *can't locate Getopt/Long.pm * *My questions: *Are these modules included with a standard installation? *How do I find/get these modules? Yes, both are 'core' modules and if they didn't get installed that would be a real problem. Did the system produce that '' with the error or did you? Look in your @INC and if they are in fact installed then you should look at the program that's using perl and have a look at what it is really trying to use...I seem to vaguely remember IRIX still using perl4 as late as 96/97. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
Jeff 'japhy' Pinyan [[EMAIL PROTECTED]] quoth: *On Nov 16, Ray Murphy said: * *When using modules, is it better to say 'use *Foo::Bar;' rather than 'require'. Also I've noticed *that some people put their 'use' or 'require' *statements in subroutines and not at the beginning of *the program - what benefits does this serve - conserve *memory because as soon as you've left the routine the *module goes bye bye (guessing)?? But surely the *library would have to compile everytime the subroutine *would be called and therefore slow the program down *somewhat (again, guessing). * *The FAQ has an answer for this: What's the difference between require and *use? Check http://www.perldoc.com/, and look in perlfaq8. * *The skinny is this: * * 1. require() happens at run-time, and either takes a bareword module * name or a path to a file (not necessarily a module) * 2. use() happens at compile-time (so putting it in a function doesn't * help) and it involves require()ing a module and then calling its * import() method In practical daily use, use(); is preferred as since it compiles the module as soon as it sees 'use Foo::Bar;' before moving on, this will catch errors and scope conflicts far sooner than if you use require(); There aren't many good reasons to use require, at least I can't think of any. When in doubt, use use(); :) If you see a lot of 'requires' in subroutines, I suspect someone just didn't get scope or wrote a quick hack so performance is the least of the codes worries. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modules
-Original Message- From: Elaine -HFB- Ashton [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 10:28 AM To: [EMAIL PROTECTED] Cc: Ray Murphy; [EMAIL PROTECTED] Subject: Re: Modules Jeff 'japhy' Pinyan [[EMAIL PROTECTED]] quoth: *On Nov 16, Ray Murphy said: * *When using modules, is it better to say 'use *Foo::Bar;' rather than 'require'. Also I've noticed *that some people put their 'use' or 'require' *statements in subroutines and not at the beginning of *the program - what benefits does this serve - conserve *memory because as soon as you've left the routine the *module goes bye bye (guessing)?? But surely the *library would have to compile everytime the subroutine *would be called and therefore slow the program down *somewhat (again, guessing). * *The FAQ has an answer for this: What's the difference between require and *use? Check http://www.perldoc.com/, and look in perlfaq8. * *The skinny is this: * * 1. require() happens at run-time, and either takes a bareword module * name or a path to a file (not necessarily a module) * 2. use() happens at compile-time (so putting it in a function doesn't * help) and it involves require()ing a module and then calling its * import() method In practical daily use, use(); is preferred as since it compiles the module as soon as it sees 'use Foo::Bar;' before moving on, this will catch errors and scope conflicts far sooner than if you use require(); There aren't many good reasons to use require, at least I can't think of any. When in doubt, use use(); :) If you see a lot of 'requires' in subroutines, I suspect someone just didn't get scope or wrote a quick hack so performance is the least of the codes worries. require() is handy inside an eval { } block to trap whether a module is installed or not. Many CPAN modules use this technique. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modules
In practical daily use, use(); is preferred as since it compiles the module as soon as it sees 'use Foo::Bar;' before moving on, this will catch errors and scope conflicts far sooner than if you use require(); There aren't many good reasons to use require, at least I can't think of any. When in doubt, use use(); :) If you see a lot of 'requires' in subroutines, I suspect someone just didn't get scope or wrote a quick hack so performance is the least of the codes worries. require() is handy inside an eval { } block to trap whether a module is installed or not. Many CPAN modules use this technique. Very occasionally I will also do something like this: my $needed_file = deduce_where_necessary_code_is(); require $needed_file; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modules
Bob Showalter [[EMAIL PROTECTED]] quoth: * *require() is handy inside an eval { } block to trap whether a module *is installed or not. Many CPAN modules use this technique. Like I said, I can't think of any good reasons for using require. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
On Fri, 5 Oct 2001, TS wrote: I use perl 5.005_03. how do I find out what modules are installed ? $perl -MCPAN -e autobundle This will first search for all installed module. Then it will search the cpan archive for updates... Perhaps you need answere a few question if this is the very first time you connect to CPAN. But it's easy. Just do it:-) and how do I add new modules ?(where are they available?). $perl -e MCPAN -e 'install MODUL_NAME::xxx' this will search the archive after module namedd MODUL_NAME::xxx and install it. If this module need other modules to work ok. The installation prossess will automatic fix this. Karl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth: *On Fri, 5 Oct 2001, TS wrote: * * I use perl 5.005_03. * how do I find out what modules are installed ? * *$perl -MCPAN -e autobundle *This will first search for all installed module. Then it will search the *cpan archive for updates... *Perhaps you need answere a few question if this is the very first time you *connect to CPAN. But it's easy. Just do it:-) This is not a first choice since it lists everything including core modules. http://www.cpan.org/misc/cpan-faq.html#How_installed_modules e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
How do I know what modules are installed ? Does the CGI_Lite module come bundled by default? This question is a CPAN FAQ, which you can read here: http://www.cpan.org/misc/cpan-faq.html#How_installed_modules You may find the other CPAN FAQs useful; the url for the full list is slightly different: http://www.cpan.org/misc/cpan-faq.html Best wishes, Rachel -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
Cool script. Why does a bunch list with a version of -- ??? Perl -- 5.6.1 Pod -- ??? RAS::AS5200 -- 1.04 SHA -- 2.01 Term::ANSIColor -- 1.04 Pod for example above. Tks, K Scott wrote: Here is some code that will list all installed modules #!/usr/bin/perl -w use ExtUtils::Installed; my $instmod = ExtUtils::Installed-new(); foreach my $module ($instmod-modules()) { my $version = $instmod-version($module) || ???; print $module -- $version\n; } -Original Message- From: Joe Bellifont [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 10:18 AM To: [EMAIL PROTECTED] Subject: modules How do I know what modules are installed ? Does the CGI_Lite module come bundled by default? _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules question
[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth: *Dose anyone know of a exsiting Perl module that will test to see what tape drives are available on Unix box? * *I looked through the some of the CPAN stuff but didn't find anything that looked like what I might need. None that I'm aware of as it is so gnarly across different Unixes to get the device that you'll probably have to go with a system specific command to list all your available drives. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules path to perl
do a 'which perl' at the command line to get the location of perl. Not sure about the modules. To get the version of perl, do 'perl --version' at the command line. Tyler - Original Message - From: David Gilden [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 05, 2001 12:29 PM Subject: modules path to perl How do I list what my ISP has on there server in terms of Modules? And what is the command (at the command line) to tell me what version The server has on it / and or the path to perl. Thanks Dave G. Looking for Web Talent, You found it! portfolio: www.coraconnection.com/web/ email: [EMAIL PROTECTED] tel/fax: (860) 231-9988
Re: modules path to perl
At 01:29 PM 7/5/01 -0400, David Gilden wrote: How do I list what my ISP has on there server in terms of Modules? perldoc CPAN and look for the autobundle command. You'll have to define your own personal CPAN directory first, but this is the official way. Dirtier way: find `perl -e 'print @INC'` -name *.pm -print And what is the command (at the command line) to tell me what version perl -v The server has on it / and or the path to perl. which perl
Re: modules path to perl
At 02:03 PM 7/5/01 -0400, David Gilden wrote: perldoc CPAN and look for the autobundle command. You'll have to define your own personal CPAN directory first, but this is the official way. Dirtier way: find `perl -e 'print @INC'` -name *.pm -print Got a long list of stuff, and wanted to write to a file, What did I miss here? (almost there...) Redirect: find `perl -e 'print @INC'` -name *.pm -print modules #!/usr/bin/perl @array = (test,dave); push @array ,`find @INC -name *.pm`; open (ML, modulelist) or die could not write file $!; while (@array){ print $_\n; } Er, just stick the module list in a file from the command line, no need to write a Perl script to do it. Then clean it up with an editor. If you're looking for more details, autobundle is the way to go; it will tell you version numbers. CPAN.pm can even tell you which modules have more recent versions available. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com
RE: Modules question
put use (MODULE NAME); at the top of the script. Run the script and see if it generates an error. e.g use Win32::Lanman; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 29 June 2001 13:36 To: [EMAIL PROTECTED] Subject: Modules question Help with Modules please. Is there a option I can run with perl to find out if a particular module is installed? Thanks, Anna --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system.
Re: Modules question
Hi Anna, To find out all the modules installed on your system, refer to the following URL: http:[EMAIL PROTECTED]/msg04057.html To find out about a single one, you can do: perl -MMODULE_NAME -e 1 So, to see if CGI.pm is installed: perl -MCGI -e 1 If you see no error messages, it is installed, if you do.. it isn't. Cheers, Kevin On Fri, Jun 29, 2001 at 08:35:34AM -0400, [EMAIL PROTECTED] ([EMAIL PROTECTED]) spew-ed forth: Help with Modules please. Is there a option I can run with perl to find out if a particular module is installed? -- [Writing CGI Applications with Perl - http://perlcgi-book.com] Don't mind your make-up, you'd better make your mind up. -- Frank Zappa
Re: Modules question
On Fri, 29 Jun 2001 [EMAIL PROTECTED] wrote: Help with Modules please. Is there a option I can run with perl to find out if a particular module is installed? Try perl -MModuleName -e ''. If it isn't in @INC, you'll get an error, otherwise it will return to the command-line prompt. -- Brett http://www.chapelperilous.net/btfwk/ Q: How do you play religious roulette? A: You stand around in a circle and blaspheme and see who gets struck by lightning first.
Re: Modules question
On Win32, typing ppm verify at the command prompt will list all the modules installed on your system quit will exit the ppm tool [EMAIL PROTECTED] wrote: Help with Modules please. Is there a option I can run with perl to find out if a particular module is installed? Thanks, Anna
Re: Modules (was: Require)
--- Peter Scott [EMAIL PROTECTED] wrote: It's always seemed to me that the 'approved' way of creating modules to import routines into another script was a bit wordy. In a nutshell, you have to do something like package abc; use Exporter; @ISA = qw(Exporter); @EXPORT = qw(foo bar baz); @EXPORT_OK = qw(blech flurble); sub foo { ... } And that's not even with proper strictness enabled. But you don't *have* to do any of that. Exporter is often only use to pollute the main package namespace. It's an awesome module, but almost never something you *have* to use. You can always just specify the namespace where the functions reside. That said, I might agree that require is a better mechanism in many cases, but when I first started looking for ways to modularize my code, I looked at require in perlfunc and saw: For a yet-more-powerful import facility, see use and perlmod. Being too much the gearhead, I went straight there and have virtually never used a require statement in a script. __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/