Re: PerlSetVar string value - no \n translation?
Yet another solution would be to use this: PerlSetVar Foo first line PerlAddVar Foo second line PerlAddVar Foo third line Or you can use the hack suggested by Steven. Interesting. It hadn't occurred to me that mod_perl would simply append the values if Foo had several assigned. I'll consider that too, but I think the hack suggested by Steven fits more neatly with other substitutions I am doing with the string. It doesn't append, it creates an array of strings which can be retrieved with ($r|$s)-dir_config. See: http://perl.apache.org/guide/config.html#PerlSetVar_PerlSetEnv_and_PerlP -- _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
PerlSetVar string value - no \n translation?
Hey all. I don't know how many people are lurking here, since the list seems to be very light traffic (the lightest of 8 I sub to), but I have a question regarding PerlSetVar and strings. Here is what I'm trying to do: In httpd.conf: Location /MyHandler . . . PerlSetVar MailMsg Access Report \ This is a mail message spanning several \ lines that I would like to mail to a \ particular address when the handler is \ invoked. \ Unfortunately, it all winds up on one line and \ any \n included do not get translated. /Location And in my module, I am successfully sending this message to the email address, but it arrives looking like this: Access Report This is a mail message spanning several lines that I would like to mail to a particular address when the handler is invoked. Unfortunately, it all winds up on one line and any \n included do not get translated. And the darn thing is all on one line. '\n' is not translated, etc. It looks like the string is proveded as if enclosed in single quotes. Which is bad. Any ideas? TIA HAND Lou -- Louis LeBlanc [EMAIL PROTECTED] Fully Funded Hobbyist, KeySlapper Extrordinaire :) http://www.keyslapper.org ԿԬ Cohen's Law: There is no bottom to worse.
Re: PerlSetVar string value - no \n translation?
-- Louis LeBlanc [EMAIL PROTECTED] Hey all. I don't know how many people are lurking here, since the list seems to be very light traffic (the lightest of 8 I sub to), but I have a question regarding PerlSetVar and strings. Here is what I'm trying to do: In httpd.conf: Location /MyHandler . . . PerlSetVar MailMsg Access Report \ This is a mail message spanning several \ lines that I would like to mail to a \ particular address when the handler is \ invoked. \ Unfortunately, it all winds up on one line and \ any \n included do not get translated. /Location And in my module, I am successfully sending this message to the email address, but it arrives looking like this: Access Report This is a mail message spanning several lines that I would like to mail to a particular address when the handler is invoked. Unfortunately, it all winds up on one line and any \n included do not get translated. And the darn thing is all on one line. '\n' is not translated, etc. It looks like the string is proveded as if enclosed in single quotes. Which is bad. Quick hack for the moment: PerlSetVar Blah A long line withbrHTMLbrBreaks In It; that or set the thing and use: s/br/\n/gs; somewhere in the code. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582
Re: PerlSetVar string value - no \n translation?
On 10/27/01 12:01 PM, Steven Lembark sat at the `puter and typed: . . . Quick hack for the moment: PerlSetVar Blah A long line withbrHTMLbrBreaks In It; that or set the thing and use: s/br/\n/gs; somewhere in the code. Pretty cool. I am already doing a hash substitution for tags of the form _TAG_, so I just added the following to the end of the hash: _BR_ = \n and that does the trick! In case any one cares, my substitution now goes as follows: my %config = { _TAG1_ = $var1, _TAG2_ = $var2, _TAG3_ = $var3, _TAG4_ = $var4, . . . _TAGn_ = $varn, _BR_ = \n }; my $tagRE = join '|', keys %config; $alert_message =~ s/($tagRE)/$config{$1}/g; And it works like a charm. Shoulda thought of that myself. Thanks! Lou -- Louis LeBlanc [EMAIL PROTECTED] Fully Funded Hobbyist, KeySlapper Extrordinaire :) http://www.keyslapper.org ԿԬ Die, v.: To stop sinning suddenly. -- Elbert Hubbard
Re: PerlSetVar string value - no \n translation?
Louis LeBlanc wrote: Hey all. I don't know how many people are lurking here, since the list seems to be very light traffic (the lightest of 8 I sub to), but That's because mod_perl has no bugs :) so we talk about the weather mostly. I have a question regarding PerlSetVar and strings. Here is what I'm trying to do: In httpd.conf: Location /MyHandler . . . PerlSetVar MailMsg Access Report \ This is a mail message spanning several \ lines that I would like to mail to a \ particular address when the handler is \ invoked. \ Unfortunately, it all winds up on one line and \ any \n included do not get translated. /Location And in my module, I am successfully sending this message to the email address, but it arrives looking like this: Access Report This is a mail message spanning several lines that I would like to mail to a particular address when the handler is invoked. Unfortunately, it all winds up on one line and any \n included do not get translated. And the darn thing is all on one line. '\n' is not translated, etc. It looks like the string is proveded as if enclosed in single quotes. Which is bad. Probably you are the first one that needed PerlSetVar to work with \n. Why don't you use startup.pl or CPerl sections to set the text, where you have a complete control over the string? Yet another solution would be to use this: PerlSetVar Foo first line PerlAddVar Foo second line PerlAddVar Foo third line Or you can use the hack suggested by Steven. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: PerlSetVar string value - no \n translation?
On 10/28/01 01:15 PM, Stas Bekman sat at the `puter and typed: Louis LeBlanc wrote: Hey all. I don't know how many people are lurking here, since the list seems to be very light traffic (the lightest of 8 I sub to), but That's because mod_perl has no bugs :) so we talk about the weather mostly. LOL. I shoulda known! Really, I'm a perl/mod_perl newbie with a C background and I've really been bitten by the Perl bug lately. It's been a goal of mine to start playing with it for some time, but only recently have I started _making_ time to do it. . . . Probably you are the first one that needed PerlSetVar to work with \n. Well, it's good to know I got into it before everything had been done :). Why don't you use startup.pl or CPerl sections to set the text, where you have a complete control over the string? I'll have to look into those. Yet another solution would be to use this: PerlSetVar Foo first line PerlAddVar Foo second line PerlAddVar Foo third line Or you can use the hack suggested by Steven. Interesting. It hadn't occurred to me that mod_perl would simply append the values if Foo had several assigned. I'll consider that too, but I think the hack suggested by Steven fits more neatly with other substitutions I am doing with the string. Thanks for the ideas. Lou -- Louis LeBlanc [EMAIL PROTECTED] Fully Funded Hobbyist, KeySlapper Extrordinaire :) http://www.keyslapper.org ԿԬ Optimization hinders evolution.