[10016] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3609 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 1 18:05:31 1998

Date: Tue, 1 Sep 98 15:00:27 -0700
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, 1 Sep 1998     Volume: 8 Number: 3609

Today's topics:
        Best way to "reset" $1? <yong@shell.com>
    Re: Best way to "reset" $1? (Larry Rosler)
    Re: Better Regular Expressions (Craig Berry)
        chat2.pl errors in 5.004_04 <smarrin@cadvision.com>
    Re: DESTROY problems <rootbeer@teleport.com>
    Re: Error writing to an output file... <jdw@dev.tivoli.com>
        format problem <didier@referencement.net>
    Re: format problem <rootbeer@teleport.com>
    Re: Freeing variables? <rootbeer@teleport.com>
    Re: Funny, that:  $#myarray <rootbeer@teleport.com>
    Re: Helo locating Modules... (Alastair)
    Re: Help create a fileupload script <rootbeer@teleport.com>
    Re: Help! How to switch usernames? <rootbeer@teleport.com>
        History of Perl <noone@noewhere.com>
    Re: History of Perl <eashton@bbnplanet.com>
    Re: Imagine... a non-greedy world! (Andrew M. Kuchling)
    Re: Misinterpreted => why no true/false keywords? (Mark-Jason Dominus)
    Re: Misinterpreted => why no true/false keywords? (Mark-Jason Dominus)
    Re: Misinterpreted => why no true/false keywords? (Mark-Jason Dominus)
    Re: Misinterpreted => why no true/false keywords? (Mark-Jason Dominus)
    Re: Mysql / Perl / Apache (Honza Pazdziora)
    Re: Need a search-script that can be run from a link! <rootbeer@teleport.com>
        Parsing XML and HTML (was: Re: Better Regular Expressio <rootbeer@teleport.com>
        perl scripts as NT services? <cr@ucsd.edu>
        Perl skills needed in NY / NJ <charles@a1assured2.demon.co.uk>
    Re: PLEASE HELP ME !!!!! (Tad McClellan)
    Re: reading from file <jdw@dev.tivoli.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 01 Sep 1998 15:01:06 -0500
From: yong <yong@shell.com>
Subject: Best way to "reset" $1?
Message-Id: <35EC5282.46F07A26@shell.com>

Suppose I have m/(string)/ and $1 is set to "string". I can't reset $1
to "" (which generates an error) or undef it (which is ignored
silently). There're two awkard ways to "do" this: use another variable
$tmp=$1 and forget about $1; make a useless match "" =~ m/()/; so $1 is
"reset" to "". What's the best way?

BTW, the reason I want to reset $1 is that the match is in a loop, and
the second time around if there's no match, $1 keeps its original value.
I don't want that.

Any advice is appreciated. Thanks.

Yong Huang
Email:yong@shell.com



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

Date: Tue, 1 Sep 1998 13:16:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Best way to "reset" $1?
Message-Id: <MPG.1055f5e19482f1d2989785@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <35EC5282.46F07A26@shell.com> on Tue, 01 Sep 1998 15:01:06 -
0500, yong <yong@shell.com> says...
> Suppose I have m/(string)/ and $1 is set to "string". I can't reset $1
> to "" (which generates an error) or undef it (which is ignored
> silently). There're two awkard ways to "do" this: use another variable
> $tmp=$1 and forget about $1; make a useless match "" =~ m/()/; so $1 is
> "reset" to "". What's the best way?
> 
> BTW, the reason I want to reset $1 is that the match is in a loop, and
> the second time around if there's no match, $1 keeps its original value.
> I don't want that.

A regex match returns TRUE if it succeeds, FALSE if it doesn't.  Check 
for that, rather than the value of $1.

if (/what(ever)/) { it succeeded and $1 is set ... }

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


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

Date: 1 Sep 1998 20:55:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Better Regular Expressions
Message-Id: <6shmvq$5ua$2@marina.cinenet.net>

Tom Phoenix (rootbeer@teleport.com) wrote:
: Naw. Parsing XML is _much_ simpler than parsing HTML, since you don't have
: to worry about how to parse bogus code. Cheers!

What do you mean by that?  (Honest question, I'm not familiar enough with
XML to see why this would be the case.)

Also, there was some talk on clp.m(isc|oderated) about built-in XML
support in Perl itself (as opposed to in a module, like HTML::Parse).  Can
anybody shed further light on this?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Tue, 01 Sep 1998 15:22:31 -0600
From: Scott Marrin <smarrin@cadvision.com>
Subject: chat2.pl errors in 5.004_04
Message-Id: <35EC6597.7867341D@cadvision.com>

I recently compiled 5.004_04, moving up from 5.003

I am trying to use (require 'chat2.pl') but keep getting error messages.
The first was that it couldn't find stddef.ph I fixed that, and then it
couldn't find stubs.ph. Fixed that one as well.
Now, I get the following:

Number found where operator expected at (eval 30) line 1, near ")0"
        (Missing operator before 0?)
String found where operator expected at (eval 96) line 1, near "'unsigned
short' 'int'"
        (Missing operator before  'int'?)
String found where operator expected at (eval 133) line 1, near "&__const
'struct sockaddr'"
        (Missing operator before  'struct sockaddr'?)

I was pretty pleased with my self that I actually fixed up the first two
error messages, but this last one is way over my head. Any ideas on what
is going wrong.

I am using the stable.tar.gz source from ftp.perl.org, installed on a
Pentium 200 with 128MB running Redhat 5.1, Kernel 2.0.35  Just to check,
I even tried the perl-5.004_06.rpm file from redhat. Same error.

Any help I could get with this would be most appreciated.

Thanks,

Scott Marrin




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

Date: Tue, 01 Sep 1998 20:53:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: DESTROY problems
Message-Id: <Pine.GSO.4.02A.9809011352120.21048-100000@user2.teleport.com>

On Tue, 1 Sep 1998, Hr. Jochen Stenzel wrote:

> This is seldomly used, I agree. But, just an idea - looking back to my
> original problem - perhaps a hint in DESTROY() notes could be helpful for
> module authors: a hint to localize $? in DESTROY() methods if $? is
> possibly modified there - because a module user may have an instanciated
> object if he calls exit().

That's a good idea. When you've written it up, use the perlbug program to
submit your patch to the Perl documentation. :-)   Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 01 Sep 1998 14:17:25 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Error writing to an output file...
Message-Id: <obhfyr8wxm.fsf@alder.dev.tivoli.com>


Pete Donina <pete.donina@ketchum.com> writes:
> > [01/Sep/1998:12:11:34] failure: for host 199.183.150.2 trying to POST
> /shell-cgi/test1.pl, cgi-parse-output reports: the CGI program
> C:\Perl5\bin\perl.exe did not produce a valid header (program terminated
> without a valid CGI header (check for core dump or other abnormal
> termination)

the error says you're script isn't generating a valid header.

> The script works fine when I run it from the NT Server.
> Here is the code.
> 
> $|=1;
> $file2 = 'blank2.htm';
> open(OUT, ">>$file2");       # Open the file
> print OUT "This is a test";
> close(OUT);

sure enough, you're not generating a header..., in fact it's not
generating any html either (at least it's not writing any to STDOUT
where httpd can display it to a user...

perldoc CGI will be a big help (If that doesn't work, consider getting
a newer version of perl, one that has CGI)

Try adding the following before your code:

use CGI qw/:standard/;

print header, start_html('Write to a file'),
      h1("I'm going to write to 'blank2.htm'");

-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: Tue, 01 Sep 1998 22:34:58 +0200
From: Didier LADNER <didier@referencement.net>
Subject: format problem
Message-Id: <35EC5A72.1935C77F@referencement.net>

Hi,

I'am using for the first time the format function.

This snippet goes wrong:
$a = "one";
$b = "two";
$c = "tree";

	format STDOUT =
	@<<<<<@||||||@>>>>>
	$a, $b, $c
	====================
	.

	write STDOUT; 

with error:Format not terminated at dir2.pl line 15, at end of line
 Could somebody tell me why?
Regards
-- 
Didier    
--                    
____________________________________________________________

Didier LADNER.
Merci de votre interet. Nous faisons prosperer vos affaires.
http://www.referencement.net


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

Date: Tue, 01 Sep 1998 21:29:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: format problem
Message-Id: <Pine.GSO.4.02A.9809011427400.21048-100000@user2.teleport.com>

On Tue, 1 Sep 1998, Didier LADNER wrote:

> with error:Format not terminated at dir2.pl line 15, at end of line
>  Could somebody tell me why?

When Perl gives you an error message you don't understand, check the
perldiag manpage. In this case, it tells you that Perl didn't find a line
with a solitary dot to terminate the format. Often that means that you had
whitespace characters before or after the dot. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 20:27:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Freeing variables?
Message-Id: <Pine.GSO.4.02A.9809011324030.21048-100000@user2.teleport.com>

On Mon, 31 Aug 1998, Rik Blok wrote:

> How do I free memory used by variables? 

Just undef the variables, and Perl will recycle the memory.

    undef $big_scalar;
    undef @big_array;
    undef %big_hash;

Of course, your OS may not permit a process to give memory back to the
system. It is for this reason that many long-running programs (whether
written in Perl or not) may periodically re-exec themselves. 

> How can I watch the allocated memory to be sure it is getting freed
> properly?

Your system probably has utilities which let you monitor each program's
memory use. But if you need to watch it from inside your program, you may
wish to use a module like BSD::Resource, if it works on your system.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 20:35:36 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Funny, that:  $#myarray
Message-Id: <Pine.GSO.4.02A.9809011329130.21048-100000@user2.teleport.com>

On Mon, 31 Aug 1998, C. Abney wrote:

> The Camel says I might get a performance boost if I don't have a FPU,
> and I can forget about forgetting the explicit cast(?) within the
> block.  Why is using 'use integer' wrong if I segregate my variables?

When you turn on 'use integer', many of Perl's operations are changed to
use different routines. These implement the "same" operation, but use your
system's int type. I put "same" in quotes because these may not be the
integers you expect! Furthermore, some operations are arguably buggy under
'use integer', such as putting a leading dash on a bareword.

    no integer;
    %hash = ( -key => 'value' );	# just what you expected
    use integer;
    %hash = ( -key => 'value' );	# not the same!

So, except in special cases, I generally recommend against using 'use
integer'. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 21:42:47 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Helo locating Modules...
Message-Id: <slrn6uou93.4i.alastair@calliope.demon.co.uk>

Billy Strader <straderb@mindspring.net> wrote:
>Hey Everyone,
>
>OK I need a little help.  Where is a good source to find modules for
>perl on a Linux 2.0.34 i586.  The module I am looking for mainly is GD.
>Any help available will be greatly appricaited.
>

Try CPAN for modules. Accessible via one of ;

http://www.cpan.org
http://www.perl.org
http://www.perl.com
etc.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Tue, 01 Sep 1998 21:05:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help create a fileupload script
Message-Id: <Pine.GSO.4.02A.9809011400460.21048-100000@user2.teleport.com>

On Tue, 1 Sep 1998, The Recruitment Database wrote:

> Can someone help me create a cgi script (solution), I am not a
> programmer but understand web site HTML

This is a lot like saying, "Can someone help me to set up a cotton
plantation? I am not an farmer, but I understand how to iron a shirt." :-)

If you wish to hire a programmer to do the work, that's possible. If you
wish to hire a tutor to teach you, that's also possible. 

If you want free help with your questions about Perl, you'll probably need
to ask your questions in a public newsgroup; in that way, those of us who
like to help will be able to help many people at once, rather than helping
only you.

Of course, if your difficilties are with a server, CGI scripting, or other
non-Perl topics, you should probably look for help in a different place
than in a newsgroup about Perl.

Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 20:23:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help! How to switch usernames?
Message-Id: <Pine.GSO.4.02A.9809011321330.21048-100000@user2.teleport.com>

On Tue, 1 Sep 1998, Ben Duncan wrote:

> I have a perl script which is launched (as root) everytime my FreeBSD
> machine is rebooted. The perl script needs to run as root initally as
> it binds to a port < 1024.
> 
> My question is, how do I switch usernames in my perl script?

I think you're looking for the special variables $< and $> (and the
closely-related $( and $) ones) documented in perlvar. Be very careful
with any script running as root, though!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 13:25:27 -0700
From: Micah <noone@noewhere.com>
Subject: History of Perl
Message-Id: <35EC5837.B357034B@noewhere.com>



Im looking for a site with a good history on Larry Wall and how Perl was

first started to add to some of the other information I have for a book
I am writting.  If you know of a good URL I woudl appreciate it if you
could pass it along.

Thanks,
Micah...

--
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
E T A I L . C O M
http://www.etail.com
Internet Marketing, Development & Design
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
510/594.0239 Voice
510/333.1589 Pager
webmaster@etail.com




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

Date: Tue, 01 Sep 1998 21:42:30 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: History of Perl
Message-Id: <35EC67F1.F8F4C9F1@bbnplanet.com>

> Im looking for a site with a good history on Larry Wall and how Perl was
> first started to add to some of the other information I have for a book
> I am writting.  If you know of a good URL I woudl appreciate it if you
> could pass it along.

there was a thread mentioning this very thing on p5p today/yesterday.
someone may choose to take the challenge and get published in tpj. if
youre writing a book im sure that someone has a little press kit or
somesuch for this very purpose. maybe mail oreilly or larry and ask. the
source is a good place to start. good luck.

e.


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

Date: 01 Sep 1998 17:48:04 -0400
From: akuchlin@cnri.reston.va.us (Andrew M. Kuchling)
Subject: Re: Imagine... a non-greedy world!
Message-Id: <3d67f7bj3f.fsf@amarok.cnri.reston.va.us>

Daniel Grisinger <dgris@rand.dimensional.com> writes:
> I have seen no arguments that greedy matching is due
> to backwards compatibility or tradition (that isn't
> to say that someone hasn't made such an assertion,
> I haven't followed this thread closely enough to say).

	More to the point, what would be gained by changing things?  I
was involved with the addition of Perl-style regexes to Python 1.5,
and we all decided to stick with Perl's notation (*? is non-greedy,
etc.), modulo some additional extensions that are irrelevant here.
Initially there was some discussion of alternate notations, but there
seemed to be no strong reason to bother using an alternative to Perl's
syntax, because no one could come up with an alternative that was
significantly clearer or more intuitive, and there were reasons to
maintain compatibility: users familiar with Perl expressions would
then be more comfortable with the Python module, documentation such as
_Mastering Regular Expressions_ would apply to both systems, etc.
There's no point in introducing variability just for the sake of
variability, when there's no clear-cut improvement to be gained by the
change.

> In article <35E9A15C.1AA43924@mine.com>
> Mee <mee@mine.com> wrote:
> >There is absolutely nothing in any theory that
> >sez that regex must be greedy  
> 
> Citation please. 
> (And no, that isn't meant to be a snotty demand. I am 
> currently attempting to understand the mathematical 
> basis for regular expressions and this statement seems 
> to  contradict the references I have available.  But
> again, I am not yet an expert here and I appreciate all
> references that will help me to fully grok this topic).

	A formal regular expression can be implemented as a
non-deterministic finite automaton, where the automaton just magically
guesses the correct state transition to make at each step.  (We'll
ignore things like backreferences, which aren't implementable in an
NFA.)  You can't write a program which magically guesses the right
transition to make at each step, however, so you have to traverse the
space of possibilities in some way, and check each possibility to see
if it matches.  This is the point of backtracking.  

	It's like searching through a linked list of numbers for
elements within a certain range; does it matter if you start searching
from the beginning or the end?  The matching numbers will be found in
a different order, but the end result will be the same.  Similarly,
the regex engine will correctly determine whether the string is within
the language expressed by the pattern; the details of the first match
found will differ depending on the search order, and that's all.  If
regexes were only used for binary, matches/doesn't match decisions, it
wouldn't matter which search order was used, but since we want to
examine the structure of the match -- the string between '{' and '}',
for example -- one ordering may be more convenient.

	The common NFA-based regex implementations that I'm aware of
have all been greedy; when repeating a subexpression, they try first
with the maximum number of repetitions, and decrease the number on
subsequent failure.  At the request of a user, Philip Hazel's PCRE
library provides a (?U) modifier which switches greedy and non-greedy
qualifiers, so * is non-greedy and *?  is greedy; the change is
trivial.  There's no technical reason for choosing one behaviour over
the other, so you have to argue about which is more convenient; greedy
* has been used everywhere else, so it seems reasonable to stick with
that as the default for historical reasons.

-- 
A.M. Kuchling			http://starship.skyport.net/crew/amk/
I have yet to see any problem, however complicated, which, when you looked at
it in the right way, did not become still more complicated.
    -- Poul Anderson



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

Date: 1 Sep 1998 17:17:31 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Misinterpreted => why no true/false keywords?
Message-Id: <6sho9b$8ur$1@monet.op.net>

In article <904341452.265237@thrush.omix.com>,
Byron Brummer  <zenin@bawdycaste.org> wrote:
>        Well, that gets cumbersome to code quickly.

Someone who is writing a core module to be bundled in the Perl
distribution should not be using that rotten excuse.  If the author
can't be bothered to do it right, it shouldn't be in the core.



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

Date: 1 Sep 1998 17:11:10 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Misinterpreted => why no true/false keywords?
Message-Id: <6shnte$8ru$1@monet.op.net>

In article <904329231.851606@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>: constant.pm is a cute and clever piece of syntactic sugar, but that's all.
>
>        True, but then so is base.pm, enum.pm, vars.pm, subs.pm, tied
>        classes, etc.  

`Syntactic sugar' is usually understood as a simple veneer over some
syntactic feature to make it look more familiar.  A typical example is

	#define begin  {

used by Pascal programmers programming in C.  The term `syntactic
sugar' originated in the Lisp world, where

	'x

is syntactic sugar for (quote x).  Syntactic sugar doesn't introduce
any new or different semantics; it just makes the program easier to
swallow by changing the syntax.  

Anyway, your remark is deceptive; it is a straw man.  You are implying
that I must object to all those things you listed, because they are
all just like `const'.  But they are not just like `const'.  

I have no objection to syntactic sugar, and I have no objection to
modules that pull in 450 lines of code to accomplish their ends.  My
objection is to syntactic sugar that pulls in 450 lines of code to
accomplish nothing more than sugar.  Even then I might not object if I
felt that the sugar was worthwhile; in this case the gain seems
minuscule, if it exists at all.

Going over your examples one at a time, I find that base.pm is not
syntactic sugar, is only 50 lines long anyway, and loads no other
modules; vars.pm is syntactic sugar for a one-line glob assignment,
but is only 40 lines long and loads no other modules; subs.pm is
syntactic sugar for a one-line glob assignment, but is only 10 lines
long and loads no other modules; and tied classes are not syntactic
sugar.  I haven't looked into `enum', so I reserve the right to object
to it (or not) at a later date.


>: That example was specifically discussing a module whose *only* purpose
>: was to define and export a certain function; it said so right up
>: front.  If you didn't want the function, you wouldn't use the module.
>
>        There are many times one wants access to a module's functions
>        without forcing them into there own name space.  If Foo's foo()
>        was only going to be called once, it is common to do:
>
>                use Foo ();
>                Foo::foo();

It is not fair to expect a two-line example in a tutorial article to
be appropriate for use in every possible bizarre circumstance,
particularly one as contrived as your example.  Nevertheless, I will
point out that simply replacing `use' with `require' here solves your
problem completely, in all cases, with the added benefit of possibly
speeding your program's startup time and reducing its memory usage if
`Foo' is never needed.

>: It was either careless or dishonest of you to ignore this.
>
>        IMHO, tutorials that show potentially dangerous or ill advised
>        practices without any mention of such hazards does no one much
>        good.

Hmm.

	Zenin:  You should have included a disclaimer with that example.

	Me:     But I did include a disclaimer.  

	Zenin:  You should have included a disclaimer with that example.


Oh well.  So much for that conversation!



	


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

Date: 1 Sep 1998 17:14:25 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Misinterpreted => why no true/false keywords?
Message-Id: <6sho3h$8tc$1@monet.op.net>

In article <904339549.217006@thrush.omix.com>,
Byron Brummer  <zenin@bawdycaste.org> wrote:
>        Duh...you're right. 
>        That's ok, your alternative that I was replying to wasn't portable
>        anyway (truncate isn't available everywere). <grin>

You may have forgotten it, but you are agreeing with me here.  The
unportable alternative that you were replying to was the `before'
picture in my before-and-after article.  (``Don't do this; do this
other thing instead.'')


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

Date: 1 Sep 1998 17:34:48 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Misinterpreted => why no true/false keywords?
Message-Id: <6shp9o$94r$1@monet.op.net>


In article <904329231.851606@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>: What's your complaint here?  That I didn't present the Ultimate Guide
>: to File Locking?
>
>        That you're offering lock files as a general Better Way[tm], when
>        there main use is only a kluge to handle broken NFS systems.

(Scratches head.)  But they don't handle broken NFS systems.  Nor did
I say that they did handle broken NFS systems.  Or working NFS
systems, for that matter.  In fact, I never mentioned NFS at all.

Hey!  How did NFS get in here?  (Rushes to shut the window.)

>: The solution I presented is more flexible
> How?  Sysopen() is light years more flexible then open().  Open() is
>        only syntactic suger, and it doesn't let you get interesting
>        easily.

The `solution' I am talking about has nothing to do with open
vs. sysopen.  It is about locking a separate empty file rather than
the one that actually has the locked data in it.  Whether you use
`open' or `sysopen' to open the empty file prior to locking it is not
relevant to my article.

Are you sure you read my article, and not someone else's?  You seem to
be arguing with me about my position on issues I never addressed at
all, and about which I have no position.



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

Date: Tue, 1 Sep 1998 20:12:20 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Mysql / Perl / Apache
Message-Id: <slrn6uol94.g6m.adelton@aisa.fi.muni.cz>

On Tue, 1 Sep 1998 13:03:27 -0600, Adam <adam.m@cadvision.com> wrote:
> Hey, this may be considered the wrong n/g but my problem is mostly oriented
> around the actual perl code. All what im trying to do is basically access a
> MySQL database from a web server using apache, sounds simple... I've written
> up the code and it works great at a command prompt, but when i call it from
> localhost netscape always reports back 'document contains no data'... The
> header's going through, but none of the actual print statements are.

Hard to tell what's wrong when we do not see the code. Anything really
simple should suffice:

	# untested
	use DBI;
	my $dbh = DBI->connect('dbi:mysql:test') or die $DBI::errstr;
	my $sth = $dbh->prepare('select * from whatever') or die $dbh->errstr;
	$sth->execute or die $sth->errstr;
	print "Content-type: text/plain\n\n";
	while (my @data = $sth->fetchrow_array)
		{ print "@data\n"; }
	__END__

> Wierdest thing. It seems specifically right at the 'Select * from whatever'
> level of code out of the DBM libraries, thats where it craps out. If i
> comment that out, the code prints fine, but obviously i have no proper sql
> output.

I probably do not catch you well - where is the problem? When you run
the above code, what's on the output and what's in the error_log?

> BTW, i as of yet dont have mod_perl installed, was up till 4am last nite
> trying to get it going, was a bitch of a time, is mod_perl my key to get
> this working?

Definitely no. It just adds more complexity, it's not a magic thing
that would solve problem you are not able to solve otherwise. It's
very powerfull tool, but you should fix what you have now, before
going further.

Hope this helps,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Tue, 01 Sep 1998 20:36:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Need a search-script that can be run from a link!
Message-Id: <Pine.GSO.4.02A.9809011336270.21048-100000@user2.teleport.com>

On Tue, 1 Sep 1998, Trygve Lie wrote:

> Subject: Need a search-script that can be run from a link!

If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 21:50:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Parsing XML and HTML (was: Re: Better Regular Expressions)
Message-Id: <Pine.GSO.4.02A.9809011435370.21048-100000@user2.teleport.com>

On 1 Sep 1998, Craig Berry wrote:

> Date: 1 Sep 1998 20:55:22 GMT
> From: Craig Berry <cberry@cinenet.net>
> Newsgroups: comp.lang.perl.misc
> Subject: Re: Better Regular Expressions
> 
> Tom Phoenix (rootbeer@teleport.com) wrote:
> : Naw. Parsing XML is _much_ simpler than parsing HTML, since you 
> : don't have to worry about how to parse bogus code. Cheers!
> 
> What do you mean by that?  (Honest question, I'm not familiar enough
> with XML to see why this would be the case.)

There's a lot of bogus HTML out there. For example...

    <b><i>I'm mismatched!</b></i>

    <b><i>I'm unterminated!</b>

    <a src=unquoted.gif alt=how can you parse this? >

The browser wars became a competition as to who could make the
best web pages out of bogus HTML. :-P

Of course, that's why we have standards. So how about this?

    <!-- -- -->
	<b>Can you see this, or is it an HTML comment?</b>
    <!-- -- -->

Some browsers interpret that as a comment, some don't. I've heard that the
new version of the HTML standard is going to be defined according to how
some popular browsers (mis-)parse HTML. I hope that was just a sick joke.

In any case, XML's standard is much tighter. In particular, it requires
that the parser choke on bogus code. So any errors should be caught at
once, and parsers can be much simpler.

> Also, there was some talk on clp.m(isc|oderated) about built-in XML
> support in Perl itself (as opposed to in a module, like HTML::Parse).  
> Can anybody shed further light on this?

AFAIK, there's nothing being done or planned that would directly support
XML within Perl. (Of course, I don't know about everything that's
happening with Perl, either.) But work is being done on such precursors as
Unicode support, since XML would require that. But I expect that most work
with XML will be done with external modules, since that sort of thing
doesn't need to be part of the core of Perl itself.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 01 Sep 1998 20:56:40 +0000
From: Chris Roelle <cr@ucsd.edu>
Subject: perl scripts as NT services?
Message-Id: <35EC5F88.C8EECF27@ucsd.edu>

    Hello -

    does anyone know how i can run a perl script
as an NT service?  just need to get it going at
boot-up, as a regular user (who could be an Admin,
i guess), without automatically logging in.  help/http/ftp
addresses w/ instructions welcome, of course, as i
would gladly rtfm, if  i could find one....

    thanks a lot,

    chris roelle
    cr@ucsd.edu



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

Date: Tue, 1 Sep 1998 21:00:54 +0100
From: "news.demon.co.uk" <charles@a1assured2.demon.co.uk>
Subject: Perl skills needed in NY / NJ
Message-Id: <904681121.21928.2.nnrp-05.c1edbd72@news.demon.co.uk>

Perl, Powerbuilder, Oracle professionals        New York / New Jersey
$60-100k / year + Bens

A client of ours has an urgent requirement for someone with the following
skills:-
        Powerbuilder, Oracle, Sybase, SQL
        PFC, OOD, C, C++, Oracle, Perl, PB 6.0
        They are looking for someone with 3 years commercial experience or
more.
        In order to facilitate a face to face interview you should be
located         somewhere in or near NY / NJ.
        Our client will pay between $60,000 and $100,000 depending on
experience. The overall package will include benefits.
If you are interested in this position, please contact Charles Goodall at
charles@a1assured2.demon.co.uk




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

Date: Tue, 1 Sep 1998 13:55:28 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: PLEASE HELP ME !!!!!
Message-Id: <0vfhs6.a7c.ln@metronet.com>

Enrico Ng (ng@usa.net) wrote:
: Can anyone help me?

   Probably.

   But since you couldn't be troubled to put an actual subject
   in your Subject, most people will not read your question.

   Please attempt to put a meaningful Subject header on your articles.


: I have been trying to do this for a long time

   So where's your code?

   It is hard to troubleshoot code that cannot be seen...


: but have not had any success.

: this is what I want the perl to do

: I have a file:

: <!--begin283549-->
: blahblah
: blahblah
: <!--end283549-->
: blahblah
: <!--begin283349-->
: blahblah
: blahblah
: <!--end283349-->

: I want the perl be able to do THREE THINGS

: 1 look at the tag and get the ID# (283549)

   print "found $1 ID $2 on line $.\n" if /^<!--(begin|end)(\d+)-->$/;


: 2 Replace blahblah with something else

   Do you need to use the ID to determine what "something else" 
   to replace it with?

   You don't have that in your specification, so you are not likely
   to get that in any proposed solutions  ;-)



   see the $/ special variable in the 'perlvar' man page to get all of
   the lines in a single scalar.

   then:

   s/<!--begin283549-->\n.*?<!--end283549-->\n/something else\n/s;



: 3 Remove everything between the begin and end tags including the tag but
: leave everything else intact.


   the s/// above does that too.


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


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

Date: 01 Sep 1998 14:05:48 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: reading from file
Message-Id: <obiuj78xgz.fsf@alder.dev.tivoli.com>


Jeffrey Rosen <Jeffrey_Rosen-P28312@email.mot.com> writes:
> I have code that is not behaving as I would expect.  $name gets
> manipulated as if it was a pointer to $line, not a string copy of the
> informaiton. How do I make a copy of the string?

you don't modify either $name or $line, do you have example code and
output where $name is changed when $line is changed?

> $DATA_FILE = "/tmp/1998_08_11_013400.ldif";
> open(DATA,"$DATA_FILE") || die "Input file not found";
> while ($line=<DATA>) {
> $name=$line;
>      if ($line =~ /nscalxitemid:/) {


-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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