perl modules
I am a unix user, but I am not a superuser, so I tried to install more perl modules, I have to install in my local directories, I used CPAN to install them, but some module depend on other modules which I already installed before, and they always complain they can't find it. please give me some advice how to install perl modules in your local directories. Emily _ Search on the go: Try Windows Live(tm) Search for Mobile beta http://www1.imagine-msn.com/minisites/mobile/Default.aspx?locale=en-us
Re: perl modules
Hi Emily, From your shell, you can execute... export PERL5LIB=/path/to/your/perl/module/install/directory ...or it's equivalent (see `man your_shell`). You can add it to your .bash_profile or equivalent in case you don't want to type it in manually every time. Or, if you are running a local apache instance (w/ mod_perl), you may also add the following to your httpd.conf. PerlSetEnv PERL5LIB /path/to/your/perl/module/install/directory Hope that helps. -Shaun On Wed, Jun 07, 2006 at 11:24:57AM -0500, yue lu wrote: I am a unix user, but I am not a superuser, so I tried to install more perl modules, I have to install in my local directories, I used CPAN to install them, but some module depend on other modules which I already installed before, and they always complain they can't find it. please give me some advice how to install perl modules in your local directories. Emily -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Need help with making a Modules
I am studying modules.. I am seeking a mentor to help. I have very simple questions like ... Do I need to pass vars into the mod? Do i need to declare vars in the mod? What is our? something like my and local? Do I need to return vars? The code I am writing creates part of a web page, so I can print it in the mod or in the main. (I wold prefer to print it in the mod.. if possible) I have been reading for 2 weeks now and can't find a simple working model to disect that I can understand all the parts of. I have read what CPAN has, and a CGI101 and Visuals Perl book and O'Rielys Mods and objects(or something like that) .. and I can't figure it out. Please reply Thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Need help with making a Modules
On Sat, 2005-11-26 at 19:48 -0800, Lou Hernsen wrote: I am studying modules.. perldoc perlmod (and perlmodlib, and perlmodstyle) Do I need to pass vars into the mod? No, but you might need to pass them into subroutines you define in the module (depending on what you want to do). Do i need to declare vars in the mod? That depends on what you want the module to do. What is our? something like my and local? perldoc -f our Do I need to return vars? The module itself needs to return a true value, this is usually achieved by sticking 1; at the end of it. Your subroutines may or may not return variables depending on what you want them to do. The code I am writing creates part of a web page, so I can print it in the mod or in the main. (I wold prefer to print it in the mod.. if possible) Its possible, but I find that building a data structure that represents the page, then dropping it into a template (using Template-Toolkit of HTML::Template) makes things more manageable. -- David Dorward http://dorward.me.uk/ Anybody remotely interesting is mad, in some way or another. -- The Greatest Show in the Galaxy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Need help with making a Modules
Lou Hernsen mailto:[EMAIL PROTECTED] wrote: : I am studying modules.. I am seeking a mentor to help. What do you mean by module? I ask because many people have very different ideas about what one is. For example, some people think about a library. require 'my_perl_module.pl; When I say module, I am usually thinking of an object. use TemplateVariables; my $vars = TemplateVariables - new() - select_categories(); Others think of a library of subroutines and variables. use CGI qw(:standard center); print header(), start_html('foo'), center(h1('foo')), end_html(); In your own words, define module. : I have very simple questions like ... : Do I need to pass vars into the mod? That depends on what you are attempting to do. It also depends on what you want the module to do. The CGI example above passed variables into the module to tell it which subroutines should be exported. An object may require variables to be added when it is constructed. : Do i need to declare vars in the mod? It is often very difficult to write an entire module without declaring a variable, but it is not impossible. : What is our? something like my and local? Yes. Have you read perlfunc? : Do I need to return vars? Not usually. Most modules return values. : The code I am writing creates part of a web page, : so I can print it in the mod or in the main. : (I wold prefer to print it in the mod.. if possible) : : I have been reading for 2 weeks now and can't find a simple working : model to disect that I can understand all the parts of. Give us a more detailed idea of what you are attempting and perhaps we could write an example for you. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 . . . With Liberty and Justice for all (heterosexuals). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Need help with making a Modules
This small piece of the Stats sub calculates the speed at which you are traveling. I have in the main program. use stats and I call on it just like a regular sub Speed(); or should it be stats::Speed; When I call on the entire mod, i want the whole thing to run. I could just put all the subs in the mod into one sub and call on that.. i guess. thanks Lou ps.. i know my coding sucks.. i'm a beginner its the best i can do given my understanding package stats; sub BEGIN { use Exporter(); @ISA = qw(Exporter); @EXPORT = qw(Speed) } sub Speed { $v0 = 1+$Army+$Hero+$Spy; $v1 = 1+$Army+$Hero+$Spy+$Wagon; if ($Wagon 1 $Horse = $v0 $Saddle = $v0 $Blanket = $v0 $Load = 100) {$Speed = 1.5;} elsif ($Wagon == 0 $Horse = $v0 $Load = 100) {$Speed = 2;} elsif ($Wagon 0 $Horse = $v1 $Load = 100) {$Speed = 2.5;} elsif ($Wagon == 0 $Load = 100) {$Speed = 3;} elsif ($Load 100) {$Speed = (int(.3 * $Load))/10;} else {$Speed=3;} } return 1; #3 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Need help with making a Modules
Lou Hernsen mailto:[EMAIL PROTECTED] wrote: : I am trying to create a module that will print the Stats of the : player of my on line game. : all it should do is take the vars, do some calulations and print the : HTML : since the Stats is used in every time i don't want to duplicate it in : each program. So there is just one subroutine. : The main program has all your players vars loaded... : the Stats subroutine (which I want to make into a mod) : puts the HTML code in the BODY of the web page... : from what I have read this should not be a hard things to do. No. It is pretty easy. : Module= a piece of code that is repeated in several programs. That's what I thought you were after, but I wanted to be sure. : Each location in the town is a separate program : If I can't get this to work I'll just leave the sub Stats() in : each program and not worry about it. Many people use copy and paste to reuse code. The problem is you may need to make a change. Either you have to write a program to make the changes in every file or you resign to not making the change. A module is definitely the right solution for you. package Stats; # No need for BEGIN. Read the Exporter docs for details. use Exporter 'import'; # Any element of this array will be imported into # calling package namespace (probably main::). @EXPORT = qw(Speed); sub Speed { $v0 = 1+$Army+$Hero+$Spy; $v1 = 1+$Army+$Hero+$Spy+$Wagon; if ($Wagon 1 $Horse = $v0 $Saddle = $v0 $Blanket = $v0 $Load = 100) {$Speed = 1.5;} elsif ($Wagon == 0 $Horse = $v0 $Load = 100) {$Speed = 2;} elsif ($Wagon 0 $Horse = $v1 $Load = 100) {$Speed = 2.5;} elsif ($Wagon == 0 $Load = 100) {$Speed = 3;} elsif ($Load 100) {$Speed = (int(.3 * $Load))/10;} else {$Speed=3;} # Do your HTML stuff } # This is more common than using return 1; 1; In your program do this. use lib '.';# Point to the directory where you placed # your module. #use Stats; # This is fine, but use Stats 'Speed'; # this tells you where Speed() come from. . . . Speed(); HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 PS Please, please, please, don't use global scoped variables in your subroutines. Lou is stubborn, but the rest of you are not off the hook. Pass all variables into the your subs and pass all variables out of your subs. Do not operate (or depend) on variables which are external a subroutine. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Help w/Modules
On Sep 25, 2005, at 2:01 PM, Randal L. Schwartz wrote: That's why I created CGI::Prototype::Hidden... to lazy-load the code for the particular step of the application. Randal, this really piqued my interest and after a little poking around I found this link; http://www.stonehenge.com/merlyn/LinuxMag/ and read these articles; Introduction to CGI::Prototype (part 1) (May 05) Introduction to CGI::Prototype (part 2) (Jun 05) Introduction to CGI::Prototype (part 3) (Jul 05) and what you're doing here started to sink in a bit. The way lazy-load works is still magic to me, but it seems to perfectly answer the problem I was worried about. But I learned more than that and I just love the logic used here... The state is used to select a particular class for the controller, along with the default template for that class. Once a state has been selected, the corresponding class is loaded into the program (unless already defined), and used to determine the next step in the program. This ``lazy loading'' behavior permits a minimum of loading for CGI programs: at most, two different state-named classes are loaded per web hit. I read this right after a few hours of playing with an easier way to get the name of template I wanted after a user submits a form. I came up with a solution that I thought worked pretty good, then I realize that you've done away with the problem altogether. I can use this logic in any cgi application I make, it's so simple and makes such good sense. I'll read the above articles a few more times and then create a small app with CGI::Prototype in a day or two. I'm pretty slow at absorbing this stuff but I must thank you for helping me better understand where I need to go and how to get there with my cgi applications. BTW, how's the Cookbook coming? Kindest Regards, -- Bill Stephenson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Help w/Modules
On Sep 24, 2005, at 10:59 AM, Bill Stephenson wrote: I'm trying to understand how to convert my CGI scripts to use modules. I worked this problem out. Reading the docs and this page (http://www.perl.com/pub/a/2001/06/05/cgi.html) for CGI::Application has helped me better understand how to use modules, but I'm still left somewhat confused on the subject of efficient web application design. My original question had to do with How big is too big and I don't see the advantage of creating a large module accessed by a small Instance script, as compared to a a single, large, cgi script that uses sub-routines, to process run-modes. What happens when your module or script grow to over 1 megabyte? Wouldn't it be more efficient for the server to run a small script that contains only the set-up and sub-routines needed to process a single run-mode instead of loading all the data needed to process all the run-modes used in an entire application? Also, the above article implies that web applications created with CGI::Application are ready for mod_perl. I've never tried creating a script that would run with mod_perl but if this is true, I'd like to try it out. Any feedback on using CGI::Application would also be much appreciated. Kindest Regards, -- Bill Stephenson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Help w/Modules
I'm trying to understand how to convert my CGI scripts to use modules. My first step is to create a SetUp module where I can store common stuff. I put together a module and script to test it with but it doesn't work. It doesn't display the first (default) and last options correctly and I can't figure out why. Does anyone here see what I'm doing wrong? -- Bill Stephenson start script #!/usr/bin/perl use CGI; use CGI::Carp('fatalsToBrowser'); use SetUp; use strict; my $SETUP = new SetUp; my $P = new CGI; my $c_state = $P-popup_menu(-name='c_state', -values=[$SETUP-states_values], -labels={$SETUP-states_labels}, -default='Select'); print $P-header, $P-start_html, $P-start_form; print $c_state, $P-p, $P-submit; print $P-end_form, $P-end_html; end script start module package SetUp; use strict; use warnings; use vars qw($VERSION); $VERSION = '0.01'; sub new { my $package = shift; return bless({}, $package); } sub states_values { return my @states_values=('Select', 'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC','FL', 'GA', 'GU', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MH', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE','NV','NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'MP','OH', 'OK', 'OR', 'PW','PA', 'PR', 'RI','SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY', '--', 'AB', 'BC', 'MB', 'NB', 'NF', 'NT', 'NS', 'NU', 'ON', 'PE', 'QC', 'SK', 'YT', '---', 'AG', 'BJ', 'BS', 'CP', 'CH', 'CU', 'CL', 'CI', 'DF', 'DG', 'GR', 'GJ', 'HG', 'JA', 'EM', 'MH', 'MR', 'NA', 'NL', 'OA', 'PU', 'QA', 'QR', 'SL', 'SI', 'SO', 'TA', 'TM', 'TL', 'VL', 'YC', 'ZT'); } sub states_labels { return my %states_labels=( 'Select' ='== Select State ==', # this displays Select 'AL'='AL - Alabama', 'AK'='AK - Alaska', 'AS'='AS - American Samoa', 'AZ'='AZ - Arizona', 'AR'='AR - Arkansas', 'CA'='CA - California', 'CO'='CO - Colorado', 'CT'='CT - Connecticut', 'DE'='DE - Delaware', 'DC'='DC - District of Columbia', 'FL'='FL - Florida', 'GA'='GA - Georgia', 'GU'='GU - Guam', 'HI'='HI - Hawaii', 'ID'='ID - Idaho', 'IL'='IL - Illinois', 'IN'='IN - Indiana', 'IA'='IA - Iowa', 'KS'='KS - Kansas', 'KY'='KY - Kentucky', 'LA'='LA - Louisiana', 'ME'='ME - Maine', 'MH'='MH - Marshall Islands', 'MD'='MD - Maryland', 'MA'='MA - Massachusetts', 'MI'='MI - Michigan', 'MN'='MN - Minnesota', 'MS'='MS - Mississippi', 'MO'='MO - Missouri', 'MT'='MT - Montana', 'NE'='NE - Nebraska', 'NV'='NV - Nevada', 'NH'='NH - New Hampshire', 'NJ'='NJ - New Jersey', 'NM'='NM - New Mexico', 'NY'='NY - New York', 'NC'='NC - North Carolina', 'ND'='ND - North Dakota', 'MP'='MP - Northern Mariana Islands', 'OH'='OH - Ohio', 'OK'='OK - Oklahoma', 'OR'='OR - Oregon
Re: Help w/Modules
Bill == Bill Stephenson [EMAIL PROTECTED] writes: Bill Wouldn't it be more efficient for the server to run a small script Bill that contains only the set-up and sub-routines needed to process a Bill single run-mode instead of loading all the data needed to process Bill all the run-modes used in an entire application? That's why I created CGI::Prototype::Hidden... to lazy-load the code for the particular step of the application. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment 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
installing modules
hi to all, my server-administrator told me I cannot use ssh to install some modules (LWP, HTML) on server. How I can do it using only ftp? thank a lot, alladr |^|_|^|_|^| |^|_|^|_|^| || || || || ||*\_/*\_/*\_/*\_/*\_/* || | | | | | | | http://www.e-allora.net| | | | | ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: installing modules
Adriano Allora wrote: hi to all, my server-administrator told me I cannot use ssh to install some modules (LWP, HTML) on server. How I can do it using only ftp? thank a lot, alladr |^|_|^|_|^| |^|_|^|_|^| || || || || ||*\_/*\_/*\_/*\_/*\_/* || | | | | | | | http://www.e-allora.net| | | | | ** sftp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Alternative Modules
Mike Blezien wrote: Hello, we are currently using the Mail::Audit module to resend piped incoming emails to a particular domain then sends it to various aliases emails from a database. I'm trying locate a similar module but doesn't put alot of the header garbage into the body of the email. Then Mail::Audit doesn't really remove certain headers from the actual body of the email. Is there a module that works similar as the Mail::Audit, but extracts the actual body content of the email without some of the headers included in it?? TIA This is a rather confusing description of what you are doing, if you can clean it up a bit we might be able to give you a better solution. Although it has a very steep learning curve, there isn't a lot that the Mail::Box suite can't do. If I wanted to do anything remotely complex with mail (and I have) I would use it hands down. It has incredible documentation, though that too has a little bit of a learning curve :-). http://perl.overmeer.net/mailbox/ There is also a mailing list... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Alternative Modules
Hello, we are currently using the Mail::Audit module to resend piped incoming emails to a particular domain then sends it to various aliases emails from a database. I'm trying locate a similar module but doesn't put alot of the header garbage into the body of the email. Then Mail::Audit doesn't really remove certain headers from the actual body of the email. Is there a module that works similar as the Mail::Audit, but extracts the actual body content of the email without some of the headers included in it?? TIA -- Mike(mickalo)Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://thunder-rain.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: Variables in Modules
David Dorward wrote: On Wed, Apr 13, 2005 at 05:14:31PM -0300, Sergio Pires de Albuquerque wrote: Thanks, but when I call another script from script1.cgi the value has gone HTTP is stateless. Each time a user requests an HTTP resource provided by a script, that script is run from scratch. If you want to make data persistent from one HTTP request to another, you either have to get the browser to pass it back (by encoding the data in the URL (typically with the query string, or (with the help of a form) in a POST request - either way it can be accessed with the param method of the CGI module), or by storing it on the server and asking the client to pass a token about (typically in a Cookie) to identify which set of data belongs to the user (this is usually done with sessions: http://search.cpan.org/~sherzodr/CGI-Session-3.95/Session.pm ) Hi, Thanks a lot David, I didn't know about that. I'll get that module and try to do. Yours, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Variables in Modules
Lawrence Statton wrote: Dear Guys, I4ve been trying to develop an application that consists in about 8-10 scripts that should know about module variables (not OO yet). I read the docs and found that I can use a module variable (declared with our) in scripts that 'use' that module. Ok, there are: module1.cgi (declare and define var1) main.cgi (declare and initialize var1) use module1 script1.cgi (read and alter var1) use module1 script2.cgi (gets var1 with undefined or previous value) use module1 I tried with our, importing that var and fully qualified it, but always it get the previous value. My question is: Which method is common to share data among apps? What Am I doing wrong? Also, I always use strict and warnings. Well, first -- I wouldn't name your modules *.cgi *.pm is what everyone expects to see, and in absence of a Good Overriding Reason you should follow the Principle of Least Astonishment. Naming your module module is also a terrible idea - unless you expect only to have one ever in your life. Give it a meaningful name. That said: The simplest way to create and use fully qualified variables from another package is just to fully qualify them. So, you've got some module Segrio's First Module: SergioPrimo.pm package SergioPrimo; our ($foo, $bar, $baz); 1; Now, down in your .cgi file, you can use those variables by their names $SergioPrimo::foo $SergioPrimo::bar etc. If you want not to have to fully qualify the variable name, you can use Exporter ... something like package SergioPrimo; use base 'Exporter'; our @EXPORT_OK = qw / $foo $bar $baz /; our %EXPORT_TAGS = ( all = [EMAIL PROTECTED] ); our ($foo, $bar, $baz); 1; Now you can say down in your CGI random.cgi use SergioPrimo (':all'); # import some variables $foo = 123; # sets $SergioPrimo::foo NOW ... all that being said: It looks like your more serious problem is: You're trying to store state in Perl from different contexts, which is surely confusing you no end. If you're using just plain-old-CGI, then each and every time your web server handles an inbound request, a brand new Perl interpreter is instantiated, SergioPrimo::foo gets built fresh (as undef) and your .cgi files may or may not set that variable and use them again later. If you're using some persistent-perl-like product (e.g. FastCGI, mod_perl) then you will find that SOMETIMES SergioPrimo::foo has the last value it had, and sometimes it doesn't. Perhaps you should take a step back and try to explain what you're trying to do. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. Hi Lawrence, It was a mistake. The module ends in .pm and not named module, it was only to demonstrate. And yes, I'm trying to save state information across pages. I'll try a CGI::Session and, for now, I want only to thank all of you for the help. Yours, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Variables in Modules
Dear Guys, I´ve been trying to develop an application that consists in about 8-10 scripts that should know about module variables (not OO yet). I read the docs and found that I can use a module variable (declared with our) in scripts that 'use' that module. Ok, there are: module1.cgi (declare and define var1) main.cgi (declare and initialize var1) use module1 script1.cgi (read and alter var1) use module1 script2.cgi (gets var1 with undefined or previous value) use module1 I tried with our, importing that var and fully qualified it, but always it get the previous value. My question is: Which method is common to share data among apps? What Am I doing wrong? Also, I always use strict and warnings. 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: Variables in Modules
--- Sergio Pires de Albuquerque [EMAIL PROTECTED] wrote: I tried with our, importing that var and fully qualified it, but always it get the previous value. My question is: Which method is common to share data among apps? What Am I doing wrong? Also, I always use strict and warnings. You're talking about global variables and, in general, using them is a bad thing as it makes code more difficult to maintain. I won't go into that, though, as there's plenty of info elsewhere about that. In your case, don't give access to the variables. If you're not going to go OO, give access to subroutines which can read and alter those variables. package Foo; use strict; use warningsl my $var = 7; sub var { $var } sub set_var { my $new_var = shift; unless (defined $new_var and $new_var =~ /^\d+$/) { require Carp; Carp::croak(Argument to set_var() can only be digits: ($var)); } $var = $new_var; } 1; With techniques like that, you can at least ensure that there is one canonical place where the data is being fetched and altered. This gives you some measure of protection to ensure that naughty code isn't doing things it should not be doing and, if it ever gets set to a bad value, you have only one place to put your debugging code. Cheers, Ovid -- If this message is a response to a question on a mailing list, please send follow up questions to the list. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Variables in Modules
Ovid wrote: --- Sergio Pires de Albuquerque [EMAIL PROTECTED] wrote: I tried with our, importing that var and fully qualified it, but always it get the previous value. My question is: Which method is common to share data among apps? What Am I doing wrong? Also, I always use strict and warnings. You're talking about global variables and, in general, using them is a bad thing as it makes code more difficult to maintain. I won't go into that, though, as there's plenty of info elsewhere about that. In your case, don't give access to the variables. If you're not going to go OO, give access to subroutines which can read and alter those variables. package Foo; use strict; use warningsl my $var = 7; sub var { $var } sub set_var { my $new_var = shift; unless (defined $new_var and $new_var =~ /^\d+$/) { require Carp; Carp::croak(Argument to set_var() can only be digits: ($var)); } $var = $new_var; } 1; With techniques like that, you can at least ensure that there is one canonical place where the data is being fetched and altered. This gives you some measure of protection to ensure that naughty code isn't doing things it should not be doing and, if it ever gets set to a bad value, you have only one place to put your debugging code. Cheers, Ovid I agree with what Ovid said, but in the case where the data won't need or shouldn't be changed, you might consider using constants, which have a global nature but are considered less messy than global variables. perldoc constant Though I would still drop them into their own module that can be 'use'd. This works well for DB DSNs, base URLs, etc. http://danconia.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: Variables in Modules
On Wed, Apr 13, 2005 at 05:14:31PM -0300, Sergio Pires de Albuquerque wrote: Thanks, but when I call another script from script1.cgi the value has gone HTTP is stateless. Each time a user requests an HTTP resource provided by a script, that script is run from scratch. If you want to make data persistent from one HTTP request to another, you either have to get the browser to pass it back (by encoding the data in the URL (typically with the query string, or (with the help of a form) in a POST request - either way it can be accessed with the param method of the CGI module), or by storing it on the server and asking the client to pass a token about (typically in a Cookie) to identify which set of data belongs to the user (this is usually done with sessions: http://search.cpan.org/~sherzodr/CGI-Session-3.95/Session.pm ) -- David Dorward http://dorward.me.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Variables in Modules
Dear Guys, I´ve been trying to develop an application that consists in about 8-10 scripts that should know about module variables (not OO yet). I read the docs and found that I can use a module variable (declared with our) in scripts that 'use' that module. Ok, there are: module1.cgi (declare and define var1) main.cgi (declare and initialize var1) use module1 script1.cgi (read and alter var1) use module1 script2.cgi (gets var1 with undefined or previous value) use module1 I tried with our, importing that var and fully qualified it, but always it get the previous value. My question is: Which method is common to share data among apps? What Am I doing wrong? Also, I always use strict and warnings. Well, first -- I wouldn't name your modules *.cgi *.pm is what everyone expects to see, and in absence of a Good Overriding Reason you should follow the Principle of Least Astonishment. Naming your module module is also a terrible idea - unless you expect only to have one ever in your life. Give it a meaningful name. That said: The simplest way to create and use fully qualified variables from another package is just to fully qualify them. So, you've got some module Segrio's First Module: SergioPrimo.pm package SergioPrimo; our ($foo, $bar, $baz); 1; Now, down in your .cgi file, you can use those variables by their names $SergioPrimo::foo $SergioPrimo::bar etc. If you want not to have to fully qualify the variable name, you can use Exporter ... something like package SergioPrimo; use base 'Exporter'; our @EXPORT_OK = qw / $foo $bar $baz /; our %EXPORT_TAGS = ( all = [EMAIL PROTECTED] ); our ($foo, $bar, $baz); 1; Now you can say down in your CGI random.cgi use SergioPrimo (':all'); # import some variables $foo = 123; # sets $SergioPrimo::foo NOW ... all that being said: It looks like your more serious problem is: You're trying to store state in Perl from different contexts, which is surely confusing you no end. If you're using just plain-old-CGI, then each and every time your web server handles an inbound request, a brand new Perl interpreter is instantiated, SergioPrimo::foo gets built fresh (as undef) and your .cgi files may or may not set that variable and use them again later. If you're using some persistent-perl-like product (e.g. FastCGI, mod_perl) then you will find that SOMETIMES SergioPrimo::foo has the last value it had, and sometimes it doesn't. Perhaps you should take a step back and try to explain what you're trying to do. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Extracting links. - without modules
On Sun, 16 Jan 2005 18:36:09 +0500 Sara [EMAIL PROTECTED] wrote: I am trying to extract links along with HTML tags a href=blah from a list, but it's not working on my XP machine with Active State Perl 5.0.6 Kindly help. # CODE START my @array = qq| bodya href=http://www.mydomain.com;img alt=Free Hosting, Freebies border=0 src=http://www.mydomain.com/images/logo2.gif;/a|;#extract LINKS (no image links) only a href=http://www.mydomain.com; my @get = grep {/a .*?/} @array; print @get\n ### CODE END ### Thanks, Sara. this is also possible _without_ any modules, except maybe strict. # this will replace the contents of each match in @get foreach(@array){ my @get = $_ =~ /a href=(.*?)/g; } or: # this will add each match to @get my @get = (); foreach(@array){ push @get, $_ =~ /a href=(.*?)/g; } -- Cheers, Alex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Extracting links. - without modules
On Mon, 17 Jan 2005, Alexander Blüm wrote: this is also possible _without_ any modules, except maybe strict. # this will replace the contents of each match in @get foreach(@array){ my @get = $_ =~ /a href=(.*?)/g; } What happens if the url has a doublequote followed by an angle bracket? It's not likely, but it can happen, and it can work. And if such a URL is discovered, this regex would break. What happens if the url isn't wrapped in quotes at all? This is much more likely, and again will work fine in browsers. But again, this regex won't find it at all. This kind of problem is why HTML (and XML) is really best processed using pre-written parser modules, such as HTML::SimpleLinkExtor. A parser has a much better shot at getting a proper view of the document than a simple regex pattern match. Yes, you can approach such problems using simple regular expressions, such as what we have here, and in many cases they'll work, and maybe even work faster than the parser version would. On the other hand, this approach is much less generally robust: minor changes that don't break the HTML may break the regex, so you end up having to constantly adjust it to handle all the special cases that come up over time. If you just parse it at the outset, such as with HTML::SimpleLinkExtor, then the code should be simple, robust, and useful for a long time. -- 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
which modules to use?
Hi all, I am really new to CGI, my 1st question is, which Perl modules should I use for creating XHTML documents ? Write me, which one are good, where I can read more about this... Thanks. /Brano -=x=- Skontrolované antivírovým programom NOD32 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: which modules to use?
On Mon, 6 Sep 2004, Ing. Branislav Gerzo wrote: I am really new to CGI, my 1st question is, which Perl modules should I use for creating XHTML documents ? Write me, which one are good, where I can read more about this... I believe that recent versions of CGI.pm should emit valid XHTML, which is nice, because it means you don't have to think so much about the document markup and can focus instead on what you're trying to do. Speaking of which -- what are you trying to do? If you want flat / cached XHTML, or are trying to do some other kind of non-interactive work, then something else might be more appropriate. But for the common case -- CGI scripts mod_perl modules -- something like CGI.pm should do the job just fine. -- 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: which modules to use?
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: : I am really new to CGI, my 1st question is, which : Perl modules should I use for creating XHTML : documents? Write me, which one are good, where I : can read more about this... CGI.pm is a good starting point. Some of us later abandon it for a tem plate package like HTML::Mason or HTML::Template which allows for CGI scripting without embedded markup. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Installing modules
Hi all, Does anyone know how could I install the DBI and DBD::mysql modules under Red Hat if I don't have root rights? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Installing modules
On Thu, 16 Oct 2003 14:18:49 +0300, Octavian Rasnita [EMAIL PROTECTED] wrote: Hi all, Does anyone know how could I install the DBI and DBD::mysql modules under Red Hat if I don't have root rights? http://groups.google.com/groups?q=wiggins+CPAN+o+conf+group:perl.beginners.*hl=enlr=ie=UTF-8oe=UTF-8group=perl.beginners.*selm=200309101906.h8AJ6To30565%40smapp01.siteprotect.comrnum=2 See if that helps. You will have to have the mysql-devel libs installed already. Assuming you do then you can fire up CPAN, set your make destination directory and it should do the rest. If you have to install the mysql stuff yourself and CPAN isn't picking up the includes then come back with the error message that you get and I (we) can probably get your CPAN sorted. It has a lot of options and switches which can be confusing, but in the end it is pretty powerful. Of course perldoc CPAN yourself if you want to try to make sense of it all. I learned through that and trial and error... Obviously with root privileges there are RPMs provided by RH 9, but you said you didn't have those [privileges]. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
modules
hi, Can I to call a function that is in another script? thanks, Rodrigo -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
Installing/Uninstalling CPAN modules
This may be the wrong forum to ask this... How do I uninstall a module downloaded from CPAN? Specifically, I cannot get the DBD::MySQL driver to install under OS X. It refuses to find the mysql_config file, and when I run Makefile again with the -L and -I switches it won't work after install. I am running the Complete MySQL distribution which has worked before, but since this installs into /usr/Library and not /usr/local, I am wondering if the module ignores symlinks to /usr/local. Hence I want to pull everything out and reload the MySQL AB distribution and try again. A quick search shows DBD in dozens of places, in perl/ in DBI/ in mySQL/ etc etc, which ones do I trash? Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing/Uninstalling CPAN modules
You may have better luck in the [EMAIL PROTECTED] list since OS X likes to do all kinds of weird things with its Perl, and with regards to DBI/DBD in [EMAIL PROTECTED] Typically removing a Perl module is not as easy as installing them, removing the associated files is only one step... Sorry I can't provide specifics I haven't tried this and don't have my PB with me http://danconia.org Thanks for that macosx link, that list passed me by somehow. I will ask there. Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Installing/Uninstalling CPAN modules
On Tue, 26 Aug 2003 19:20:03 +, Greenhalgh David [EMAIL PROTECTED] wrote: This may be the wrong forum to ask this... How do I uninstall a module downloaded from CPAN? Specifically, I cannot get the DBD::MySQL driver to install under OS X. It refuses to find the mysql_config file, and when I run Makefile again with the -L and -I switches it won't work after install. I am running the Complete MySQL distribution which has worked before, but since this installs into /usr/Library and not /usr/local, I am wondering if the module ignores symlinks to /usr/local. Hence I want to pull everything out and reload the MySQL AB distribution and try again. A quick search shows DBD in dozens of places, in perl/ in DBI/ in mySQL/ etc etc, which ones do I trash? You may have better luck in the [EMAIL PROTECTED] list since OS X likes to do all kinds of weird things with its Perl, and with regards to DBI/DBD in [EMAIL PROTECTED] Typically removing a Perl module is not as easy as installing them, removing the associated files is only one step... Sorry I can't provide specifics I haven't tried this and don't have my PB with me http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_perl books, cpan modules. (fwd)
Someday I will write a new edition. The problem is that almost everything has changed and so it is basically a new book. Lincoln -- Forwarded message -- Date: 20 Mar 2003 09:33:56 - From: entius [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: mod_perl books, cpan modules. I want to learn mod_perl and there're two books who talk about this. Now a third has arrives and it's talking about 2.0 mod_perl but i am a Lincoln Stein fan and i want the Writing Apache Modules with Perl and C. But the last edition is still about 1.3, anyone knows anything about any intention about making a super-new edition about 2.0?? Another question about cpan modules, only very few are really classes aren't them? i mean, oop is still rare in cpan? or i'm wrong and all new modules get rid of exporter.pm?? http://www.perlattack.com -- Lincoln Stein [EMAIL PROTECTED] Cold Spring Harbor Laboratory 1 Bungtown Road Cold Spring Harbor, NY 11724 (516) 367-8380 (voice) (516) 367-8389 (fax) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mod_perl books, cpan modules.
I want to learn mod_perl and there're two books who talk about this. Now a third has arrives and it's talking about 2.0 mod_perl but i am a Lincoln Stein fan and i want the Writing Apache Modules with Perl and C. But the last edition is still about 1.3, anyone knows anything about any intention about making a super-new edition about 2.0?? Another question about cpan modules, only very few are really classes aren't them? i mean, oop is still rare in cpan? or i'm wrong and all new modules get rid of exporter.pm?? http://www.perlattack.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: mod_perl books, cpan modules.
On 20 Mar 2003 09:33:56 -, entius [EMAIL PROTECTED] wrote: I want to learn mod_perl and there're two books who talk about this. Now a third has arrives and it's talking about 2.0 mod_perl but i am a Lincoln Stein fan and i want the Writing Apache Modules with Perl and C. But the last edition is still about 1.3, anyone knows anything about any intention about making a super-new edition about 2.0?? I don't do a lot of mod_perl but I would think that the basis for how the various steps in a request/response are handled, etc. are very similar between the two versions, so the underlying core of the book mentioned above would still apply, with various changes in syntax for the interface, etc. I will comment that when I went through the book a little over a year ago it was excellent for anyone with a good background in Perl and its use on the web. Another question about cpan modules, only very few are really classes aren't them? i mean, oop is still rare in cpan? or i'm wrong and all new modules get rid of exporter.pm?? This I would disagree with currently, though I couldn't say when a critical mass was reached, though obviously I feel it safe to say that much of the OOP is concentrated in newer modules. And part of the beauty and flexibility of the Perl OOP model means it only requires a little more effort to make a module both OOP and non-OOP. the CGI.pm is a perfect example, for those from the old school they will find CGI fits their purposes and provides all of the same functionality, that it does to those that prefer the OOP approach, through virtually the same interface. Some other examples include the Mail::Box module for all things mail oriented, it is extremely extensive and uses Perl's OOP tactics to the fullest. POE, Crypt::OpenPGP, DBI, and then the obvious examples of things like Class::MethodMaker that handle building much of the OOP interface for you (isn't Perl grand!). I think it is dangerous to think of OOP and using the exporter as mutually exclusive however... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ISP won't install Perl modules
I thought CPAN inherited the PERL5LIB as it's install location. If this is not the case on of the configuration parameters given to CPAN is something like Additional options for Makefile which you can set to include a directive such as PREFIX=/path/to/lib/dir that will then get passed to the make command so that the module will be installed in the proper location. At the cpan prompt you can type h for list of commands, then you want 'o conf' and then set the 'makepl_arg' as described above. http://danconia.org Octavian Rasnita wrote: But wouldn't this command try to install that module in the default location? How can I specify the right path where I want to install the module? Will the CPAN module ask me this each time? Thank you. Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: Beginners-CGI List [EMAIL PROTECTED] Sent: Friday, January 17, 2003 4:52 PM Subject: RE: ISP won't install Perl modules On Fri, 17 Jan 2003 15:18:42 +0100, Rene Verharen [EMAIL PROTECTED] wrote: Hi all, My ISP won't install some Perl modules I want to use (Email::Valid and Mail::Address). Is there a way to install these modules in some directory I have access to so I'll be able to use them ? You didn't state whether you can login at a terminal prompt, so I will assume so, but this isn't necessary either. At a terminal you should be able to set PERL5LIB environment variable in your shell to point to whatever directory you wish the modules to live under, for instance HOME/lib where HOME is your home directory, then just run perl -MCPAN -e shell and install as normal. Then in your scripts you will have to add a 'use lib' line, similar to: use lib '/HOME/lib'; Before you 'use' any of the modules in that directory. This is the easiest way, if you must install by hand then you will most likely need to pass a PREFIX=/path/to/lib/dir directive to perl Makefile.pl, and if you don't have a terminal, then you should be able to install a local version where you are doing your development and then just recursively upload the directory, but this is dangerous as you must make sure the two environments match before installing. HTH, http://danconia.org -- 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]
ISP won't install Perl modules
Hi all, My ISP won't install some Perl modules I want to use (Email::Valid and Mail::Address). Is there a way to install these modules in some directory I have access to so I'll be able to use them ? Kind regards, Rene Verharen Please DO NOT reply to me personally. I'll get my copy from the list. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ISP won't install Perl modules
Rene, If it is a pure perl module (I believe Email::Valid is), you can put it in one of your directories and push/unshift it into @INC. In some cases you may have to do that push or unshift inside a BEGIN so that the interpreter sees that action before reading @INC. Another option is to find a web host that willingly installs modules for you. I'm working with one now that is great about this. If you'd like more info, e-mail me offline from the list. Thanks! - Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] -Original Message- From: Rene Verharen [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 8:19 AM To: Beginners-CGI List Subject: ISP won't install Perl modules Hi all, My ISP won't install some Perl modules I want to use (Email::Valid and Mail::Address). Is there a way to install these modules in some directory I have access to so I'll be able to use them ? Kind regards, Rene Verharen Please DO NOT reply to me personally. I'll get my copy from the list. -- 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: ISP won't install Perl modules
Similar (If it is a pure perl module) - If you are using cgi-bin as is typical, you can place the module into your cgi-bin path.../cgi-bin/Email and refer to as usual in your perl script, i.e. use Email::Valid; (This can clutter up cgi-bin..., but it worked for me.) Scot Robnett wrote: Rene, If it is a pure perl module (I believe Email::Valid is), you can put it in one of your directories and push/unshift it into @INC. In some cases you may have to do that push or unshift inside a BEGIN so that the interpreter sees that action before reading @INC. Another option is to find a web host that willingly installs modules for you. I'm working with one now that is great about this. If you'd like more info, e-mail me offline from the list. Thanks! - Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] -Original Message- From: Rene Verharen [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 8:19 AM To: Beginners-CGI List Subject: ISP won't install Perl modules Hi all, My ISP won't install some Perl modules I want to use (Email::Valid and Mail::Address). Is there a way to install these modules in some directory I have access to so I'll be able to use them ? Kind regards, Rene Verharen Please DO NOT reply to me personally. I'll get my copy from the list. -- 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]
Solved: ISP won't install Perl modules
Hi all, At 17-01-2003 15:18 +0100, I wrote: My ISP won't install some Perl modules I want to use (Email::Valid and Mail::Address). Is there a way to install these modules in some directory I have access to so I'll be able to use them ? I installed the modules in a different dir and solved the problem this way : push(@INC, /path/to/my/modules); Thanks for your response. Kind regards, Rene Verharen Please DO NOT reply to me personally. I'll get my copy from the list. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
listing modules installed with CPAN
Hello- How can I tell what modules I've installed using CPAN? When I type in 'b' or 'd' or 'm' I seem to get everything, I only want to know what modules / bundles I've installed using CPAN. Thanks in advance, Justin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: listing modules installed with CPAN
On 17 Oct 2002 at 14:15, Justin Cook wrote: How can I tell what modules I've installed using CPAN? When I type in 'b' or 'd' or 'm' I seem to get everything, I only want to know what modules / bundles I've installed using CPAN. Read the section about autobundle in `perldoc CPAN`. William -- Lead Developer Knowmad Services Inc. || Internet Applications Database Integration http://www.knowmad.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
libwww-perl and URI modules for 5.005_02
Hello, I am working on a Solaris platform using version 5.005_02. Could someone point me to libwww-perl and URI modules that would work with 5.005_02? I searched through www.cpan.org and the earliest versions that I found are: libwww-perl-5.10.tar.gz URI-1.18.tar.gz After installing these modules, I tried to run my program and got the error: Missing base argument at .../lib/site_perl/5.005/HTTP/Request.pm line 102 I also searched the following sites which were listed under CPAN's FAQ for Where can I find older/obsolete versions of Perl or Perl Modules?: (http://www.cpan.org/misc/cpan-faq.html#Where_older_Perl) http://www.etla.org/retroperl/ - only has perl1 to perl4 http://mirrors.valueclick.com/perl/really-ancient-perls/ - only has perl1 to perl5.003_08 http://history.perl.org/src/ - only has perl1 to perl4 http://mirrors.valueclick.com/perl/backup.pause/ - for old versions of modules - contains the following links: GAAS - libwww-perl-5.00.readme- libwww-perl-5.00.tar.gz- libwww-perl-5.01.readme- libwww-perl-5.01.tar.gz- libwww-perl-5.02.readme- libwww-perl-5.02.tar.gz- libwww-perl-5.03.readme- libwww-perl-5.03.tar.gz- libwww-perl-5b6.tar.gz - but following these links all resulted in HTTP 404 - File not found It seems that upgrading from 5.005_02 to 5.6.1 is inevitable, but this process would require additional time and resources to recertify all of our existing programs on 5.6.1. Thanks, -Victor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: libwww-perl and URI modules for 5.005_02
At 06:42 PM 7/10/02 -0700, H. Victor Lim wrote: Hello, I am working on a Solaris platform using version 5.005_02. Could someone point me to libwww-perl and URI modules that would work with 5.005_02? I searched through www.cpan.org and the earliest versions that I found are: libwww-perl-5.10.tar.gz URI-1.18.tar.gz After installing these modules, I tried to run my program and got the error: Missing base argument at .../lib/site_perl/5.005/HTTP/Request.pm line 102 I also searched the following sites which were listed under CPAN's FAQ for Where can I find older/obsolete versions of Perl or Perl Modules?: (http://www.cpan.org/misc/cpan-faq.html#Where_older_Perl) http://mirrors.valueclick.com/perl/backup.pause/ - for old versions of modules - contains the following links: GAAS - libwww-perl-5.00.readme- libwww-perl-5.00.tar.gz- libwww-perl-5.01.readme- libwww-perl-5.01.tar.gz- libwww-perl-5.02.readme- libwww-perl-5.02.tar.gz- libwww-perl-5.03.readme- libwww-perl-5.03.tar.gz- libwww-perl-5b6.tar.gz - but following these links all resulted in HTTP 404 - File not found I had no trouble with navigating from the above link to downloading http://mirrors.valueclick.com/perl/backup.pause/authors/id/G/GA/GAAS/libwww-perl-5.00.tar.gz. It seems that upgrading from 5.005_02 to 5.6.1 is inevitable, but this process would require additional time and resources to recertify all of our existing programs on 5.6.1. No, it's not supposed to be that difficult and I don't believe it is. I just tested the latest HTTP::Request and URI against Perl 5.004_04 and it had no compilation problem. The error you cite is a run-time error that is not indicative of using too old a perl. Recommendation: use the *latest* libwww and URI. (Get Bundle::LWP.) You haven't shown your program here so we can't tell how the error might lie there, but here's a hint: if the GET program supplied with libwww works, the problem is in your code. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running Modules
Hi, Don't forget to close the FH : close(DEMO_LOG); Regs David - Greetings All, I have the following code, from which I attempt to call the module Test #!/usr/local/bin/perl ### ### Program name: demo.pl ### Created By:Theresa Mullin require cgi.lib; ### Include the CGI stuff use CGI qw(:standard); ### Include the database access stuff use DBI; ### Push location of user created packages onto @INC array push(@INC,/home/tmullin/perl/libs); use Test; ### Force no buffering for output $| = 1; ### Parse the arguments sent in from the browser ReadParse(); ### Open log file open DEMO_LOG, /home/tmullin/demo_log||die unable to open log file; print DEMO_LOG Begin processing...\n; print DEMO_LOG array INC: @INC\n; print DEMO_LOG Database selected is: $dbase\n; Here is module Test: #!/usr/bin/perl ### Program Name: Test.pm ### Created By:Theresa Mullin ### Date: 5/20/02 package Test; $dbase = TEST; print And to all a good night \n; The code appears to execute, and no error messages are generated. However, the value of $dbase is never written to the log file. Any advice you can give would be helpful. Thanks, T. Theresa M. Mullin Programmer/Analyst Administrative Computing Northern Essex Community College 100 Elliott Way Haverhill, MA 01830 (978) 556-3757 [EMAIL PROTECTED] --=_NextPart_000_0003_01C21B8B.A3BFB810-- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Running Modules
Greetings All, I have the following code, from which I attempt to call the module Test #!/usr/local/bin/perl ### ### Program name: demo.pl ### Created By:Theresa Mullin require cgi.lib; ### Include the CGI stuff use CGI qw(:standard); ### Include the database access stuff use DBI; ### Push location of user created packages onto @INC array push(@INC,/home/tmullin/perl/libs); use Test; ### Force no buffering for output $| = 1; ### Parse the arguments sent in from the browser ReadParse(); ### Open log file open DEMO_LOG, /home/tmullin/demo_log||die unable to open log file; print DEMO_LOG Begin processing...\n; print DEMO_LOG array INC: @INC\n; print DEMO_LOG Database selected is: $dbase\n; Here is module Test: #!/usr/bin/perl ### Program Name: Test.pm ### Created By:Theresa Mullin ### Date: 5/20/02 package Test; $dbase = TEST; print And to all a good night \n; The code appears to execute, and no error messages are generated. However, the value of $dbase is never written to the log file. Any advice you can give would be helpful. Thanks, T. Theresa M. Mullin Programmer/Analyst Administrative Computing Northern Essex Community College 100 Elliott Way Haverhill, MA 01830 (978) 556-3757 [EMAIL PROTECTED]
Re: Running Modules
On Monday, June 24, 2002, at 01:09 , drieux wrote: [..] use Test; [..] there is also a 'name space' clash here Test.pm already exists as a real module in most of the perl releases. cf: perldoc -m Test So you may want to get into h2xs a little sooner - so that you can feel safe about doing things like h2xs -AX tmullin::Foo which will get you a safe name space to work on the stuff you wish to spin up. ciao drieux http://www.wetware.com/drieux/pbl/ -- This space left intentionally blank. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Running Modules
-Original Message- From: Theresa Mullin [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 2:30 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Running Modules Greetings All, I have the following code, from which I attempt to call the module Test #!/usr/local/bin/perl ### ### Program name: demo.pl ### Created By:Theresa Mullin require cgi.lib; ### Include the CGI stuff use CGI qw(:standard); ### Include the database access stuff use DBI; ### Push location of user created packages onto @INC array push(@INC,/home/tmullin/perl/libs); use Test; ### Force no buffering for output $| = 1; ### Parse the arguments sent in from the browser ReadParse(); ### Open log file open DEMO_LOG, /home/tmullin/demo_log||die unable to open log file; print DEMO_LOG Begin processing...\n; print DEMO_LOG array INC: @INC\n; print DEMO_LOG Database selected is: $dbase\n; I assume you want $dbase to have the value set below, right? ...Here is module Test: #!/usr/bin/perl Don't need this. The shell will never run Test.pm ### Program Name: Test.pm ### Created By:Theresa Mullin ### Date: 5/20/02 package Test; Add a use strict here. $dbase = TEST; Since I told you to add use strict, you need: our $dbase = TEST; print And to all a good night \n; Modules need to end with a true value, so it's customary to have this as the last line, which is always a true value: 1; The code appears to execute, and no error messages are generated. However, the value of $dbase is never written to the log file. Any advice you can give would be helpful. The reason is that in Test.pm, you set the value of $Test::dbase, while in your main program you access the value of $main::dbase. So, you have two options: 1. Refer to the variable as $Test::dbase in your main program, or 2. Export $dbase to your main package. Perl has a simple mechanism that allows modules like Test.pm to export symbols into the calling namespace, such that when you access $dbase, you actually are getting the value of $Test::dbase. To do this, you would add the following lines to Test.pm, typically right after the package Test line: require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw($dbase); Now when you use Test in your main program, the $dbase symbol will be automatically exported to your namespace and everything will Just Work. n.b. if you are creating a module for use by others, it is now considered impolite to unilaterally export symbols like this. The preferred method is to use the @EXPORT_OK array instead of @EXPORT: our @EXPORT_OK = qw($dbase); Now, the symbol will only be exported if explicitly requested on the use line: (in main program) use Test qw($dbase); All the poop on this is in: perldoc Exporter HTH P.S. why use both cgi-lib.pl and CGI? The former is deprecated and the latter should be used exclusively... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session modules to use
Hi, I was thinking to use session for my application. But there are so many options of the modules in CPAN. Apache::session and PHP::Session are ones of the options. As i programmed in PHP before, i'm quite interested in using PHP::Session as it's simple and easy. I would like to know the positive and negative from both modules or maybe there are other better modules than this ? maybe this would be useful, i'm using apache without mod_perl (gog to) in win2k. niko -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sort of Conceptual, Syntax, and modules related questions
1. It will only read the first line. The time you want to be careful with is when you are assigning it to a list. For example, @myarray = INFILE; will assign the entire contents of the file, while $myscalar = INFILE; will assign only the first line. 2. In Windows, the endline character is interpreted as two characters, \n \r. This should not be an issue when dealing with binary files, since by definition you should not be dealing with them on a line by line basis (unless I'm forgetting something obvious). 3. This is a scoping issue. First, I'll write it out so it's easier to read. #version 1 sub any { for (@data) { my ($a, $b) = split (/=/, $_); } # $a and $b don't exist here anymore return 1; } #version 2 sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split(/=/, $_); } # $a and $b still exist return 1; } 4. It shouldn't matter as far as I know. 5. I don't think you can, but I might be wrong. Usually There's More Than One Way To Do It. 6. I'm not sure what you're getting at. If you don't want to use something, just don't include it in your script, for the most part. Perhaps what you're asking is how to delay useing something until you really need it? 7. # # s///e treats the right hand side as code to be evaluated first. $year = It is .; $numYear = 2002; $year =~ s//sprintf(%04d,$numYear)/e; #$year is now It is 2002.; or $year =! s//sprintf(%04d,$numYear)/; #$year is now It is sprintf(%04d,$numYear). # # s///g replaces all instances of the match $sentence = One must always watch what one says in public.; $sentence =~ s/one/two/gi; #$sentence is now two must always watch what two says in public. or $sentence =~ s/one/two/i; #$sentence is now two must always watch what one says in public. 8. Not sure on this one. 9. Check CPAN http://search.cpan.org Whew! Good questions. I hope this puts you on the right track to a whole new mess of questions! :) -Original Message- From: Connie Chan To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 3/22/02 1:30 PM Subject: Sort of Conceptual, Syntax, and modules related questions Dear All, I have sort of questions, would you please give me some hint, even refering me to a perldoc would be nice too. 1. When I open a text file with *lines, however, I just want to read the first line, would this be a good idea ? open (FILE, textfile.txt); $firstline = FILE; close (FILE); would this process run till EOF, or terminated after read $firstline ? 2. I am using Win32 system , would you tell when is \n apprear and when is \r\n apprear ? What about this when dealing with binary files ? 3. Is this different for this 2 scripts ? version 1 : sub any { for (@data) { my ($a, $b) = split (/=/, $_) } return 1 } version 2 : sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split (/=/, $_) } return 1 } 4. Is that reading binary data faster then reading text file ? 5. How can I write multiple line if remark like /* and */ pairs, instead of using # at every line ? 6. Is that any syntax for local call about 'use' and 'require', so as something like 'not require', 'not use' expressions ? 7. Would you give me some short examples for //e, and //g ? I am confused for their usuage. 8. Any modules can help to check connecting threats for a certain page ? or if I run $alive = `ping $ip` a good idea ? 9. Any modules can help to read and write the ID3vX for mp3 files ? Any ideas and respond will be very very helpful. Really urgent for a project design and development. Thank you very much =) Connie This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sort of Conceptual, Syntax, and modules related questions
Oops! The exclamation point in number 7 was a typo. -Original Message- From: Timothy Johnson To: 'Connie Chan '; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 3/22/02 1:59 PM Subject: RE: Sort of Conceptual, Syntax, and modules related questions 1. It will only read the first line. The time you want to be careful with is when you are assigning it to a list. For example, @myarray = INFILE; will assign the entire contents of the file, while $myscalar = INFILE; will assign only the first line. 2. In Windows, the endline character is interpreted as two characters, \n \r. This should not be an issue when dealing with binary files, since by definition you should not be dealing with them on a line by line basis (unless I'm forgetting something obvious). 3. This is a scoping issue. First, I'll write it out so it's easier to read. #version 1 sub any { for (@data) { my ($a, $b) = split (/=/, $_); } # $a and $b don't exist here anymore return 1; } #version 2 sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split(/=/, $_); } # $a and $b still exist return 1; } 4. It shouldn't matter as far as I know. 5. I don't think you can, but I might be wrong. Usually There's More Than One Way To Do It. 6. I'm not sure what you're getting at. If you don't want to use something, just don't include it in your script, for the most part. Perhaps what you're asking is how to delay useing something until you really need it? 7. # # s///e treats the right hand side as code to be evaluated first. $year = It is .; $numYear = 2002; $year =~ s//sprintf(%04d,$numYear)/e; #$year is now It is 2002.; or $year =! s//sprintf(%04d,$numYear)/; #$year is now It is sprintf(%04d,$numYear). # # s///g replaces all instances of the match $sentence = One must always watch what one says in public.; $sentence =~ s/one/two/gi; #$sentence is now two must always watch what two says in public. or $sentence =~ s/one/two/i; #$sentence is now two must always watch what one says in public. 8. Not sure on this one. 9. Check CPAN http://search.cpan.org Whew! Good questions. I hope this puts you on the right track to a whole new mess of questions! :) -Original Message- From: Connie Chan To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 3/22/02 1:30 PM Subject: Sort of Conceptual, Syntax, and modules related questions Dear All, I have sort of questions, would you please give me some hint, even refering me to a perldoc would be nice too. 1. When I open a text file with *lines, however, I just want to read the first line, would this be a good idea ? open (FILE, textfile.txt); $firstline = FILE; close (FILE); would this process run till EOF, or terminated after read $firstline ? 2. I am using Win32 system , would you tell when is \n apprear and when is \r\n apprear ? What about this when dealing with binary files ? 3. Is this different for this 2 scripts ? version 1 : sub any { for (@data) { my ($a, $b) = split (/=/, $_) } return 1 } version 2 : sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split (/=/, $_) } return 1 } 4. Is that reading binary data faster then reading text file ? 5. How can I write multiple line if remark like /* and */ pairs, instead of using # at every line ? 6. Is that any syntax for local call about 'use' and 'require', so as something like 'not require', 'not use' expressions ? 7. Would you give me some short examples for //e, and //g ? I am confused for their usuage. 8. Any modules can help to check connecting threats for a certain page ? or if I run $alive = `ping $ip` a good idea ? 9. Any modules can help to read and write the ID3vX for mp3 files ? Any ideas and respond will be very very helpful. Really urgent for a project design and development. Thank you very much =) Connie This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sort of Conceptual, Syntax, and modules related questions
Dear All, I have sort of questions, would you please give me some hint, even refering me to a perldoc would be nice too. 1. When I open a text file with *lines, however, I just want to read the first line, would this be a good idea ? open (FILE, textfile.txt); $firstline = FILE; close (FILE); would this process run till EOF, or terminated after read $firstline ? 2. I am using Win32 system , would you tell when is \n apprear and when is \r\n apprear ? What about this when dealing with binary files ? 3. Is this different for this 2 scripts ? version 1 : sub any { for (@data) { my ($a, $b) = split (/=/, $_) } return 1 } version 2 : sub any { my $a, $b ; for (@data) { ($a, $b, $c) = split (/=/, $_) } return 1 } 4. Is that reading binary data faster then reading text file ? 5. How can I write multiple line if remark like /* and */ pairs, instead of using # at every line ? 6. Is that any syntax for local call about 'use' and 'require', so as something like 'not require', 'not use' expressions ? 7. Would you give me some short examples for //e, and //g ? I am confused for their usuage. 8. Any modules can help to check connecting threats for a certain page ? or if I run $alive = `ping $ip` a good idea ? 9. Any modules can help to read and write the ID3vX for mp3 files ? Any ideas and respond will be very very helpful. Really urgent for a project design and development. Thank you very much =) Connie
Missing modules
Hi from stanbul, Anyone knows a free server that i can test my perl scripts? I've already find some but the modules that i need aren't installed. I prefer the one that all the perl modules are installed if it exists:) thanx Derya
Get stuck when using modules
Hi all, I am using Windows 98 and active perl , and now I have 2 problems here : Q1) I am trying to use CGI module to output a GIF, but I found that it is fail . However, my purpose is to output multiple GIFs, just something looks like a counter. Would anybody have suggestion for a better module or have some live example can give me ? Thank you very much. Q2) Is there any module is suitable for read modify Excel file ? I have try the Spreadsheet module, but its not quite what I want Any other suggestion ??
Re: Perl modules on web host server
On Sat, 8 Dec 2001, Hoenie Luk wrote: Hi, I'm new to cgi-programming with Perl and I've been looking for answers for the following questions: 1. How do you find out if the web host supports certain Perl modules? 2. If the web host does not have certain modules installed and I need to use them for my Perl cgi-script, what can I do? I'm guessing you're talking about your ISP as your web host, if so, the only way I know how to do it is to actually put the use statement in an cgi script and see if it works. Like: test.pl #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use ?::Module; print header, start_html(test), h1(Add test.); - Where ?::Module is the one you need. Bit of a long way to go, but the server will let you know if the module you need isn't installed. If it's not, what you could do is: 1. Download and install the module on your home machine 2. Copy all the subroutines from the module (or just the subroutines you actually need into your cgi script. Again, a long way to go, but it worked for me. You could use: perldoc -m ?::Module test.cgi Substitute your own headers, and put your code after the subroutines, delteing everything else. Should work the same the same as using the module. In my case it worked fine with Sort::Fields good luck, Jack Daly -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perl modules on web host server
-Original Message- From: Hoenie Luk [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 09, 2001 2:52 AM To: [EMAIL PROTECTED] Subject: Perl modules on web host server Hi, I'm new to cgi-programming with Perl and I've been looking for answers for the following questions: 1. How do you find out if the web host supports certain Perl modules? perldoc ExtUtils::Installed 2. If the web host does not have certain modules installed and I need to use them for my Perl cgi-script, what can I do? If you have a shell account, you can install modules under your home directory and reference them from your scripts. perldoc -q 'How do I keep my own module/library directory?' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perl modules on web host server
hi dear. you use to install redhat linux in one server.. in it exist many perl madule ... I think with this your problem will solve. Best regards. Nafiseh Saberi www.iraninfocenter.net www.sorna.net Beaty is in the eye of the beholder. _ - Original Message - From: Hoenie Luk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 09, 2001 11:22 AM Subject: Perl modules on web host server Hi, I'm new to cgi-programming with Perl and I've been looking for answers for the following questions: 1. How do you find out if the web host supports certain Perl modules? 2. If the web host does not have certain modules installed and I need to use them for my Perl cgi-script, what can I do? Hoenie -- 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: Perl modules on web host server
test ..! --- nafiseh saberi [EMAIL PROTECTED] wrote: hi dear. you use to install redhat linux in one server.. in it exist many perl madule ... I think with this your problem will solve. Best regards. Nafiseh Saberi www.iraninfocenter.net www.sorna.net Beaty is in the eye of the beholder. _ - Original Message - From: Hoenie Luk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 09, 2001 11:22 AM Subject: Perl modules on web host server Hi, I'm new to cgi-programming with Perl and I've been looking for answers for the following questions: 1. How do you find out if the web host supports certain Perl modules? 2. If the web host does not have certain modules installed and I need to use them for my Perl cgi-script, what can I do? Hoenie -- 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] = # _ Francisco Valladolid Hernandez #!/usr/bin/perl -w print Unix, Hardware, Web, Perl, Comics ..; print Taking initiative ..!; #= __ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perl modules on web host server
Hi, I'm new to cgi-programming with Perl and I've been looking for answers for the following questions: 1. How do you find out if the web host supports certain Perl modules? 2. If the web host does not have certain modules installed and I need to use them for my Perl cgi-script, what can I do? Hoenie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using custom modules
On Friday 07 December 2001 12:49, fliptop wrote: Gerry Jones wrote: I want to use a module I have created and stored in cgi-bin directory. It holds a few commonly used functions. I remember having done this before, but can't remember how I got it to work, and my error log says the module did not return a true value. Somebody please save me from wading through all the documentation. make sure your module returns a true value. for example: package Foo; use strict; use SomeOtherModule; sub bar { ...some code here... } sub baz { ...more code... } 1;# all modules should return true __END__ sound of hand smacking forhead Thanks ;-) Gerry. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
where to get modules? and any gui for win32?
Hi people, Where do I get some of these cool modules like www, DBI... etc? and is there a module to write gui programs using perl in win32 environmrnt? (WINNT or 2k) Thanks! Eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where to get modules? and any gui for win32?
Where do I get some of these cool modules like www, DBI... etc? www.cpan.org is the definitive repository. Many assume the availability of a C compiler and proper development tools like make or nmake. On Win32, you can use VC++, or the CygWin environment, which gives you a lot of GNU tools. ActiveState also has a repository for pre-built modules (PPMs) that you can install, but it is not comprehensive like CPAN is. and is there a module to write gui programs using perl in win32 environmrnt? (WINNT or 2k) The Tk module works very well under Windows, and best of all, you can move the code to another platform (Mac, Linux, Solaris) and run it with little or no modification. -- Brett http://www.chapelperilous.net/ Humor in the Court: Q: Now, you have investigated other murders, have you not, where there was a victim? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where to get modules? and any gui for win32?
You know where I can get nmake? I used to have it and it works great! but I just lost my HD on my labtop (w/o backup) and I forgot where I got it from. Thanks! Eric On Wed, 10 Oct 2001, Brett W. McCoy wrote: Where do I get some of these cool modules like www, DBI... etc? www.cpan.org is the definitive repository. Many assume the availability of a C compiler and proper development tools like make or nmake. On Win32, you can use VC++, or the CygWin environment, which gives you a lot of GNU tools. ActiveState also has a repository for pre-built modules (PPMs) that you can install, but it is not comprehensive like CPAN is. and is there a module to write gui programs using perl in win32 environmrnt? (WINNT or 2k) The Tk module works very well under Windows, and best of all, you can move the code to another platform (Mac, Linux, Solaris) and run it with little or no modification. -- Brett http://www.chapelperilous.net/ Humor in the Court: Q: Now, you have investigated other murders, have you not, where there was a victim? -- 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: where to get modules? and any gui for win32?
http://www.bell-labs.com/project/nmake/ -James -Original Message- From: Eric Wang [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 10, 2001 2:47 PM To: Brett W. McCoy Cc: [EMAIL PROTECTED] Subject: Re: where to get modules? and any gui for win32? You know where I can get nmake? I used to have it and it works great! but I just lost my HD on my labtop (w/o backup) and I forgot where I got it from. Thanks! Eric On Wed, 10 Oct 2001, Brett W. McCoy wrote: Where do I get some of these cool modules like www, DBI... etc? www.cpan.org is the definitive repository. Many assume the availability of a C compiler and proper development tools like make or nmake. On Win32, you can use VC++, or the CygWin environment, which gives you a lot of GNU tools. ActiveState also has a repository for pre-built modules (PPMs) that you can install, but it is not comprehensive like CPAN is. and is there a module to write gui programs using perl in win32 environmrnt? (WINNT or 2k) The Tk module works very well under Windows, and best of all, you can move the code to another platform (Mac, Linux, Solaris) and run it with little or no modification. -- Brett http://www.chapelperilous.net/ Humor in the Court: Q: Now, you have investigated other murders, have you not, where there was a victim? -- 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: where to get modules? and any gui for win32?
that version only has no nmake for winnt systems. Thanks for the help thou eric On Wed, 10 Oct 2001, James Kelty wrote: http://www.bell-labs.com/project/nmake/ -James -Original Message- From: Eric Wang [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 10, 2001 2:47 PM To: Brett W. McCoy Cc: [EMAIL PROTECTED] Subject: Re: where to get modules? and any gui for win32? You know where I can get nmake? I used to have it and it works great! but I just lost my HD on my labtop (w/o backup) and I forgot where I got it from. Thanks! Eric On Wed, 10 Oct 2001, Brett W. McCoy wrote: Where do I get some of these cool modules like www, DBI... etc? www.cpan.org is the definitive repository. Many assume the availability of a C compiler and proper development tools like make or nmake. On Win32, you can use VC++, or the CygWin environment, which gives you a lot of GNU tools. ActiveState also has a repository for pre-built modules (PPMs) that you can install, but it is not comprehensive like CPAN is. and is there a module to write gui programs using perl in win32 environmrnt? (WINNT or 2k) The Tk module works very well under Windows, and best of all, you can move the code to another platform (Mac, Linux, Solaris) and run it with little or no modification. -- Brett http://www.chapelperilous.net/ Humor in the Court: Q: Now, you have investigated other murders, have you not, where there was a victim? -- 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: where to get modules? and any gui for win32?
Ok, then try here next. ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe Or you could just to: www.google.com www.dogpile.com www.metacrawler.com even www.yahoo.com -James -Original Message- From: Eric Wang [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 10, 2001 3:38 PM To: James Kelty Cc: Brett W. McCoy; [EMAIL PROTECTED] Subject: RE: where to get modules? and any gui for win32? that version only has no nmake for winnt systems. Thanks for the help thou eric On Wed, 10 Oct 2001, James Kelty wrote: http://www.bell-labs.com/project/nmake/ -James -Original Message- From: Eric Wang [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 10, 2001 2:47 PM To: Brett W. McCoy Cc: [EMAIL PROTECTED] Subject: Re: where to get modules? and any gui for win32? You know where I can get nmake? I used to have it and it works great! but I just lost my HD on my labtop (w/o backup) and I forgot where I got it from. Thanks! Eric On Wed, 10 Oct 2001, Brett W. McCoy wrote: Where do I get some of these cool modules like www, DBI... etc? www.cpan.org is the definitive repository. Many assume the availability of a C compiler and proper development tools like make or nmake. On Win32, you can use VC++, or the CygWin environment, which gives you a lot of GNU tools. ActiveState also has a repository for pre-built modules (PPMs) that you can install, but it is not comprehensive like CPAN is. and is there a module to write gui programs using perl in win32 environmrnt? (WINNT or 2k) The Tk module works very well under Windows, and best of all, you can move the code to another platform (Mac, Linux, Solaris) and run it with little or no modification. -- Brett http://www.chapelperilous.net/ Humor in the Court: Q: Now, you have investigated other murders, have you not, where there was a victim? -- 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: use of modules with authorize.net
Susanne wrote: does anyone have sample code that would educate me on credit card processing with authorize.net? tia. try this module from cpan: http://search.cpan.org/search?dist=Business-OnlinePayment-AuthorizeNet
use of modules with authorize.net
does anyone have sample code that would educate me on credit card processing with authorize.net? tia.
RE: using modules installed in local CGI bin
Al Hospers wrote: : I changed the setup to : : #!/usr/local/bin/perl : use CGI qw(:all); : use lib ./libnet; : use Net::FTP; : print header; : ... : now I get this error : : BEGIN failed--compilation aborted at weather_ftp.cgi line 4. I presume this is from the server's error_log. Is that the complete error, or is there something before it? Do you get the same error when you run it from the command line? If not, then it may be a permissions problem: CGI scripts run as someone else, usually nobody, and it may not have read pemission on the module. -- tdk
RE: using modules installed in local CGI bin
if ($#path 0) @paths=split /:/, $ENV{$key}; Should be if ($#path 0) { @paths=split /:/, $ENV{$key}; } Your content type should be (space after the colon) print Content-Type: text/html\n\n; --- Al Hospers [EMAIL PROTECTED] wrote: is this correct? #!/usr/local/bin/perl print Content-Type:text/html\n\n; print EndOfHTML; htmlheadtitlePrint Environment/title/head body EndOfHTML print I am at . `pwd` . br\n; foreach $key (sort(keys %ENV)) { if ($key eq 'PATH') { @paths=split /:/, $ENV{$key}; if ($#path 0) @paths=split /:/, $ENV{$key}; if ($#path 0) { print $key = $ENV{$key}br\n; } else { print PATHS are:brcenter\n; foreach $path (@paths) { print $pathbr; } print /center; } } else { print $key = $ENV{$key}br\n; } } print 'pbINC follows:/bp'; foreach $b (@INC) { print '$INC[' . $i++ . ]= $bbr\n; } print /body/html; exit; I am getting the following command line error: Array found where operator expected at env.cgi line 13, at end of line (Missing operator before ?) syntax error at env.cgi line 13, near ) @paths syntax error at env.cgi line 28, near else Execution of env.cgi aborted due to compilation errors. thanks, Al = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
RE: using modules installed in local CGI bin
Sorry Al, the script should be ... jwm print Content-Type:text/html\n\n; # w/o space works OK on my server :) print EndOfHTML; htmlheadtitlePrint Environment/title/head body EndOfHTML print 'I am at ' . `pwd` . br\n; print \$CGI_HOME = $CGI_HOMEp; foreach $key (sort(keys %ENV)) { if ($key eq PATH) { @paths=split /:/, $ENV{$key}; if ($#path 0) { print $key = $ENV{$key}br\n; } else { print PATHS are:brcenter\n; foreach $path (@paths) { print $pathbr; } print '/center'; } } else { print $key = $ENV{$key}br\n; } } print 'pbINC follows:/bp'; foreach $b (@INC) { print '$INC[' . $i++ . ]= $bbr\n; print '/body/html'; -Original Message- From: Al Hospers [mailto:[EMAIL PROTECTED]] Sent: June 08, 2001 16:05 To: [EMAIL PROTECTED] Subject: RE: using modules installed in local CGI bin Oops ... too much paste ... sorry John. does not compute? grin Al
RE: using modules installed in local CGI bin
tdk wrote: snip Did you just copy the FTP.pm file into this area, or did you actually do the install? i.e., something like perl Makefile.PL prefix=/myinstall/directory make make test make install snip I just deleted the entire libnet folder started over. so, first I did: perl Makefile.PL prefix=/libnet it seemed to work. the installer asked me a number of questions about hosts etc. for testing, to which I said no to all as I didn't want it to test my hosts. I will worry about if the names are OK in my script. at the end it said: Writing libnet.cfg Writing Makefile for Net so then I said: make and I got the following error on the command line: make: Warning: Can't find `make.rules': No such file or directory mkdir ./blib mkdir ./blib/lib make: Fatal error: wait() failed: Interrupted system call sigh Al
RE: using modules installed in local CGI bin
the script should be ... thanks John. OK got it working. so what am I looking for? here is some of the info: PATHS are: /bin /usr/vde/bin /usr/local/bin /usr/gnu/bin /usr/ucb /usr/css/bin /usr/local/cvbin SNIP $INC[1]= /usr/local/pkg/perl5/libbr $INC[2]= /usr/local/pkg/perl5/lib/site_perl/sun4-solarisbr $INC[3]= /usr/local/pkg/perl5/lib/site_perlbr $INC[4]= .br