[16306] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3718 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 18 10:13:01 2000

Date: Tue, 18 Jul 2000 07:12:50 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963929569-v9-i3718@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 18 Jul 2000     Volume: 9 Number: 3718

Today's topics:
    Re: local and use strict (jason)
    Re: local and use strict (Brendon Caligari)
    Re: Locking a file (Keith Calvert Ivey)
    Re: Locking a file (Bart Lateur)
    Re: Making a Perl module (Alex T.)
    Re: Mechanics of a File Upload? (Malcolm Dew-Jones)
        Metadot Perl portal software server (Daniel)
    Re: metrics again, please read the reformulated questio (Abigail)
        multiline & single line reqexp question (Lance Hoffmeyer)
    Re: multiline reqexp question (Tad McClellan)
    Re: multiline reqexp question (Marc Schaefer)
    Re: multiline reqexp question (Lance Hoffmeyer)
    Re: multiline reqexp question (Art Haas)
        Multiple values per key (deno)
        MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible?? ()
    Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? (Kristian Koehntopp)
    Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? (josh)
    Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? (brian d foy)
    Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible? (W Kemp)
        nasty DESTROY behaviour ()
    Re: nasty DESTROY behaviour (jason)
    Re: nasty DESTROY behaviour (Jakob Schmidt)
    Re: Need advice on converting excel files. ()
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 15 Jul 2000 01:40:04 GMT
From: elephant@squirrelgroup.com.bbs@openbazaar.net (jason)
Subject: Re: local and use strict
Message-Id: <3bPG55$XDx@openbazaar.net>

Brendon Caligari wrote ..
><nobull@mail.com> wrote in message news:u9itu8u19l.fsf@wcl-l.bham.ac.uk...
>
>> However, in general you should avoid doing this. local() is a powerfull
>> tool in the cases where it is the right tool.  It is however not often
>> the right tool.
>
>I admit that while I appreciate it's existence, I couldn't really conceive
>any particular use for it.  I classify it together with taboos like 'gotos'.

you just haven't come across a situation that it was made for yet - or
don't understand Perl's special variables .. the following situation is
perfect for local to be used

  my @input = ();
  open INPUT, "blah" or die "etc";
  {
    local $/;
    @input = <INPUT>;
  }

  # continue program

>I'm still trying to 'accept' previousy frowned upon concepts such
>as breaking straight out of a number of nested loops

frowned upon by whom ? .. breaking out of a loop is a well tested and
supported language feature than lends itself to good design

>> Note that "for", "map" and "grep" implicity localise $_, you don't
>> need to do it explicitly.
>
>Aha.  So, really and truly it's irrelevant what gets passed to, say,
>a foreach iteration in fact being 'localised'.
>
>    #!/usr/bin/perl -w
>    use strict;
>    my( $s );
>    $s = "Whatever";
>    print("Entry Value = $s\n");
>    foreach $s (1..5) { print("Interim Value = $s\n"); }
>    print("Exit Value = $s\n");
>    exit(0);
>
>..yeah...in fact it gave "Whatever 1 2 3 4 5 Whatever"

from a linguistic view - there's nothing wrong with the above .. from a
human understanding view - it's rarely advantageous to use the one
variable for two different purposes .. the above would be better written
as

  #!/usr/bin/perl -w
  use strict;

  my $value = "Whatever";

  print("Entry Value = $value\n");

  foreach my $count (1..5) { print("Interim Value = $count\n"); }

  print("Exit Value = $value\n");
  exit(0);

  __END__

--
  jason -- elephant@squirrelgroup.com --


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

Date: 15 Jul 2000 08:10:01 GMT
From: bcaligari@shipreg.com.bbs@openbazaar.net (Brendon Caligari)
Subject: Re: local and use strict
Message-Id: <3bPQCP$Trt@openbazaar.net>

"jason" <elephant@squirrelgroup.com> wrote in message
news:MPG.13da5ed557c176009896b9@news...
> Brendon Caligari wrote ..
> ><nobull@mail.com> wrote in message
news:u9itu8u19l.fsf@wcl-l.bham.ac.uk...
> >
> >> However, in general you should avoid doing this. local() is a powerfull
> >> tool in the cases where it is the right tool.  It is however not often
> >> the right tool.
> >
> >I admit that while I appreciate it's existence, I couldn't really
conceive
> >any particular use for it.  I classify it together with taboos like
'gotos'.
>
> you just haven't come across a situation that it was made for yet - or
> don't understand Perl's special variables .. the following situation is
> perfect for local to be used
>
>   my @input = ();
>   open INPUT, "blah" or die "etc";
>   {
>     local $/;
>     @input = <INPUT>;
>   }
>
>   # continue program
>
> >I'm still trying to 'accept' previousy frowned upon concepts such
> >as breaking straight out of a number of nested loops
>
> frowned upon by whom ? .. breaking out of a loop is a well tested and
> supported language feature than lends itself to good design

I'm just intrdocuing myself to perl.  Many perl concepts are 'NO NO NO' in
other 'stricter' languages.  Try 'breaking' out of two nested loops in C.

Perl can get a bit confusing, to guys like me who are coming from a
programming
but un-perlish background.  As time goes by I am really turning to perl, at
least for the everyday tasks (hardly turn to C / awk any more.  nothing
beats
grep / sed / csh for the majority of quickies in sysadmin though) but I
honestly cannot see Perl as a language fit for...say..students who are still
at their programming-concepts infancy.

>
> >> Note that "for", "map" and "grep" implicity localise $_, you don't
> >> need to do it explicitly.
> >
> >Aha.  So, really and truly it's irrelevant what gets passed to, say,
> >a foreach iteration in fact being 'localised'.
> >

[ cut ]

>
> from a linguistic view - there's nothing wrong with the above .. from a
> human understanding view - it's rarely advantageous to use the one
> variable for two different purposes .. the above would be better written
> as

sorry I confused you there......that was just an 'experiment'
to check $s's contents before and after being used within
a foreach :-)

>
[ cut ]
>

Thanks
Brendon


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

Date: 16 Jul 2000 14:20:02 GMT
From: kcivey@cpcug.org.bbs@openbazaar.net (Keith Calvert Ivey)
Subject: Re: Locking a file
Message-Id: <3bQPJ2$UmK@openbazaar.net>

martho@my-deja.com wrote:

>Okay, I see the problem: With the download of my win-perl-bins, I didn't
>get any doc-files. Where can I get them ?

If you're using ActivePerl, look under Start > Programs >
ActivePerl > Online Documentation.  If it's not there, there's
something wrong with your installation.  Or you can find the
documentation at perl.com.

--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)


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

Date: 16 Jul 2000 17:40:02 GMT
From: bart.lateur@skynet.be.bbs@openbazaar.net (Bart Lateur)
Subject: Re: Locking a file
Message-Id: <3bQUT3$XPg@openbazaar.net>

martin@radiok2r.de wrote:

>What's the best way to lock/unlock a file while one user is working with
>ist ? I could use flock(), but if the user aborts or the connections
>breaks down, the file would be locked forever...

I think the OS will automatically free a lock if you don't do it before
the program quits; even if it's forced to quit.

--
	Bart.


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

Date: 13 Jul 2000 16:00:03 GMT
From: samara_biz@hotmail.com.bbs@openbazaar.net (Alex T.)
Subject: Re: Making a Perl module
Message-Id: <3bOBO3$Xjp@openbazaar.net>

Hi,

Yeah, I guess I should have better described what was the problem. Or try to
use perldoc on modules, before I asked. Thanks for reply though!

I have another question. I'm using IIS 4.0 ASP objects, such as $Response and
$Server. I tried create a module with just one function, which uses those
objects. When I run my script, I get the following error:

Global symbol "$Response" requires explicit package name at
C:/Perl/site/lib/Aspfunctions.pm. Global symbol "$Server" requires explicit
package name at C:/Perl/site/lib/Aspfunctions.pm line 31. Global symbol
"%Replacements" requires explicit package name at
C:/Perl/site/lib/Aspfunctions.pm line 35. Global symbol "%Replacements"
requires explicit package name at C:/Perl/site/lib/Aspfunctions.pm line 36.
Global symbol "$Response" requires explicit package name at
C:/Perl/site/lib/Aspfunctions.pm line 38. Compilation failed in require line 8.
BEGIN failed--compilation aborted at (eval 10) line 8.

/admin.asp, line 41

As I understand, I get this error, because the module doesn't know where
$Response and $Server come from. So how do I make my module understand that
those are the ASP objects?

Thanks for your help!

Alex


Tad McClellan wrote:

> On Thu, 13 Jul 2000 10:00:42 -0400, Alex T. <samara_biz@hotmail.com> wrote:
>
> >How do I make a module in Perl?
>
> >    @EXPORT = qw(funcOne funcTwo);
>                               ^^^
> >sub funcTwp{...}
>          ^^^
>
> >I tried something like that,
>                    ^^^^^^^^^
>
> Not close enough to whatever it was that you really tried, it appears.
>
> >but it didn't work.
>
> What's that mean?
>
> Get any messages? (messages are meant to help with debugging, so you
>                    should include them if you want debugging help)
>
> Get any output that indicates "didn't workness"?
> ( if so, what did you get, and what did you want to get? )
>
> >So I'm wondering if I'm
> >missing something.
>
> So are we.
>
> We are missing the code that you tried.
>
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas


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

Date: 11 Jul 2000 20:40:02 GMT
From: yf110@vtn1.victoria.tc.ca.bbs@openbazaar.net (Malcolm Dew-Jones)
Subject: Re: Mechanics of a File Upload?
Message-Id: <3bMdc6$V0G@openbazaar.net>

Jeff Boes (jboes@eoexchange.com) wrote:
: Matthew Jochum wrote:
: >
: > Hey All,
: >     I was wondering how the file upload process works?  What protocol
: > the server uses to read the file on a remote computer.  How the bytes
: > are transfered, etc etc...


: I think it's important to note (beyond things pointed out elsewhere in
: this thread) that the browser and the web server are doing the work, not
: so much the CGI program. You can build a form like this:

: <html><head></head><body>
: <form action="/cgi-bin/nosuchscript.cgi">
: <input type="file"><input type="submit"></form>
: </body></html>

: Then load up this page, select a 20 meg file from your hard drive, and
: submit it. The browser will grind away for whatever time it takes to
: upload the file, then the server will store it in some temp directory.
: Finally, the specified program gets called. And of course in this
: example, there's no program found, so it bombs. Your program never gets
: control of the upload process until the point where the file is already
: on the server. This is important, because the second question people ask
: (after #1, "how do I do a file upload?") is usually, "How do I prevent
: the user from uploading a large file/a binary file/a file I already
: have?" And you can't, at least not from your CGI program. Oh, you can
: refuse to accept it from the server, but by the time your code is
: running, the file is already uploaded, and has eaten up whatever
: bandwidth it's going to eat, and occupies space on your server (and
: we'll assume that your server is correctly configured to reclaim this at
: some point).

This doesn't sound correct.

There are two possibilities, either file is uploaded via POST or GET.

If uploaded via POST (the normal way) then the CGI script gets control
before the POST data has been read from STDIN.  Meanwhile the network
software block, waiting for the receiving program (the CGI script) to suck
in the data. The network software on the client (i.e. the browser end)
will not be able to finish sending its data until the server unpauses, or
at least if it does send the data then the server will ignore it.

If the data is sent via GET (which you would have to set up yourself) then
conceivably the HTTP GET line could be very big and take up lots of
virtual memory.  I rather suspect that servers have a predefined maximum
that they will accept on a single line of the protocol.  In any case the
server is not saving any kind of temporary file when this happens, though
if the entire request where to be logged then the data would go into the
log file (though again I suspect there are maximum sizes defined for the
data being logged).


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

Date: 17 Jul 2000 15:40:02 GMT
From: dguermeur@slb.com.bbs@openbazaar.net (Daniel)
Subject: Metadot Perl portal software server
Message-Id: <3bRGl3$UiP@openbazaar.net>

For those looking for a easy to use Perl free open source poprtal solution
look at Metadot Portal Server.
It features a dashboard, online discussion, content management and more.
It's written in Perl on top of MySQL, mod_perl and Apache.

http://www.metadot.com

--
Daniel


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

Date: 17 Jul 2000 19:30:06 GMT
From: abigail@delanet.com.bbs@openbazaar.net (Abigail)
Subject: Re: metrics again, please read the reformulated question
Message-Id: <3bRMkZ$VWK@openbazaar.net>

Nadim Khemir (nkh@cpen.com) wrote on MMDVIII September MCMXCIII in
<URL:news:396dad1e.0@d2o68.telia.com>:
&& >Can someone point me to some metric scripts ?
&& >MacCabbe
&& >halstead
&&
&& thank to all that send me script converting inches to whatever.
&&
&& The question is " Where can I find SOFTWARE Metrics ?". Mccabe conplexity,
&& halstead volume, fan-in-out,ELOC, ...
&&
&& language used C, C++.
&&
&& or some link to a C/C++ lexer,parser the rest I can manage myself.
&&


And the relevance to Perl is... ?


Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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

Date: 14 Jul 2000 22:20:01 GMT
From: vibrato@my-deja.com.bbs@openbazaar.net (Lance Hoffmeyer)
Subject: multiline & single line reqexp question
Message-Id: <3bPAh1$Wny@openbazaar.net>

Yes, Yes that works.  That you very much.  I now have two other
questions.  I am trying to perform some other regexps as well as this
multiline reqexp and wish to insert another multiline regexp into this
program.  Whenever I add a regexp or another multiline regexp to this
program the first multiline regexp quits working.

Also, I am currently opening a new file to save the changes I make.  How
can I save the changes in the existing file?

Thanks in advance.

Lance


use strict;

opendir(PWD,".") || die "Can't open `.'! $!\n"; my @listofdat =
grep(/\.asc$/,»
 closedir(PWD);

 foreach my $file (@listofdat) {
open(FILE,"<$file")|| die "Can't open `$file'! $!\n"; my $printflag = 1;
open(OUT,">test.new");

 while(<FILE>) {
# s/^COL.*//g            #########stops the program from functioning###
   $printflag = 0 if (/^MACRO/);
    print OUT if ($printflag);
   $printflag = 1 if (/^ENDMACRO/);

#  $printflag = 0 if (/^I:/);   ##########stops program from functioning
#    print OUT if ($printflag);
#   $printflag = 1 if (/^\n/);

               }
close(FILE);
 close(OUT);
 }




In article <lr66q8ptow.fsf@yoda.wg.waii.com>,
  Art Haas <arthur.haas@westgeo.com> wrote:
> Lance Hoffmeyer <vibrato@my-deja.com> writes:
>
> > Using 'while' was exactly what I was doing!  I am still having
problems
> > though.  I am trying the /../ approach but I am still doing
something
> > wrong (probably in opening the file).. Here is my entire code this
time:
> >
> > # Get a list of files to process
> > @listofdat = glob("*.asc");
> >
> > # work on each file
> > foreach $listt (@listofdat){
> > print "$listt \n";
> >
> > #open(IN, "<$listt>");
> >
> > while(<$llist>){
> > print unless /^MACRO/../^ENDMACRO/;
> >
> >
> > #close(IN);
> >            }
> >
> > }
> >
>
> The way you're dealing with the files is wrong. I'd also suggest
> reading the the documentation on opendir(), readdir(), and closedir()
> to avoid glob().
>
> Try something like this ...
>
> $ cat foo.pl
> #!/usr/local/bin/perl
>
> use strict;
>
> opendir(PWD,".") || die "Can't open `.'! $!\n";
> my @listofdat = grep(/\.asc$/, readdir(PWD));
> closedir(PWD);
>
> foreach my $file (@listofdat) {
> 	open(FILE,"<$file") || die "Can't open `$file'! $!\n";
> 	my $printflag = 1;
> 	while(<FILE>) {
> 		$printflag = 0 if (/^MACRO/);
> 		print if ($printflag);
> 		$printflag = 1 if (/^ENDMACRO/);
> 	}
> }
> $ cat foo.asc
> 1
> 2
> 3
> 4
> 5
> MACRO
> a
> b
> c
> d
> e
> ENDMACRO
> 6
> 7
> 8
> 9
> $ perl foo.pl
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> $
>
> Other solutions certainly exist.
>
> --
> ###############################
> # Art Haas
> # (713) 689-2417
> ###############################
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 13 Jul 2000 19:30:13 GMT
From: tadmc@metronet.com.bbs@openbazaar.net (Tad McClellan)
Subject: Re: multiline reqexp question
Message-Id: <3bOGka$UPs@openbazaar.net>

On Thu, 13 Jul 2000 18:03:56 GMT, Lance Hoffmeyer <vibrato@my-deja.com> wrote:
>I wish to remove some multiline text from a file.
>
>MACRO
>text
>text
>text
>ENDMACRO
>
>Basically, I want to remove MACRO, ENDMACRO, and everything in between.
>
>s/MACRO.*ENDMACRO//s
>
>does not work.
 ^^^^^^^^^^^^^

What indicated it's "doesn't workness"?




>The /s should allow . to handle newline characters.  What
>am I missing here?


Do you _have_ multiple lines in $_ ?



> What would make this work?


It works for me:

---------------------------------
#!/usr/bin/perl -w
use strict;

$_ = 'stuff before
MACRO
text
text
text
ENDMACRO
stuff after
';

s/MACRO.*ENDMACRO//s;

print;
---------------------------------


You probably want .*? instead of .* too.

You might also want to remove the newline following the ENDMACRO.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 13 Jul 2000 19:50:05 GMT
From: marc.schaefer@warwick.ac.uk.bbs@openbazaar.net (Marc Schaefer)
Subject: Re: multiline reqexp question
Message-Id: <3bOHNS$W9q@openbazaar.net>

Hi Lance,

Lance Hoffmeyer <vibrato@my-deja.com> writes:

> s/MACRO.*ENDMACRO//s
>
> does not work.

Well, this works for me:

	#!/usr/bin/perl -w
	use strict;

	# Slurp _entire file_ into one scalar
	$_ = do {local $/; <DATA>};

	# Delete _first_ occurance of MACRO ... ENDMACRO
	s/MACRO.*ENDMACRO//s;

	# Output is
	#	blabla
	#
	#	blabla
	print;

	__DATA__
	blabla
	MACRO
	text
	text
	text
	ENDMACRO
	blabla

> What am I missing here?  What would make this work?

The problem is probably in the part of your program that you don't
show us. If you read your file line by line, like in

	while (<DATA>) {
	    s/MACRO.*ENDMACRO//s;
	    print;
	}

you apply the substitution to every line individually - but there is
no line which contains both 'MACRO' and 'ENDMACRO'.

You could apply the substitution to the whole file in one go as I did
in the example above, but then you probably want to use the /g
modifier on your regexp to kill _all_ occurrences of your pattern. The
other solution is processing the file line by line, but using the '..'
operator from perlop:

	#!/usr/bin/perl -w
	use strict;

	while (<DATA>) {
	    print unless /^MACRO/../^ENDMACRO/;
	}

	__DATA__
	blabla
	MACRO
	text
	text
	text
	ENDMACRO
	blabla
 
or shorter

	perl -ne 'print unless /^MACRO/../^ENDMACRO/'

HTH

Best,

Marc


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

Date: 14 Jul 2000 16:10:02 GMT
From: vibrato@my-deja.com.bbs@openbazaar.net (Lance Hoffmeyer)
Subject: Re: multiline reqexp question
Message-Id: <3bP1CQ$Yy1@openbazaar.net>

Using 'while' was exactly what I was doing!  I am still having problems
though.  I am trying the /../ approach but I am still doing something
wrong (probably in opening the file).. Here is my entire code this time:

# Get a list of files to process
@listofdat = glob("*.asc");

# work on each file
foreach $listt (@listofdat){
print "$listt \n";

#open(IN, "<$listt>");

while(<$llist>){
print unless /^MACRO/../^ENDMACRO/;


#close(IN);
           }

}


Any help would be appriciated.

Lance











> Hi Lance,
>
> Lance Hoffmeyer <vibrato@my-deja.com> writes:
>
> > s/MACRO.*ENDMACRO//s
> >
> > does not work.
>
> Well, this works for me:
>
> 	#!/usr/bin/perl -w
> 	use strict;
>
> 	# Slurp _entire file_ into one scalar
> 	$_ = do {local $/; <DATA>};
>
> 	# Delete _first_ occurance of MACRO ... ENDMACRO
> 	s/MACRO.*ENDMACRO//s;
>
> 	# Output is
> 	#	blabla
> 	#
> 	#	blabla
> 	print;
>
> 	__DATA__
> 	blabla
> 	MACRO
> 	text
> 	text
> 	text
> 	ENDMACRO
> 	blabla
>
> > What am I missing here?  What would make this work?
>
> The problem is probably in the part of your program that you don't
> show us. If you read your file line by line, like in
>
> 	while (<DATA>) {
> 	    s/MACRO.*ENDMACRO//s;
> 	    print;
> 	}
>
> you apply the substitution to every line individually - but there is
> no line which contains both 'MACRO' and 'ENDMACRO'.
>
> You could apply the substitution to the whole file in one go as I did
> in the example above, but then you probably want to use the /g
> modifier on your regexp to kill _all_ occurrences of your pattern. The
> other solution is processing the file line by line, but using the '..'
> operator from perlop:
>
> 	#!/usr/bin/perl -w
> 	use strict;
>
> 	while (<DATA>) {
> 	    print unless /^MACRO/../^ENDMACRO/;
> 	}
>
> 	__DATA__
> 	blabla
> 	MACRO
> 	text
> 	text
> 	text
> 	ENDMACRO
> 	blabla
>
> or shorter
>
> 	perl -ne 'print unless /^MACRO/../^ENDMACRO/'
>
> HTH
>
> Best,
>
> Marc
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 14 Jul 2000 16:20:02 GMT
From: arthur.haas@westgeo.com.bbs@openbazaar.net (Art Haas)
Subject: Re: multiline reqexp question
Message-Id: <3bP1P4$XqD@openbazaar.net>

Lance Hoffmeyer <vibrato@my-deja.com> writes:

> Using 'while' was exactly what I was doing!  I am still having problems
> though.  I am trying the /../ approach but I am still doing something
> wrong (probably in opening the file).. Here is my entire code this time:
>
> # Get a list of files to process
> @listofdat = glob("*.asc");
>
> # work on each file
> foreach $listt (@listofdat){
> print "$listt \n";
>
> #open(IN, "<$listt>");
>
> while(<$llist>){
> print unless /^MACRO/../^ENDMACRO/;
>
>
> #close(IN);
>            }
>
> }
>

The way you're dealing with the files is wrong. I'd also suggest
reading the the documentation on opendir(), readdir(), and closedir()
to avoid glob().

Try something like this ...

$ cat foo.pl
#!/usr/local/bin/perl

use strict;

opendir(PWD,".") || die "Can't open `.'! $!\n";
my @listofdat = grep(/\.asc$/, readdir(PWD));
closedir(PWD);

foreach my $file (@listofdat) {
	open(FILE,"<$file") || die "Can't open `$file'! $!\n";
	my $printflag = 1;
	while(<FILE>) {
		$printflag = 0 if (/^MACRO/);
		print if ($printflag);
		$printflag = 1 if (/^ENDMACRO/);
	}
}
$ cat foo.asc
1
2
3
4
5
MACRO
a
b
c
d
e
ENDMACRO
6
7
8
9
$ perl foo.pl
1
2
3
4
5
6
7
8
9
$

Other solutions certainly exist.

--
###############################
# Art Haas
# (713) 689-2417
###############################


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

Date: 11 Jul 2000 13:00:00 GMT
From: jdNOjdSPAM@syncon.ie.invalid.bbs@openbazaar.net (deno)
Subject: Multiple values per key
Message-Id: <3bMRd0$WPa@openbazaar.net>

The following is meant yo update a db, for some reason (which I
cannot figure out) only $dname is being pushed into the database.

Any1 got any ideas.

Thanks.



$mail_sent_total 	= '0';
$mailsent		= '0';
$sendtime		= '0000000000';
$response		= '0';
$mailsys		= 'no_answer';
$recv_time	= '0000000000'


tie %h, 'DB_File', 'DN_Status', O_CREAT|O_RDWR, 0640, $DB_HASH
or die "Cannot open database file: $!\n";

while (<DOMAIN_NAMES>)
	
	{
	
	($dname) = map {s/^\s+//;	# read domain into dname
	s/\s+$//;			# and trim whitespace
	$_} split("\n");
	

 	if (exists $h{$dname}) {print "Record already exists for
= $dname - skipping\n"}
	
else
	
	{
 
	print " \nAdding new record for - $dname\n";
	
	push (@{$h {$dname}}, $mailsent, $sendtime, $response,
$mailsys, $recv_time );

untie %h






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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com


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

Date: 17 Jul 2000 23:10:02 GMT
From: vartekquest@my-deja.com.bbs@openbazaar.net ()
Subject: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <3bRSXR$UeQ@openbazaar.net>

   I want to setup a Linux www server with support for PHP + mod_perl +
SSL, but I haven't been able to compile it succesfully.

   - Firstly I install mySQL
   - then I build PHP
   - then I patch apache with mod_ssl
   - then I patch apache with mod_perl
   - from mod_perl I do: make; make install, but it doesn't compile.
   - then I should change httpd.conf to add support for .php, .php3,
etc. et voila!

   The question is: is it possible to share both PHP, mod_perl and
mod_ssl built on an Apache server? Or is it just plain stupid compiling
mod_perl when you have PHP?

   Has anybody successfully built this config?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 18 Jul 2000 07:46:03 +0200
From: kris@koehntopp.de (Kristian Koehntopp)
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <8l0qur$na$1@valiant.koehntopp.de>

vartekquest@my-deja.com writes:
>   The question is: is it possible to share both PHP, mod_perl and
>mod_ssl built on an Apache server? Or is it just plain stupid compiling
>mod_perl when you have PHP?

This is possible, and in fact Suse Linux is delivered out of the box with
Apache, mod_php, mod_perl and mod_ssl.

Kristian
-- 
"X was designed to run three programs: xterm, xload, and xclock. (The idea
 of a window manager was added as an afterthought, and it shows.)"
	-- Don Hopkins


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

Date: 17 Jul 2000 23:40:02 GMT
From: josh@Jessey.uberlab.bbs@openbazaar.net (josh)
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <3bRTN2$UiR@openbazaar.net>

Yes, I have done this. The way I did it is, Compiled Apache+ssl.
then build php and modperl as DSO's.

oww my cat is biting me. bad kitty, down !

					--josh
					rot13(wbfu@ghytrl.pbz);
 


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

Date: 18 Jul 2000 06:20:03 GMT
From: brian@smithrenaud.com.bbs@openbazaar.net (brian d foy)
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <3bRdh4$Xbr@openbazaar.net>

In article <8l03b1$ho9$1@nnrp1.deja.com>, vartekquest@my-deja.com wrote:

>   The question is: is it possible to share both PHP, mod_perl and
>mod_ssl built on an Apache server?

yes.

> Or is it just plain stupid compiling
>mod_perl when you have PHP?

depends what you want to do.

--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
  <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: 18 Jul 2000 08:10:09 GMT
From: bill.kemp@wire2.com.bbs@openbazaar.net (W Kemp)
Subject: Re: MySQL+Apache+PHP+mod_perl+mod_ssl - Is it possible??
Message-Id: <3bRgaX$SWO@openbazaar.net>

<snip>
>   The question is: is it possible to share both PHP, mod_perl and
>mod_ssl built on an Apache server? Or is it just plain stupid compiling
>mod_perl when you have PHP?


Not stupid, but you might look at how its using memory.
You might look at having different Apache server types on one machine.
One plain, one mod_perl one PHP perhaps?

(Would this be a neopolitan set-up? One vanilla, one strawberry and one
chocolate.)
(PS Neopolitan is a type of ice-cream in case this is not a global concept)


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

Date: 17 Jul 2000 23:20:01 GMT
From: arandachristian@hotmail.com.bbs@openbazaar.net ()
Subject: nasty DESTROY behaviour
Message-Id: <3bRSk1$SOK@openbazaar.net>

Hi All,

When running my OOP program I get the following error:

Uncaught exception from user code:
        DESTROY created new reference to dead object during global
destruction.

When running in the debugger, this error message is displayed once I
hit "q" and quit the debugger.  I assume this is because the garbage
collector is trying to do its magic and clean up, but I have no
evidence of this.

I have never seen this before, and don't even know where to begin to
debug.  Furthermore, it's almost impossible to post the offending code
since I don't know where it occurs.  My only thoughts on debugging are
to quit the debugger at various points and see if the error message is
displayed.

Here is the information I can provide:

WinNT 4.0 SP6a

This is perl, version 5.005_03 built for MSWin32-x86-object
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-1999, Larry Wall

Binary build 522 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 09:52:28 Nov  2 1999

Thanks in advance for any and all help!

CMA


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 17 Jul 2000 23:20:03 GMT
From: elephant@squirrelgroup.com.bbs@openbazaar.net (jason)
Subject: Re: nasty DESTROY behaviour
Message-Id: <3bRSk7$SmI@openbazaar.net>

arandachristian@hotmail.com wrote ..
>When running my OOP program I get the following error:
>
>Uncaught exception from user code:
>        DESTROY created new reference to dead object during global
>destruction.
>
>When running in the debugger, this error message is displayed once I
>hit "q" and quit the debugger.  I assume this is because the garbage
>collector is trying to do its magic and clean up, but I have no
>evidence of this.
>
>I have never seen this before, and don't even know where to begin to
>debug.  Furthermore, it's almost impossible to post the offending code
>since I don't know where it occurs.  My only thoughts on debugging are
>to quit the debugger at various points and see if the error message is
>displayed.

making a few assumptions (like that you don't have a DESTROY sub that
creates any references)

sounds like you've got an AUTOLOAD sub in a module/class that you've
written and you're not checking to make sure that the called sub (in
$AUTOLOAD) is NOT the DESTROY special sub ?

something like

  return if $AUTOLOAD =~ /::DESTROY$/;

near the top of your AUTOLOAD sub should do the trick

or you can create an empty DESTROY sub so that AUTOLOAD will not be
called

  sub DESTROY { }

--
  jason -- elephant@squirrelgroup.com --


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

Date: 17 Jul 2000 23:30:02 GMT
From: sumus@aut.dk.bbs@openbazaar.net (Jakob Schmidt)
Subject: Re: nasty DESTROY behaviour
Message-Id: <3bRTAQ$VyF@openbazaar.net>

arandachristian@hotmail.com writes:

> Uncaught exception from user code:
>         DESTROY created new reference to dead object during global
> destruction.

Global destruction removes objects in a rather blunt way without checking
to see if some of the objects to be removed later on still might use
the object being removed.

Your problem probably arises from a DESTRUCTOR which does something with
other objects being called during global destruction in stead of during
regular garbage collection. This probably happens because you have circular
references in your data structures - something which the garbage collector
currently cannot handle.

For instance you may have a container object which holds references to some
nodes. If the nodes also hold a reference to the container garbage collection
will be defeated. You have to actively break such circles before exiting
the program.

See the section Two-Phased Garbage Collection in perlobj.

--
Jakob


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

Date: 18 Jul 2000 08:00:10 GMT
From: mcnam@my-deja.com.bbs@openbazaar.net ()
Subject: Re: Need advice on converting excel files.
Message-Id: <3bRgO9$UDh@openbazaar.net>

In article <v3Lb5.15$cK2.780@sjc-read>,
  Kirill Sapelkin  <znanie@shell5.ba.best.com> wrote:

> The problem is that xlsHtml fails sometimes on large xls files with a
> lot of text.  Just the sort of thing that I am dealing with.
>
> Can perl help in this regard?  Do I have to upgrade to 5.6?   I have
found a
> package called ole storage.

Do you mean xlHtml from http://www.xlhtml.org/ ? If so this is your best
bet on UNIX. It is derived from OLE::Storage but is much more robust.

On Windows you can also use Win32::OLE.
See
http://www.activestate.com/ActivePerl/docs/faq/Windows/ActivePerl-Winfaq
12.html and
http://www.activestate.com/ActivePerl/docs/site/lib/Win32/OLE.html


John McNamara
--
Try before you die()


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3718
**************************************


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