[11434] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5034 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 2 14:07:42 1999

Date: Tue, 2 Mar 99 11:00:22 -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           Tue, 2 Mar 1999     Volume: 8 Number: 5034

Today's topics:
        ANSWER:embedding Perl interpreter in *DLL* nadeem@gate.net
        Any info on calling Perl from Java? <mike.presseller@westgroup.com>
    Re: Any info on calling Perl from Java? <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Any info on calling Perl from Java? <mike.presseller@westgroup.com>
    Re: Determine web directory size (Greg Ward)
    Re: Editing 2,000 lines of someone else's code (Jonathan Stowe)
    Re: Editing 2,000 lines of someone else's code <revjack@radix.net>
    Re: Editing 2,000 lines of someone else's code <jeromeo@atrieva.com>
    Re: Editing 2,000 lines of someone else's code <jdf@pobox.com>
        embedding Perl in *DLL*? nadeem@gate.net
    Re: Finding the word after a word <staffan@ngb.se>
    Re: Finding the word after a word <uri@home.sysarch.com>
    Re: Help Please: Script Optimization <trevor@bunny.demon.co.uk>
        How to interrupt a foreach loop <webmaster@provence-shop.com>
        How to run cgi automatically? <stud0v64@nortel.com>
    Re: Is there a more efficient routine? (M.J.T. Guy)
    Re: logically impaired <jdf@pobox.com>
        LWP PUT & ftp via a proxy <jon.hawkes@bigfoot.com>
        LWP Search Engine on Web.. <ankadakia@hotmail.com>
    Re: LWP Search Engine on Web.. (Benjamin Franz)
    Re: next in a continue block restarts continue block, b (Steve Linberg)
    Re: not an array referecne?? (Abigail)
        Occasional Perl failure(?) question... <philipNOSPAM@hrsites.com>
    Re: Occasional Perl failure(?) question... (Steve Linberg)
    Re: Pentium III Chips Released with IDs - Intel won't b <wetboy@shore.net>
    Re: Pentium III Chips Released with IDs - Intel won't b <achrist@easystreet.com>
    Re: Pentium III Chips Released with IDs - Intel won't b <kat_j@mindless.com>
    Re: perl -d trouble... (Greg Bacon)
    Re: Search and Replace in Perl <staffan@ngb.se>
    Re: Search and Replace in Perl (Steve Linberg)
    Re: Search and Replace in Perl (Greg Ward)
    Re: The truth about the Pentium III chip and ID --- **b <bfrisbee@nospam.webengine-db.com>
    Re: The truth about the Pentium III chip and ID --- **b <mtr@ottawa.com>
    Re: Variables in regular expressions <Allan@due.net>
    Re: Why isn't this a race condition ? <mhc@Eng.Sun.COM>
    Re: y2k and 4-digit dates (was Re: foreach and while) <staffan@ngb.se>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 02 Mar 1999 17:35:47 GMT
From: nadeem@gate.net
Subject: ANSWER:embedding Perl interpreter in *DLL*
Message-Id: <7bh7hj$4sd$1@nnrp1.dejanews.com>

ok 10 minutes after I posted my original question...I figured it out.  It's
working now.

Here's what I had to do, if others have this problem.  Embedding the Perl5.0
in win32 DLL or a console app is the same.  Nothing special is required.

I am using MSVC6.0 to build my DLL (which has an embedded CPerlObj).  My
"project" was including
dynaloader.c
win32.c
win32sck.c
perlcore.lib

the problem went away when instead of the .c files I added
dynaloader.obj
win32.obj
win32sck.obj
perlcore.lib

(if you are wondering why I am including the above, and how to get them...THEN
READ THE PERLWIN32 FAQ)

these obj were produced when I first built perl on my NT4 box (and that took a
little patience too because the makefile distributed with the perl5.0 win32
source has an incomplete path with one of the libs...what a nuisance).

and ofcourse don't forget to "ignore libraries" MSVCRT since I believe the
perl I built uses the perlCRT instead...and the two don't tango together.

anyway, so it builds and runs now, and I am happy.
Cheers
---n

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 2 Mar 1999 11:21:01 -0600
From: "Mike Presseller" <mike.presseller@westgroup.com>
Subject: Any info on calling Perl from Java?
Message-Id: <36dc1da5@wwwproxy3.westgroup.com>

In particular, I'd like to send a string of text from a Java routine to a
perl script that performs a regex to extract words from the input string of
text.  The extracted words should then be returned to the calling java
routine.  I am using jdk 1.1.6 or 1.2 running on NT.




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

Date: 02 Mar 1999 18:26:18 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Any info on calling Perl from Java?
Message-Id: <834so34xc5.fsf@vcpc.univie.ac.at>

Re: Any info on calling Perl from Java?, Mike
<mike.presseller@westgroup.com> said:

Mike> In particular, I'd like to send a string of
Mike> text from a Java routine to a perl script that
Mike> performs a regex to extract words from the
Mike> input string of text.  The extracted words
Mike> should then be returned to the calling java
Mike> routine.  I am using jdk 1.1.6 or 1.2 running
Mike> on NT.

How about

  http://www.perl.com/pace/pub/perldocs/1998/12/jpl-announce.html

(no recommendation, I've never tried it, just
something from www.perl.com)

There are also some regex classes for java from:

  http://www.oroinc.com/downloads/

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Tue, 2 Mar 1999 12:14:15 -0600
From: "Mike Presseller" <mike.presseller@westgroup.com>
Subject: Re: Any info on calling Perl from Java?
Message-Id: <36dc2a1f@wwwproxy3.westgroup.com>

The JPL looks promising.  It says its included in 5.005_54 version release
of Perl.  I'm having trouble finding the download for this release for NT.
Does anyone know where it is?

I've also looked at the Java regex classes from OROINC.  They look good.
However, it doesn't come with source code (something my company requires)
and have not been able to get any licensing info yet from the owner.  IBM
also has Java regex classes available on the alphaworks site, however, it
looks pretty buggy still.

Thanks

Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote in message
news:834so34xc5.fsf@vcpc.univie.ac.at...
>Re: Any info on calling Perl from Java?, Mike
><mike.presseller@westgroup.com> said:
>
>Mike> In particular, I'd like to send a string of
>Mike> text from a Java routine to a perl script that
>Mike> performs a regex to extract words from the
>Mike> input string of text.  The extracted words
>Mike> should then be returned to the calling java
>Mike> routine.  I am using jdk 1.1.6 or 1.2 running
>Mike> on NT.
>
>How about
>
>  http://www.perl.com/pace/pub/perldocs/1998/12/jpl-announce.html
>
>(no recommendation, I've never tried it, just
>something from www.perl.com)
>
>There are also some regex classes for java from:
>
>  http://www.oroinc.com/downloads/
>
>hth
>tony
>--
>Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
>Liechtensteinstrasse 22, A-1090 Wien.  |
<URI:http://www.vcpc.univie.ac.at/>
>"You see? You see? Your stupid minds!  | private email:
>    Stupid! Stupid!" ~ Eros, Plan9 fOS.|
<URI:mailto:tony_curtis32@hotmail.com>




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

Date: 2 Mar 1999 18:33:31 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Determine web directory size
Message-Id: <7bhatr$2dg$2@ffx2nh5.news.uu.net>

Dmitry Diskin wrote:
> Is there any simple solution for count the total size of files in
> particular directory of web server?

Is this a server somewhere "out there" on the web? or a local machine
that you can access via the filesystem?

If the former: no, it can't be done.  There is no standard way for web
server's to tell clients the files in a directory.  You can write
something that'll handle (say) all/most Apache servers (depending on how
they're configured), or something more elaborate that'll handle (say)
Apache, Netscape, and IIS servers, but you can't handle everything.

In general, the only way to discover resources on the web is to follow
links.

If you have access via the filesystem, then just use Perl's normal
facilities for this: opendir, readdir, closedir.  RTFM on those
functions ("perldoc -f opendir", etc.) -- that'll tell you more than the
minor flamewar currently raging in this thread.  ;-)

        Greg

PS. please don't post multipart MIME messages to USENET -- by
convention, USENET is a plain-text, ASCII medium.  You'll have to change
the configuration of your newsreader to fix this.

-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Tue, 02 Mar 1999 17:23:33 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Editing 2,000 lines of someone else's code
Message-Id: <36dc1592.28286649@news.dircon.co.uk>

On 2 Mar 1999 15:59:38 GMT, Fuchs McDowell <revjack@radix.net> wrote:
Subject: Editing 2,000 lines of someone else's code

>AAAAAAAAAAAAAARRRRRRRRRRRRGGGGGGHHHHHHHH
>

How about a nice cup of tea ?

/J\


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

Date: 2 Mar 1999 18:27:01 GMT
From: Halley Lin <revjack@radix.net>
Subject: Re: Editing 2,000 lines of someone else's code
Message-Id: <7bhahl$11h$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Jonathan Stowe explains it all:

:How about a nice cup of tea ?

Sorry about that. Serious question:

Under perl 4 [yes, *4*, -v below], given the subroutine:

  sub printWah {
    print "WAH\n";
  }


Why do you suppose someone would call the sub this way:

  eval '&printWah';

instead of this way:

  &printWah;

Hm?

I'm working with Mister Sysadmin on upgrading the perl version, no fear.

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

~$ perl -v

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36

-- 
  /~\  responsive tortoise nightmarish brink successor fray Rhodes eve
 C oo  Campbell kraut conundrum cohesive brandy Cochran backside cervi
 _( ^) 1 , 0 0 0 , 0 0 0   m o n k e y s   c a n ' t   b e   w r o n g
/___~\ http://3509641275/~revjack  03/02/99 13:19:52 revjack@radix.net


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

Date: Tue, 02 Mar 1999 10:22:09 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Editing 2,000 lines of someone else's code
Message-Id: <36DC2C51.24CA1FA3@atrieva.com>

Fuchs McDowell wrote:
> 
> AAAAAAAAAAAAAARRRRRRRRRRRRGGGGGGHHHHHHHH

Globalthermonuclear War.

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: 02 Mar 1999 13:49:10 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Halley Lin <revjack@radix.net>
Subject: Re: Editing 2,000 lines of someone else's code
Message-Id: <m37lsz682h.fsf@joshua.panix.com>

Halley Lin <revjack@radix.net> writes:

>   sub printWah {
>     print "WAH\n";
>   }

No, no.  Put your head there, like this, then go "Wahhhh."

> Why do you suppose someone would call the sub this way:
> 
>   eval '&printWah';
> 
> instead of this way:
> 
>   &printWah;
> 
> Hm?

WOL.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf
weeping out loud


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

Date: Tue, 02 Mar 1999 16:55:07 GMT
From: nadeem@gate.net
Subject: embedding Perl in *DLL*?
Message-Id: <7bh556$2jn$1@nnrp1.dejanews.com>

I have read all the FAQs I can get me hands on and am not able to find a
definite answer for my Q:

I am trying to embed the Perl interpreter in a *DLL* (MSVC 6.0).  This way my
DLL (which does something specialized) will also be able to execute scripts.

The perl-win32 FAQ addresses how to embed the interpreter in a console
application (MSVC) and I can do that just fine...thank you very much.  The FAQ
was very clear on how to do that.
However, as soon as I try the same thing in a DLL...I get all sorts for
compilation errors (syntactical mostly...which is confusing and leads me to
believe I am probably bungling up some include dependencies or something).

So, is there something else I need to do to get this thing to work from a DLL?
any pointers will be appreciated
thanks
---n

Here are my system details: D:\AP509_source\bin>perl -V Summary of my perl5
(5.0 patchlevel 5 subversion 02) configuration:  Platform:  osname=MSWin32,
osvers=4.0, archname=MSWin32-x86-object  uname=''  hint=recommended,
useposix=true, d_sigaction=undef  usethreads=undef useperlio=undef
d_sfio=undef  Compiler:  cc='cl.exe', optimize='-O2 -MD -DNDEBUG -TP -GX',
gccversion=  cppflags='-DWIN32'  ccflags ='-O2 -MD -DNDEBUG -TP -GX -DWIN32
-D_CONSOLE -DNO_STRICT	-DHAVE_DE S_FCRYPT -DPERL_OBJECT'  stdchar='char',
d_stdstdio=define, usevfork=false  intsize=4, longsize=4, ptrsize=4,
doublesize=8  d_longlong=undef, longlongsize=8, d_longdbl=define,
longdblsize=10	alignbytes=8, usemymalloc=n, prototype=define  Linker and
Libraries:  ld='link', ldflags ='-nologo -nodefaultlib -release -machine:x86'
 libpth=\lib  libs= oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32. lib advapi32.lib shell32.lib ole32.lib  oleaut32.lib
netapi32.lib uuid.lib wsock 32.lib mpr.lib winmm.lib  version.lib odbc32.lib
odbccp32.lib msvcrt.lib  libc=msvcrt.lib, so=dll, useshrplib=yes,
libperl=perlcore.lib  Dynamic Linking:	dlsrc=dl_win32.xs, dlext=dll,
d_dlsymun=undef, ccdlflags=' '	cccdlflags=' ', lddlflags='-dll -nologo
-nodefaultlib -release -machine:x86'



Characteristics of this binary (from libperl):
  Locally applied patches:
        ActivePerl Build 509
  Built under MSWin32
  Compiled at Jan  5 1999 13:37:15
  @INC:
    D:\AP509_source\lib
    D:\AP509_source\site\lib
    .

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 02 Mar 1999 18:23:03 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Finding the word after a word
Message-Id: <36DC1E77.14E3D0D5@ngb.se>

Allan Hawdon wrote:
> Allan Hawdon <udaa460@axolotl.kcl.ac.uk> wrote:
> : Allan Hawdon <udaa460@axolotl.kcl.ac.uk> wrote:
> : : kalikste@uiuc.edu wrote:
> : : : Quick question for a regular expression-
> 
> <snip>
> 
> : Whoops. Unless it's at the beginning of the string of course.
> 
> : ($dummy,$res) = $string =~ /(^|.* )$srch (\S+) /;

what kind of word is (\S+)? why not use

	$string =~ /\b$srch (\w+)\b/;
	$word =~ $1;

or if you really want (\S+), use 

	$string =~ /\b$srch ([^\s\n]+)/;
	$word =~ $1;

which gets anything up to a the end of the string, a space, or a
newline.

perlre

HTH
Staffan


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

Date: 02 Mar 1999 13:20:25 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Finding the word after a word
Message-Id: <x7d82reot2.fsf@home.sysarch.com>

>>>>> "SL" == Staffan Liljas <staffan@ngb.se> writes:

  SL> 	$string =~ /\b$srch (\w+)\b/;
  SL> 	$word =~ $1;
               ^
i think you mean = here and below. be careful what you type here!

  SL> or if you really want (\S+), use 

  SL> 	$string =~ /\b$srch ([^\s\n]+)/;
                               ^^^^
\s is not space but whitespace which covers \n so that is redundant.

  SL> 	$word =~ $1;
               ^
uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Tue, 2 Mar 1999 17:39:37 -0000
From: "Trevor Squires" <trevor@bunny.demon.co.uk>
Subject: Re: Help Please: Script Optimization
Message-Id: <920396325.28398.0.nnrp-03.9e9838e3@news.demon.co.uk>

doh!

serves me right for not testing my suggestions!

>
>my $address = gethostbyname $host;
>print "$address\n";
>


my $addr_in_dot_notation = join '.', unpack('C4', $address);
print "$addr_in_dot_notation\n";

the returned address from gethostbyname is a four byte thingamabob.

Trevor




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

Date: Tue, 02 Mar 1999 13:35:09 -0500
From: Lionel ANDRE -- Provence Shop Webmaster <webmaster@provence-shop.com>
Subject: How to interrupt a foreach loop
Message-Id: <7bhad3$d91$1@news-1.news.gte.net>



Hi,

I'm a PERL toddler, and I would like to know if there is a way to
interupt
a foreach loop.

Or is there a way to use a for loop.  I assume there is, but I dunno how
to
do that?

Here is the code with comments.  If you feel the need to reply, can you
please email webmaster@provence-shop.com in the Cc: field?

foreach $i (@indata) {
    chomp($i);
    ($index,$nom,$email,$un,$deux,$trois,$quatre,$cinq,$six) =
split(/\t/,$i);

    ++$count;
    $subcount = 0;
    print "<td bgcolor=#A8A8A8>$nom, $count</td>\n\n";
    if ($count == 3){ #this line makes a "subloop" to write the lines
beneath the header cells containing "$nom, $count"
       print "</TR>\n\n";# the cell beneath the header

              open(INF,$filename) || die "Could not open $filename: $!";

              print "<tr>\n\n";
             @indata = <INF>;
             close(INF);
             foreach $i (@indata) { # THIS IS THE FOREACH LOOP I WANT TO

INTERRUPT AFTER 3 ITTERATIONS
                    chomp($i);

($index,$nom,$email,$un,$deux,$trois,$quatre,$cinq,$six)
 = split(/\t/,$i);
                    print "<td>$un \n<HR Width\=\"90\%\" Size\=\"1\"
Align\=\"Center\">$deux \n<BR>$trois \n<BR>$quatre \n<BR>$cinq
\n<BR>$six
<BR> sc\=$subcount</td>\n\n";

             }# IT ENDS HERE
        $count = 0;
   }# if
}# foreach


I appreciate your time, thank you!

Lionel Andre
Provence-Shop Webmaster

webmaster@provence-shop.com
http://www.provence-shop.com




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

Date: Tue, 02 Mar 1999 13:16:16 -0500
From: "Michalowski, Martin" <stud0v64@nortel.com>
Subject: How to run cgi automatically?
Message-Id: <36DC2AF0.FBC10E77@nortel.com>

I want to run my perl cgi as soon as I open the page. Is that possible?
-- 
Martin @ 799.2775


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

Date: 2 Mar 1999 18:53:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Is there a more efficient routine?
Message-Id: <7bhc3m$ho4$1@pegasus.csx.cam.ac.uk>

Jerome O'Neil  <jeromeo@atrieva.com> wrote:
>
>Perl file locking is merely advisory.  What happens if you are not able
>to achieve the lock?  It's a good idea to check the return status of
>flock as well.
>
>if(flock(DB,LOCK_EX)){
>	#Blah blah blah...
>}else{
>	#Do what we do when we can't flock together...
>}

While it's good general practice to check the results of system calls,
that seems a bit pointless here.    My flock(2) man page says

ERRORS
     EBADF               The argument fd is an  invalid  descrip-
                         tor.

     EOPNOTSUPP          The argument  fd  refers  to  an  object
                         other than a file.

     EWOULDBLOCK         The  file  is  locked  and  the  LOCK_NB
                         option was specified.

I don't see how any of those can happen (in this case) unless Perl or
the operating system is broken.

I also don't understand what the advisory nature of locks has to do with
possible failures of flock().


Mike Guy


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

Date: 02 Mar 1999 13:46:54 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Staffan Liljas <staffan@ngb.se>
Subject: Re: logically impaired
Message-Id: <m3aexv6869.fsf@joshua.panix.com>

Staffan Liljas <staffan@ngb.se> writes:

> Oliver Moffat wrote:
> >   foreach $FILE (@_){
> >    open FILE or die "$FILE $!";
> 
> I don't think this opens the file.

Why don't you think so?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 02 Mar 1999 17:04:07 +0000
From: Jon Hawkes <jon.hawkes@bigfoot.com>
Subject: LWP PUT & ftp via a proxy
Message-Id: <36DC1A07.EEE5DD84@bigfoot.com>

The LWP documentation for LWP says that "PUT will store a file on an ftp
server".
Could any one give me an example of this? I can't work out how to build
the request.

I was thinking it should be something like:

use LWP;
use HTTP::Request::Common;

my $ua = new LWP::UserAgent;
$ua->proxy(ftp => "my proxy");

my $req = PUT "ftp://ftpuser:ftppass\@ftpserver", "filename";

$req->proxy_authentication_basic("my proxy user", "my proxy password");

my $rsp = $ua->request($req);

But I get a message back from the proxy saying:

The file could not be uploaded by the proxy.
Proxy server is unable to find the file or directory named
        /.

Check the file name and try again.

which makes me think I haven't specified the file correctly.

Thanks

Jon





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

Date: Tue, 02 Mar 1999 18:07:12 GMT
From: ankadakia <ankadakia@hotmail.com>
Subject: LWP Search Engine on Web..
Message-Id: <7bh9c8$6gb$1@nnrp1.dejanews.com>

Please, if anyone put the search engine on web, made using LWP, I would like
to see it.


||Beautify|||||||||||||||
||||||||||Your|||||||||||
||||||||||||||Existance||
||ANK||||||||||||||||||||

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 02 Mar 1999 18:22:31 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: LWP Search Engine on Web..
Message-Id: <H%VC2.1265$jd.2063@typhoon01.swbell.net>

In article <7bh9c8$6gb$1@nnrp1.dejanews.com>,
ankadakia  <ankadakia@hotmail.com> wrote:
>Please, if anyone put the search engine on web, made using LWP, I would like
>to see it.

http://www.vietgate.net/

-- 
Benjamin Franz



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

Date: Tue, 02 Mar 1999 12:36:40 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: next in a continue block restarts continue block, but...
Message-Id: <linberg-0203991236400001@ltl1.literacy.upenn.edu>

In article <F7z7DM.Fno@unx.sas.com>, sherman@unx.sas.com (Chris Sherman) wrote:

> How do I do something like a next, but _not_ have it restart
> in the continue block since I'm already in it?

I'm not clear what you're trying to accomplish.  If you want to exit the
loop, use last.  If you want to execute based on a condition, use a while
construction and set the condition inside the loop.  If you want to
continue inside the block only if certain criteria are met, and otherwise
restart the loop, try "next unless (condition)".

It's rarely a good idea to set up infinite loops without terminating
conditions, in my experience, unless that's really what you intend.  I
almost always find it better and safer to explicitly state the exit
conditions in the loop declaration, even if it's just a flag reflecting
the state of something happening inside.  Makes it clearer to the
reader/maintainer/you-two-weeks-later when the loop ends.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: 2 Mar 1999 18:03:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: not an array referecne??
Message-Id: <7bh96d$qn9$1@client2.news.psi.net>

Peter Bismuti (bismuti@cs.fsu.edu) wrote on MMIX September MCMXCIII in
<URL:news:7bg6oo$fba$1@news.fsu.edu>:
`` 
`` 
`` $ip[$i]   = [ split(/\./,$line[2]) ];
`` 
`` ${$ip[$j+1]}[3]      OK
``  {$ip[$j+1]}->[3]    NOT OK???  Error messate: Not a
``                      reference to an array. 
`` 
`` 
`` I'm confused, I the first expression stores a hard
`` reference int the $ith element of the array ip.
`` The expression: {$ip[$j+1]} should evaluate to that 
`` reference which should in turn be able to be 
`` derenced by either expression.  
`` 
`` What is wrong with this arguement??


Easy. There's no '$' in front!


Either use:
   ${$ip [$j+1]} [3];
or
   $ip [$j+1] -> [3];    (Obscure form: $ip [$j+1] [3];)



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Tue, 02 Mar 1999 11:21:15 -0600
From: Philip Parker <philipNOSPAM@hrsites.com>
Subject: Occasional Perl failure(?) question...
Message-Id: <36DC1E0A.474E7799@hrsites.com>

Actually, the problem may be with my programs or with my installation.
I'm using the ActiveState installation (build 509) on NT4Wks SP3. On
rare occasions, I find that a Perl program may die or produce incorrect
output. I've seen it happen with very simple programs where the code
itself was quite clear. When I run it again with identical input and
conditions (as far as I can tell), it will run fine. Has anyone ever
experienced this? I'm talking about cases where everything was done on a
single machine and no IPC. As a side note, I do make very liberal use of
hashes. Unfortunately, I have no code snippets to post, I've forgotten
or deleted the simple examples. Thanks.


                                Philip Parker




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

Date: Tue, 02 Mar 1999 12:30:31 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Occasional Perl failure(?) question...
Message-Id: <linberg-0203991230310001@ltl1.literacy.upenn.edu>

In article <36DC1E0A.474E7799@hrsites.com>, Philip Parker
<philipNOSPAM@hrsites.com> wrote:

> Unfortunately, I have no code snippets to post, I've forgotten
> or deleted the simple examples. Thanks.

Um.  This makes it just about impossible to diagnose.  Try to come up with
a reproducible case, and we can help you.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Tue, 02 Mar 1999 17:07:52 GMT
From: wetboy <wetboy@shore.net>
Subject: Re: Pentium III Chips Released with IDs - Intel won't budge
Message-Id: <IVUC2.359$HF2.58466@news.shore.net>

In comp.lang.c Mike Tiller <mtiller@ptrs14.srl.ford.com> wrote:
: Christopher Nelson <chris@pinebush.com> writes:

:> Kenny Chaffin wrote:
:> 
:> > Well you may not want to admit it, but it will affect you or your
:> > customers/clients/company....
:> > And as far as not buying it, that would be great if intel/microsoft
:> > didn't have a monopoly on the pc market....
:> 
:> What monopoly? I've got an AMD chip in my PC.

: Exactly.  Anybody who thinks Intel is a monopoly just doesn't know the
: facts.

My AMD K5 processor computer has been very happily running
Windows NT 4.0 for the past couple of years, and I'm looking
forward to purchasing an AMD K7 when it comes out, partly
to avoid "Big Brother Inside".

Read here, post here.

-- Wetboy


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

Date: Tue, 02 Mar 1999 09:26:15 -0800
From: Al Christians <achrist@easystreet.com>
Subject: Re: Pentium III Chips Released with IDs - Intel won't budge
Message-Id: <36DC1F37.F2A38999@easystreet.com>

I'm afraid that the really big (money) issue wrt CPU ID's is one 
that no one has noticed much yet.  It has to do with electronic 
commerce apps.  The application development opportunities here 
are endless.  There is already a great deal of work on custom 
content in the development of web and e-business apps.  What the 
CPU ID allows is the identification of particular customers as 
suckers who will not get a very good price offer, and of others 
as smart shoppers who must be given competitive pricing.  Our 
typical markets today with posted pricing do not facilitate 
changing the price based on what it looks like the particular 
customer will stand -- it is only worthwhile in negotiaing big 
ticket items like cars, houses,  mainframe computer systems, 
enterprise-wide software licenses.  E-business changes all that, 
and what it will allow, particularly if big companies get to 
dominate  electronic markets, is the elimination of list prices 
and their replacement with customer-specific pricing.  

Imagine a database circulated amongst sellers that identifies you 
as someone who is willing to pay high prices, so that high prices 
are  what is offered to you, while others are getting better deals.  
This is far from the optimal free market economy described by Adam 
Smith and other expositors of the advantages of economic freedom,  
and it is something that we ought to try to prevent.  It is not 
benign technology.  Socially responsible software developers should 
not promote or assist it.

Al


Bob Butler wrote:
> 
> Jon Helms wrote in message <36DB485A.79499011@purdue.edu>...
> <cut>
> > What are you trying to hide that you don't want people to have your CPU
> ID?
> <cut>
> 
> The argument that "if you have nothing to hide then you should not object to
> being searched" has been used many times to take away the basic right to
> privacy.  Sometimes the principle is more important than the specific
> instance.  I would agree that there are reasons for having this and in the
> particular case of CPU IDs I have mixed feelings and no decision yet.  The
> above argument, however, is a strong case for fighting it.


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

Date: Tue, 02 Mar 1999 12:13:02 +0000
From: Kathryn Taylor Jennings <kat_j@mindless.com>
To: Jon Helms <helmsjr@purdue.edu>
Subject: Re: Pentium III Chips Released with IDs - Intel won't budge
Message-Id: <36DBD5CE.ADA6D027@mindless.com>

OK, I haven't checked this out _personally_ but this is a direct quote from
www.bigbrotherinside.com:

What about using using the PSN to prevent chip theft and
                  overclocking?

                  Chip theft is an important issue and thefts cost the industry and
Intel millions
                  of dollars each year. However, Intel states that the PSN is not
designed to be
                  used for either preventing chip theft or limiting overclocking.

If anyone knows otherwise would they please post something to this effect?

Jon Helms wrote: "You afraid of making it easier to track down stolen CPUs?......"

--

"The effort of using machines to mimic the human mind
has always struck me as rather silly. I would rather
use them to mimic something better"
- Professor Edsger Dijkstra

"The difference between stupidity and genius is that
genius has limits" - Albert Einstein




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

Date: 2 Mar 1999 17:36:17 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: perl -d trouble...
Message-Id: <7bh7ih$502$1@info.uah.edu>

In article <36DC0C7B.2408B18@leafton.com>,
	Ben Bergen <ben@leafton.com> writes:
: Yesterday morning this was working.

This may seem like a crazy idea, but how about presenting the code in
question?

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


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

Date: Tue, 02 Mar 1999 18:38:06 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Search and Replace in Perl
Message-Id: <36DC21FE.E85BFDC4@ngb.se>

Disco wrote:
> I'm in the middle of a project which requires me to perform a search
> and replace on various HTML tags within a HTML document for
> reformatting purposes.

This should be very easy with regexp. Try looking in perlre for info. As
a example, to change the locations of images in a html-page, the
following should work:

$html =~ s#(<[Ii][Mm][Gg][^>]*)/olddir/#$1/newdir/#g;

assuming that /olddir/ only exists in the src attribute, and that no
attributes have > enbedded in the value. 

HTH
Staffan

> It seems like quite a simple task which I'm sure someone must have come up
> against before. Is there a Perl module which will help me do this? Are there
> any examples of code which will do this?
> 
> Thanks in advance.
> 
> D
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: Tue, 02 Mar 1999 12:44:10 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Search and Replace in Perl
Message-Id: <linberg-0203991244100001@ltl1.literacy.upenn.edu>

In article <7bgqg7$odv$1@nnrp1.dejanews.com>, Disco
<disco181@my-dejanews.com> wrote:

> Help!
> 
> I'm in the middle of a project which requires me to perform a search and
> replace on various HTML tags within a HTML document for reformatting purposes.
> It seems like quite a simple task which I'm sure someone must have come up
> against before. Is there a Perl module which will help me do this? Are there
> any examples of code which will do this?

OK, change the h2's to h3's below, programmatically.

<h2>
<h2  >
<h2 align="center">
</h2>
<p>I like h2 tags, h2 is the tag for me!</p>

Which "h2"s are parts of tags?
"<h2>" doesn't match them all.
"h2>" doesn't match them all.
"h2" matches them all and then some.

Simple, no.  :)  But yes, the problem has been grappled with.  See
HTML::Parse and its family.

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: 2 Mar 1999 18:41:45 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Search and Replace in Perl
Message-Id: <7bhbd9$2dg$3@ffx2nh5.news.uu.net>

Staffan Liljas <staffan@ngb.se> wrote:
> This should be very easy with regexp. Try looking in perlre for info. As
> a example, to change the locations of images in a html-page, the
> following should work:
> 
> $html =~ s#(<[Ii][Mm][Gg][^>]*)/olddir/#$1/newdir/#g;
> 
> assuming that /olddir/ only exists in the src attribute, and that no
> attributes have > enbedded in the value. 

This is bad advice for a couple of reasons:

  * Perl can do case-insensitive regular expressions -- no need for
    that icky [Ii] business, just use the /i modifier:
       s#(<img[^>]*)/olddir/#$1/newdir/#gi;

  * regular expressions are totally inadequate for parsing HTML in
    the general case; you should use the modules in the HTML-Parse
    distribution.  I find HTML::TokeParse particularly handy for
    quick 'n dirty jobs (and when is an HTML parsing job *not*
    quick 'n dirty?); for more involved work, the more general
    and low-level modules might be needed.

        Greg

-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Tue, 2 Mar 1999 12:44:31 -0500
From: "Bill Frisbee" <bfrisbee@nospam.webengine-db.com>
Subject: Re: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <6qVC2.364$HF2.59795@news.shore.net>


John Kenyon <etljwk@etl.x.dmx.ericsson.se> wrote in message
news:36DC1106.5DCDC5A9@etl.x.dmx.ericsson.se...
>George Bonser wrote:
>>
>> Oh, give it a break. Every Sun SPARC or UltraSPARC machine ever built has
a
>> CPU serial number. So do most other brands of high-end machines. This is
>> nothing new.
>
>You mean the host id, which is held in NVRAM, (which can be modified),
>which was designed to allow licensing of software, rather than the
>tracking of the person who was using it.
>
>The fact is that host id's existed a longtime before the Internet
>went "mainstream". Given the current rate of "dumbing down" of
>functionality, it is only a matter of time until this "host id"
>techology gets misused.

Bah... Sun knows EVERYTIME I turn my system on tracked by that host id which
is PART of the CPU and hardcoded to the CPU.

BTW it is a Ultra5 not really a high end machine, yet the cpu ID is easily
retrieved by Sun. Intel is doing nothing new.


Bill F.





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

Date: Tue, 2 Mar 1999 13:08:20 -0500
From: "Michael T. Richter" <mtr@ottawa.com>
Subject: Re: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <bOVC2.27$xJ4.144@198.235.216.4>

What does any of this have to do with Python?

Bill Frisbee wrote in message <6qVC2.364$HF2.59795@news.shore.net>...
>
>John Kenyon <etljwk@etl.x.dmx.ericsson.se> wrote in message
>news:36DC1106.5DCDC5A9@etl.x.dmx.ericsson.se...
>>George Bonser wrote:
>>>
>>> Oh, give it a break. Every Sun SPARC or UltraSPARC machine ever built
has
>a
>>> CPU serial number. So do most other brands of high-end machines. This is
>>> nothing new.
>>
>>You mean the host id, which is held in NVRAM, (which can be modified),
>>which was designed to allow licensing of software, rather than the
>>tracking of the person who was using it.
>>
>>The fact is that host id's existed a longtime before the Internet
>>went "mainstream". Given the current rate of "dumbing down" of
>>functionality, it is only a matter of time until this "host id"
>>techology gets misused.
>
>Bah... Sun knows EVERYTIME I turn my system on tracked by that host id
which
>is PART of the CPU and hardcoded to the CPU.
>
>BTW it is a Ultra5 not really a high end machine, yet the cpu ID is easily
>retrieved by Sun. Intel is doing nothing new.
>
>
>Bill F.
>
>
>



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

Date: Tue, 2 Mar 1999 12:39:24 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Variables in regular expressions
Message-Id: <7bh7bv$qqd$1@camel19.mindspring.com>

Larry Rosler wrote in message ...
:[Posted and a courtesy copy mailed.]
:
:In article <m2r9r7hp2c.fsf@kn-10-0-21-140.kotnet.kuleuven.ac.be>, on 02
:Mar 1999 16:46:35 +0100 kris.verbeeck@advalvas.be says...
:> I have a full fledged regular expression in a variable:
:> $MULTI_TAG = "\$<MULTIMAX=([0-9]+)>\$";
:> Now I want to use this regular expression in a matching, like this:
:> $text =~ /^$MULTI_TAG/;
:> That doesn't work.  I tried prefixing the variable with "\Q" and
:> postfixing it with "\E", but that didn't work either.  I checked the
:> FAQ, but can't seem to find a good answer for my problem.  Can anyone
:> help me?
:
:You need to use single-quotes around the string in $MULTI_TAG, or double
:the back-slashes so they survive into the regex.  \Q would be a disaster
:-- you *want* those metacharacters to be interpreted as such.
:

Ok, I understand the nature of the original post but something has me
confused (ya, so unusual eh?).  I am sure this is simple but I just don't
see it.

Anyway, in the script below if I use
my $match = "$foo";
then $match = 'oo'  and there is a successful match.

if I use
my $match = "\\\$foo";
Then $foo becomes the literal '$foo' and I match.  All well and good.

But what would $match = "\$foo" actually match?  I have tried modifying
$string in all kinds of ways
my $string = '\$foo';
my $string = "\$foo";
and I never get a match to \$foo.  Can someone shed some light on what is
going on here?  What would $match = "\$foo"; match?

#!/usr/local/bin/perl -w
use strict;
my $string = '$foo';
my $foo = 'oo';

#my $match = "$foo"; # $match = $foo = 'oo' so we match
#my $match = "\\\$foo"; # $match = '$foo' so we match
my $match = "\$foo"; # What would this match in $string?

print "$match\n";
print "$1\n" if $string =~ /($match)/;

Thanks,

AmD

No need to email me I check back regularly.
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
An old pond-
The sound of the water
When the frog jumps in
 - Basho




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

Date: 02 Mar 1999 08:39:29 -0800
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Why isn't this a race condition ?
Message-Id: <8p6aexvonge.fsf@Eng.Sun.COM>

"Juho Cederstrvm" <cederstrom@removethis.kolumbus.fi> writes:

> I've read the FAQ, and this is what I found:
> 
> ----- (I still don't get locking. I just want to increment...):
>     ...
>     Anyway, this is what to do:
>     ...
>     sysopen(FH, "numfile", O_RDWR|O_CREAT, 0644) or die "can't open numfile:
> $!";
>     flock(FH, 2)      or die "can't flock numfile: $!";
>     ...
> -----
> 
> I've understood, that opening and locking should be done by the same
> function. And here two functions are used. So now it seems that I was wrong.
> Could you _please_ explain this to me ?

There's no need for opening and locking to be done by the same
function.  And there's no need for them to be done as a single atomic
action.  There is no race condition between the two operations---any
number of processes can open the file simultaneously without problems.
*All* the atomicity required is built into flock().  The only reason
to open the file at all is that flock() requires an open file handle
to operate on.  

-mike


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

Date: Tue, 02 Mar 1999 19:04:42 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: y2k and 4-digit dates (was Re: foreach and while)
Message-Id: <36DC283A.4E261E27@ngb.se>

Russell Schulz wrote:
> > It's all about context.  4 digits doesn't magically fix everything.
> 
> actually, for the overwhelming majority of cases (AD1-AD9999), they
> do. if used consistently, if there hadn't been `year-1900' silliness,
> if data storage would have allowed them, if output fields were wide
> enough, there wouldn't have been a y2k concern.

Actually, AD1-AD9999 isn't really the overwhelming majority of all
cases. The Universe has existed for about 2E10 years, and is likely to
exist for at least that many more, so 1E4 years is only a 2.5E-7 part of
all years, not really a majority. However, it might be the overwhelming
majority of cases YOU need to consider. 4-digit years are appropriate
where you have programs that you expect to deal with timespans around
1E3 years, and 2-digit years are fine when you're dealing with timespans
of 1E1 years. The rest is implementation.

And there was a Y1.9K problem: in Sweden, at least, the population has
been documented, with birthdates, since several hundred years. How do
you know whether 89 is 1789 or 1889? You look at the front page of the
book... It's all about context. 

The problem arises when you assume that the context is obvious or
uninteresting. What if the front page doesn't contain that information?
What if you don't write documentation to show WHAT you're assuming about
your 2-digit (or four digit)? You get problems.

We get the same problem whenever the context isn't obvious but someone
considered it to be so. And four-digit years is an example of this, if
we're dealing with dates out of the ordinary.

Staffan


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed 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 5034
**************************************

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