[13322] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 732 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 7 16:07:23 1999

Date: Tue, 7 Sep 1999 13:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 7 Sep 1999     Volume: 9 Number: 732

Today's topics:
    Re: advise please with input buffering and flock proble <peter@tienderen.demon.nl>
        Apache + Perl + Authorisation <jjyooi@yahoo.com>
    Re: Apache + Perl + Authorisation (Bill Moseley)
        Building XS under Windows (Bill Moseley)
    Re: case for open lang on win32 - fill in the table <ehpoole@ingress.com>
    Re: Data structure for Dynamic Use of CGI.pm? <makkulka@cisco.com>
    Re: Filter <aqumsieh@matrox.com>
    Re: Help! Newbie can't see print error in code <huang2@andrew.cmu.edu>
    Re: How can i unlink some files?? <aqumsieh@matrox.com>
    Re: How can two Perl programs exchange data directly? (Eric Bohlman)
    Re: How do I delete apostraphe from a string? (James R. Goodfriend)
    Re: How do I delete apostraphe from a string? <aqumsieh@matrox.com>
    Re: is our reese the author of mysql book? (Greg Bacon)
    Re: large dataset problem <makkulka@cisco.com>
    Re: mysql interview (Greg Bacon)
    Re: mysql interview (Greg Bacon)
    Re: perl mail filter? (Greg Bacon)
        Perl->Time->Milliseconds curtisbeard@my-deja.com
    Re: Please help a newbe <rhomberg@ife.ee.ethz.ch>
    Re: Please help a newbe (Eric Bohlman)
    Re: Please help a newbe (Larry Rosler)
    Re: Problem with <!--#exec cgi=/scripts/script.pl%22--> <ehpoole@ingress.com>
    Re: Regular Expressions <aqumsieh@matrox.com>
    Re: Subscribing to p5p <gnat@frii.com>
    Re: teen angst. <Joe.Kline@sdrc.com>
    Re: test, please ignore (Abigail)
    Re: test (Abigail)
    Re: Unix Trouble <neil@pacifier.com>
    Re: using code written in C (anyone know about stemming (Bill Moseley)
    Re: Want to use PERL to run script on another server. (Abigail)
    Re: Writing Oracle SQL for DBD-Oracle? <bshow@my-deja.com>
    Re: writing to a file within a loop (Abigail)
    Re: Y2K bugs on the Internet <aqumsieh@matrox.com>
    Re: Y2K bugs on the Internet <bshow@my-deja.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 7 Sep 1999 21:49:40 +0200
From: "Peter van Tienderen" <peter@tienderen.demon.nl>
Subject: Re: advise please with input buffering and flock problem
Message-Id: <936733493.24253.0.pluto.d4ee06f0@news.demon.nl>

Thanks Larry,  the problem seems to persist . (I skipped a few lines too
many in the previous message, the seek/truncate was there already - sorry..)
Peter

Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.123de7c3230298ac989f1c@nntp.hpl.hp.com...

> Your conjecture about the problem seems wrong.  You are writing the new
> data at the end of the file, not over the original data.  So the second
> process is reading the original first line, which is still there.
>
>   seek DUB, 0, 0 or die ...
>
> after the read and before the write.  You might also want to truncate
> the file to zero length after the seek, in case the new record is
> shorter than the old one.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com




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

Date: Tue, 07 Sep 1999 18:50:21 GMT
From: Tuxedo Loopy <jjyooi@yahoo.com>
Subject: Apache + Perl + Authorisation
Message-Id: <7r3mp7$upc$1@nnrp1.deja.com>

Hello all. I've got a query (it's not a major problem, but I'd sure
appreciate some help.)	Here's the scoop:

I use Apache to serve a local website (until I get it working completely, I
won't put it up)  and I've used it to protect a directory (foo) using the
 .htaccess file and user files. Now I have user details which are needed to be
entered in the resource box otherwise you can't enter. Fine. No problem. What
I'd like to do is keep an separate account for each user. I've been thinking
about using the cgi-bin directory to store the account files, but I need to
find out via a perl script who the current user is and maybe what the
password is. Can anyone help or suggest a possible script? I still consider
myself a rookie at this. ;-)

--
Tuxedo Loopy
------------
jjyooi@yahoo.com
http://www.geocities.com/Tokyo/Bay/5879


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 7 Sep 1999 12:28:02 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Apache + Perl + Authorisation
Message-Id: <MPG.123f07206373b100989714@nntp1.ba.best.com>

Tuxedo Loopy (jjyooi@yahoo.com) seems to say...
> ...but I need to
> find out via a perl script who the current user is and maybe what the
> password is. Can anyone help or suggest a possible script? I still consider
> myself a rookie at this. ;-)

Apache will set an environment variable to indicate the user (if access 
is via .htaccess).  CGI.pm provides a method to get this, too.

Can't get the password unless you read the .htpasswd file manually, 
AFAIK.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Tue, 7 Sep 1999 12:25:20 -0700
From: moseley@best.com (Bill Moseley)
Subject: Building XS under Windows
Message-Id: <MPG.123f06764996f6989713@nntp1.ba.best.com>

Ok, now I'm wondering if I can build XS modules under Windows.  I'm 
using ActiveState's perl.  I thought I read someplace that I need to use 
the same libraries to build perl as I used to build any XS modules.  Is 
that correct?

So, do I need to build my own perl?  If so, do I have to reinstall all 
the modules I've installed?

I've got MingW32 gcc and make (using Cyg-win BASH shell).


Just in my little attempts:

BASH.EXE-2.02$ perl Makefile.PL
Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck] [-
nolinenumb
ers] [-s pattern] [-typemap typemap]... file.xs
Writing Makefile for Mytest


BASH.EXE-2.02$ gcc -v
Reading specs from D:\UNIX\BIN\..\lib\gcc-lib\i386-mingw32\2.95\specs
gcc version 2.95 19990728 (release)

BASH.EXE-2.02$ make -v
GNU Make version 3.77, by Richard Stallman and Roland McGrath.

BASH.EXE-2.02$ perl -v

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 519 provided by ActiveState Tool Corp. 
http://www.ActiveState.com
Built 09:50:30 Aug 12 1999



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Tue, 07 Sep 1999 14:58:06 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: case for open lang on win32 - fill in the table
Message-Id: <37D5603E.D4B6D288@ingress.com>

Jason Kohlhoff wrote:
> 
> I have something to add...
> 
> You Perl guys are all full of "open" shit...
> 
> I doubt you could write a script for a Windows machine that could not be
> done(possibly even better) with WSH and VBS, or JS.

Who's full of s**t? 

Even though I am biased toward NT (though I maintain several Linux machine
and program for Linux and FreeBSD as well), at least most of us "Perl
guys" have far more open minds.

It often isn't about whether or not a script could be written marginally
better for a specific platform, Perl is about being able to write a script
of fairly substantial complexity that will run on nearly ANY platform with
little to no need to rewrite the code.  It is flexible, powerful, and
extremely portable and has a very large base of supporting modules and
applications.

Now try to do that in WSH, VBS.  JS comes the closest, but it is still a
fairly infant language with a lot of bugs still left to be worked out and
comparatively sparse applicactions and ready-made modules and doesn't
offer a whole lot over Perl even under the best of circumstances.  So far
JS hasn't been everything it was hyped-up to be.  That said, it is only a
few years old and still has plenty of time to catch up -- most languages
take time to mature and JS is no exception.

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: Tue, 07 Sep 1999 12:08:17 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Data structure for Dynamic Use of CGI.pm?
Message-Id: <37D562A1.A5CC7C69@cisco.com>

[ Linux GNUBEE wrote:

> I want to read in a file with four values on each line.  Each value is
> separated by a \t.  I want to display one of the variables (the fourth one
> from each line) from each line of four as a radio-button selection in a FORM
> (using CGI.pm).  If a particular radio-button is selected on the form, I
> want to pass all four variables to another script.  How can I efficiently
> identify which other three variables relate to the selected variable?  A
> hash table?  Any ideas on a data structure example?

You can keep the three value combo in a hash if you like to make your script
writing easier but you will have to pass it using hidden vars to
the next script.  As you want to use the 4th col as a radio button
selection -- this makes me assume that they are all unique.
You could do --
print $query->radio_group(-name=>'OS',
                               -values=>[val1,val2,val3],
                                -default=>'Unix');
where val1, val2 and val3 were found in the 4th col.
and pass the other three values in the row using a hidden
variable (where the values are separated using a separator like a
semicolon )

$OtherThreeValues = join ":", @values
print "<type=hidden name=val1_hidden value=$OtherThreeValues>" ;
The names of the hidden variables will be unique as long as values
in the 4th column are all unique.
--



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

Date: Tue, 7 Sep 1999 11:07:23 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Filter
Message-Id: <x3y3dwqiwuu.fsf@tigre.matrox.com>


jimtaylor5@aol.com (Jimtaylor5) writes:

> I am writing a childrens program and I need to filter out at least some
> offensive words. Of course I know how to match with =~/***/ but the problem I
> am having is this also filters out words like pass and assimilate. Is there a
> way I can do this that it won't catch these words, and words like it for other
> offensive words? Thanks!

Perhaps you need to read more about regular expressions. They are more
powerful than you think. Take special attention of \b and \B.

HTH,
--Ala



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

Date: Tue, 07 Sep 1999 13:15:03 -0400
From: Cathy Huang <huang2@andrew.cmu.edu>
To: Arved Sandstrom <Arved_37@chebucto.ns.ca>, Arved Sandstrom <Arved_37@chebucto.ns.ca>
Subject: Re: Help! Newbie can't see print error in code
Message-Id: <37D54817.57CD7497@andrew.cmu.edu>

Arved Sandstrom wrote:
> 
> In article <37D46B48.CDF3430B@andrew.cmu.edu>, Cathy Huang
> <huang2@andrew.cmu.edu> wrote:
> 
> > I can't figure out why after I run this portion of code, the file
> > paths.dat has been created, but is totally empty -
> > though volume3.dat is getting printed to fine. It's prob. something
> > obvious I can't see.
> >
> [ snippage ]
> >
> > ($protocol,@directories) = directory_selector();
> > print VOLDATA "protocol = $protocol\n";
> > print VOLDATA "directories before = @directories\n\n";
> > @directories = map { add_share_path($_) } @directories;
> > #print PATHS "directories after = @directories\n";
> >
> > print PATHS "what the heck???!!\n";
> > print VOLDATA "directories after = @directories\n";
> >
> > ############### PATHS empty!!!!!!!!!!
> 
> Well, I hope 'paths.txt' at least has "what the heck???!!\n" in it. :-)
> 
> Seriously, if directory_selector() and add_share_path($_) are working to
> your satisfaction, then once you take the comment out of the print PATHS
> then you'll write something to that file. :-)
> 
> Arved

Actually paths.txt doesn't even have "what the heck" in it! volume3.dat
gets printed to fine though. add_share_path($_) is working.

Cathy


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

Date: Tue, 7 Sep 1999 13:48:04 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How can i unlink some files??
Message-Id: <x3yzoyyhauj.fsf@tigre.matrox.com>


Abel =?iso-8859-1?Q?Almaz=E1n?= <abel.almazan@ogilvyinteractive.es> writes:

> If i want to unlink all files in a subdirectory, what can i do??

Read the documentation on unlink().

> i tried with:
> 
>         unlink (/dir/*.*);
> and
>         unlink (/dir/*);
> 
> but it doesn't works.

Of course, because you didn't read the documentation on
unlink(). 'perldoc -f unlink' to learn more.

The Truth is Out There (in the docs).

--Ala



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

Date: 7 Sep 1999 17:56:02 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: How can two Perl programs exchange data directly?
Message-Id: <7r3jji$52a@dfw-ixnews3.ix.netcom.com>

Thorsten (thorsten_kuske@gmx.net) wrote:
: I am a Perl newcomer and I tried hard to find out how to exchange data
: directly between two Perl programs running, but I did not get along with
: this. So it would be really great if you could help me!

The perlipc document is likely to be of much help to you.



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

Date: Tue, 07 Sep 1999 17:51:45 GMT
From: GoodfriB@jntf.osd.mil (James R. Goodfriend)
Subject: Re: How do I delete apostraphe from a string?
Message-Id: <RgcB3.65$1L2.515@news2.rmi.net>

In article <37D4EBA7.C8F3090C@insnet.net>, matt@insnet.net says...
>
>Hi everyone, 
>
>Has anyone got an idea of what the regular expression
>to delete an apostraphe from a string would be?
>
>i.e. the string is  "monster's" I need it to become
>"monsters".
>
What's wrong with the following?:

$string =~ s/'//g;

Try
perldoc perlop
perldoc perlre
				-Bob




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

Date: Tue, 7 Sep 1999 14:09:58 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How do I delete apostraphe from a string?
Message-Id: <x3yyaeih9u1.fsf@tigre.matrox.com>


Matt Duggan <matt@insnet.net> writes:

> Has anyone got an idea of what the regular expression
> to delete an apostraphe from a string would be?

It is very similar to the regular expression to delete the letter
'a'.

	tr/'//d;

'perldoc perlop' for more info.

--Ala



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

Date: 7 Sep 1999 17:55:35 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: is our reese the author of mysql book?
Message-Id: <7r3jin$6lk$3@info2.uah.edu>

In article <cyHA3.182$96.7818@ptah.visi.com>,
	George Reese <borg@imaginary.com> writes:

: Either way, however, dismissing a book on MySQL and mSQL because one
: of the three authors of the book thinks Perl is crap is absurd.

Are you going to justify your opinion that Perl is crap, or are you
foaming at the mouth?

Greg
-- 
Sam:  What's new, Normie? 
Norm: Terrorists, Sam. They've taken over my stomach. They're demanding beer. 


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

Date: Tue, 07 Sep 1999 12:37:39 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: large dataset problem
Message-Id: <37D56983.98BDF059@cisco.com>

[ Benjamin Franz wrote:

> You want to use a data structure like this:
>  $data->[$year]->[$month]->[$row]->[$column] = $value;

I merely want to add to what Benjamin has said.  This datastructure
would be an overkill to construct if the only need was to determine
the values at a (longitude, latitude ) pair for a (month, yr).  These
could be printed out when the script is making a pass over the
dataset file. If determining these values was necessary very often
(drawing a map for example)  and the script is doing some
processing using these values then this datastructure would be justified
to give fast access times.

Or else simple file indexing would work. After "freezing" the dataset
file, write a script to create an index on the file with the following
structure.

year, month, row seekpos

where seekpos where you would seek() to inside
the file to position for (year, month, row)
and then read a line to get your values. This data struct
would be much smaller but slightly slower.
--





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

Date: 7 Sep 1999 17:59:48 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: mysql interview
Message-Id: <7r3jqk$6lk$4@info2.uah.edu>

In article <eA%A3.376$96.26431@ptah.visi.com>,
	George Reese <borg@imaginary.com> writes:

: Actually, no, it was not. It was a "for anything you might want to do
: in perl, python works and it is easier to maintain". I do not think
: perl sucks as such, even though I will say it out of hand. I simply
: think perl serves no purpose any more.

Are you going to justify any of this, or are you foaming at the mouth?

Greg
-- 
Petty laws breed great crimes.
    -- Ouida


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

Date: 7 Sep 1999 18:48:24 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: mysql interview
Message-Id: <7r3mlo$7ha$1@info2.uah.edu>

In article <jgbB3.56$S5.2774@ptah.visi.com>,
	George Reese <borg@imaginary.com> writes:

: What is so hard about that for you to understand?

I find it hard to understand that someone with no brain could live longer
than a few seconds.

Greg
-- 
They send you off to college to try to gain a little knowledge
But all you wanna do is learn how to score.
    -- Jimmy Buffett


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

Date: 7 Sep 1999 17:52:20 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: perl mail filter?
Message-Id: <7r3jck$6lk$2@info2.uah.edu>

In article <7qujo3$q43$1@news1.radix.net>,
	revjack <revjack@radix.net> writes:

: Just curious, has anyone here ever written their own procmail-style 
: e-mail filter using perl? I keep getting these suicidal impulses to 
: do this every six months or so, and I was wondering if anyone had any 
: success/failure stories or advice.

I don't know about procmail-style, but my .forward delivers incoming
messages to a Perl program that rejects spam and deposits messages in
one of my mh folders.  It's not hard to write and is actually kind of
fun.

Greg
-- 
The depths of idiocy are as yet unplumbed.
              -- Larry Wall in <199612181938.LAA10214@wall.org>


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

Date: Tue, 07 Sep 1999 17:58:10 GMT
From: curtisbeard@my-deja.com
Subject: Perl->Time->Milliseconds
Message-Id: <7r3jna$scu$1@nnrp1.deja.com>

I was wondering how to display the milliseconds position when
displaying the time.

Thanks,
Curtis


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 07 Sep 1999 19:30:32 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Please help a newbe
Message-Id: <37D54BB8.62F4A205@ife.ee.ethz.ch>

jp_48504@my-deja.com wrote:
> Thanks Joakim
> I have been able to write to the file, but I ma still working on
> getting the information read according to the last 20 entries. I'm
> needing use this to configure some scores(such as bowling). The user
> enters the scores and I need to figure their handicaps based on the
> last 20 scores that were entered into their file. I am very new to
> Perl, I am not sure which function I need to use to complete the task.
> Are there any websites where I can get more information?
> Thanks
> JP

I suggest two possibilities for getting the same functionality as tail:

One: Use (gasp) tail:

open FILE, "tail -10 $0|" or die "cannot open $0";
while (<FILE>) {
  print;
}

Note the pipe symbol | at the end of the open command

or with backticks or qx//:

for (qx/tail -10 $0/) {  #process the output of tail
  print;
}

Two: read the file into an array and discard all but the last entries:

open FILE, "$0" or die "aaargh";
@WholeFile = <FILE>;

for (@WholeFile[-10..-1]) {
  print;
}

Note that this first reads the whole file, which might be not so good
for huge files. But unlike the others, it does not rely on external
programs, so it should work on braindead platforms.

HTH
- Alex


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

Date: 7 Sep 1999 17:54:10 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Please help a newbe
Message-Id: <7r3jg2$52a@dfw-ixnews3.ix.netcom.com>

Alex Rhomberg (rhomberg@ife.ee.ethz.ch) wrote:
: Two: read the file into an array and discard all but the last entries:
: 
: open FILE, "$0" or die "aaargh";
: @WholeFile = <FILE>;
: 
: for (@WholeFile[-10..-1]) {
:   print;
: }
: 
: Note that this first reads the whole file, which might be not so good
: for huge files. But unlike the others, it does not rely on external
: programs, so it should work on braindead platforms.

It's not necessary to store the entire file in the array, only the number 
of lines that need to be kept:

my $MAX_LINES=10;
my @lines;
open(FILE,"<$0") or die "couldn't open $0: $!";
while (<FILE>) {
  shift @lines if @lines>$MAX_LINES;
  push @lines,$_;
}

When the loop finishes, @lines contains the last 10 (or the number of 
lines in the file if less than 10) lines.



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

Date: Tue, 7 Sep 1999 11:57:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Please help a newbe
Message-Id: <MPG.123effe625329afa989f1f@nntp.hpl.hp.com>

In article <7r3jg2$52a@dfw-ixnews3.ix.netcom.com> on 7 Sep 1999 17:54:10 
GMT, Eric Bohlman <ebohlman@netcom.com> says...
+ Alex Rhomberg (rhomberg@ife.ee.ethz.ch) wrote:
+ : Two: read the file into an array and discard all but the last
+ : entries:
+ : 
+ : open FILE, "$0" or die "aaargh";
+ : @WholeFile = <FILE>;
+ : 
+ : for (@WholeFile[-10..-1]) {
+ :   print;
+ : }
+ : 
+ : Note that this first reads the whole file, which might be not so
+ : good for huge files. But unlike the others, it does not rely on
+ : external programs, so it should work on braindead platforms.
+ 
+ It's not necessary to store the entire file in the array, only the 
+ number of lines that need to be kept:
+ 
+ my $MAX_LINES=10;
+ my @lines;
+ open(FILE,"<$0") or die "couldn't open $0: $!";
+ while (<FILE>) {
+   shift @lines if @lines>$MAX_LINES;
+   push @lines,$_;
+ }
+ 
+ When the loop finishes, @lines contains the last 10 (or the number of 
+ lines in the file if less than 10) lines.

Another Way To Do It is to seek to the end of the file and read it 
backwards (block by block) until 10 lines have been read.

Maybe we can persuade Uri Guttman to finish and publish his Backwards 
module, which makes this very simple (and very efficient!).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 07 Sep 1999 15:01:42 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: Problem with <!--#exec cgi=/scripts/script.pl%22--> in IIS4
Message-Id: <37D56116.F3D8C542@ingress.com>

Wyzelli wrote:
> 
 
> Of course an actually useful response is:
> 
> "IIS does not support SSI"
> 
> (actually I find that statement mildly amusing in it's own right!)
> 
> Wyzelli

What's amusing is the ignorance in that statement.  Since IIS 2.0
(currently version 4.0) IIS has supported the *full* range of SSI options.

I guess I don't see how giving the original poster a wrong answer is going
to prove "actually useful".

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: Tue, 7 Sep 1999 13:41:19 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Regular Expressions
Message-Id: <x3y1zcaipq9.fsf@tigre.matrox.com>


anderson@unt.edu (Richard L. Anderson) writes:

> In article <37D3D3E8.E725FC2C@gmx.de>, m.scheferhoff@gmx.de wrote:
> 
> > Hello,
> > 
> > ich have a problem with regular expressions. I have this string or
> > something like this:
> > 
> > <caddaar<test<hello
> > 
> > If want to cut everything including the second "<".
> > 
> > Does anybody know the expression for this?
> > 
> > Thanks,
> > 
> > Michael
> 
> Checkout perldoc perlre or the section on patern matching in the camel
> starting on page 58.  
> 
> #!perl -w
> 
> use strict;
> 
> my $testString = "<caddaar<test<hello";
> 
> if ($testString =~ /<.*?<(.*)/){
>    print $1;
> }

Well, that hardly does what the original poster wanted (which is not
quite clear). But he/she wants something cut out, and you don't cut
anything. I suspect the original poster wanted to cut everything up to
and including the second "<". Then your regexp should be:

	$testString =~ s/^[^<]*<[^<]*<//;

A (better?) option might be:

	my $t = "<caddaar<test<hello";
	substr($t, 0, (index($t, '<', index($t, '<')+1)+1)) = '';

HTH,
--Ala



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

Date: 07 Sep 1999 13:28:53 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: Subscribing to p5p
Message-Id: <m3n1uyed1m.fsf@localhost.frii.com>

Jean-Louis Leroy <jll@enterprise.newedgeconcept> writes:
> > btw, you can get to the old Perl Institute site by visiting
> > tpi.perl.org.
> 
> Thanks. Telling 'subscribe perl5-porters' to majordomo@perl.org didn't
> work, I assume this information is outdated...

I went through and updated the information yesterday.  Majordomo isn't
running the lists any more.

Sorry for the confusion,

Nat


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

Date: Tue, 07 Sep 1999 14:06:36 -0400
From: Joe Kline <Joe.Kline@sdrc.com>
Subject: Re: teen angst.
Message-Id: <37D5542C.F914443@sdrc.com>

Martin wrote:

> <SNIP>
> So, I have a sensible question and I'd appreciate a sensible answer. Are
> there any good online, printed resources at all that cover PHP3, mySQL,
> their integration with Perl and also anything on Search engine and spider
> designing?
>

<SNIP long tedious thread content>

Well, to add my centavos to this mess, there is a manual that comes with MySQL
(I was passed along a PostScript version that was created via Latex) that is
extraordinarily thorough. It does have references to a variety of API's: C,
C++, PHP, Python, Perl, TCL.

The PHP references send you to http://www.php.net/ to find the documentation
for MySQL and PHP.

I did by the book, with some reservations mind you. I have enjoyed the database
theory section immensely, but havedn't really ventured into the other areas
just yet. But by and large, the manual covers everything you ever wanted to
know about MySQL (installation, maintenance, queries, etc.). The _MySQL & mSQL_
book has more "polish" to it, but in the bits I read/sped-read they cover the
guts of MySQL equally. I will probably change that opinion once I've read both
thoroughly.

For me, the jury is still out. If you think having G.Reese as a co-author is
bad, get the manaul (hey it's free). If you aren't sure, get the manual (like I
said it's free) and the book and make your own decision.

joe


--



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

Date: 7 Sep 1999 12:51:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: test, please ignore
Message-Id: <slrn7tak9i.mgi.abigail@alexandra.delanet.com>

Peter Wilkinson (peterw@innate.co.uk) wrote on MMCXCI September MCMXCIII
in <URL:news:936097141.6382.0.nnrp-10.c3ada081@news.demon.co.uk>:
"" 


*ploink*



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 7 Sep 1999 12:48:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: test
Message-Id: <slrn7tak5f.mgi.abigail@alexandra.delanet.com>

robert (robert@demon.net) wrote on MMCXCI September MCMXCIII in
<URL:news:936097143.4857.0.nnrp-09.c2d99743@news.demon.co.uk>:
&& test,
&& 
&& please ignore


Sure.


*ploink*


Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 7 Sep 1999 12:33:30 PST
From: Neil <neil@pacifier.com>
Subject: Re: Unix Trouble
Message-Id: <37d5688a.0@news.pacifier.com>


> what does it means to be a Unix server, how do i know whether mine is
> one??

The majority of Web servers in the world currently run on some variant 
of UNIX (though some run on Windows NT), so you might consider looking
into the matter of Web site hosting. Because unless you have
a static IP address, you are not going to be hosting your Web site on
your own machine.

Find out what OS your ISP is using. Then find out if you get your own cgi-bin 
directory (a place to run your own cgi scripts), or if your ISP provides canned 
scripts that customers can use. You might need a domain name and a Virtual Server 
to run your own cgi-scripts, and only have accessed to the canned scripts if you
have a regular account.

Getting various scripts to work on your web site and examining the code (customizing
them if possible), is an excellent way to start learning cgi. Since most cgi
scripts are written in Perl, it is a fun way to start learning Perl as well.

Also, see if your ISP provides telnet access. If they offer telnet access, then 
telnet into the UNIX shell and learn about UNIX and to learn a UNIX text editor. 
I personally use Pico which is easy and fun and available on most systems.

Once you have seen what Perl cgi scripts can do you will be curious about Perl 
and you will want to get into learning it.

(This post may have seemed off topic but it comes back to Perl in the end.)

Neil


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

Date: Tue, 7 Sep 1999 11:37:38 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: using code written in C (anyone know about stemming?)
Message-Id: <MPG.123efb4f3b88ba50989712@nntp1.ba.best.com>

Thanks everyone for your help.  Seems to have taken less than a day!

Should I deal with these messages?  If so, how?

% make
[cut]
MakeMaker (v5.4301)
Warning (non-fatal): Target 'dynamic' depends on targets in skipped 
section 'dynamic_lib'
Warning (non-fatal): Target 'static' depends on targets in skipped 
section 'static_lib'

% make test
[cut]
1..2
ok 1
ok 2 - returned '0' and 'index'
make: Fatal error: Don't know how to make target `pure_all'
Current working directory /home/moseley/XS/Stemmer/mylib
*** Error code 1
make: Fatal error: Command failed for target `test'



The Glauber (theglauber@my-deja.com) seems to say...
> If Stem returns 0 on success and 1 on failure, you could do:
> 
> bool_t
> stem( word )
>     char * word
>     CODE:
>         RETVAL = (Stem(word) == 0);
>     OUTPUT:
>         RETVAL
>         word
> 

using bool_t caused errors (below).  I used just 'int' and it worked 
fine. 

Stemmer.c: In function `XS_Stemmer_stem':
Stemmer.c:32: `bool_t' undeclared (first use in this function)
Stemmer.c:32: (Each undeclared identifier is reported only once
Stemmer.c:32: for each function it appears in.)
Stemmer.c:32: parse error before `RETVAL'
Stemmer.xs:22: `RETVAL' undeclared (first use in this function)
*** Error code 1
make: Fatal error: Command failed for target `Stemmer.o'


Thanks again,



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 7 Sep 1999 13:44:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Want to use PERL to run script on another server.
Message-Id: <slrn7tanei.mgi.abigail@alexandra.delanet.com>

Mark Conlin (Mark.Conlin@bridge.bellsouth.com) wrote on MMCXC September
MCMXCIII in <URL:news:37CAB5C5.EDDC11DE@bridge.bellsouth.com>:
## I would like to use PERL to run another PERL script on a different
## server. 

It's Perl, not PERL.

And you would do it the same way as calling a C program on a different
server from a C program.

## Is there a way to access the script as if I had hit it with a web
## browser, from
## inside a different script on a different server ?


That's a different question. And the answer is yes. Look in the LWP
package.



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 07 Sep 1999 19:30:06 GMT
From: Bob Showalter <bshow@my-deja.com>
Subject: Re: Writing Oracle SQL for DBD-Oracle?
Message-Id: <7r3p3d$m6$1@nnrp1.deja.com>

In article <7r1vue$t8f$5@ash.prod.itd.earthlink.net>,
  hatterasNOSPAM@hotbot.com (Jamie Schrumpf) wrote:
> Does anyone have any examples of using Perl to call Oracle SQL
without using
> procedures?  All the examples from perldoc use them, and there must
be a way to
> pass SQL without having to use preset procs.

For SELECT queries, just use $dbh->prepare() to specify your SQL
statement and get a statement handle. Use $sth->execute() to execute
the query and a loop with $sth->fetchrow_array() or similar to handle
retrieving data. Use $sth->finish() to close the cursor when you're
done fetching.

For statements that don't return rows, you can use prepare/execute, or
just use $dbh->do().

HTH,
-- Bob


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 7 Sep 1999 13:48:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: writing to a file within a loop
Message-Id: <slrn7tanm1.mgi.abigail@alexandra.delanet.com>

Lakmal Jinadasa (lakmal@ml.com) wrote on MMCXC September MCMXCIII in
<URL:news:37CAB5A1.38DCD6B0@ml.com>:
?? 
?? I open a file within a foreach loop
?? then try to write some data to the file.
?? 
?? everything goes fine except the data is not in the file.

How do you know? You never check the return value of open(); there
might be many things that are wrong, and you just ignore them.

?? Part of the program is as follows
?? 
?? foreach $key1(@list1)
??     foreach $key2 (@list2) {
??      open DAT ">File_Name";
??      @arr = output_of _a function;
?? print DAT @arr;
?? close (DAT);
??     }
?? 
?? }
?? 
?? Seperate file is created for each key1.key2

Oh, really? It doesn't look like that in the code fragment.

?? The files are there with 0 byte length.

Are you sure that @arr contains what you thing it does?



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 7 Sep 1999 14:44:34 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Y2K bugs on the Internet
Message-Id: <x3yvh9mh88g.fsf@tigre.matrox.com>


finsol@ts.co.nz writes:

> My principal motives for posting these messages re Y2K are:
> (a) A few more programmers may get the message
> (b) The feedback provides a barometer that I and others can use to
> measure just much the Y2K message has got through to the programming
> community. Feedback generated by my last post would indicate that Y2K
> awareness is still a very big problem.

My question to you would be "Why are you so interested in those little
Y2K bugs on the web?" ... Most (if not all) of the problems you
reported are minor ones appearing on personal webpages of ignorant
individuals. When the time comes, their pages would simply show
"19100" or "00" as the current year. So?

I suspect that you are trying to use the Y2K bug to gain fame and
recognition, and single-handedly save the world from disaster. But,
that will never be the case.

There is enough hype around Y2K, and if webpage maintainers want to
fix it, they know where to look. You shouldn't be that paranoid about
it? Don't you have anything better to do?

--Ala

PS. I confess. A few years ago, I borrowed some Perl code (before I
attempted to learn Perl) from a friend of mine to decorate my very
first webpage. I realize now that it has a Y2K bug, and I will not fix
it simply because I don't feel like it. But, don't blame me if earth
explodes at midnight Jan 1st, 19100.

:-)



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

Date: Tue, 07 Sep 1999 19:09:11 GMT
From: Bob Showalter <bshow@my-deja.com>
Subject: Re: Y2K bugs on the Internet
Message-Id: <7r3nsb$vm1$1@nnrp1.deja.com>

In article <gt8B3.81$xa4.1114@news.colt.net>,
  Jon Peterson <jpeterson@office.colt.net> wrote:
> ...How much of a problem is it if Joe Blogg's web feedback form
> says 1/1/19100 ???
>
> Less than catastrophic. And what will happen then? The net will
briefly be
> flooded with requests for how to fix this problem, rapidly followed by
> answers, followed by a return to normal life.
>
Hear Hear! This is exactly how I predict the Y2K "catastrophe" will
manifest...

-- Bob


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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


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