From adam.trickett at iredale.net Fri Oct 5 05:30:00 2007 From: adam.trickett at iredale.net (Adam Trickett) Date: Fri, 5 Oct 2007 13:30:00 +0100 Subject: [Thamesvalley-pm] Fwd: London Perl Workshop 2007 Message-ID: <200710051330.07973.adam.trickett@iredale.net> This came out today, and should be well worth attending. ---------- Forwarded Message ---------- Please spread this far and wide to blogs, sites, mailing lists, print it and stick it up on a notice board. If you have an internal dev mailing list, spam that. Bonus points for people posting it to other london language lists. ---- London Perl Workshop 2007 So it's that time of year again, the nights are growing long, the mornings are growing cold and people who should know better once again decide to organise a conference. That's right it's time for this year's London Perl Workshop. So let's get down to the details, because we haven't much time ... When? Saturday 1st of December (10:00->17:30) Where? Cavendish Campus, University of Westminster, London (Thanks again!) (http://www.wmin.ac.uk/page-7679-smhp=4459) What? This year we will be encouraging people from other languages to participate so we can continue Perl's long tradition of stealing the best ideas from other languages (including future versions of Perl itself). We will also be doing a lot more lightning talks (because people like them). What can you do? Register to attend. http://conferences.yapceurope.org/lpw2007/ Propose a talk (remember lightning talks particularly welcome!) Same as above. n.b. you need to be registered to submit a proposal. The deadline for proposals is if I remember, remember correctly, the 5th of November. But please don't leave it to the last minute. (Talks should be 5 (lightning), 15 or 30 minutes long, unless it's something exceptional.) ------------------------------------------------------- -- Adam Trickett Overton, HANTS, UK In the field of observation, chance favours only the prepared minds. -- Louis Pasteur -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://mail.pm.org/pipermail/thamesvalley-pm/attachments/20071005/f85f71df/attachment.bin From gmatt at nerc.ac.uk Tue Oct 16 06:45:31 2007 From: gmatt at nerc.ac.uk (Greg Matthews) Date: Tue, 16 Oct 2007 14:45:31 +0100 Subject: [Thamesvalley-pm] using third party perl scripts Message-ID: <4714C07B.3080506@nerc.ac.uk> This question will probably show my naivity... I have a perl script that I want to make use of in my own perl scripts. I dont want to have to mangle the original script as I will loose the ability to easily incorporate updated versions. How can I call the first script from my own? Do I have to resort to a system() GREG -- Greg Matthews 01491 692445 Head of UNIX/Linux, iTSS Wallingford -- This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. From charlie at peopleandplanet.org Tue Oct 16 06:49:29 2007 From: charlie at peopleandplanet.org (Charlie Harvey) Date: Tue, 16 Oct 2007 14:49:29 +0100 Subject: [Thamesvalley-pm] using third party perl scripts In-Reply-To: <4714C07B.3080506@nerc.ac.uk> References: <4714C07B.3080506@nerc.ac.uk> Message-ID: <4714C169.8030801@peopleandplanet.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Greg Matthews wrote: > This question will probably show my naivity... I have a perl script that > I want to make use of in my own perl scripts. I dont want to have to > mangle the original script as I will loose the ability to easily > incorporate updated versions. How can I call the first script from my > own? Do I have to resort to a system() > > GREG Hey Greg, Sounds like you need to use do or eval. do EXPR Uses the value of EXPR as a filename and executes the contents of the file as a Perl script. do 'stat.pl'; is just like eval `cat stat.pl` http://perldoc.perl.org/functions/do.html Cheers, - -- Charlie Harvey IT Officer People & Planet Printing causes pollution and wastes energy and paper. Please consider not printing this email. Thanks. Shared Planet 2007 | 16 - 18 November | Sheffield University The UK's biggest student campaigning event. Designed to inform and inspire you to take action on poverty, human rights and the environment. Tickets cost just ?16 before 26 October. Book now http://peopleandplanet.org/sharedplanet -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHFMFpy48xIMwPXm0RAlBpAJ9ZGG+pkwd3d6AJrJ3HXbTyGLS+pACglc6Y 61XtKYBszpe67SU7U9BJaMc= =1uy7 -----END PGP SIGNATURE----- From gmatt at nerc.ac.uk Tue Oct 16 07:26:21 2007 From: gmatt at nerc.ac.uk (Greg Matthews) Date: Tue, 16 Oct 2007 15:26:21 +0100 Subject: [Thamesvalley-pm] using third party perl scripts In-Reply-To: <4714C169.8030801@peopleandplanet.org> References: <4714C07B.3080506@nerc.ac.uk> <4714C169.8030801@peopleandplanet.org> Message-ID: <4714CA0D.2060400@nerc.ac.uk> Charlie Harvey wrote: > Hey Greg, > > Sounds like you need to use do or eval. > > do EXPR hrmmm.. not used that before... at the moment I'm using this approach: open(PCA, "$pca_bin $pca_opts |") or die "No fork: $!\n"; my @result = ; close PCA; and set $pca_bin to be the path to the perl utility. Is this acceptable? I'm using a very similar approach in order to use ssh from perl. It works but I'm not clear if this is best practice. its not clear from the docs whether you can capture output from "do" (as I do above with the pipe). G > > Uses the value of EXPR as a filename and executes the contents of the > file as a Perl script. > > do 'stat.pl'; > > is just like > > eval `cat stat.pl` > > http://perldoc.perl.org/functions/do.html > -- Greg Matthews 01491 692445 Head of UNIX/Linux, iTSS Wallingford -- This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system. From Rafiq.Ismail at MorganStanley.com Wed Oct 17 01:57:47 2007 From: Rafiq.Ismail at MorganStanley.com (Ismail, Rafiq (IT)) Date: Wed, 17 Oct 2007 09:57:47 +0100 Subject: [Thamesvalley-pm] using third party perl scripts In-Reply-To: <4714CA0D.2060400@nerc.ac.uk> References: <4714C07B.3080506@nerc.ac.uk><4714C169.8030801@peopleandplanet.org> <4714CA0D.2060400@nerc.ac.uk> Message-ID: <0F354FDFECA12647B75F7B154EC382850855BDB4@LNWEXMB58.msad.ms.com> I would probably suggest putting all your common/reused components/logic in a module, where each of your scripts can share this. If, however, you're going to use do (perldoc -f do), which I'm not so fond of, then I would recommend using such a pattern that insures you: i) Minimise use/overlap of global variables between scripts ii) Try and wrap your functionality in subroutines, as opposed to the main body of the script Iii) If you can't go with (ii) then at least ensure that @ARGV is set to the expected input of the included script. When you do a 'do', you're basically evaluating the script into your current execution thread. So, if you have all your processing in the main body of the script, dependent on the state of @ARGV - this might cause confusion/collision when you evaluate the script from one which has its own @ARGV and surrounding scope to deal with. This is why it's better to try and strip your processing out of the main body. A way to get around this would be to have some main method which is directly invoked when your script is executed - but not otherwise. Further, if needed, try to return a result set which can be used by your calling application.: fooMain(@ARGV) unless caller(); sub fooMain { my @args = @_; my @stuff; #... Do stuff return @stuff; } If your "do 'foo_script.pl'" succeeds, then you can directly call your