#perl - Mon 14 May 2007 between 05:29 and 05:43



revdiabloadj 1: of uncertain outcome; especially fraught with risk
jrockwaydodgy doggy
anabainwhy uncertain?
balbir97what should we use mod_perl|python|php or FastCGI of all this
amnesiacAssembly?
revdiabloanabain: I'm not sure if scalar m//g works properly when the original variable changes
anabain: You are modifying the same thing you're looking at. There is probably a nicer way to say it, but the phrase that comes to mind is "don't shit where you eat"
anabainin fact, when tried to do with $&, I got a readonly warning. That's why I put two variables, in order to avoid eating+shitting, and it's weird 'cause the same code without the substitution it's okay...
revdiabloI think modifying $var may reset the position of the match
Yeah
It does
anabainthen?
PaulWay[w]Hi all!
I've got a script which gets libraries from two different sources, depending on how its called.
revdiabloanabain: Then build a new string with modified values instead of replacing the existing string as you go
actionCPAN upload: CORBA-Python-0.37 by PERRAD
CPANupload: CORBA-Python-0.37 by PERRAD
PaulWay[w](The production script gets the production library, the development script in a different directory loads the development library instead.)
It achieves this through 'if ($0 =~ m[/path/to/production/dir]) { use lib qw(/path/to/production/lib); } else { use lib qw(/path/to/development/lib); }'
This works.
Jmaxno it doesn't
PaulWay[w]But Perl seems to still check for access to the development directory, which under my SELinux policy is not allowed for the production script.
anabainrevdiablo, and could it be possible to retain the pos of the match and perform the substitution right before this position?
revdiabloPaulWay[w]: Both of those 'use' lines will be executed
PaulWay[w]Ah.
Blast.
revdiabloPaulWay[w]: 'use' runs at compile time, before the condition gets a chance to even run
PaulWay[w]Can I do anything like that?
JmaxPaulWay[w]: require then import. use is compile-time, require/import is runtime
PaulWay[w]Ah. Excellent.
Thanks!
Jmaxyou're welcome
alternatively you could fuddle with @INC directly
without using base.pm at all
revdiabloanabain: I don't know, but I would recommend against it. See previous comment about feces and food consumption.
PaulWay[w]So do I require lib qw(blah) then import lib?
anabainok, revdiablo
PaulWay[w]I'll read up on require and import and get back to you...
Jmaxno, require lib; import lib qw(blah);
perldoc -f require; perldoc -f import; perldoc base
revdiablolib->import(qw(blah)); # If you want to avoid indirect method call syntax

Page: 4 11 18 25 32 39 46 53 60 67 74 81 88 95 102 109 116 

IrcArchive