Re: subroutine in seperate file, question
On Aug 10, 2012 11:41 PM, wrote: > > > I mean to ask, wether they will clash with the same loaded modules loaded > > in calling script? > > > > No. they are loaded only once. > Well, they will both be in ISA to look up separately but there is no conflict.
Re: subroutine in seperate file, question
> I mean to ask, wether they will clash with the same loaded modules loaded > in calling script? > No. they are loaded only once. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: subroutine in seperate file, question
I mean to ask, wether they will clash with the same loaded modules loaded in calling script? From: "pa...@riseup.net" To: Rajeev Prasad Cc: perl list Sent: Friday, August 10, 2012 9:05 PM Subject: Re: subroutine in seperate file, question Yes, the modules in required file will be loaded. $ cat ext.pl use CGI; use DBI; 1; $ cat main.pl require 'ext.pl'; use Data::Dumper; print Dumper \%INC; Thus run perl main.pl to see what prints. > i want to keep a peice of code which uses CGI and DBIx module in a > seperate file, and want to include it in all my scripts as follows: > > require "/path/to/script/file"; > > I am not sure if the calling program is also using same modules CGI and > DBIx what kind of unknown errors i might get? anyone know?
Re: subroutine in seperate file, question
Yes, the modules in required file will be loaded. $ cat ext.pl use CGI; use DBI; 1; $ cat main.pl require 'ext.pl'; use Data::Dumper; print Dumper \%INC; Thus run perl main.pl to see what prints. > i want to keep a peice of code which uses CGI and DBIx module in a > seperate file, and want to include it in all my scripts as follows: > > require "/path/to/script/file"; > > I am not sure if the calling program is also using same modules CGI and > DBIx what kind of unknown errors i might get? anyone know? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
subroutine in seperate file, question
i want to keep a peice of code which uses CGI and DBIx module in a seperate file, and want to include it in all my scripts as follows: require "/path/to/script/file"; I am not sure if the calling program is also using same modules CGI and DBIx what kind of unknown errors i might get? anyone know? ty. Rajeev
Re: Forking question
On 08/10/12 02:10, G M wrote: I'm working on a forking process and I need a way to check if any of the processes have failed and if they have restart them. Can anyone point me in the right direction to a tutorial or explanation of how to do this? "Network Programming with Perl" by Lincoln D. Stein covers forking (and threading): http://www.pearsonhighered.com/educator/product/Network-Programming-with-Perl/9780201615715.page David -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Raspberry Pi: Beginners Web App Example
I've brought up the "Raspberry Pi" project here a couple times already and finally got my "RPi" a week ago. I've also mentioned I use a simple MVC sort of framework to create small web based apps. So, I've been working on an example web based app that demonstrates pretty much how I've been doing things lately, it's a simple note pad app for beginners to play with. I put the app and code on my Linux web server here: http://www.raspberryperl.com My goal is to give beginners some code that's configured to run on the raspberry pi and simple enough to understand that they can start twiddling with it right off the bat. I'd like to take them a step at a time through the process of building an app, adding features along the way that they might use in the real world. This app isn't ready for that yet, but it's a start, and I intend to keep working on it. Since I've not had the pleasure of either a formal education, nor working with anyone writing perl who has, it's possible, even likely, that I'm doing something obviously wrong that beginners would not benefit from. Then again, maybe not. "There's more than one way to do it" and this way works for me, but if anyone here would like to go over the code and critic it, and offer some suggestions on improving it so beginners might learn more (and better), I'm all for it. I'm an old dog, but if I have to learn a few new tricks to get this right I'll buck up and learn them. I'll gladly make changes and add credits to the code. If you'd like to help build on this example, or contribute your own examples, lessons, and projects to the site, that would be great. BTW, the little raspberry pi is pretty darn cool. It's really a perfect sandbox to start playing in with perl. In fact, it may be perfect for developing perl since you can change out the entire system, configured for a single project, with a $6 SD card. I'm having a great time playing and learning with mine! Kindest Regards, Bill Stephenson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Forking question
> > Hi, > > I'm working on a forking process and I need a way to check if any of the > processes have failed and if they have restart them. Can anyone point me > in the right direction to a tutorial or explanation of how to do this? > Or use a server framework like POE which manages forking for you. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Forking question
Hi Graeme, On Fri, 10 Aug 2012 10:10:10 +0100 G M wrote: > > Hi, > > I'm working on a forking process and I need a way to check if any of > the processes have failed and if they have restart them. Can anyone > point me in the right direction to a tutorial or explanation of how > to do this? How do you expect to know when a process has "failed"? Will it die in this case? If so, you'll receive a SIGCHLD signal and can trap it and handle it appropriately. There's some rudimentary coverage of that on http://perldoc.perl.org/perlipc.html (though I can warn you that the perl code is no longer considered idiomatic - see http://perl-begin.org/tutorials/bad-elements/ ), and you may also wish to look at https://metacpan.org/module/Parallel::ForkManager for a useful wrapper over the nitty-gritty details. If that's not what you want, then you'll have to explain. Regards, Shlomi Fish > > > Thanks in advance, > > Graeme > -- - Shlomi Fish http://www.shlomifish.org/ What Makes Software Apps High Quality - http://shlom.in/sw-quality The KGB used to torture their victims by having them look at scrolling XSLT code. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Using existing db in DBM::Deep
Hi Punit, On Wed, 8 Aug 2012 17:51:05 +0530 punit jain wrote: > Hi , > > I am using DBM::Deep to store my HoH. > > my $db = new DBM::Deep( > file => "hash.db", > locking => 1, > autoflush => 1 > ); > > I want to reuse the same hash.db next time I run rather than recreate > hash.db from scratch using new. Is it possible to do so ? > The whole point of DBM::Deep is to provide on-disk persistence (otherwise, you would just use Perl's built-in in-memory data structures), so it is possible to do so. In https://metacpan.org/module/DBM::Deep , search for "load" - just call the constructor normally and the existing file will be read and loaded. Regards, Shlomi Fish > Regards, > Punit -- - Shlomi Fish http://www.shlomifish.org/ Perl Humour - http://perl-begin.org/humour/ There is no IGLU Cabal! Its members can be arranged in N! orders to form N! different Cabals. The algorithm to find which order formulates the correct IGLU Cabal is NP‐Complete. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Forking question
Hi, I'm working on a forking process and I need a way to check if any of the processes have failed and if they have restart them. Can anyone point me in the right direction to a tutorial or explanation of how to do this? Thanks in advance, Graeme