From ptaylor at ordsvy.gov.uk Tue Nov 7 05:49:45 2000 From: ptaylor at ordsvy.gov.uk (Taylor, Paul) Date: Wed Aug 4 00:06:59 2004 Subject: Thinking about Windows? Message-ID: <3951D6A730CBD211BFA800805FA7BC4D01A5FFB8@ordsvy.gov.uk> Problem is, IT Services would freak if they caught on. They probably would; I think they have software audits and the like. ActiveState is working out okay, although my trainee is learning most of his Perl from Randal's rag ( Learning Perl ) and it uses a coupla things that don't seem to be supported under Win32, like flock. Poor little get. P. > -----Original Message----- > From: Kevin.Cornmell@ntl.com [mailto:Kevin.Cornmell@ntl.com] > Sent: 31 October 2000 15:07 > To: southampton-pm@happyfunball.pm.org > Subject: RE: Thinking about Windows? > > > Howabout installing a UMDOS linux partition on his > box & letting him play big-time. > > Ive got peanut-linux, which is great for this, and I think > uses Xitami. > > However it does not make the news much nowadays, > BigSlack will do nicely, ZipSlack = no windows. > > -----Original Message----- > From: Taylor, Paul [mailto:ptaylor@ordsvy.gov.uk] > Sent: 31 October 2000 13:25 > To: 'southampton-pm@hfb.pm.org' > Cc: 'techlist@sotonians.org.uk' > Subject: Thinking about Windows? > > > Ok. Small recommendation here for people who wind up on the > Gate-meister's > platform. > > OS is a bit funny about installing new machines and operating > systems. I > have no root permission anywhere in the building and the Perl installs > effected by the admin team leave something to be desired. > > I'm trying to teach a trainee about CGI and Perl's general > handiness in that > arena - but I can't get into the Apache config to specify an > area for him to > muck about in. Bummer. He's got a Windows box on his desk, > and we've both > got the coveted "Developer's Rights". > > So, solution we found was ActiveState Perl and the Xitami Web > Server for > Windows. Xitami has quite nice handling of CGI - it even > supports the UNIX > she-bang mechanism - and the Perl modules we wanted to use > worked right off > the bat. Nice. > > P. > > ------------------------------------------------------ > Paul Taylor > Perl Developer > Ordnance Survey > ------------------------------------------------------ > Tel: 023 8030 5287 > Mob: 077 2044 9005 > > > > *************************************************************** > This email/attachment(s) has been virus checked upon > receipt at the OS and is free of all known viruses. > > *************************************************************** > > > From ptaylor at ordsvy.gov.uk Wed Nov 29 05:14:25 2000 From: ptaylor at ordsvy.gov.uk (Taylor, Paul) Date: Wed Aug 4 00:06:59 2004 Subject: Who's about? Message-ID: <3951D6A730CBD211BFA800805FA7BC4D01A60056@ordsvy.gov.uk> List has been pretty quiet. Who's about? P. ------------------------------------------------------ Paul Taylor Perl Developer Ordnance Survey ------------------------------------------------------ Tel: 023 8030 5287 Mob: 077 2044 9005 ------------------------------------------------------ Southampton-pm - Perl Mongers From Gareth.Noyce at pennantplc.co.uk Wed Nov 29 05:11:34 2000 From: Gareth.Noyce at pennantplc.co.uk (Gareth Noyce) Date: Wed Aug 4 00:06:59 2004 Subject: Who's about? Message-ID: I'm still here... > List has been pretty quiet. Who's about? From pap at sotonians.org.uk Thu Nov 30 05:08:32 2000 From: pap at sotonians.org.uk (Pap Taylor) Date: Wed Aug 4 00:06:59 2004 Subject: Refs Message-ID: <4.2.0.58.20001130110616.009862b0@pop3.lineone.net> Two things Paym, You need to sign up from your work address if you want to post from there. southampton-pm has a members only submission thing in action. Onto your question:- --question Anyway here's me spak ladened question my old muckers. How does perl pass things in functions? E.g. $poo = "Bad shagging data structure"; &myfunct($poo); sub myfunct { Whatever oooh the pain. ... ... } Now, does perl pass the information as a reference or does it copy the whole thing. In other words would I make my scripts more efficient by passing everything by reference? Over to the perl meisters. --- question Perl passes things by copy. It has to. As you know, when Perl calls a function, all arguments are passed as a parameter array. Perl will create the parameter array as a copy of the original data. Passing things by reference will allow subroutine modifications to persist after the scope of the sub. As for speed, somewhat difficult to say. If you do pass references, you obviously don't need to return stuff. If you're returning a scalar, Perl would create a temporary scalar behind the scenes before it arrived in your return value. If you return an array, Perl will create an temporary array to shift the stuff into the values you're assigning the result of the function to. Yadda yadda yadda. It would seem that by passing references, you'd stop Perl from needing to create this temporary values. But you'd be wrong. Perl will return implicitly if it doesn't return explicitly. It'll return the last thing evaluated by default, e.g. the result of the print function or the if statement. So whether you return explicitly or not, Perl will still return something, even if it's delivering the value to void. Remember, that even if you passed your args as refs, Perl would still endure the overhead of creating your parameter array. The /only/ time I use references to function calls is when there's a damn good reason ( i.e. passing nested structures - or multiple lists or hashes ). If you're after passing scalars, it isn't worth the bother. Remember that each of your refs is a scalar too, and will cause almost as much overhead. And I do hope you're using named parameters.... P From paymon at 365.co.uk Thu Nov 30 05:14:22 2000 From: paymon at 365.co.uk (paymon@365.co.uk) Date: Wed Aug 4 00:06:59 2004 Subject: Refs In-Reply-To: <4.2.0.58.20001130110616.009862b0@pop3.lineone.net>; from pap@sotonians.org.uk on Thu, Nov 30, 2000 at 11:08:32AM +0000 References: <4.2.0.58.20001130110616.009862b0@pop3.lineone.net> Message-ID: <20001130111422.A28474@365.co.uk> testy testies paymon From paymon at 365.co.uk Thu Nov 30 05:17:40 2000 From: paymon at 365.co.uk (paymon@365.co.uk) Date: Wed Aug 4 00:06:59 2004 Subject: Refs In-Reply-To: <4.2.0.58.20001130110616.009862b0@pop3.lineone.net>; from pap@sotonians.org.uk on Thu, Nov 30, 2000 at 11:08:32AM +0000 References: <4.2.0.58.20001130110616.009862b0@pop3.lineone.net> Message-ID: <20001130111740.A28570@365.co.uk> okay, so it's not worth it then, unless I'm passing the array from hell. Point taken and being poked as we speak. Paymon On Thu, Nov 30, 2000 at 11:08:32AM +0000, Pap Taylor wrote: > Two things Paym, > You need to sign up from your work address if you want to post from > there. southampton-pm has a members only submission thing in action. > > Onto your question:- > > --question > > Anyway here's me spak ladened question my old muckers. > How does perl pass things in functions? > E.g. > $poo = "Bad shagging data structure"; > &myfunct($poo); > sub myfunct > { > Whatever oooh the pain. > ... > ... > } > > Now, does perl pass the information as a reference or does it copy the > whole thing. In other words would I make my scripts more efficient by > passing everything by reference? > Over to the perl meisters. > > --- question > > Perl passes things by copy. It has to. As you know, when Perl calls a > function, all arguments are passed as a parameter array. > > Perl will create the parameter array as a copy of the original > data. Passing things by reference will allow subroutine modifications to > persist after the scope of the sub. > > As for speed, somewhat difficult to say. If you do pass references, you > obviously don't need to return stuff. If you're returning a scalar, Perl > would create a temporary scalar behind the scenes before it arrived in your > return value. If you return an array, Perl will create an temporary array > to shift the stuff into the values you're assigning the result of the > function to. > > Yadda yadda yadda. > > It would seem that by passing references, you'd stop Perl from needing to > create this temporary values. But you'd be wrong. Perl will return > implicitly if it doesn't return explicitly. It'll return the last thing > evaluated by default, e.g. the result of the print function or the if > statement. So whether you return explicitly or not, Perl will still return > something, even if it's delivering the value to void. > > Remember, that even if you passed your args as refs, Perl would still > endure the overhead of creating your parameter array. > > The /only/ time I use references to function calls is when there's a damn > good reason ( i.e. passing nested structures - or multiple lists or hashes > ). If you're after passing scalars, it isn't worth the bother. Remember > that each of your refs is a scalar too, and will cause almost as much overhead. > > And I do hope you're using named parameters.... > > P > > From Gareth.Noyce at pennantplc.co.uk Thu Nov 30 05:28:46 2000 From: Gareth.Noyce at pennantplc.co.uk (Gareth Noyce) Date: Wed Aug 4 00:06:59 2004 Subject: Refs Message-ID: References to scalars are no quicker, however arrays and other data-structures do see a lot of benefit from references. In general I tend to use references purely for passing closures/tieing events to anonymous functions and getting around weird TK namespacing issues... "Advanced Perl" -- chapter one p9-10, discusses reference passing performance. The last few chapters discuss the internals in more detail... From paymon at 365.co.uk Thu Nov 30 05:36:42 2000 From: paymon at 365.co.uk (paymon@365.co.uk) Date: Wed Aug 4 00:06:59 2004 Subject: Refs In-Reply-To: ; from Gareth.Noyce@pennantplc.co.uk on Thu, Nov 30, 2000 at 11:28:46AM -0000 References: Message-ID: <20001130113642.A28676@365.co.uk> I used a scalar in the example but it was supposed to say 'big data structure' not bad data structure. So I use it when it massive, innit. On Thu, Nov 30, 2000 at 11:28:46AM -0000, Gareth Noyce wrote: > References to scalars are no quicker, however arrays and other > data-structures do see a lot of benefit from references. In general I tend > to use references purely for passing closures/tieing events to anonymous > functions and getting around weird TK namespacing issues... > > "Advanced Perl" -- chapter one p9-10, discusses reference passing > performance. The last few chapters discuss the internals in more detail... -- -------------------------------------------------------------------------------- Paymon Yau, Web Developer, 365 Corporation plc -------------------------------------------------------------------------------- p:+44 (020) 7505 7848 f: +44 (020) 7505 7802 i: http://www.365corp.com -------------------------------------------------------------------------------- Registered in England no 3435822 Registered office: 52 Gloucester Place, London W1H 3HJ -------------------------------------------------------------------------------- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. From Gareth.Noyce at pennantplc.co.uk Thu Nov 30 05:37:15 2000 From: Gareth.Noyce at pennantplc.co.uk (Gareth Noyce) Date: Wed Aug 4 00:06:59 2004 Subject: Refs Message-ID: > I used a scalar in the example but it was supposed to say > 'big data structure' not bad data structure. > So I use it when it massive, innit. In which case you see some benefit in using references, as you're not merging the entire passed structure to @_. Anything larger than a scalar benefits from this lack of merging... Even small arrays. Just dereference the passed structure from @_ and continue as normal... From Kevin.Cornmell at ntl.com Thu Nov 30 05:49:59 2000 From: Kevin.Cornmell at ntl.com (Kevin.Cornmell@ntl.com) Date: Wed Aug 4 00:06:59 2004 Subject: Refs Message-ID: <69841B8175B8D3118C050060084A4316012B3A1F@mast-wi0-se02.private.ntl.com> Dear Drooper, Youve got to use references when passing more than one array around too. Kevin -----Original Message----- From: paymon@365.co.uk [mailto:paymon@365.co.uk] Sent: 30 November 2000 11:37 To: southampton-pm@happyfunball.pm.org Subject: Re: Refs I used a scalar in the example but it was supposed to say 'big data structure' not bad data structure. So I use it when it massive, innit. On Thu, Nov 30, 2000 at 11:28:46AM -0000, Gareth Noyce wrote: > References to scalars are no quicker, however arrays and other > data-structures do see a lot of benefit from references. In general I tend > to use references purely for passing closures/tieing events to anonymous > functions and getting around weird TK namespacing issues... > > "Advanced Perl" -- chapter one p9-10, discusses reference passing > performance. The last few chapters discuss the internals in more detail... -- ---------------------------------------------------------------------------- ---- Paymon Yau, Web Developer, 365 Corporation plc ---------------------------------------------------------------------------- ---- p:+44 (020) 7505 7848 f: +44 (020) 7505 7802 i: http://www.365corp.com ---------------------------------------------------------------------------- ---- Registered in England no 3435822 Registered office: 52 Gloucester Place, London W1H 3HJ ---------------------------------------------------------------------------- ---- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. From pap at sotonians.org.uk Thu Nov 30 06:04:24 2000 From: pap at sotonians.org.uk (Pap Taylor) Date: Wed Aug 4 00:06:59 2004 Subject: Refs In-Reply-To: Message-ID: <4.2.0.58.20001130120005.0099a410@pop3.lineone.net> >In which case you see some benefit in using references, as you're not >merging the entire passed structure to @_. Anything larger than a scalar >benefits from this lack of merging... Even small arrays. It's worth pointing out that if you're using named parameters, you'll have to pass arrays as refs in order to access them the way you want. Otherwise, your key ( at best ) will refer to the first element of your array - or worse - won't be a key at all anymore. If you're serious about accessing big old data structures, you're better off realising your module as a class, and simply storing the data structure as an attribute of that object. Then, it's accessible through all of your subs as $self->{whatever}. P.