[23274] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5494 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 12 18:05:51 2003

Date: Fri, 12 Sep 2003 15:05:14 -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           Fri, 12 Sep 2003     Volume: 10 Number: 5494

Today's topics:
        $SIG{__DIE__} doesn't make sense when using CGI::Carp <johanoberm@gmx.de>
        Better to upgrade <luriel@gfy.yahoo.com>
    Re: Better to upgrade <ak+usenet@freeshell.org>
    Re: caturing ftp standard output while using system() a (Nathan Pryor)
        Compress/Zip a String (http://edealseek.com/newsgroup.html)
    Re: Compress/Zip a String <jurgenex@hotmail.com>
    Re: Converting DBM to other DB file type <noreply@gunnar.cc>
    Re: Converting DBM to other DB file type (James Willmore)
    Re: Help me beef up my cruddy program <jidanni@jidanni.org>
        Hierarchical structures with objects (Gerry Grieve)
    Re: Hierarchical structures with objects <bharnish@technologist.com>
    Re: How to ignore "Callback called exit" <daniel.rawson.take!this!out!@asml.nl>
    Re: How to ignore "Callback called exit" <daniel.rawson.take!this!out!@asml.nl>
    Re: How to ignore "Callback called exit" <lusol@cube0.CC.Lehigh.EDU>
    Re: How to ignore "Callback called exit" <daniel.rawson.take!this!out!@asml.nl>
    Re: How to replace a variable string within /* variable (Victor)
    Re: How to replace a variable string within /* variable (Victor)
    Re: How to replace globally a string1 with string2 only (giri alamuri)
    Re: index, find regex <Ben_Dover@pickupsoap.forme.com>
    Re: Modify Apache http headers from perl? (David Efflandt)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 12 Sep 2003 22:37:34 +0200
From: Jo Oberman <johanoberm@gmx.de>
Subject: $SIG{__DIE__} doesn't make sense when using CGI::Carp
Message-Id: <p8b4mv4k3mmqno0p02139v63f0m9shig7c@4ax.com>

Me and my cgi-script have the following problem.

I'm using the package CGI::Carp (which installs internally some
$SIG{__DIE___} handlers).
In addition my script defines an own handler methods for
$SIG{__DIE__}.

My suggestion was, that my definition is "overwritting" the defintion
of CGI::Carp.
But that doesn't seem to be right.

Here is my example:

Perl-Skript:
---------------
use CGI::Carp;
 
 $SIG{__DIE__} = \&myDie;
 sub myDie {
    print "<b>ERROR-Message: $_[0]</b>";
 }
eval {     
  print "Content-type: text/html\n\n";
 print "Just some text<br>";
 
 die "I'm dying. Please help!";
 
 print "some text never shown";
};


When running the skript I get the following message (notice the wrong
module and line number)

Just some text
ERROR-Message: I'm dying. Please help! at
d:/dev_soft/apache/Perl/lib/CGI/Carp.pm line 301.


So it seems that the CGI:Carp definition of $SIG{__DIE__} is somewhat
alive. It is called before my own signal-handler is activated.

What is the way to undo the CGI::Carp handler definitions?
Just wanna know 1.) why CGI::Carp::die handler is still active when I
overwrite it with my own handler and 2.) how I can
prevent it? 

By the way:
The above example-script simplifies the core problem for discussion!
In real life there are two scripts installed running under mod_perl.
One of it uses CGI::Carp. The otherone defines the signal handler.


Thanks and Greetings! 


------------------------------

Date: Fri, 12 Sep 2003 19:35:01 GMT
From: "Luriel" <luriel@gfy.yahoo.com>
Subject: Better to upgrade
Message-Id: <Fdp8b.2192$ed2.1564@newssvr27.news.prodigy.com>

On our UNIX and BSD working stations, we are still using Perl 5.6. I'm
trying to get the IT department to upgrade to 5.8 or even 5.9 if that is
out.

Is there any real benefit or gain in 5.8 over 5.6 ? And what of 5.9? A yahoo
search did not give me anything over then FAQs, but not really what the
changes are. It would be veddy nice to know.

Thankie




------------------------------

Date: Fri, 12 Sep 2003 20:07:49 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Better to upgrade
Message-Id: <slrnbm49sk.t0o.ak+usenet@vinland.freeshell.org>

[nonrelated groups deleted]

In article <Fdp8b.2192$ed2.1564@newssvr27.news.prodigy.com>, Luriel wrote:
[cut]
> Is there any real benefit or gain in 5.8 over 5.6 ? And what of 5.9? A yahoo
> search did not give me anything over then FAQs, but not really what the
> changes are. It would be veddy nice to know.

    http://www.perldoc.com/perl5.8.0/pod/perldelta.html


-- 
Andreas Kähäri


------------------------------

Date: 12 Sep 2003 10:22:14 -0700
From: mrtortoise@yahoo.com (Nathan Pryor)
Subject: Re: caturing ftp standard output while using system() and cron
Message-Id: <2605bae1.0309120922.4cd0874f@posting.google.com>

<snip>
> > >
> > >  Why dont you use Net::FTP and save yourself the trouble of Portability
> > >and other issues.
> > >
> > >  The thumb rule is use perl modules wherever you can.
> >
> > Assuming you know that there *is* one :-)
> 
> Hence the reason everyone uses http://search.cpan.org/

I'm looking at the module now.  Thanks for the tip everyone.


------------------------------

Date: 12 Sep 2003 09:16:38 -0700
From: a@slip-12-64-158-90.mis.prserv.net (http://edealseek.com/newsgroup.html)
Subject: Compress/Zip a String
Message-Id: <7bce11cb.0309120816.9c29321@posting.google.com>

I need to convert a string, an URI/EmailAddress based string into a
letter/number only string. I know I can use acsii table, but that will
make each char into a 2 letter thing, that will increase the length of
the string by 100%. I know there are many zip/compress algorithm for
files. I used gzip to zip text file, and the ratio is 10%, so that
means using a good algorithm, I can cut 90% fat. I wonder if anyone
can show me a way to zip/compress a string (http://?&key=value, and
something@somewhere.com like) into the least of letters/numbers

Thank you.


------------------------------

Date: Fri, 12 Sep 2003 16:31:30 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Compress/Zip a String
Message-Id: <Cxm8b.363$NX3.92@nwrddc01.gnilink.net>

http://edealseek.com/newsgroup.html wrote:
> I need to convert a string, an URI/EmailAddress based string into a
> letter/number only string.

It appears you are looking for uuencode/uudecode.

jue




------------------------------

Date: Fri, 12 Sep 2003 18:36:20 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Converting DBM to other DB file type
Message-Id: <bjstg7$n7q4r$1@ID-184292.news.uni-berlin.de>

Please do not top post! http://web.presby.edu/~nnqadmin/nnq/nquote.html

Archi3 wrote:
> James Willmore wrote:
>> On Thu, 11 Sep 2003 10:48:00 -0400 "Archi3"
>> <archi3@archiventure.net> wrote:
>>> I have an older program which stores information in a dbm
>>> file...is there a way to convert this file into something
>>> Windows based or that can data transferred into SQL?
>> 
>> As you get each record from the dbm file, you can then insert the
>> record into your new database using DBI.  Or, you can loop
>> through each dbm record and write it to a CSV file - then, using
>> your database client, you can insert the records into your
>> database (because _most_ databases will allow you to
>> update/insert/etc. records from a CSV file).
> 
> I have the account file (account.dbm) from an older program I
> use...can I just manipulate that file?

In your first post you said "dbm file", and now you are talking about
a file whose extension is .dbm, which probably is quite another thing.

> My background..VB6 programmer

If you are a programmer - any kind of programmer - you should realize
that you need to provide accurate and detailed information if anybody
shall be able to help you with this kind of problem.

Also, please note that this is a group for discussing the Perl
program. I'm not sure what made you post here in the first place.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: 12 Sep 2003 14:05:35 -0700
From: jwillmore@cyberia.com (James Willmore)
Subject: Re: Converting DBM to other DB file type
Message-Id: <e0160815.0309121305.47720de7@posting.google.com>

"Archi3" <archi3@archiventure.net> wrote in message news:<3f61f6ec@news.greennet.net>...
> I have the account file (account.dbm) from an older program I use...can I
> just manipulate that file?
> My background..VB6 programmer with little knowledge of PERL, CGI, Linux..etc
> etc
> I was hoping I could take the files and DTS them into a SQL db or something
> to that effect
> Is there a program I can open the file in, that is windows based?
<snip>
> >
> > As you get each record from the dbm file, you can then insert the
> > record into your new database using DBI.  Or, you can loop through
> > each dbm record and write it to a CSV file - then, using your database
> > client, you can insert the records into your database (because _most_
> > databases will allow you to update/insert/etc. records from a CSV
> > file).
> >
> > Since you have given little information about what your doing (code,
> > database your going to use, what you have tried so far), this is all I
> > can offer.

How was the DBM file created?  Was it created with Perl or some other
software?

If you have the code that produced the DBM file lying around, you
could modify it to write out each record to a CSV file (a comma
separated values file).  _Most_, if not all modern RDBMS's have _some_
facility to import information into a database from a CSV file.  That
was the basic jist of the previous reply.

Did you want to write a script to do this -or- were you looking for
someplace with something pre-made?  If the later, go to
http://freshmeat.net.  It's an open source repository.  There you may
find something pre-made.  If you wanted to write your own, check out
http://www.perl.com.  The latest "Perl Cookbook" article applies, in
part, to databases (DBD::SQLLite I believe).  This may give you some
ideas.  If nothing else, it will show you some Perl syntax and
generate some more questions and/or code.

HTH

Jim


------------------------------

Date: Sat, 13 Sep 2003 03:26:55 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: Re: Help me beef up my cruddy program
Message-Id: <87llstkdts.fsf@jidanni.org>

I have added beef kindly provided here to
http://jidanni.org/geo/taiwan_datums/programs/twd6797thl , thanks.
The only worry left is will
#!/usr/bin/perl -ws
work for my Microsoft pals? If not, how do I make a portable version?
perldoc perlrun shows what -n, -p are equivalent to, but not -s.
Do I just do $^W=1 for -w too?


------------------------------

Date: 12 Sep 2003 20:30:00 GMT
From: grieve@astro.ubc.ca (Gerry Grieve)
Subject: Hierarchical structures with objects
Message-Id: <bjtac8$r6$1@nntp.itservices.ubc.ca>


I have some data (course Info) which I'm trying to model as an
Object "panda_course" which stores the data into a hash.  Besides other things,
a "panda_course" can have one or more "sections" which are modelled as another
Object & the references are stored in an array @ { $panda_course->{sections}.
This part works;

Each section can include one or more "Meetings" which is again  an object which uses
an hash to store the info.  I wanted to store references to these "meetings" objects
as an array in a "section->{meetings} (the meeting method is below.)  
I expected each section to have a unique array of meeting references, but
I get only one array being used.  
My test case is 1 course w 3 sections each having 1 meeting. 
Below is some debug statements that the meeting method prints out:
Each  panda_course_section is an unique hash, but each meeting array
is the same.

what I am missing, (besides a clue !!)

Gve 

debug Output 

panda_course:section:meeting Put panda_course_meeting=HASH(0xe2d40) on array self{meetings} 
panda_course:section:meeting The array ref is $self{meetings} is ARRAY(0xdc7bc)  
panda_course:section:meeting The self  is  panda_course_section=HASH(0x6a25c) 

panda_course:section:meeting Put panda_course_meeting=HASH(0xe2ee4) on array self{meetings} 
panda_course:section:meeting The array ref is $self{meetings} is ARRAY(0xdc7bc)  
panda_course:section:meeting The self  is  panda_course_section=HASH(0xe4c98) 

panda_course:section:meeting Put panda_course_meeting=HASH(0xe2f5c) on array self{meetings} 
panda_course:section:meeting The array ref is $self{meetings} is ARRAY(0xdc7bc)  
panda_course:section:meeting The self  is  panda_course_section=HASH(0xe4e3c) 

End_of_debug Output 

sub meeting
{
    my $self = shift;
    my $type = ref($self) || die "<<$self>> is not an object\n";
    my $rest = shift;
    my $m = panda_course_meeting->new(); 

    while  ($rest =~ m[<(\w+?)>(.*?)</\1>]msg)
    {
         next unless ($1);
        my $field = $1;
	my $value = $2;
        $value =~ s/^\s*$//;
 	$m->$field($value);
    }  
    print "panda_course:section:meeting Put $m on array self{meetings} \n";
    print "panda_course:section:meeting The array ref is \$self{meetings} is $self->{meetings}  \n";
    print "panda_course:section:meeting The self  is  $self \n\n";
    push @ { $self->{meetings} }, $m; 
    
    return $self->{meetings};
}
  





------------------------------

Date: Fri, 12 Sep 2003 21:07:46 GMT
From: Brian Harnish <bharnish@technologist.com>
Subject: Re: Hierarchical structures with objects
Message-Id: <pan.2003.09.12.21.08.01.88669@technologist.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On Fri, 12 Sep 2003 20:30:00 +0000, Gerry Grieve wrote:
> what I am missing, (besides a clue !!)

Um, a questionmark?

Also, the rest of your code! How are we supposed to be able to  tell whats
in $self->{meetings} when we don't see where it's created, or even used?

Also Also, try using Data::Dumper, much easier to read, and more detail
than your dump.

 - Brian
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/YjWviK/rA3tCpFYRAoPPAKCLrPjTpu7vi4piNeDiadFN3a1OSQCgnbHn
JmYkLeXhwjsmTsV0YTfmw6M=
=YCts
-----END PGP SIGNATURE-----



------------------------------

Date: Fri, 12 Sep 2003 12:25:10 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: How to ignore "Callback called exit"
Message-Id: <3F61F366.3070307@asml.nl>

Dominik Seelow wrote:
> Hello Dan,
> 
> 
> 
>>I'd like to be able to ignore the "Callback called exit" warning (since I'm doing it on purpose <g>); how can I do it??
> 
> That's presumeably not a warning but a fatal error?! They can be
> trapped, but as the reason lies probably somewhere within your code, you
> should rather try to fix the error.
> 
>>On a more general note, is there a mechanism (other than reading the source code) to determine what warnings categories 
>>are actually available??
> 
> 
> You can set warnings and die messages at run-time. So you won't be able
> to find out the message's text in advance:
> 
> for my $n (0..20){
> 	warn ("I don't like this number $n\n") if rand($n)>10;
> }
> 
> Or do you mean this:
> 
> form 'perldiag':
> 
> These messages are classified as follows (listed in increasing order of
> desperation):
> 
>     (W) A warning (optional).
>     (D) A deprecation (optional).
>     (S) A severe warning (default).
>     (F) A fatal error (trappable).
>     (P) An internal error you should never see (trappable).
>     (X) A very fatal error (nontrappable).
>     (A) An alien error message (not generated by Perl).
> 
> The majority of messages from the first three classifications above (W,
> D & S) can be controlled using the warnings pragma.
> 
> HTH,
> Dominik
> 
Dominik -

Thanks; the error is listed as fatal in perldiag.

This is absolutely intentional in this case; I have a perl/Tk application which puts a directory selection dialog up at 
startup.  If they cancel on the initial dialog, the callback for the cancel button simply calls exit.  On the other 
hand, if they bring up the directory selection dialog after the app has started, then do a "Cancel", I simply return 
them to the app without changing the directory selection.

With that said, I'm unclear about how I might trap this error . . . .  I looked at perldiag, perlwarn, eval, die, etc 
without much luck.

TIA . . .

Dan






------------------------------

Date: Fri, 12 Sep 2003 12:40:08 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: How to ignore "Callback called exit"
Message-Id: <3F61F6E8.50505@asml.nl>

Dan Rawson wrote:
> Dominik Seelow wrote:
> 
>> Hello Dan,
>>
>>
>>
>>> I'd like to be able to ignore the "Callback called exit" warning 
>>> (since I'm doing it on purpose <g>); how can I do it??
>>
>>
>> That's presumeably not a warning but a fatal error?! They can be
>> trapped, but as the reason lies probably somewhere within your code, you
>> should rather try to fix the error.
>>
>>> On a more general note, is there a mechanism (other than reading the 
>>> source code) to determine what warnings categories are actually 
>>> available??
>>
>>
>>
>> You can set warnings and die messages at run-time. So you won't be able
>> to find out the message's text in advance:
>>
>> for my $n (0..20){
>>     warn ("I don't like this number $n\n") if rand($n)>10;
>> }
>>
>> Or do you mean this:
>>
>> form 'perldiag':
>>
>> These messages are classified as follows (listed in increasing order of
>> desperation):
>>
>>     (W) A warning (optional).
>>     (D) A deprecation (optional).
>>     (S) A severe warning (default).
>>     (F) A fatal error (trappable).
>>     (P) An internal error you should never see (trappable).
>>     (X) A very fatal error (nontrappable).
>>     (A) An alien error message (not generated by Perl).
>>
>> The majority of messages from the first three classifications above (W,
>> D & S) can be controlled using the warnings pragma.
>>
>> HTH,
>> Dominik
>>
> Dominik -
> 
> Thanks; the error is listed as fatal in perldiag.
> 
> This is absolutely intentional in this case; I have a perl/Tk 
> application which puts a directory selection dialog up at startup.  If 
> they cancel on the initial dialog, the callback for the cancel button 
> simply calls exit.  On the other hand, if they bring up the directory 
> selection dialog after the app has started, then do a "Cancel", I simply 
> return them to the app without changing the directory selection.
> 
> With that said, I'm unclear about how I might trap this error . . . .  I 
> looked at perldiag, perlwarn, eval, die, etc without much luck.
> 
> TIA . . .
> 
> Dan
> 
OK, I got it to work like this:  from inside the tk callback sub-routine from the cancel button on the dialog:

if ($appRunning)
{
     $dialogBox->destroy;	
     $mw->deiconify;
}
else
{
     local $SIG{'__DIE__'};
     exit 1;
}

Dan



------------------------------

Date: 12 Sep 2003 17:24:13 GMT
From: Steve Lidie <lusol@cube0.CC.Lehigh.EDU>
Subject: Re: How to ignore "Callback called exit"
Message-Id: <bjsvft$f74@fidoii.CC.Lehigh.EDU>

Dan Rawson <daniel.rawson.take!this!out!@asml.nl> wrote:
> Dominik Seelow wrote:
>> Hello Dan,
>> 
>> 
>> 
>>>I'd like to be able to ignore the "Callback called exit" warning (since I'm doing it on purpose <g>); how can I do it??
>> 
>> That's presumeably not a warning but a fatal error?! They can be
>> trapped, but as the reason lies probably somewhere within your code, you
>> should rather try to fix the error.
>> 
>>>On a more general note, is there a mechanism (other than reading the source code) to determine what warnings categories 
>>>are actually available??
>> 
>> 
>> You can set warnings and die messages at run-time. So you won't be able
>> to find out the message's text in advance:
>> 
>> for my $n (0..20){
>>       warn ("I don't like this number $n\n") if rand($n)>10;
>> }
>> 
>> Or do you mean this:
>> 
>> form 'perldiag':
>> 
>> These messages are classified as follows (listed in increasing order of
>> desperation):
>> 
>>     (W) A warning (optional).
>>     (D) A deprecation (optional).
>>     (S) A severe warning (default).
>>     (F) A fatal error (trappable).
>>     (P) An internal error you should never see (trappable).
>>     (X) A very fatal error (nontrappable).
>>     (A) An alien error message (not generated by Perl).
>> 
>> The majority of messages from the first three classifications above (W,
>> D & S) can be controlled using the warnings pragma.
>> 
>> HTH,
>> Dominik
>> 
> Dominik -
> 
> Thanks; the error is listed as fatal in perldiag.
> 
> This is absolutely intentional in this case; I have a perl/Tk application which puts a directory selection dialog up at 
> startup.  If they cancel on the initial dialog, the callback for the cancel button simply calls exit.  On the other 
> hand, if they bring up the directory selection dialog after the app has started, then do a "Cancel", I simply return 
> them to the app without changing the directory selection.
> 
> With that said, I'm unclear about how I might trap this error . . . .  I looked at perldiag, perlwarn, eval, die, etc 
> without much luck.

ask in the proper group, that will help! (;

comp.lang.perl.tk

i haven't seen that error in years, perhaps your perl/tk is very old ...



> 
> TIA . . .
> 
> Dan
> 
> 
> 
> 


------------------------------

Date: Fri, 12 Sep 2003 14:33:29 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: How to ignore "Callback called exit"
Message-Id: <bjt3hr$mn9jp$1@ID-122008.news.uni-berlin.de>

Steve Lidie wrote:
> Dan Rawson <daniel.rawson.take!this!out!@asml.nl> wrote:
> 
>>Dominik Seelow wrote:
>>
>>>Hello Dan,
>>>
>>>
>>>
>>>
>>>>I'd like to be able to ignore the "Callback called exit" warning (since I'm doing it on purpose <g>); how can I do it??
>>>
>>>That's presumeably not a warning but a fatal error?! They can be
>>>trapped, but as the reason lies probably somewhere within your code, you
>>>should rather try to fix the error.
>>>
>>>
>>>>On a more general note, is there a mechanism (other than reading the source code) to determine what warnings categories 
>>>>are actually available??
>>>
>>>
>>>You can set warnings and die messages at run-time. So you won't be able
>>>to find out the message's text in advance:
>>>
>>>for my $n (0..20){
>>>      warn ("I don't like this number $n\n") if rand($n)>10;
>>>}
>>>
>>>Or do you mean this:
>>>
>>>form 'perldiag':
>>>
>>>These messages are classified as follows (listed in increasing order of
>>>desperation):
>>>
>>>    (W) A warning (optional).
>>>    (D) A deprecation (optional).
>>>    (S) A severe warning (default).
>>>    (F) A fatal error (trappable).
>>>    (P) An internal error you should never see (trappable).
>>>    (X) A very fatal error (nontrappable).
>>>    (A) An alien error message (not generated by Perl).
>>>
>>>The majority of messages from the first three classifications above (W,
>>>D & S) can be controlled using the warnings pragma.
>>>
>>>HTH,
>>>Dominik
>>>
>>
>>Dominik -
>>
>>Thanks; the error is listed as fatal in perldiag.
>>
>>This is absolutely intentional in this case; I have a perl/Tk application which puts a directory selection dialog up at 
>>startup.  If they cancel on the initial dialog, the callback for the cancel button simply calls exit.  On the other 
>>hand, if they bring up the directory selection dialog after the app has started, then do a "Cancel", I simply return 
>>them to the app without changing the directory selection.
>>
>>With that said, I'm unclear about how I might trap this error . . . .  I looked at perldiag, perlwarn, eval, die, etc 
>>without much luck.
> 
> 
> ask in the proper group, that will help! (;
> 
> comp.lang.perl.tk
> 
> i haven't seen that error in years, perhaps your perl/tk is very old ...
> 
> 
> 
Steve -

It's 800.024 . . . .

Dan



------------------------------

Date: 12 Sep 2003 09:18:30 -0700
From: gvictor97@yahoo.com (Victor)
Subject: Re: How to replace a variable string within /* variable_string */ with x  for each character in string?
Message-Id: <ab759f.0309120818.56c30180@posting.google.com>

Thanks Matija your help. 
--Victor

Abigail <abigail@abigail.nl> wrote in message news:<slrnbm1u0o.6v3.abigail@alexandra.abigail.nl>...
> Victor (gvictor97@yahoo.com) wrote on MMMDCLXIII September MCMXCIII in
> <URL:news:ab759f.0309111049.48aafe05@posting.google.com>:
> ^^  How to replace a variable string within /* variable_string */ with x 
> ^^  for each character in string? 
> ^^  
> ^^  The string may span on multiple lines. 
> ^^  
> ^^  for eaxmple:
> ^^  
> ^^  /* string */ -> 
> ^^  /* xxxxxx */
> ^^   
> ^^  /* stringstring */ ->
> ^^  /* xxxxxxxxxxxx */
> ^^  
> ^^  /* string1
> ^^     string2
> ^^  */ -> 
> ^^  
> ^^  /* xxxxxxx
> ^^     xxxxxxx
> ^^  */
> 
> 
>     use Regexp::Common;
> 
>     $str =~ s{$RE{comment}{C}{-keep}}{my $x = $3; $x =~ s!\S!x!g; "/*$x*/"}ge;
> 
> 
> Abigail


------------------------------

Date: 12 Sep 2003 09:19:50 -0700
From: gvictor97@yahoo.com (Victor)
Subject: Re: How to replace a variable string within /* variable_string */ with x  for each character in string?
Message-Id: <ab759f.0309120819.4e7cb038@posting.google.com>

Thanks Matija for your help. 
--V

Matija Papec <mpapec@yahoo.com> wrote in message news:<16j1mvoj9dvddd3ehdovma1ke10hnn3o0m@4ax.com>...
> X-Ftn-To: Victor 
> 
> gvictor97@yahoo.com (Victor) wrote:
> >How to replace a variable string within /* variable_string */ with x 
> >for each character in string? 
> >
> >The string may span on multiple lines. 
> >
> >for eaxmple:
> >
> >/* string */ -> 
> >/* xxxxxx */
> > 
> >/* stringstring */ ->
> >/* xxxxxxxxxxxx */
> >
> >/* string1
> >   string2
> >*/ -> 
> >
> >/* xxxxxxx
> >   xxxxxxx
> >*/
> 
> $code =~ s{/\*(.+?)\*/}{
>   (my $com = $1) =~ s/\S/x/g;
>   "/*$com*/";
> }ges;


------------------------------

Date: 12 Sep 2003 09:25:57 -0700
From: galamuri81@yahoo.com (giri alamuri)
Subject: Re: How to replace globally a string1 with string2 only if string1 does not have a sub_strig
Message-Id: <1547077a.0309120825.4ea247f3@posting.google.com>

Hello Ryan and Brian, 
Thanks for your help. 
Negative look ahead worked for me. 

Regards,
Giri

Ryan Shondell <shondell@cis.ohio-state.edu> wrote in message news:<xcwu17rge59.fsf@psi.cis.ohio-state.edu>...
> galamuri81@yahoo.com (giri alamuri) writes:
> 
> > What I want to do is: 
> > 
> > s/begin(^(abc)).*end//xyz/gs
> > 
> > What I meant above is, find string begin which is not followed by abc and 
> > then followed by any string till it find "end" and replace the whole string 
> > with "xyz" globally.
> > 
> > That is, I want to replace begin.*end with xyz only if begin is not followed
> > by "abc". 
> 
> I think this is a job for the negative look-ahead assertion, with some
> non-greediness added...
> 
> s/begin(?!abc).*?end/xyz/g;
> 
> 
> Ryan


------------------------------

Date: Fri, 12 Sep 2003 11:43:33 -0400
From: Ben Dover <Ben_Dover@pickupsoap.forme.com>
Subject: Re: index, find regex
Message-Id: <3F61E9A5.91D2E9E7@pickupsoap.forme.com>



ok! ok.
here's version .00000000000002 of my tiny project.
what do you think?

#!/usr/bin/perl

# variables
$setFileExt='.JPG'; #camera produces this extension

foreach $picFile (@ARGV) {
    #if it does not end in $setFileExt, skip file.
    $findExt=rindex($picFile,$setFileExt);
    if ($findExt eq "-1"){
        next;
    }

    open (READ, $picFile);
    ENDHERE: while ($line=<READ>){
        if ($line=~ /\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}/) {
            $line =~ /(\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2})/;
            $datetime=$1;
            last ENDHERE;
        }
    }
    close (READ);

    $datetime=~ s|(\d{4}):(\d{2}):(\d{2})
(\d{2}):(\d{2}):(\d{2})|_$1-$2-$3_$4_$5_$6|;


    $dotPos=rindex($picFile, '.');
    $filename=substr($picFile, 0,$dotPos);
    $fileExt=substr($picFile, $dotPos+1, length($picFile)-$dotPos-1);

    $renTo= "$filename$datetime.$fileExt";


#   print "$picFile ==> $renTo\n"; #testing purposes
    rename $picFile, $renTo || warn "could not mv $picFile ==> $renTo 
$!";
}


------------------------------

Date: Fri, 12 Sep 2003 15:17:16 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Modify Apache http headers from perl?
Message-Id: <slrnbm3ors.ipq.efflandt@typhoon.xnet.com>

On Fri, 12 Sep 2003, Mark <REMOVEXtwoheadsX@tiscaliX.co.uk> wrote:
> In order to stop certain documents from caching I would like to modify
> the http headers generated by the server. I have tried the usual meta
> tag solution and a variety of other suggestiongs but find that whilst
> they may work in one browser they fail in others, and I have been told
> that modifying the server http header is the only reliable method. 
> 
> Unfortunately I am on a shared hosting plan with no telnet access so
> the only way I might be able ot modify the server parameters is
> through perl. There are only a few documents that I do not want to be
> cached and it would be handy if I could tell the script generating the
> document to change the header to 'no cache', deliver the document and
> then change it back to a normal header. 
> 
> Does anyone know if this is possible in perl and which commands,
> modules, etc. I should be looking at? 

If using CGI.pm, you could put special headers within the header().  But
if you print the headers yourself, there is nothing Perl specific about
it.

HTTP headers are one per line, with the last header separated from content
by a blank line.  So when you print Content-type and any other reply
headers, just make sure you do NOT have any blank lines (or double
newline) until the end of the LAST header.  No need to change anything
back either, HTTP is one request, and one reply.  But if a single script 
handles multiple types of requests for cached and non-cached output, 
determine which before printing any headers.

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


------------------------------

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.  

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 5494
***************************************


home help back first fref pref prev next nref lref last post