[6431] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 56 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 5 16:27:19 1997

Date: Wed, 5 Mar 97 12:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 Mar 1997     Volume: 8 Number: 56

Today's topics:
     Re: [Q] Extract a regex (Jeffrey)
     Re: `date` equivalent in win32 perl (Phil Hanna)
     ActiveWare user having problem with "use vars"... is th <eryq@enteract.com>
     Can I test scripts on Windows 3.1? (Pan Tofli)
     cgi file upload utility <cbusch@member.com>
     Chopping lines? (Ted Timmons)
     Re: Creating NonExisting File with Perl <charliew@atlml1.attmail.com>
     Help me please <postmaster@www.reymond.ch>
     Re: How can I use #! w/o knowing where perl lives? (Casper H.S. Dik - Network Security Engineer)
     Re: How to convert tab delimited file to space delimite (Markus Laker)
     Installing Perl for Win32 <dmills@riag.com>
     Is this correct? lpa@sysdeco.no
     Knowing the pid of a fork()'ed child, really <mccrory@fnal.gov>
     libwww 5.07 DESTROY.al <jeffs@pop3.silverplatter.com>
     mathematically correct? (Thomas A. Loser)
     Re: NT 4.0 Perl 5 (Ben Thompson)
     Re: Passing more than one array <tchrist@mox.perl.com>
     Re: Passing more than one array <forster@hq.rnp.br>
     Re: perl man pages (Greg Ward)
     Re: Perl script for displaying last update date on a si (A. Deckers)
     Re: perl TCP/IP server <basole@uiuc.edu>
     persistence in perl <cbusch@member.com>
     Re: putting a text comment space (Tad McClellan)
     Re: Regex and Greedy for words (Jeffrey)
     SERVE UP A FILE - ** it works now! Heres the script for <stevek@unidial.com>
     SERVE UP A FILE - What's wrong with my script? <stevek@unidial.com>
     Splitting a very large file <tor@kmd.dk>
     Re: Subroutine Source? <tchrist@mox.perl.com>
     unix perl <--> Oracle NT / Boston area perl consultants cdagdigian@genetics.com
     Re: URGENT! Please Help!  I don't wanna get fired! <wkuhn@uconect.net>
     Re: Where is FAQ? (David Combs)
     Re: wild cards and models searching ? <jander@ml.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 05 Mar 1997 16:09:54 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: Vegard Bakke <vegardb@knoll.hibu.no>
Subject: Re: [Q] Extract a regex
Message-Id: <JFRIEDL.97Mar6010954@tubby.nff.ncl.omron.co.jp>


[mail and post]

Vegard Bakke <vegardb@knoll.hibu.no> wrote:
|> I would like to "move" the matching pattern from a regex in
|> a string to a new variable.
|> 
|> Lets use the three first random cahacters as an example ( /^.{3}/ ).
|> $OrgStr="1234567890";
|> $NewStr="";
|> In this example I would like the result to be:
|> $OrgStr="4567890";
|> $NewStr="123";
|> 
|> This is just an example. I after a solution that does this with
|> any regex. (Not only /^.{3}/.)

Is there anything wrong with
	$OrgStr =~ s/(...regex...)//;
	$NewStr = $1;
?

(If regex has backreferences, they have to be updated to account for the
 additional outer parens).

	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/


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

Date: Wed, 5 Mar 1997 14:57:30 GMT
From:  (Phil Hanna)
Subject: Re: `date` equivalent in win32 perl
Message-Id: <331e8776.4146578@newshost.unx.sas.com>

On Tue, 04 Mar 1997 21:09:55 -0500, Charlie Wu <charwu@ibm.net> wrote:

>how do i get the system date on the PC? i want the result which is
>equivalent to the unix `date +%m-%d-%y`

Try this approach:

sub getDate {
   ($dd, $mm, $yy) = (localtime)[3, 4, 5];
   # Note - month is 0=Jan,1=Feb,etc.
   return sprintf("%02d-%02d-%02d", $mm+1, $dd, $yy);
}

Using built-in perl functions where possible gets around portability
problems.  Don't backtick even on Unix unless you have to and/or you
aren't worried about porting.
Phil Hanna (saspeh at unx dot sas dot com)
Econometrics and Time Series R&D
SAS Institute, Inc.


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

Date: Wed, 05 Mar 1997 10:38:08 -0600
From: Eryq <eryq@enteract.com>
Subject: ActiveWare user having problem with "use vars"... is this normal?
Message-Id: <331DA170.65717B4B@enteract.com>

One of the MIME::Lite users is using the ActiveWare port of
5.003, and was tripped up by the line:

	use vars qw($VERSION);

They got a message like:

	Can't locate vars.com at @INC at c:\perl5\lib\MIME/Lite.pm 
		line 131

To which I say... hunh?  Is there some reason this line shouldn't
be working for them under 5.003?  I *could* change MIME::Lite to say:

	$MIME::Lite::VERSION = blah blah blah

instead of the "use vars" approach, but I thought I'd ask
to see if anyone knows what's going on, and maybe what
advice I should give users who contact me with this kind
of problem...
 
-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Check out STREETWISE, Chicago's newspaper
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 5 Mar 1997 11:57:23 -0500
From: pyz@panix.com (Pan Tofli)
Subject: Can I test scripts on Windows 3.1?
Message-Id: <5fk8lj$t13@panix.com>

I just saw this thread on one of the Perl Newsgroups.  Did anyone offer a
reply?  If so, is there a module which you can use on a Win3.1/DOS box to
test Perl scripts and where would it be available?

Thanks!

Max
pyz@panix.com



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

Date: Wed, 05 Mar 1997 11:21:47 -0600
From: Chris Busch <cbusch@member.com>
Subject: cgi file upload utility
Message-Id: <331DABAB.29F6@member.com>

Has anyone written an upload file cgi utility that can support both
binary and text files?

I am working on one in Perl, but it adds an anyone CR/LF at the
beginning and end of some files.

Please reply directly with any suggestions

--
Chris 
cbusch@geocities.com

PS I can post what I am working on if anyone is interested.


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

Date: 4 Mar 1997 19:02:48 GMT
From: tedder@e-zone.e-z.net (Ted Timmons)
Subject: Chopping lines?
Message-Id: <5fhrko$hbi@work2.e-z.net>

I'd like to chop long lines so that they are around 70 characters. I
don't need to worry about long/short line pairs (from having, say,
90-character lines) because of the application.

Right now, I'm using something like this:

$data equals some long string
$data1 = substr ($data,0,70);
$data = substr ($data, 70);
print out $data1, start over (more or less)

The problem is it doesn't chop on word breaks. I've tried using a regexp
with s/.*\W(\w+)/$1/; and several other combinations, but it doesn't
like non-alphanumerics, like (, #, and more. Does anyone have any
suggestions?

--
-=TED=-         O-      JAPH
tedder@mailzone.com  


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

Date: Wed, 05 Mar 1997 11:37:12 -0500
From: Charlie Wu <charliew@atlml1.attmail.com>
Subject: Re: Creating NonExisting File with Perl
Message-Id: <331DA138.3462@atlml1.attmail.com>

Arnout Symoens wrote:
> 
> Following problem :
> 
> I'm writing a little CGI in perl (works perfectly..). But one of the
> things I need is to create a none existing new file (a new one for
> each new user). I can't do this with the open command, which will die
> when I open a none existing file..
> 
> Ok, how do I create a new file from within perl ? It's running on an
> UNIX server...Would this mean I have to send an UNIX command like ? If
> yes, what command ? I can't find one..
> 
> On the other hand..It's probably me, not noticing which powerfull
> command Perl has hidden somewhere for me to create a file ...
> 
> Anyone can help me out with this one...Source (small) wouldl be
> appreciated..
> 
> Thank you,
> Arnout Symoens
> Student somewhere and somehow...
> Aegir@mail.dma.be

in unix you can do a 'touch filename' to create a new file.

so for example you want to create a unique file you would do

perl -e '`touch abcd.$$`'

hope that helps.
-- 
Charlie Wu
http://www.impactsite.com/charliew/
Web Applications Developer/Consultant
AT&T, Atlanta, Georgia


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

Date: Wed, 05 Mar 1997 16:12:32 +0100
From: Cedric Schwartz <postmaster@www.reymond.ch>
Subject: Help me please
Message-Id: <331D8D60.6214@www.reymond.ch>

Hi guys,

I have never used perl and I don't know very much about cgi...

All I want to do is executing a program from  a client station.

The command-line to execute this program is : control.exe ims.cpl (for
example)

So, is it possible to execute this kind of thing with a browser ?

Hope to hear from you soon.

Thanks

Ced
-- 
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//////////////////////////////
 \\     Librairie-Papeterie    Tel.: +41 32 722 12 12   //
  \\    REYMOND S.A.           Fax : +41 32 722 12 13  //
   \\   St-Honore 5                                   //
    \\                     postmaster@www.reymond.ch //
     \\ 2000 NEUCHATEL     http://www.reymond.ch    //                 
      \\\\\\\\\\\\\\\\\\\\\\\////////////////////////


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

Date: 5 Mar 1997 16:22:50 GMT
From: Casper.Dik@Holland.Sun.COM (Casper H.S. Dik - Network Security Engineer)
Subject: Re: How can I use #! w/o knowing where perl lives?
Message-Id: <casper.857579143@uk-usenet.uk.sun.com>

"Paul H. Hargrove" <hargrove@sccm.Stanford.EDU> writes:

>I am currently working on a perl script that needs to run on a few 
>different UN*X systems (with perl versions 4 and 5) on which I have
>accounts.  Unfortunately the perl interpreter is located in different
>directories on different systems.  My home directory is different on
>different systems so using a symbolic link to the interpreter won't work
>either (since I don't have a consistent place to put it).  I am
>currently using the following method:


My pet trick is:

#!/usr/bin/env perl

which find perl in your $PATH, "env" is standard and the PATH /usr/bin
should work everywhere (if not, /bin/env will work)

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.


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

Date: Wed, 05 Mar 1997 16:41:05 GMT
From: mlaker@contax.co.uk (Markus Laker)
Subject: Re: How to convert tab delimited file to space delimited file
Message-Id: <5fk7pm$fh0$1@newsserver.dircon.co.uk>

"Jack L. Owens" <jlowens@ptconnect.infi.net> writes:

> I have several tab delimited ASCII files that I need to convert to fixed
> length space delimited fields.

Here's some code I wrote a while back to do the job.  It's currently
configured for comma-delimited files, but you can change that just by
altering the value of $delimiters.  It finds the optimal width for
each column, then outputs the converted file and prints the columns
used to stdio.

There are three things you should know about this code:

1. It relies on being able to hold the entire file in memory twice
over.

2. It comes in the form of a DOS batch file, though with a little
topping and tailing it becomes a normal Perl source file.

3. I was a Perl neophyte when I wrote it.  If I had to do the job
again it would come out rather different.  In particular, I haven't
tried it with -w.

With those caveats, here's the code:

@perl -x %0.bat %1 %2
@goto end

#!perl

# This program takes a comma-delimited file and outputs it in
# columnated form.

# The line below says that the fields are delimited by commas.
# Change it as necessary.

$delimiters = ",";

# Check args and open files.

die "Usage: $0 inputfile outputfile\n" unless $#ARGV == 1;
open IN,  $ARGV[0]	or die "Can't open $ARGV[0]: $!\n";
open OUT, ">$ARGV[1]"	or die "Can't open $ARGV[1]: $!\n";

# Read in the file.  Determine the max length of each field.

for (@data = <IN>)
{	for (0 .. split /$delimiters/o)
	{	$ell = length $_[$_];
		$len[$_] = $ell if $len[$_] < $ell;
	}
}

# Create a sprintf() format string and use it to output
# the columnated data.

$fmt = join ' ', map "%-${_}s", @len;
print OUT map {sprintf $fmt, split /$delimiters/o} @data;

# Print the column settings we used.

print "Columns ", join(', ', map {($sum += $_+1) - ($_+1)} @len),
"\n";

__END__

:end


[Mailed and posted]


Markus Laker



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

Date: Wed, 05 Mar 1997 13:03:28 -0800
From: Daniel Mills <dmills@riag.com>
Subject: Installing Perl for Win32
Message-Id: <331DDFA0.35CB@riag.com>

Has anyone installed the Perl port for Win32 systems done by ActiveWare?
I've downloaded their binary and unzipped it but when I run the 
install.bat file, I get this error:

"Can't locate NT.ph in @INC <did you run h2ph> at install.bat line 36"

I've attached the bat file if anyone cares to take a look.  I've also 
confirmed that the NT.ph file does exist and looks ok

Thanks,
Dan.

=========================================================
Dan Mills						
RIAG
dmills@riag.com
---------------------------------------------------------
The opinions expressed here are those of the author only.
Sorry to be so uncreative here but I'm just too busy (or
slow) to do anything about it.
=========================================================


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

Date: Wed, 05 Mar 1997 09:11:37 -0600
From: lpa@sysdeco.no
Subject: Is this correct?
Message-Id: <857574413.7513@dejanews.com>



self explanatory:

sub new {
    my $name_or_ob = shift;
    my $class = ref{$name_or_ob} ||  $name_or_ob;
    my $self = {};
    $self->{NAME} = undef;
    $self->{COMPONENTS} = [];
    bless($self,$class);
}

sub add_component {
    my $self = shift;
    if (@_) { push(@{ $self->{COMPONENTS} }, @_)
    return @{ $self->{COMPONENTS} };
}

do you see anything wrong with the second method?
Other suggestion?

Luca

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 05 Mar 1997 09:14:19 -0600
From: Elliott McCrory <mccrory@fnal.gov>
Subject: Knowing the pid of a fork()'ed child, really
Message-Id: <331D8DCB.43E7@fnal.gov>

perl 5.0003 qeustion under Solaris 2.4/2.5 (SPARC).

fork() returns the pid of the child to the parent.  I need the pid for a
status file which I must maintain for similar processes.  The trouble is
that exec() does not *always* make the process run under the same pid #
as what the fork returns.  For example, if you do `exec("some-process
2>errorlog")` (which is exactly the sort of thing I need to do,
otherwise the STDERR messages from some-process get spewed around the
system), exec() recognizes the ">" shell metacharacter and says "sh -c
some-process 2>errorlog" (in this case), creating a new pid number. 
MOST of the time, the pid is "fork() + 1", but some of the time it is
"fork()+2", and some (rarer) time, "fork()+3", and probably so on.

How can I deal with this so that the parent process really knows what
the pid of the process is that I need?  I have a workaround now that
when "fork()+1" is not found, it tries "fork()+2", but is still fails if
the pid goes to "fork()+3".

-- 
Elliott S. McCrory, Ph. D.	| mccrory@fnal.gov
Fermi National Accelerator Lab	| http://www-linac.fnal.gov/~mccrory
MS 307, PO Box 500		| Phone: 630-840-4808
Batavia, IL  60510		| FAX: 630-840-8590


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

Date: Wed, 5 Mar 1997 16:33:51 GMT
From: Jeff Seifer <jeffs@pop3.silverplatter.com>
Subject: libwww 5.07 DESTROY.al
Message-Id: <331DA06F.457F6CF4@pop3.silverplatter.com>

How come when I create a request object like:

my $method        = "POST";
my $request       = new HTTP::Request $method; 

I get the following error at the end of my program:
Can't locate auto/LWP/UserAgent/DESTROY.al in @INC      (in cleanup) 

DESTROY.al is NOT there - I just installed LWP 5.07 and got the same
error.  My program works fine, it's just an annoying message to get at
the end of the script...  Anyone know how to fix this???

-- 
jeff -  http://jeffs.silverplatter.com


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

Date: Wed, 05 Mar 1997 12:40:21 -0500
From: tloser@valdemar.microserve.com (Thomas A. Loser)
Subject: mathematically correct?
Message-Id: <tloser-0503971240210001@168.133.124.5>

  The PERL (camel) book gives an example for selecting a random line
from a file of unknown length with a single pass through the file:

  (paraphrased from page 246) 

  "This procedure selects a line at random from a file, using just
one pass over the file and without knowing in advance the number of
lines. It works by calculating the probability that the current line
would be selected with a probability of 100%, but the second line 
has a 50% chance of replacing the first one, the third line a 33%
chance of replacing one of the first two, and so on."

  srand;
  rand($.) < 1 && ($it = $_) while <>;
  


  I'm no math genius but if I assume just 3 lines it appears that line
2 will replace line 1 once every other time (1 out of 2) and line 3
will replace 1 *or* 2 every third time (1 out of 3) leaving line 1 as
the selected line just 1 out of every six times. (1/2 + 1/3 = 5/6
chance of line 1 being replaced). Is my logic faulty or does this 
routine heavily favor lines later in the file? I'm attracted to its
simplicity but not if it's way skewed.

  -Tom Loser

-- 
imagine a world with no hypothetical situations

All opinions expressed here are mine and only mine - but you are welcome to borrow them if you like


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

Date: Wed, 05 Mar 1997 14:01:22 GMT
From: ben@mendip.com (Ben Thompson)
Subject: Re: NT 4.0 Perl 5
Message-Id: <331d7c3e.19381945@snews.zippo.com>

Yes,

It comes in three varieties Perl , a perl extension for IIS (with an
annoying foible of automatically sending the content type header) and
Perl Script for Active Server pages.

All three versions can be got from www.activeware.com

yours,

Ben Thompson
---
Given enough time I would have a web site. 
Unfortunately, I have to let my work speak for itself.


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

Date: 5 Mar 1997 15:22:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Passing more than one array
Message-Id: <5fk33h$na6$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Antonio Paulo Salgado Forster <forster@hq.rnp.br> writes:
:I need to pass more than one array to a subroutine, but I'm not sure about
:the best way to do it...

The best way is the way documented in the perlsub man page
in the section entitled "Pass by Reference".

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


Travel important today; Internal Revenue men arrive tomorrow.


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

Date: Wed, 5 Mar 1997 11:32:04 -0300
From: Antonio Paulo Salgado Forster <forster@hq.rnp.br>
Subject: Re: Passing more than one array
Message-Id: <Pine.SOL.3.95.970305112534.18475A-100000@colibri.hq.rnp.br>

Hello all!

I just would like to thank all the people that helped me with this
reference stuff :)

Antonio Paulo Forster

--

Antonio Paulo Salgado Forster  
Operacoes em Redes - RNP




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

Date: 5 Mar 1997 18:23:39 GMT
From: greg@bic.mni.mcgill.ca (Greg Ward)
Subject: Re: perl man pages
Message-Id: <5fkdnb$6kr@sifon.cc.mcgill.ca>

SRI (ss51@columbia.edu) wrote:
: I installed perl5.003 on a HP 9000/712. I did a 'man perl' and it shows

: PERL(1)                                                            
: PERL(1)
:                           Release 4.0 Patchlevel 36
: .......

: This seems to be for the 4.0 version. But I checked /usr/local/man/man1
: and /usr/local/lib/perl5/man/man3 and they all are brand new. Where are
: the old man pages hiding? Also there are two executables 'perl' and
: 'perl5.003' in /usr/local/bin. Are they the same?

Try "man -w perl" or "man -W perl" (or "man man" if neither of these
work) -- most versions of man use -w to tell you where they're finding
the man page they're showing you.  If that doesn't work, check your
MANPATH variable, or RTFM on man to see what it searches by default --
probably you have a crusty old Perl lurking in there somewhere.
(Happens to all of us, it seems.)

        Greg

--
Greg Ward - Research Assistant              greg@bic.mni.mcgill.ca
Brain Imaging Centre (WB201)                 voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute                fax: (514) 398-8948
Montreal, Quebec, Canada  H3A 2B4


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

Date: 5 Mar 1997 18:28:24 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: Perl script for displaying last update date on a site?
Message-Id: <slrn5hreq9.g8g.Alain.Deckers@nessie.mcc.ac.uk>

In <synfony-2602972350050001@slip129-37-242-214.ca.us.ibm.net>,
	John H. Ghadimi <synfony@netbox.com> wrote:
>
>Hi;
>I'm looking for a shareware/freeware script that performs the following task:
>
>I need to be able to poll all the files on a web site and determine the
>most recent revision/creation date.  Then I need to have that date be
>displayed on the bottom of the main page.  The ouput will be in the format
>of "This site was last revised on <the polled date>".  I was able to come
[...]

Have a look at Randal Schwartz's home page:

  <URL:http://www.stonehenge.com/merlyn/>

You'll find a link to his "what's new" script.

It doesn't do *exactly* what you want, but you should be able to modify
it without too much effort.

HTH,
-- 
Alain.Deckers@man.ac.uk          <URL:http://www.man.ac.uk/%7Embzalgd/>


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

Date: Wed, 05 Mar 1997 12:07:15 -0600
From: Milind Basole <basole@uiuc.edu>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl TCP/IP server
Message-Id: <331DB653.274C@uiuc.edu>

many thanks for putting the fix out. the new multithreaded version
runs on Sun0S 5.5, but i can't get it to run on DEC OSF1 4.0
running on a DEC Alpha. is there anything specific that needs to be
tweaked to get it to run on the DEC?

secondly, would you have an example of bidirectional communication (the 
server sees what the client is saying and sends out a msg accordingly)
example somewhere? i need that for a specific purpose rather urgently 
and am quite clueless as to how that could be done.

please help!

thanks.
milind basole
basole@uiuc.edu


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

Date: Wed, 05 Mar 1997 09:24:59 -0600
From: Chris Busch <cbusch@member.com>
Subject: persistence in perl
Message-Id: <331D904B.2CB0@member.com>

I am wondering if anyone patched perl so it has persistence.

For example, perhaps a function called "savestate".  This function would 
create a file that could then be used to restart the process in the
exact same state.  The file should be 100% portable to other platforms
(or at least to other machines running the same OS).

savestate("filename") 
  returns:
     0 - just awoke
     1 - saved ok
    -1 - not supported
    -2 - cannot save state since there are files open
    -3 - unknown failure


So an example in psuedo code would be:

 $ret = savestate("mystate.bin");
 if( $ret > 0 ) { 
   print "state saved to mystate.bin resume with perl -R mystate.bin\n";
   exit(0);
 }elsif( $ret < 0) {
   print "Could not save state, received an error code of $ret.\n";
   exit(-1);
 }
 ####$ret == 0 so must of awake
 print "good morning :) \n";


I have just read a portion of DDJ's March issue on agents. See
http://www.ddj.com for details.  If perl had this, we could make perl 
agents. =^)

--
Chris Busch 
cbusch@member.com
Member Services International


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

Date: Wed, 5 Mar 1997 10:21:14 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: putting a text comment space
Message-Id: <qh6kf5.d72.ln@localhost>

James (hydrotmp@tcac.com) wrote:
: How would I go about putting in a textarea for a comment section at the 
: bottom of this form.  I would like it to have four or five lines 
: available.
: I have tried but all has failed.
: This is my .html
  ^^^^^^^^^^^^^^^^

But this is the *perl* newsgroup.

Please don't make off-topic postings.

HTML questions should be asked in the HTML newsgroup:

comp.infosystems.www.authoring.html



[ snip a bunch of non-perl related stuff]


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 05 Mar 1997 16:34:24 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: yoosh@cs.UAlberta.CA (Yoo-Shin Lee)
Subject: Re: Regex and Greedy for words
Message-Id: <JFRIEDL.97Mar6013424@tubby.nff.ncl.omron.co.jp>


[mail and post]

Yoo-Shin Lee <yoosh@cs.UAlberta.CA> wrote:
|> $a="from the text book and from bill smith v. woolco where";
|> 
|> I want to replace:
|> 	"bill smith v. woolco"
|> with:
|> 	"<>bill smith v. woolco<>".
|> 
|> Using:
|> 	"s/(from|in)\s+(.*?) v. (.*?) where/\1 <>\2 v. \3<> where/g;
|> 	
|> Unfortunately, I'm getting:
|> 	"<>the text book and from bill smith v. woolco<>"
|> 
|> How do I match from the 2nd "from" ?

Is it ``the 2nd from'' from which you want to match, or is that you
don't want to match any "from" or "in" other than the one that begins
the match?

I suspect the latter, so I'd suggest:

  s{
      \b(from|in)\s+

      ## now want to match stuff that doesn't include "from" or "in"
      (
	#`stuff' can include:
	(?:
	   (?!\b(?:from\b|in\b)) # So long as it's not "from" or "in"...
	    .                    # ...a non-newline byte.
        )*?
      )
      \ v\.\ #
      ((?:(?!\b(?:from\b|in\b)).)*?) # (same as above)
      \ #
      where\b

  }{$1 <>$2 v. $3<> where}xg;


The

	(?:
	   (?! ...regex...))
	    .   
        )*

pattern is pretty useful, although really ugly to look at.
There are ways to optimize it, but then it gets a lot more ugly.


BTW, some things to note about your original:
|> 	s/(from|in)\s+(.*?) v. (.*?) where/\1 <>\2 v. \3<> where/g;

\1, etc., are regex metacharacters. The replacement string is a string,
not a regex, so you can't use them there. Use $1 and the like.

Don't forget that . is a metacharacter, so to match "v.", use /v\./.

|> please email answers to me yoosh@cs.ualberta.ca

I have, but it's rude to ask w/o special needs (such as your news provider
not offering the group). If you're asking others to spend their time to help
you, spending a bit of your own time to read them is the least you can do.

	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/


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

Date: Wed, 05 Mar 1997 12:02:16 -0500
From: Steve Karr <stevek@unidial.com>
Subject: SERVE UP A FILE - ** it works now! Heres the script for all! **
Message-Id: <331DA718.3EB9@unidial.com>

Wow! Was I stressed! I [finally] got the dern thing to work
and since I'm now in such a good mood, I wanna share the script
(naturally).  

Want force a download/'save as' of a file insted of having it
viewed in the browser window?  Just install this script and supply
the filename in the url like this:

http://yourserver.com/cgi-bin/download.cgi?/filetodownload.doc

download.cgi
--------------------------------

#!/perl/perl5/perl.exe  -w -T


$name = $ENV{'QUERY_STRING'};

print "Content-Type: application/octet-stream\n";
print "Content-Disposition: inline;filename=$name\n\n";


&readFileContents;

exit 0;



sub readFileContents {

        local($/) = undef;
	open (FILE, $name) || die "Cannot open file for input";
	binmode (FILE);
        binmode (STDOUT);
        select (STDOUT);
        $| = 1;
	print <FILE>;
	close(FILE);
                     }



------------------------------------------------------
Steve Karr - Internet Services Coordinator
UniDial Communications, Inc.    http://www.unidial.com
Voice (502) 244-6666 ext. 1147    Fax   (502) 244-6222
E-mail: stevek@unidial.com


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

Date: Wed, 05 Mar 1997 10:57:19 -0500
From: Steve Karr <stevek@unidial.com>
Subject: SERVE UP A FILE - What's wrong with my script?
Message-Id: <331D97DF.55E3@unidial.com>

Hi all...

Ok, this works partially.  The point is to download a file from
the server w/o the computer illiterate client having to right click
and 'save as...'.  The netscape save as box pops up fine with the
right filename [finally], and the download begins, ends, and the
file is saved locally.  Great.  BUT, the files contents seem to be
slightly corrupted. WHY, oh, WHY??  Example, I downloaded a word 97
doc and when I try to run it, word crashes.  I tested it on a .gif,
and the gif is garbled.  I analyzed the .gif contents and it appeared
to be about 2 bytes longer after downloaded than on the guys machine
I d/led it from.  Hmmm.  Anyone have a better way to spit out a binary
files contents than I've got here?  Thanks!  (FYI: running Netscape
Enterprise server in house on WinNT with Win95 clients)

- Steve




#!/perl/perl5/perl.exe  -w -T

$name = $ENV{'QUERY_STRING'};

print "Content-Type: application/octet-stream\n";
print "Content-Disposition: inline;filename=$name\n\n";

&readFileContents;

exit 0;

sub readFileContents {

        local($/) = undef;
	open (FILE, $name) || die "Cannot open file for input";
	binmode(FILE);
	print <FILE>;
	close(FILE);
	exit;
                     }

# That's it!


------------------------------------------------------
Steve Karr - Internet Services Coordinator
UniDial Communications, Inc.    http://www.unidial.com
Voice (502) 244-6666 ext. 1147    Fax   (502) 244-6222
E-mail: stevek@unidial.com


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

Date: Wed, 05 Mar 1997 16:13:55 +0100
From: Torfinn =?iso-8859-1?Q?K=E5ringen?= <tor@kmd.dk>
Subject: Splitting a very large file
Message-Id: <331D8DB3.733F@kmd.dk>

Hope anybody can help.

I won't to split one file containing from 1 to very many edifact 
interchanges, into one file for each interchange.

>From my point of view does an edifact look like this:
UNA+xxxxxx'text..'UNZxxx' or UNB+xxxxxx'text..'UNZxxx'
so the file i wan't to split look something like this:
UNBxxx'text...'UNZxxx'UNBxxx'text......'UNZxxx'UNAxxx'UNBtext....'UNZxxx'
just one long string and the files i wan't to split it into
will look like this.
file1: UNBxxx'text...'UNZxxx'
file2: UNBxxx'text......'UNZxxx'
file3: UNAxxx'UNBtext....'UNZxxx'

I treid something like this:

while (<FILE>) {
         @segm = split(/'/);
         foreach (@segm) {
         $msg .= $_ . "'";
         if (/^UNZ/) {
           open(OUTFIL,">$uniqufilename") || die "Cannot open file";
           print(OUTFIL $msg);
           close(OUTFIL);
           $msg = '';
         }
     }
}

this works as long as the FILE is less than a few MB

Hope for an answer

Torfinn


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

Date: 5 Mar 1997 15:24:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Subroutine Source?
Message-Id: <5fk372$na6$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, jreed@itis.com (Jason Red) writes:
:Is there any way, in the middle a script, to see the perl code associated
:with a subroutine? (particularly if the sub was defined in the middle of
:an eval?)

Nope.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Patriotism is the virtue of the vicious."
 - Oscar Wilde


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

Date: Wed, 05 Mar 1997 10:11:29 -0600
From: cdagdigian@genetics.com
Subject: unix perl <--> Oracle NT / Boston area perl consultants?
Message-Id: <857578048.10086@dejanews.com>

I've written a large number of perl scripts and CGI's (running on DEC
Alpha's w/ Digital Unix) that are used to analyze or play with cDNA
sequences.

I now find myself in a position where some of my perl scripts are going to
have to communicate their results to an Oracle database that will probably
be sitting on an NT platform.

The more I read about the various Oracle/Perl modules the more I get
confused... it also seems that most of the solutions are aimed at
situations where Perl, the scripts and the Oracle database are all
resident on the same machine.

Any recomendations or pointers to resources that deal with using perl to
communicate with Oracle *across a network* would be greatly appreciated.

On a similar note, I would welcome contact from any New England area
consultants who have experience in this area.

regards,
Chris Dagdigian, cdagdigian@genetics.com
Genetics Institute
Cambridge, MA US

--
Spam me at your own risk.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 05 Mar 1997 09:47:25 -0500
From: Bill Kuhn <wkuhn@uconect.net>
To: stevek@unidial.com
Subject: Re: URGENT! Please Help!  I don't wanna get fired!
Message-Id: <331D877D.3D61E95B@uconect.net>

This is a CGI question, not a perl question.

You should post your question to the appropriate newsgroup.

But I will give you a hint on how to solve you problem:

Don't write CGI programs to duplicate the efforts of a properly
configured web server.

-Bill

-- 
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com


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

Date: Wed, 5 Mar 1997 16:46:57 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: Where is FAQ?
Message-Id: <dkcombsE6KxAA.I45@netcom.com>

In article <5fhajh$8ko$3@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>
>But yes, it's being worked on quite hard right now.  It'll be in like
>10 or 12 different sections.  Prelimary copies of about half of the sections
>have been posted to the perl-porters list for comment, so you could look
>at the mailing list archive or its mail-2-news gateway if you'd like to see
>what we're doing.

But please do also have a version all in one piece, for easy downloading
and printing-out.

Thanks!



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

Date: 05 Mar 1997 14:46:55 +0000
From: Jim Anderson  <jander@ml.com>
Subject: Re: wild cards and models searching ?
Message-Id: <wkb67z6gzvk.fsf@swapsdvlp15.i-did-not-set--mail-host-address--so-shoot-me>

Procaccia Jehan <jehan@inapg.inra.fr> writes:

> Hello
> 
> I have written a perl script to manage personal directory over the WEB.
> I want users to be able to use "*" in their search.
> For example "Name=gat*" .

Try  "Name=gat.*" instead.

> Unfortunatly in the above example the result will list me all names
> strating with "ga" and not "gat*" :-). The latest letter always disepear
> in my search script.
> 
> I use cgi-lib.pl to parse the query string. Here is the code:
> 
> &ReadParse(*input);  get the query string
> $inname=lc($input{'name'}); get the name parameter
> $inname=~ s/\*/ /; here I substitute the * caracter
> open(FL,"/webroot1/httpd/cgi-bin/intra/file_annu.txt"); open the flat
> text database
> while (<FL>) {
> 	($name,$prenom,$email)=split(/:/); cut fields
> 	$namel=lc($name); lower case the search
> if ($namel=~ /^$inname/ ) HERE IS THE BUGGY TEST! WHY ?
> 
> Why this test is always true even if $namel is "ga" and $inname is "gat"

-- 
Jim Anderson			jander@ml.com
Consultant-at-large		jander@jander.com
				(212) 449-1598


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

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 V8 Issue 56
************************************

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