[19017] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1212 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 28 18:05:33 2001

Date: Thu, 28 Jun 2001 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)
Message-Id: <993765913-v10-i1212@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 28 Jun 2001     Volume: 10 Number: 1212

Today's topics:
    Re: Basic Questions about Locking a DBM (dave)
        can't get sort(@array) to work <vrdoljak@uclink.berkeley.edu>
    Re: can't get sort(@array) to work <vrdoljak@uclink.berkeley.edu>
        converting shell "sort" command to perl.. <perler@yahoo.com>
    Re: converting shell "sort" command to perl.. (Anno Siegel)
    Re: converting shell "sort" command to perl.. <uri@sysarch.com>
        Create unique file in dir? (Craig Berry)
    Re: error making Archive::Zip (Gururaj Upadhye)
    Re: error making Archive::Zip <bart.lateur@skynet.be>
    Re: expression match help <greg_j_miller@agilent.com>
    Re: Highlight message in DOS <jnurick@zdnetonebox.com>
    Re: how can i get the output of a forked child? <ren@tivoli.com>
    Re: How do I spawn an xterm executing another program a (Roland Giersig)
        How to run SUN perl script in HP-UX? <jniu@visteon.com>
    Re: How to run SUN perl script in HP-UX? (Tad McClellan)
    Re: How to run SUN perl script in HP-UX? <bart.lateur@skynet.be>
        I need some functions from Ingperl translated to DBI (O <czajko@ocas.on.ca>
        Lincoln D. Stein's HTTPD user manage script (Gururaj Upadhye)
    Re: lvalue functions <nospam-abuse@ilyaz.org>
    Re: New knowledgebase site - looking for authors, artic (Tony L. Svanstrom)
        New To Perl--Regex Question (JR)
    Re: Newbie question: What's the opposite of chop? <ren@tivoli.com>
    Re: Overlapping regular expression results <uri@sysarch.com>
    Re: Overlapping regular expression results (Craig Berry)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Jun 2001 13:12:17 -0700
From: usted@cyberspace.org (dave)
Subject: Re: Basic Questions about Locking a DBM
Message-Id: <e2c00ae.0106281212.eeb275c@posting.google.com>

open (DBLOCK, "$db_lock") or bail("Cannot open lock file $db_lock
$!");
flock(DBLOCK, LOCK_EX); 

#dbmopen, tie, save the world here, but most likely:
#open something 
#write to it
#close it

close (DBLOCK) or bail("Can't close size file $db_lock $!");
flock(DBLOCK, LOCK_UN);

So the basic idea is that you have a blank file that everybody locks
on to take turns writing to the 'real' file that you are trying to
protecto from concurrent access.

dbmopen calls tie() now anyway so don't worry about it being
deprecated

good luck with everything,

dave


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

Date: Thu, 28 Jun 2001 13:56:38 -0700
From: Gordon Vrdoljak <vrdoljak@uclink.berkeley.edu>
Subject: can't get sort(@array) to work
Message-Id: <3B3B9A05.2A499542@uclink.berkeley.edu>

Hello,
I can't seem to get sort to work in the code fragment below.  It always pops up
on the cgi form in the key order rather than the ascii sorted order.  The array
in question is @matlist below.
Anyone have some suggestions what I'm missing?  Is cgi doing something weird to
the ordering of the array?
Gordon

code fragment----------------------
# try reading in materials.txt for part of the form
# materials.txt has form- "material","price","unit"
open (MAT, "materials.txt");
while (<MAT>)
        {
                my @materials = split(/,/,$_);
                foreach $item (@materials)
                        { # get rid of the silly quotes
                                $item =~ s/"//g;
                        }
                chomp @materials;
 
                # now lets make a hash of all the information - keys are item
desc (unit)
                # combine together the name and unit to make it easier to read
                # on the form
                $mat{"$materials[0] ($materials[2])"} = $materials[1];
        }
close (MAT) || die "can't close materials.txt: $!";
 
@matlist = keys %mat; # created this array for use in the scrolling list
@matlist =
sort(@matlist);                                                                         
 
print header, start_html( "-title" => "EML Store", -bgcolor => "white" ),
h3("EML shopping");
print start_form;
print ("<img src=ucberkeley-logo3.gif>");
 
print p("Please input First Name: ", textfield("first_name"));
print p("Please input Last Name: ", textfield("last_name"));
print scrolling_list
(
        -NAME => "material",
        -VALUES => \@matlist,
        -SIZE => 10,
        -MULTIPLE => 0, # 1 for true, 0 for false
);                                      















-- 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Gordon Ante Vrdoljak                                  Electron Microscope Lab
ICQ 23243541   http://nature.berkeley.edu/~gvrdolja   26 Giannini Hall
vrdoljak@uclink.berkeley.edu                          UC Berkeley
phone (510) 642-2085                                  Berkeley CA 94720-3330
fax   (510) 643-6207 cell (510) 290-6793


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

Date: Thu, 28 Jun 2001 14:02:40 -0700
From: Gordon Vrdoljak <vrdoljak@uclink.berkeley.edu>
Subject: Re: can't get sort(@array) to work
Message-Id: <3B3B9B70.E310E902@uclink.berkeley.edu>

Never mind...
it works....
The funky thing was that I was looking at a local copy through my web browser
rather than the file I was editing on the main server...

Gordon Vrdoljak wrote:
> 
> Hello,
> I can't seem to get sort to work in the code fragment below.  It always pops up
> on the cgi form in the key order rather than the ascii sorted order.  The array
> in question is @matlist below.
> Anyone have some suggestions what I'm missing?  Is cgi doing something weird to
> the ordering of the array?
> Gordon
> 
> code fragment----------------------
> # try reading in materials.txt for part of the form
> # materials.txt has form- "material","price","unit"
> open (MAT, "materials.txt");
> while (<MAT>)
>         {
>                 my @materials = split(/,/,$_);
>                 foreach $item (@materials)
>                         { # get rid of the silly quotes
>                                 $item =~ s/"//g;
>                         }
>                 chomp @materials;
> 
>                 # now lets make a hash of all the information - keys are item
> desc (unit)
>                 # combine together the name and unit to make it easier to read
>                 # on the form
>                 $mat{"$materials[0] ($materials[2])"} = $materials[1];
>         }
> close (MAT) || die "can't close materials.txt: $!";
> 
> @matlist = keys %mat; # created this array for use in the scrolling list
> @matlist =
> sort(@matlist);
> 
> print header, start_html( "-title" => "EML Store", -bgcolor => "white" ),
> h3("EML shopping");
> print start_form;
> print ("<img src=ucberkeley-logo3.gif>");
> 
> print p("Please input First Name: ", textfield("first_name"));
> print p("Please input Last Name: ", textfield("last_name"));
> print scrolling_list
> (
>         -NAME => "material",
>         -VALUES => \@matlist,
>         -SIZE => 10,
>         -MULTIPLE => 0, # 1 for true, 0 for false
> );
> 
> --
> \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
> Gordon Ante Vrdoljak                                  Electron Microscope Lab
> ICQ 23243541   http://nature.berkeley.edu/~gvrdolja   26 Giannini Hall
> vrdoljak@uclink.berkeley.edu                          UC Berkeley
> phone (510) 642-2085                                  Berkeley CA 94720-3330
> fax   (510) 643-6207 cell (510) 290-6793

-- 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Gordon Ante Vrdoljak                                  Electron Microscope Lab
ICQ 23243541   http://nature.berkeley.edu/~gvrdolja   26 Giannini Hall
vrdoljak@uclink.berkeley.edu                          UC Berkeley
phone (510) 642-2085                                  Berkeley CA 94720-3330
fax   (510) 643-6207 cell (510) 290-6793


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

Date: Thu, 28 Jun 2001 20:53:39 +0200
From: Patrick Erler <perler@yahoo.com>
Subject: converting shell "sort" command to perl..
Message-Id: <Xns90CED48AB1F6Dfuyyehcesyrdx@62.153.159.134>

hello!

i have a small shell script which sorts log files for me.. from the usenet 
i got a sort command to do it once, i never tried to understand what it 
does (and i wasn't that interrested in it anyway) it just worked...

now i want to convert the script to perl, no big problem, but this command 
i just don't get converted:

sort -k 4.9b
,4.13n -k 4.5b,4.7M -k 4.2b,4.3n -k4.14b,4.15n -k 4.17b,4.18n -k 
4.20b,4.21n 

what it sorts is a simple apache log like this:
213.83.52.132 - - [28/Jun/2001:20:29:43 +0200] "GET / HTTP/1.0" 200 3392 
"-" "check_http/1.32.2.6 (netsaint-plugins 1.2.9-4)"


ok, i could call the shell but i really would like to do it in perl...

could someone have look, please?

thanks in advance...

-- 
PAT


vcard/LDAP/PGP: http://dresden-online.com/perler/identity.html
PGP fingerprint: DAC6 2FDA 1ED7 AD55  BD1F 5142 3D5F 72BF
Yahoo-ID: perler - http://jpager.yahoo.com/jpager/messenger.html


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

Date: 28 Jun 2001 19:34:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: converting shell "sort" command to perl..
Message-Id: <9hg0s4$njg$1@mamenchi.zrz.TU-Berlin.DE>

According to Patrick Erler  <perler@yahoo.com>:
> hello!
> 
> i have a small shell script which sorts log files for me.. from the usenet 
> i got a sort command to do it once, i never tried to understand what it 
> does (and i wasn't that interrested in it anyway) it just worked...
> 
> now i want to convert the script to perl, no big problem, but this command 
> i just don't get converted:
> 
> sort -k 4.9b
> ,4.13n -k 4.5b,4.7M -k 4.2b,4.3n -k4.14b,4.15n -k 4.17b,4.18n -k 
> 4.20b,4.21n 
> 
> what it sorts is a simple apache log like this:
> 213.83.52.132 - - [28/Jun/2001:20:29:43 +0200] "GET / HTTP/1.0" 200 3392 
> "-" "check_http/1.32.2.6 (netsaint-plugins 1.2.9-4)"
> 
> 
> ok, i could call the shell but i really would like to do it in perl...
>
> could someone have look, please?
 
I suppose you are best off using the sort command as is.  Whatever it
does, it looks like a rather complex comparison routine that would
take some effort to implement and more effort to make fast (hi Uri).
Moreover, sort uses temp files to reduce memory load when the file
gets big.  Apache logs do that.

I'd open a command pipe to the external sort and read the log from
there.  

Anno


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

Date: Thu, 28 Jun 2001 19:55:24 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: converting shell "sort" command to perl..
Message-Id: <x7y9qc8jma.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  >> sort -k 4.9b
  >> ,4.13n -k 4.5b,4.7M -k 4.2b,4.3n -k4.14b,4.15n -k 4.17b,4.18n -k 
  >> 4.20b,4.21n 
 
  AS> I suppose you are best off using the sort command as is.  Whatever it
  AS> does, it looks like a rather complex comparison routine that would
  AS> take some effort to implement and more effort to make fast (hi Uri).
  AS> Moreover, sort uses temp files to reduce memory load when the file
  AS> gets big.  Apache logs do that.

i agree. if it works with the sort util, and it is has complex fields
like that, stick with what works. the overhead of a fork is likely to be
nothing compared to a sort of a large log file.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Thu, 28 Jun 2001 20:37:42 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Create unique file in dir?
Message-Id: <tjn5cm42nfgafd@corp.supernews.com>

Anybody have suggestions on how to create a unique file in a directory,
possibly obtaining an open filehandle to it in the process?  (Obviously, I
could open it as a separate step, but doing both in one process would be
an optimization).  I don't care about the details of the name.  Obviously,
race conditions between separate processes trying to do this must be
avoided.  Any suggestions?

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Magick is the art and science of causing change in conformity
   |   with Will."  - Aleister Crowley


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

Date: 28 Jun 2001 12:58:13 -0700
From: gururaj@powertec.com (Gururaj Upadhye)
Subject: Re: error making Archive::Zip
Message-Id: <23c54ab6.0106281158.7cb66d69@posting.google.com>

I tried using DPM but I am getting error for that also. Here it goes
D:\shared\Download>dpm install archive-zip-0.11.zip
Error: Don't know how to install archive-zip-0.11.zip
Making TOC
DONE
When I do dpm query, this module is not listed.

I have installed all modules manually so far and never had any
problem. I am having problem for this one, xml expat, archive-tar,
etc. They have one thing in common, system[some bathfile].... which is
failing.

Thanks

Bart Lateur <bart.lateur@skynet.be> wrote in message news:<i7fkjtccr6j6ip2b8k803mboofesvcaopf@4ax.com>...
> Gururaj Upadhye wrote:
> 
> >I tried installing PPM and it needs expat and though I am able to
> >compile that, I am not able to install PPM. Is there any other way I
> >can install the package?
>  
> >> >I am getting following error while making Archive::Zip. I am working
> >> >on Windows NT 4.0, perl 5.6.0. THis is from output of perl -v
> >> >This is perl, v5.6.0 built for MSWin32-x86-multi-thread
> 
> I don't get it. What brand of Perl are you using? If you're using
> Activestate's ActivePerl, then PPM should already be on your system. If
> using IndigoPerl, this one offers an equivalent alternative, called DPM,
> and with a web interface called VPM.
> 
> You should never have to install it yourself.


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

Date: Thu, 28 Jun 2001 21:31:28 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: error making Archive::Zip
Message-Id: <os6njt4rtj89jr2klkit7l0rcndo670ke9@4ax.com>

Gururaj Upadhye wrote:

>I tried using DPM but I am getting error for that also. Here it goes
>D:\shared\Download>dpm install archive-zip-0.11.zip
>Error: Don't know how to install archive-zip-0.11.zip
>Making TOC
>DONE
>When I do dpm query, this module is not listed.

DPM only recognizes .PPM files and .TAR.GZ archives. I don't know
exactly what is in Archive::Zip... Could this ZIP contain just those
two? Extract them, and try again. Do not decompress the .tar.gz file.

Be sure that it is compiled for the version you're using. A module with
a DLL compiled for 5.005 will NOT work on 5.6. It will only crash.

I've tried installing the module directly using the browser interface,
on IndigoPerl 5.6.0, from
<http://www.activestate.com/PPMpackages/5.6plus/>, but it didn't work.
Apparently the PPM file format is slightly changed so DPM chokes on it.

So here's what *did* work:

Download the file
<http://www.activestate.com/PPMpackages/5.6plus/MSWin32-x86-multi-thread/Archive-Zip.tar.gz>.
Save it in a temp directory. I made a directory called
"local_repository" in my perl root directory, next to the "bin", site",
"lib", "html" etc. directories that were already there.

I got the file Archive-Zip.ppd from the parent directory from the URL
above, reduced it in a text editor to

<SOFTPKG NAME="Archive-Zip" VERSION="0,11,0,0">
  <IMPLEMENTATION>
    <CODEBASE HREF="Archive-Zip.tar.gz" />
    <ARCHITECTURE NAME="MSWin32-x86-multi-thread" />
    <OS NAME="MSWin32" />
  </IMPLEMENTATION>
  <ABSTRACT>Provide an interface to ZIP archive files.</ABSTRACT>
  <TITLE>Archive-Zip</TITLE>
  <AUTHOR>Ned Konz (perl@bike-nomad.com)</AUTHOR>
</SOFTPKG>

and save it next to the above archive file under the original name.

Next, I launched PerlConsole, went to "GUI Package Manager", selected
local repository, which, under the default settings, will find
Archive-Zip. Select it, click "install", and you'll get what you want in
a few seconds.

Using DPM should work to, I hope, if you chdir to local_repository, and
at the DOS prompt, type

	DPM install Archive-Zip

(not tested).

This was my test script:

    use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
    my $zip = Archive::Zip->new();
    $member = $zip->addString( 'This is a test', 'stringMember.txt' );
    $member = $zip->addFile($0);
    $zip->writeToFileNamed('someZip.zip') == AZ_OK or die 'write error';

I got a valid ZIP file. So it must have installed properly.

-- 
	Bart.


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

Date: Thu, 28 Jun 2001 12:41:34 -0700
From: Greg Miller <greg_j_miller@agilent.com>
Subject: Re: expression match help
Message-Id: <3B3B886E.D8F43C40@agilent.com>



Prarie Dawn wrote:

> Stepping away from regex, is it an option to simply match the first =
>
> ... since this will always be the assignment op?
>

I can't be guaranteed there is an equal sign...sometimes I'm parsing an
entire equation and sometimes I'm parsing a part of an equation...makes
it a bit tricky...

-Greg





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

Date: Thu, 28 Jun 2001 19:34:41 +0100
From: John Nurick <jnurick@zdnetonebox.com>
Subject: Re: Highlight message in DOS
Message-Id: <j3umjt0bntl7ljhc0ngu5ign57ptef59bn@4ax.com>

On Wed, 27 Jun 2001 15:48:31 -0400, "Anthony" <hoa@nortelnetworks.com>
wrote:

>My perl script run on WinNT which prints out messages to DOS prompt when
>errors were occurred. I want to highlight some keywords in the messages. If
>anyone knows what are the special characters to turn on/off highlight or
>change color in DOS prompt?

It's not a DOS prompt but an NT command prompt; they are quite
different under the surface. There's some rather discouraging
information in articles Q101875 and Q98730 at
http://search.support.microsoft.com/kb/c.asp.

--
John

$q[$qq++]=$_ for unpack q[a] x 16, q[ acehJklnoPrstu];
$qq = sub{print qq[...$q\n]}; $q.= $q[$_] for map hex,
unpack"a"x29,q{89D010B3170A3B7041263B01D0177}; &${qq};


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

Date: 28 Jun 2001 13:09:05 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: how can i get the output of a forked child?
Message-Id: <m3ofr8tr26.fsf@dhcp9-173.support.tivoli.com>

On 28 Jun 2001, tsv.werbung@web.de wrote:

> I tries the following code-snippet:

[snipped and replaced below with modifications]

> and it worked fine.  I now want the father to collect the output of
> the childs. (In reality the forked childs are shellscripts which
> will get executed by Net::Telnet->cmd() on many different hosts,
> preferable in parallel.)
> 
> By now, the childs create a file /tmp/tmp$$ and the father wait()s
> for all his childs to die. I would like to avoid using these
> files...

Use pipe().

Note that I've commented out the reading of list in favor of using
DATA for this example.  I've also added strictures and warnings and
made the necessary change of "my $pid".

#!/bin/perl                    
#                                                                
# A full parallel cat...                                         
use strict;
use warnings;

my @handles;
                
#open (LIST, "<$ARGV[0]") or die "Can't open file";
                
#while(<LIST>){      
while(<DATA>){
        pipe my $rh, my $wh or die "Could not create pipe, $!\n";
        if(my $pid = fork){
                # parent here
                close $wh;
                push @handles, $rh;
                next;
        } elsif (defined $pid){
                # child here
                close $rh;
                print $wh $_;
                exit;
        } else {
                die "Can't fork, father stopped";
        }
}
#close LIST;
print <$_> for @handles;
__DATA__
One
Two
Three
__END__

-- 
Ren Maddox
ren@tivoli.com


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

Date: 28 Jun 2001 14:36:36 -0700
From: RGiersig@cpan.org (Roland Giersig)
Subject: Re: How do I spawn an xterm executing another program and then interact with the executed program with Expect.pm
Message-Id: <717195e0.0106281336.2738d5bd@posting.google.com>

keith@aztek-eng.com (Keith) wrote in message news:<8683bf68.0106151259.f0fac1c@posting.google.com>...
> This is what I want to do:
> Run a perl script from one xterm that execs another xterm and then automates 
> the program running in the new xterm using Expect.pm module.

Why do you want to spawn a xterm?  Why not spawning the program directly?
If you are trying to automate a X application that pops up a window
with buttons and menues and the stuff, sorry, this won't work.

> Expect normally works with programs that read from standard input or 
> /dev/tty and xterms don't read their input in this manner; therefore , I 
> believe something fancy has to be done with the IO::Pty module and the xterm
> '-S' option to get the Perl program with Expect.pm and the external xterm
> application communicating.
> 
> I am relatively proficient in perl with Expect.pm, but my understanding of pseudo
> terminals, pty, tty, ... is limited.  Can anyone help?

Let me give you an overview:  a xterm also spawns a program (most of
the time a shell), and whatever that program produces on stdout or stderr
is drawn into the xterm frame using X commands.  When the user types
a key on the keyboard, this event is translated and sent to the spawned
program via stdin.  When you normally run a program inside a xterm,
then you type the programs name and <Return>.  This gets sent to the
shell, which in turn spawns that program and also connects its stdin/out/err
with the xterm.  Then the shell withdraws into the background and waits
until the program has finished running.  When you run an Expect script
that in turn spawns a program, the Expect script stays in between
and handles stdin/out/err of the spawned program.  By using 'interact',
Expect also withdraws into the background and lets the user, well, interact
directly with the program, until the escape sequence is seen.  Then
it takes over again.

Hope this helps,

Roland
--
RGiersig@cpan.org


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

Date: Thu, 28 Jun 2001 16:06:50 -0400
From: Jean Niu <jniu@visteon.com>
Subject: How to run SUN perl script in HP-UX?
Message-Id: <3B3B8E5A.FDA48423@yahoo.com>

I got a perl script that written by perl 5.0.0.4 on Sun. It works fine
on SUN.
But now, I need run it on HP-UX 11.00, I have perl 5.0.0.4 on HP as
well.
But when I run it, it failed. through out many syntax errors.

Do you have any ideas how can I run it HP? Do I need to change any code?


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

Date: Thu, 28 Jun 2001 16:31:00 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to run SUN perl script in HP-UX?
Message-Id: <slrn9jn504.mj6.tadmc@tadmc26.august.net>

Jean Niu <jniu@visteon.com> wrote:
>I got a perl script that written by perl 5.0.0.4 on Sun. It works fine
>on SUN.
>But now, I need run it on HP-UX 11.00, I have perl 5.0.0.4 on HP as
>well.
>But when I run it, it failed. through out many syntax errors.
>
>Do you have any ideas how can I run it HP? 


We cannot help you fix syntax errors when we can see neither the
syntax nor the error messages!

We are not psychic.


>Do I need to change any code?


Yes, syntax errors are a show stopper.

But you haven't shown the messages that you are getting, so they
may not even be syntax errors. Can't tell if we can't see the
message text.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 28 Jun 2001 21:49:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How to run SUN perl script in HP-UX?
Message-Id: <mf9njt0aldm69dfv3jv0n1l47orh0kk6b9@4ax.com>

Jean Niu wrote:

>I got a perl script that written by perl 5.0.0.4 on Sun. It works fine
>on SUN.
>But now, I need run it on HP-UX 11.00, I have perl 5.0.0.4 on HP as
>well.
>But when I run it, it failed. through out many syntax errors.
>
>Do you have any ideas how can I run it HP? Do I need to change any code?

It's 5.004. But anyway, if this is indeed (roughly) the same perl
version, you shouldn't have any syntax errors. The only thing that could
happen is that certain modules are missing. But that's not the case, is
it? There's not an error like"Cannot find Foo/BAr.pm in @INC (@INC
contains ...)" or similar?

Are you indeed even sure you're using the ame perl version? Is the
shebang line pointing to the correct version of perl? It could be
pointing to a perl4 executable, for example. Try a simple script like

	print "Perl version: $]\n";

-- 
	Bart.


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

Date: Wed, 27 Jun 2001 18:17:41 GMT
From: "Daniel Czajko" <czajko@ocas.on.ca>
Subject: I need some functions from Ingperl translated to DBI (Oracle)
Message-Id: <GFLpnK.DA6@alfalfa.utcs.utoronto.ca>

I am currently in the process of migrating some Ingperl code to run on an
Oracle DB.  So I have been translating Ingperl functions to DBI (Oracle).
There are few functions/variables that I haven't been able to find.   Those
functions/variables in Ingperl are:

$sql_version(read only)

$sql_sqlcode(read only)

Does anyone know what their equivalent in DBI (Oracle) is?

Thanks a lot




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

Date: 28 Jun 2001 13:10:40 -0700
From: gururaj@powertec.com (Gururaj Upadhye)
Subject: Lincoln D. Stein's HTTPD user manage script
Message-Id: <23c54ab6.0106281210.6c6e39b3@posting.google.com>

I have set this on windows NT, with mod perl. The behaviour is very
unusual. The first, 3rd, 5th, (odd) access to the script result in
user name and password prompt page to be displayed. At this point if I
hit the browser's back button and try again, the operation is
successful. This has puzzled me a lot and I donot have any solution
for this. Thanks for your help.

Thanks and regards,
-Gururaj.


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

Date: Thu, 28 Jun 2001 19:44:43 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: lvalue functions
Message-Id: <9hg1fb$1d33$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to

<nobull@mail.com>], who wrote in article <u97kxwzfnd.fsf@wcl-l.bham.ac.uk>:
> > 	sub func  { $private }
> > 	sub func= { $private = shift }

> How about the following syntax?

>   use LvalueSubWithSeperateFetchAndStoreMethods func => {
>     FETCH => sub { $private },
>     STORE => sub { $private = shift },
>   };

Why do you discuss syntax where semantic would not work?  Remember
cryptocontext?

Ilya


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

Date: Thu, 28 Jun 2001 21:57:03 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: New knowledgebase site - looking for authors, articles or tips about Perl
Message-Id: <1evql4j.9lbgip16k0ucqN%tony@svanstrom.com>

KBaseonline.com <info@kbaseonline.com> wrote:

> I assure I do not have any funding whatsoever and I have undertaken the
> entire project with out of pocket costs.   I am not looking for fame and
> glory but rather a place where people can go to read about the industry
> and current technology.

There are lots of places like those already available, some that can do
more than you because they have founding and some because they already
have a lot of people doing work for them... Why make it harder for
people to find a single good source of information by competing with
them, when you could, if you wanted to do something, simply create your
own portal?


        /Tony
-- 
the truth is dead, faith is gone, reality killed... ruled by the plastic
laws of modern life we're pushed towards the hell of personal doubt,
betrayal, hate, lust and murder... the now has become an illusion, a
paradise of a dead tomorrow... (c)2000-2001 tony@svanstrom.com


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

Date: 28 Jun 2001 14:05:53 -0700
From: tommyumuc@aol.com (JR)
Subject: New To Perl--Regex Question
Message-Id: <319333f5.0106281305.1ee0c0fb@posting.google.com>

I'm new to Perl, so please forgive this very simple question.  I'm
trying to figure out what type of regular expression to 'grab' several
lines of data and push them into an array.  For instance, if I have a
file that has the following and the pattern I want to find is
"pattern":

line 1                   #pattern not found (single line)
line 2                   #pattern not found (single line)
line 3  "pattern....     #pattern found     (multiple lines)  
line 4  ..........."     #the pattern is not on this line, but because
it
                          is on the previous line and that line spans
several
                          lines, I want all subsequent lines to match
until
                          the next pattern for which I am searching is
found.

For example, if I'm trying to match the word dog (and include data
through to the next occurance of where information for dog is not
found (which would be four lines down, where the 'z' is, in this
instance):

1) xxxxxxxxxxxxxxxxxxxxxxxxxx
2) yyyyyyyyyyyyyyyyyyyyyyyyyy
3) dog
   ddddddddd
   dddddddddd
   ddddddddddd
4) zzzzzzzzzzzzzzzzzzzzzzzzzz

The data I am trying to match against is separated by line numbers, as
above, so that should make it easier, but I haven't found a way to
make it work, as of yet.  Listed below is the code that I have
created, which almost works.  Any advice anyone could offer would be
greatly appreciated.  Thank you very much.


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

my ( @getdata, $getdata, @holddata, $holddata, @file_reference,
@date_submitted,
        @type_of_change, @state_code, @county_code, @area, @mcd_place,
@political_desc, @desc_of_change, @date_of_change, @additional_info,
@junkData,
         $area, $mcd_place, $getdata2, @temp, $temp, @make_dp,
$make_dp, $junkData );

open(GOOD,"dps_cluttered.txt") || die "Cannot open new_dps.txt: $!";
@getdata = <GOOD>;
chomp @getdata;
close ( GOOD );

foreach $getdata ( @getdata ) {
   undef $/;
   if ( $getdata =~ /File Reference/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /Date Submitted/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /Type of Change/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /State-code/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /County-code/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /Area/ ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /MCD-place/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /Political Desc./i ) {
      push ( @make_dp, $getdata )
   }
   elsif ( $getdata =~ /Desc. of change/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /Date of change/i ) {
      push ( @make_dp, $getdata );
   }
   elsif ( $getdata =~ /Additional Info/i ) {
      push ( @make_dp, $getdata );
   }
   else {
      push ( @junkData, $getdata );
   }
}

foreach $make_dp ( @make_dp ) {
   print "$make_dp\n";
   if ( $make_dp =~ /\(11\)/ ) {
      print "\t---\n\n";	#provide break at last line of DP
   }
}

--JR


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

Date: 28 Jun 2001 12:53:00 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Newbie question: What's the opposite of chop?
Message-Id: <m3sngktrsz.fsf@dhcp9-173.support.tivoli.com>

On 28 Jun 2001, rwellum@irp-view5.cisco.com wrote:

> I did get syntax errors with some of the recommendations:
> 
> For example:
> 
>        print DAT  "$_\n" foreach @raw_data;

The for(each) modifier was added in... 5.005 I believe.

> and:
> 
> 	{
>  	    local $" = "\n";
> 	    print DAT "@raw_data\n";
> 	}

Hmm... that should work in pretty much any version of Perl 5.  In Perl
4, local required parens (as did lots of other built-ins).  You aren't
using Perl 4 are you?!

> and:
> 
>         print DAT "$_\n" for @raw_data;

The for(each) modifier again.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 28 Jun 2001 18:34:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Overlapping regular expression results
Message-Id: <x766dga1ye.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  AS> According to  <nobull@mail.com>:
  >> bernard.el-hagin@lido-tech.net (Bernard El-Hagin) writes:
  >> 
  >> > push @found, $1 while $seq =~ /(?=(.ctctc))/g;
  >> 
  >> OK, how come that works?  By rights it should be an infinite loop.
  >> 
  >> Looks to me like as well as the visible value of pos() there's also a
  >> hidden flag saying the last match was zero-width and that another zero
  >> with match starting at pos() should be ignored.  DWIM gone mad!

  AS> I think it's a common practice (if not a necessity) for a regex
  AS> engine to take care that a zero-width match doesn't match in the
  AS> same place again.

it is documented that pos will be incremented by at least one even if
nothing or just a zero width matched. this is just for this case to stop
infinite loops. it makes sense.

in perlre look for this section header:

	Repeated patterns matching zero-length substring

the text following is poorly written (and even a warning claims that!)
and complex. but the idea is to allow loops on zero width matches
without infinite loops.

this part covers the /g issue some:

	The higher level-loops preserve an additional state between
	iterations: whether the last match was zero-length.  To
	break the loop, the following match after a zero-length
	match is prohibited to have a length of zero.  This
	prohibition interacts with backtracking (see the section on
	Backtracking), and so the second best match is chosen if the
	best match is of zero length.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Thu, 28 Jun 2001 21:37:57 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Overlapping regular expression results
Message-Id: <tjn8tlfir23g15@corp.supernews.com>

David Pratt (pratt@biop.ox.ac.uk) wrote:
: I'm trying to get _all_ the matches to a regular expression in my string
: including the 'overlapping ones'.  For example :
: 
: If my string is $seq = 'attctctctcggata'
: and my reg-ex is /.ctctc/
: 
: i'd want to get both examples of tctctc, i.e. _tctctc_tc and tc_tctctc_.
: the _'s indicating the found strings.

  $seq   = 'attctctctcggata';
  $re    = qr/.ctctc/;
  @found = $seq =~ /(?=($re))/g;

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Magick is the art and science of causing change in conformity
   |   with Will."  - Aleister Crowley


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

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


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