[24343] in Perl-Users-Digest
Perl-Users Digest, Issue: 6532 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 6 18:05:55 2004
Date: Thu, 6 May 2004 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 6 May 2004 Volume: 10 Number: 6532
Today's topics:
Re: At wits end! LWP and IIS(?) <gnari@simnet.is>
Re: Books online???? <bxb7668@somewhere.nocom>
Re: Books online???? <cwilbur@mithril.chromatico.net>
Re: Books online???? <cwilbur@mithril.chromatico.net>
Re: Books online???? <ittyspam@yahoo.com>
Re: Books online???? <cwilbur@mithril.chromatico.net>
Re: Formmail Question <webmaster @ infusedlight . net>
Re: free source authentication script <webmaster @ infusedlight . net>
Re: hashes and array's <dave.verhoeven@pandora.be>
Re: Help Needed Building Array Of Hashes From CSV <tsheetspublic@insightbb.com>
Re: Help Needed Building Array Of Hashes From CSV <tsheetspublic@insightbb.com>
Re: List questions on form <chiefS@edu.edu>
Re: List questions on form <noreply@gunnar.cc>
newbie; appending multiple files (Steve)
Re: newbie; appending multiple files <1usa@llenroc.ude>
pb PERL script with Apache server (Nicolas D)
Re: pb PERL script with Apache server <gnari@simnet.is>
Re: Perl Embedding Question <jgibson@mail.arc.nasa.gov>
Re: perl script to remove entire tags!? (Kevin Collins)
Re: Win32::API and SetEnvironmentVariable (Shawn Campbell)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 6 May 2004 18:28:21 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: At wits end! LWP and IIS(?)
Message-Id: <c7e016$cdc$1@news.simnet.is>
"Gisle Aas" <gisle@ActiveState.com> wrote in message
news:m37jvqszkr.fsf@eik.g.aas.no...
> "gnari" <gnari@simnet.is> writes:
>
> > I have never used these for file upload, and can't be bothered to do
> > research, but I suspect that you at least need to specify
> > multipart/form-data in the POST call, and probably some more
> > work. an upload post is in a pretty different format that regular
> > posts, and I am not sure HTTP::Request::Common supports it, thus the
> > "501 (Not Implemented)" message.
>
> HTTP::Request::Common certainly do support file uploads.
so it does!
and after a quick look at the OP's code, I see that the filename
passed to POST is not the same that was tested with -e.
in addition, it looks to me that unsafe assumptions about current
directory are made.
gnari
------------------------------
Date: Thu, 6 May 2004 19:04:43 GMT
From: "bxb7668" <bxb7668@somewhere.nocom>
Subject: Re: Books online????
Message-Id: <HxB3nt.5qL@news.boeing.com>
"David K. Wall" <dwall@fastmail.fm> wrote in message
news:Xns94E186BD7E2D9dkwwashere@216.168.3.30...
> GreenLight <google@milbaugh.com> wrote:
>
> > "bxb7668" <bxb7668@somewhere.nocom> wrote in message
> > news:<Hx5Bp0.Dn1@news.boeing.com>...
> >
> >> stuck or didn't know where to find the answer. I have a firm rule
> >> on questions: "There is no such thing as a stupid question. Just
> >> stupid answers."
> >
> > Well, I completely disagree. I have heard a lot of questions that
> > I can only characterize as "stupid". I have never quite grasped
> > how that little saying came about...
>
> "There may be no stupid questions, but there sure are a lot of
> inquisitive idiots."
One of my job titles is "Customer Support". While some of the
questions that I get are stupid, if I responded with "You are a stupid
git! RTFM!" I'd quickly be out looking for a job. Therefore I find it
easier and politer to give the question asker the benefit of the doubt
and assume that they just don't know how to ask a better worded
question or where to look for the answer.
------------------------------
Date: Thu, 06 May 2004 19:29:17 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Books online????
Message-Id: <87smedfjpx.fsf@mithril.chromatico.net>
>>>>> "A" == axel <axel@white-eagle.co.uk> writes:
A> Although I have seen other things online which I suspect may be
A> violations of copyright law, but who am I to judge whether a
A> press cutting or image violates the copyright law of some other
A> country?
Every reasonable thing to do can be taken to an unreasonable extreme.
The fact that it's impossible to report *every* copyright violation
you find on the Internet is no argument that you should not report
*any* copyright violation.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Thu, 06 May 2004 19:29:17 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Books online????
Message-Id: <87oep1fjfa.fsf@mithril.chromatico.net>
>>>>> "t" == taswold <hen_mcgiggle@yahoo.co.uk> writes:
t> "RTFM" IS rude and unhelpful, how in God's name can you
t> seriously pretend otherwise?
A flat "RTFM" is usually rude and unhelpful. However, "RTFM -
particularly perldoc -q 'my own module'" -- especially when the answer
to the question is found in the FAQ, and it's clear that the querent
hasn't read it -- is quite helpful. What could *possibly* be gained
by the respondent writing yet another response to the question instead
of providing a pointer to the peer-reviewed answer in the FAQ or other
documentation?
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Thu, 6 May 2004 16:13:52 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Books online????
Message-Id: <20040506161222.M25082@dishwasher.cs.rpi.edu>
On Thu, 6 May 2004, bxb7668 wrote:
> One of my job titles is "Customer Support". While some of the
> questions that I get are stupid, if I responded with "You are a stupid
> git! RTFM!" I'd quickly be out looking for a job. Therefore I find it
> easier and politer to give the question asker the benefit of the doubt
> and assume that they just don't know how to ask a better worded
> question or where to look for the answer.
I wholeheartedly guarantee that the *instant* someone starts paying me to
answer their Perl questions, you will never see me reply with "read this
perldoc".
Afterall, if they actually *learn*, they won't be filling my wallet with
their questions anymore, now will they? ;-)
Paul Lalli
------------------------------
Date: Thu, 06 May 2004 21:59:16 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Books online????
Message-Id: <87fzadfco0.fsf@mithril.chromatico.net>
>>>>> "bxb" == bxb7668 <bxb7668@somewhere.nocom> writes:
bxb> One of my job titles is "Customer Support". While some of the
bxb> questions that I get are stupid, if I responded with "You are
bxb> a stupid git! RTFM!" I'd quickly be out looking for a
bxb> job.
Well, yes. Pay me a reasonable amount, and I'll gladly answer every
moronic question you ask. Or, if you prefer, I'll read the perldocs
to you and explicate them as I go along. And you'll never learn how
to solve the problem or find the answer for yourself, and you'll
always be dependent on me to answer your questions -- meaning more
income.
bxb> Therefore I find it easier and politer to give the
bxb> question asker the benefit of the doubt and assume that they
bxb> just don't know how to ask a better worded question or where
bxb> to look for the answer.
Right. Which is why the best answer is not an answer, but a pointer
to the correct answer in the documentation. That way the querent
learns how to find an answer on his own.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Thu, 6 May 2004 13:09:25 -0800
From: "Robin" <webmaster @ infusedlight . net>
Subject: Re: Formmail Question
Message-Id: <c7e9l1$72c$2@reader2.nmix.net>
"Jim Tome" <jtome@demicooper.nospam (replace "nospam" with "com")> wrote in
message
news:200405060848011575%jtome@demicoopernospamreplacenospamwithcom...
> Hello, I'm not much of a Perl programmer (I usually just adapt a canned
> formmail script!), but I have a situation where I need to route
> information from an HTML contact form to different people (via having
> the form results e-mailed via the aforementioned formmail) depending on
> which checkbox in a form is selected.
>
> Just to make it a little more difficult, the form needs to process to
> more than one person if more than one checkbox is selected (e.g. if
> box1 then mailto person1, if box1 and box2 then mailto person1 and
> person2).
>
> Can anyone help me with altering the formmail scriot to include the if
> statements that determine the recipient? Also, I'm not sure where in
> the canned script the changes should go.
>
> Any help?
>
> Either post here or e-mail me directly.
there are better groups for this sort of thing...the the .jobs group or go
spam the .cgi groups. hehe.
-Robin
------------------------------
Date: Thu, 6 May 2004 13:07:59 -0800
From: "Robin" <webmaster @ infusedlight . net>
Subject: Re: free source authentication script
Message-Id: <c7e9l0$72c$1@reader2.nmix.net>
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:%Rgmc.28167$3Q4.834111@news20.bellglobal.com...
>
> "Jim Cochrane" <jtc@shell.dimensional.com> wrote in message
> news:slrnc9ii0l.aii.jtc@shell.dimensional.com...
> > In article <20040505144153.B25082@dishwasher.cs.rpi.edu>, Paul Lalli
> wrote:
> > >
> > >
> > > Do you honestly believe that's the only reason open() might fail? If
> > > so... damn, I don't even know what to say to that. And even if it
> *was*
> >
> > Perhaps he's operating on a different plane of reality, using a system
> that
> > never has file storage failures, files are always readable and writable
by
> > everyone, files are never locked, etc.
> >
> >
>
> Want to get where you're going without the hassle and cost of a
professional
> pilot, or even someone who's read the manual? Then fly Air Robin! If we
> can't get off the ground, we'll drive you there in our plane.
>
> (I just had a thought of him reading that post and wondering which plane
he
> was supposed to have taken... ; )
>
> Matt
I might be an idiot, but not a stupid one.
-Robin
------------------------------
Date: Thu, 06 May 2004 22:02:39 GMT
From: "Dafke8" <dave.verhoeven@pandora.be>
Subject: Re: hashes and array's
Message-Id: <3Cymc.1509$nZ.279104715@hestia.telenet-ops.be>
> Actually, as I understand, it's HTML. I know that HTML is made up of
> text, but; Don't use regular expressions to parse HTML. It _is_ rocket
> science, so try to stick with HTML::Parser (or one of the related
modules).
It's because i'm new to perl and this is a project for school and reg. exp.
was the only thing we have seen for searching text. I'm gonna see to that
HTML parser too and find out how it works, probably it's much easier but
you've gotta know it exists.
> > sub list_name2number(@){
>
> No need to prototype it.
But this function is in a module that i made, and i tought i must do it like
that.
>>........
> > my $akte;
> > my %naamnrs;
>
> You should consider _not_ declaring these variables _before_ you use them.
> Keeping them within the correct (and - most often - only-used) scope is
> what you probably want.
I've changed this.
> > foreach $akte(@tekst){
> > if($akte =~
> > m!<span\s+class="akte"\s+id="[0-9]+-[0-9]+">(.*?)</span>!g){
> > $akte =~
> > m!<span\s+class="akte"\s+id="[0-9]+-[0-9]+">(.*?)</span>!g;
> > ($aktenummer = $1);
> > }
> > }
>
> Can't really see why you have that regular expression twice; only once
> will do the same;
Yes indeed, it was a stupid mistake from me, i also changed that.
> foreach my $akte ( @tekst ) {
> if ( $akte =~
m!<span\s+class="akte"\s+id="[0-9]+-[0-9]+">(.*?)</span>!g ) {
> $aktenummer = $1;
> }
> }
>
> > push @namen,$akte =~
m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g;
>
> You _really_ should check the outcome of this patch before you try to use
> anything from it. What happens if the match fails?
>
> if ( $akte =~ m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g ) {
> push( @namen, $1 );
> }
Now i did the following:
push @namen,$akte =~ m!<span\s+class="naam"\s+id="(n[0-9]+)">(.*?)</span>!g;
is it the same as:
if ( $akte =~ m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g ) {
push( @namen, $1 ,$2);
}
> You could also consider doing the two regular expressions (above) in one
> take, thus saving some lines of code;
>
> if ( $akte =~ m!<span\s+class="(.*?)"\s+id="(.*?)">(.*?)</span>!g ) {
> my $class = $1;
> my $id = $2;
> my $span = $3;
> }
>
If i do it like you sugested wil i have al the names and id's? because there
are more names in one $akte, or will i have only the firs name and id?
>
> > foreach $naam(@namen){
> > if (exists $naamnrs{uc($naam)}){
> > if(not($naamnrs{uc($naam)} =~ m!$aktenummer!)){
> > $naamnrs{uc($naam)} = $naamnrs{uc($naam)}." ".$aktenummer;
> > }
>
> Hmm. Maybe you should consider uppercasing the things you add to $naamnrs
> when you add them? Seems like there are way too many uc() calls in the
> code above. No error, of course, but...
Gonna changed it too.
> And: Please do something with your indentation. It's almost impossible
> to read your code properly, and I refuse to copy and paste it into my own
> editor to format it right.
>
> When you've done that, _and_ taken account of the suggestions I've made,
> please feel free to repost your question(s).
>
I'm willing to learn every day so i can use all the help. So thank for all
the help so far.
greetz,
Dave
------------------------------
Date: Thu, 06 May 2004 19:06:38 GMT
From: Tim Sheets <tsheetspublic@insightbb.com>
Subject: Re: Help Needed Building Array Of Hashes From CSV
Message-Id: <21wmc.31061$Ia6.5083974@attbi_s03>
Anno Siegel wrote:
> Tim Sheets <tsheetspublic@insightbb.com> wrote in comp.lang.perl.misc:
>
>
>>$count=0;
>
>
> You're not running under "strict", are you? You should, and switch
> warnings on too.
Wasn't, but am now. :-)
>>while (<REFERENCEFILE>) {
>> if ($count == 0) {
>> @refdatakeys = split(/,/, $_);
>
>
> The last key will have a linefeed tacked on. You ought to chomp
> the line first.
You got that right!! Actually, I was doing that in another part of the
script where I am massaging the fields to meet some formatting requirements.
>> @arrefdata = ({$refdatakeys[$i] => '$refdatavalues[$i]'});
>
>
> This assigns a single hashref (which contains a single key/value pair)
> to @arrefdata. @arrefdata will never accumulate anything that way.
> This is probably the central problem of your code.
Yes, it was.
> So here is a way to do what you want:
>
> my ( @refdatakeys, @arrefdata);
>
> for ( scalar <REFERENCEFILE> ) {
> chomp;
> @refdatakeys = split /,/;
> }
>
> while ( <REFERENCEFILE> ) {
> chomp;
> my %row;
> @row{ @refdatakeys} = split /,/;
> push @arrefdata, \ %row;
> }
Works great!! I followed your suggestions and dropped this in place
which got me past this hurdle.
I finally got everything finished up today....it may not be pretty, but
it works. :-)
Thanks for your help!!!!
Tim
------------------------------
Date: Thu, 06 May 2004 19:16:46 GMT
From: Tim Sheets <tsheetspublic@insightbb.com>
Subject: Re: Help Needed Building Array Of Hashes From CSV
Message-Id: <yawmc.32533$IG1.1638085@attbi_s04>
Jim Cochrane wrote:
> Sorry, Tim - I was probably being a little overly didactic, but I was
> trying to point out that you didn't really say why you are trying to build
> an array of hashes - that is, what you were going to do with the array
> once you built it. In other words, often if you can specify a problem
> from what the program should do from the perspective of a user of the
> program who has no idea of what the code looks like, you can be clear
> as to what the problem actually is, both in terms of your own thinking
> and for presenting it to others. Often this helps not only in finding
> a correct implementation, but in finding a better one (e.g., more efficient,
> easier to maintain, or etc.)
Thanks for the clarification, Jim. I will keep this in mind in future
posts.
> I do maintain that to become truly good at programming, it's necessary
> to be able to state a problem without mentioning or implying an
> implementation (e.g., without talking about hashes, arrays, etc.).
> However, becoming a professional programmer may not be your goal, which is
> why I was perhaps being overly didactic.
While I would like to be a great programmer, it isn't my primary
function at work, and don't really want to be a programmer by
profession. The way I tell it is "I want to know enough programming to
be able to do what I want to do". :-) Of course that may change from
day to day... So, I end up writing a little script to accomplish a
specific task about once every 3 or 4 months.
Anyway, thanks again for the pointers on posting questions from the
perspective of the problem, and what I am trying to accomplish, as
opposed to an implementation perspective.
Tim
------------------------------
Date: Thu, 06 May 2004 13:37:02 -0500
From: "Chief S." <chiefS@edu.edu>
Subject: Re: List questions on form
Message-Id: <c7e0kk$s7v$1@lenny.tc.umn.edu>
Roger wrote:
> Here's the code, a comment at the end about what I'm trying to do.
> >
> @list = ("w","d","e","e","d","r","f","e","d",
> "c","v","g","h","t","y","h","g","t","h","y","D","P");
A cleaner way to do this sort of thing:
@list = qw(w d e e d r f e d c v g h t y h g t h y D P);
> @end = @list[16..19];
> splice (@list,16,17, "Z", "X"); # after this 18..21 are undef
Why 17? Are you understanding splice() correctly?
> splice(@list ,18,1, @end);
> ($Fld1) = "|" . join "|", @list ;
> ($Fld1) .= "|";
> print $Fld1;
One join() will work:
$Fld1 = join('|', '', @list, '');
> #The basic idea here is to take a list, remove some values in the middle
> #and replace them with some other values, and then make the entire record
> #pipe delimited, beginning to end.
It's not clear exactly what you're trying to do, but this seems like
something achievable with a single splice() command.
--
Chief S.
------------------------------
Date: Thu, 06 May 2004 20:55:01 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: List questions on form
Message-Id: <2fvg9jF2ql5fU1@uni-berlin.de>
Roger wrote:
>
Something's missing here:
use strict;
use warnings;
> @list = ("w","d","e","e","d","r","f","e","d",
> "c","v","g","h","t","y","h","g","t","h","y","D","P");
Better written as
my @list = qw/w d e e d r f e d c v g h t y h g t h y D P/;
> while( @list ) # just debugging here
> {
A while loop like that makes an endless loop. Take it away.
> @end = @list[16..19];
> splice (@list,16,17, "Z", "X"); # after this 18..21 are undef
You should study the documentation for splice():
perldoc -f splice
One thing you'll notice is that the third argument is the number of
elements to be removed. Your use of 17 indicates that you have
misunderstood that.
> splice(@list ,18,1, @end);
The push() function would be more suitable here.
perldoc -f push
This is an easier way to accomplish the exchange of elements:
my @end = splice @list, 16;
push @list, 'Z', 'X', @end[0..3];
> ($Fld1) = "|" . join "|", @list ;
> ($Fld1) .= "|";
> print $Fld1;
No need to concatenate the parts into a scalar variable.
print '|', (join '|', @list), "|\n";
> #It might be a hash would be a better choice, but my
> #'expertise' does not yet reach to that data type
Can't see how a hash would be better.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 6 May 2004 13:57:13 -0700
From: sjwallacew@hotmail.com (Steve)
Subject: newbie; appending multiple files
Message-Id: <eb6d00cc.0405061257.5b167226@posting.google.com>
Hello,
I have files 1.txt, 2.txt, 3.txt.......n.txt. Each file contains a
single line of text. I need each line of text from all these source
files to be appended into a single destination file called bulk.txt.
I have found some marginally helpful stuff in the manpages and faqs
but not quite what I need. Any pointers are appreciated.
Thanks,
Steve
------------------------------
Date: 6 May 2004 22:02:17 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: newbie; appending multiple files
Message-Id: <Xns94E1B77EC86D7asu1cornelledu@132.236.56.8>
sjwallacew@hotmail.com (Steve) wrote in news:eb6d00cc.0405061257.5b167226
@posting.google.com:
> Hello,
>
> I have files 1.txt, 2.txt, 3.txt.......n.txt. Each file contains a
> single line of text. I need each line of text from all these source
> files to be appended into a single destination file called bulk.txt.
>
> I have found some marginally helpful stuff in the manpages and faqs
> but not quite what I need. Any pointers are appreciated.
And your Perl question is ...?
cat ?.txt > bulk.txt
ought to do it.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: 6 May 2004 13:50:44 -0700
From: nico99@netcourrier.com (Nicolas D)
Subject: pb PERL script with Apache server
Message-Id: <7fe6c964.0405061250.1ce532f7@posting.google.com>
Hello,
My perl program doesn't work.
In my error.log i have:
[error] 27979: ModPerl::Registry: Can't locate CGI_Lite.pm in @INC
(@INC... contains: /var/www/perl
In my httpd2.conf i have:
Alias /perl/ /var/www/perl/
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
</Location>
and my perl script :
#!/usr/bin/perl
use CGI_Lite;
$cgi=new CGI_Lite;
#!/usr/bin/perl
use CGI_Lite;
$cgi=new CGI_Lite;
%in = $cgi->parse_form_data;
print "Content-type: text/html\n\n\";
print "<h1>Bonjour $in{'nom'} !</h1>";
so, where is the problem ?
Thanks
------------------------------
Date: Thu, 6 May 2004 20:56:53 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: pb PERL script with Apache server
Message-Id: <c7e8nm$dh8$1@news.simnet.is>
"Nicolas D" <nico99@netcourrier.com> wrote in message
news:7fe6c964.0405061250.1ce532f7@posting.google.com...
> Hello,
>
> My perl program doesn't work.
> In my error.log i have:
> [error] 27979: ModPerl::Registry: Can't locate CGI_Lite.pm in @INC
> (@INC... contains: /var/www/perl
>
> so, where is the problem ?
and where is CGI_Lite.pm ?
gnari
------------------------------
Date: Thu, 06 May 2004 15:04:06 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Perl Embedding Question
Message-Id: <060520041504063197%jgibson@mail.arc.nasa.gov>
In article <kV5lc.77738$yv.2740594@twister.southeast.rr.com>, Steve
Titus <titus@nospam.com> wrote:
> I am a veteran Perl user, but a newbie embedder. I am trying to figure
> out the best way to solve a problem I have. Please read along--any
> advice is appreciated.
>
> TASK: I am talking to a networked camera via HTTP, and the URLs I need
> to send and the requests I get back are a variety of fairly complicated
> and not always consistent text strings. THE GOAL: I need to interface
> with the camera from a C/C++ program.
>
> APPROACH: the camera came with a hard-copy manual that spelled out all
> the camera params and commands, syntax, etc. I slapped all the info into
> a config file in my own white-space-delimited column format that is
> pretty simple to read and understand. As far as parsing goes, I figure
> there are 4 general approaches I could have taken:
>
> 1. Hack something together using sscanf, strtok, and their ilk, and not
> have it robust, but get it working quickly. NOT AN OPTION.
>
> 2. Do it "right" in C using lex/yacc, bison/flex, etc. I have done
> parsers in this manner, but generally takes longer than using a Perl
> approach, and you have to debug the grammar corner cases, etc.
>
> 3. Embed Perl into the C program and use Perl for all the text munging.
> Has the added advantage of being flexible, not having to recompile when
> config file changes, yada.
>
> 4. Do the config file in standardized text format like XML, and it may
> not be too readable to humans, but I am sure there are some free
> libraries that will parse it easily and hand me my data in C nicely.
>
> COMMENTS WELCOME on which approach is best...but I chose 3.
>
You might want to consider another option: munge the text and generate
C code to provide the data or functions to control the camera as
needed. You shouldn't have to change the config file very often, as the
camera is not changing. You can put the generation of the C-code file
into make and have it done automatically every time the config file
changes.
[Perl questions snipped]
------------------------------
Date: Thu, 06 May 2004 18:26:29 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: perl script to remove entire tags!?
Message-Id: <slrnc9l0qg.hk.spamtotrash@doom.unix-guy.com>
In article <409a079c$1_1@news.adelaide.pipenetworks.com>, Nigel wrote:
> hello
>
> with perl is there a way to delete entire <tags> text </tags> from a file?
>
> the apache vhost.conf has many sites but when one is deleted, they need to
> be deleted. ServerName is always unique though. is there a perl script that
> can delete multiline expressions?
>
><VirtualHost *>
> ServerName testdomain12.com
> ServerAdmin admin@testdomain12.com
> ErrorLog /home/sites/site61/log_errorlog
> CustomLog /home/sites/site61/log_customlog common
> DocumentRoot /home/sites/site61/www
> RewriteEngine on
> <Directory /home/sites/site61/www>
> Options Indexes
> #ExecCGI
> AllowOverride AuthConfig Limit
> Order allow,deny
> Allow from all
> </Directory>
></VirtualHost>
See 'perldoc perlre' - specifically the 1st few paragraphs describing the 'm'
and 's' modifiers. You should be able to come up with a multi-line regexp that
will handle that for you.
Kevin
------------------------------
Date: 6 May 2004 11:37:24 -0700
From: smc0862.usa@mindspring.com (Shawn Campbell)
Subject: Re: Win32::API and SetEnvironmentVariable
Message-Id: <8ce1e050.0405061037.2862f31@posting.google.com>
Ben Morrow <usenet@morrow.me.uk> wrote in message news:<c7b60i$mu0$1@wisteria.csv.warwick.ac.uk>...
> Quoth smc0862.usa@mindspring.com (Shawn Campbell):
> > Eric Bohlman <ebohlman@earthlink.net> wrote in message news:<Xns94DFB77DFE349ebohlmanomsdevcom@130.133.1.4>...
> > > Ben Morrow <usenet@morrow.me.uk> wrote in
> > > news:c791n4$5gm$1@wisteria.csv.warwick.ac.uk:
> > >
> > > >
> > > > Quoth smc0862.usa@mindspring.com (Shawn Campbell):
> > > >> I'm having a problem setting environment variables with a large
> > > >> string. According to the MSDN documentation, an environment variable
> > > >> can be up to 32k. I'm well under this value, but it's not being set.
> > > >>
> > > >> Following is the code I'm using.
> > > >
> > > > <snip Win32::API SetEnvironmentVar>
> > > >
> > > > Why do you not just use %ENV? (Is there something I'm missing?)
> > >
> > > I presume he's doing it for the reasons listed by perldoc -q environment
> >
> > Actually, it looks like the SetEnvVar sub I created is working fine,
> > other than truncating the value at 1024. The problem was in the
> > GetEnvVar sub I created. I didn't supply enough buffer size so it
> > wasn't reading in the value, giving me the impression it was not set.
>
> Can you clarify: does SetEnvironmentVar simply set the var for the
> current process, or does it change the default environment in the
> registry? If it does the former, then there really is no reason not to
> simply use %ENV.
>
> > I have another environment variable issue I am struggling with that I
> > hope you could give me some insight on.
> >
> > I'm using ActivePerl to create an automated build process. Part of
> > the process is setting the LIB, INCLUDE, PATH, SOURCE variables from
> > within the Perl script and then using a system call to invoke
> > MSDEV.EXE using the /USEENV option. It looks like the process the
> > Perl script is running in is setting the variables I need, but MSDEV
> > is not finding them. If I manually set the same values within the DOS
> > console and then run my Perl script, MSDEV finds the variables.
>
> This makes me suspect the latter; which is definitely not what you want
> in this case. MSDEV.EXE will receive the environment given it by the
> perl process, rather than the default environment. In addition, new
> console windows you open *will* receive the default environment, so they
> will get the values for LIB etc. you have specified... not terribly
> useful. Try using %ENV.
>
> > I'm working on Windows XP, so I'm not sure if this might be the issue,
> > but it behaves as if MSDEV is not looking at the process that the Perl
> > script is running in, but is looking at it's parent for the
> GRR ^
> > environment variables.
>
> This is unlikely. Processes don't have parents under windows (except
> under certain restricted situations).
>
> > Is there any way of setting environment variables within the 'parent'
> > DOS process from the PErl script?
>
> No.
>
> Ben
Using ENV worked. I still can't figure out why using the
SetEnvironmentVariable function would not work, but at this point I
don't care as long as I have a solution.
Thanks for the help!
Shawn Campbell
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6532
***************************************