[17527] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4947 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 22 06:05:34 2000

Date: Wed, 22 Nov 2000 03:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974891111-v9-i4947@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 22 Nov 2000     Volume: 9 Number: 4947

Today's topics:
    Re: "Broken pipe" (Villy Kruse)
    Re: $x % 0 [was: Addition vs. concatenation] (Anno Siegel)
    Re: [Parse::RecDescent or yacc] question ? <brannon@lnc.usc.edu>
    Re: Accessing NT shares from UNIX - Remote Invocation ? <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
    Re: Addition vs. concatenation [was: Beginners Blues II (Anno Siegel)
    Re: Binding Variables and DBI (Honza Pazdziora)
        C to C++ conversion <vidulats@yahoo.co.uk>
        Curses CPAN module install fails under FreeBSD 4.2 (Chris Fedde)
    Re: Curses CPAN module install fails under FreeBSD 4.2 (Honza Pazdziora)
    Re: expat <pavel@gingerall.cz>
    Re: FAQ? <smokindave@smokindave.com>
    Re: FAQ? <smokindave@smokindave.com>
    Re: Free Online Romance Network <brannon@lnc.usc.edu>
    Re: HELP! bring variables out of a subroutine? <skv@iis.nsk.su>
    Re: How to make something in list context? (Tad McClellan)
    Re: How to send back 2 or more gif, if only one cgi cal <johngros@Spam.bigpond.net.au>
    Re: looking for PERL GUI debugger for UNIX (Chris Fedde)
    Re: looking for PERL GUI debugger for UNIX (Ilya Zakharevich)
    Re: need some help with regex <MiGuenther@lucent.com>
    Re: OT:Re: Eurodate mysteries (Martien Verbruggen)
    Re: OT:Re: Eurodate mysteries coluche@my-deja.com
        Posting Guidelines? jbuff1856@my-deja.com
    Re: quick sorting question fhinchey@my-deja.com
    Re: quick sorting question <uri@sysarch.com>
    Re: Reg Exp Learning? (Mark-Jason Dominus)
    Re: Reg Exp Learning? (Mark-Jason Dominus)
        rounding with "printf %f" <fd@orga.com>
        running a script as root <news@#nospam#althepal.com>
    Re: Simple question <brannon@lnc.usc.edu>
    Re: Sorting question (Tad McClellan)
        strange socket problem tlynch001@my-deja.com
    Re: strange socket problem (Honza Pazdziora)
    Re: strange socket problem nobull@mail.com
    Re: Tom Christiansons' 'style' (Chris Fedde)
    Re: Tom Christiansons' 'style' (David H. Adler)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 22 Nov 2000 08:23:53 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: "Broken pipe"
Message-Id: <slrn91n0he.gn.vek@pharmnl.ohout.pharmapartners.nl>

On Tue, 21 Nov 2000 18:06:30 GMT,
            rereidy@my-deja.com <rereidy@my-deja.com> wrote:

>This error is a UNIX error and is probaly coming from (but we can't be
>sure since you posted no code) something like:
>
>open(F, "gzip $file |") ...
>
>At least, this is where I have seen the problem occur.
>


If you then don't read from F until EOF, then the gzip command gets
a broken pipe condition, because it is writing to a pipe which is
closed in the other end.



Villy


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

Date: 22 Nov 2000 09:11:52 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $x % 0 [was: Addition vs. concatenation]
Message-Id: <8vg2ko$3a3$1@lublin.zrz.tu-berlin.de>

Ilmari Karonen  <usenet11282@itz.pp.sci.fi> wrote in comp.lang.perl.misc:
>In article <8ve8so$1o6$1@lublin.zrz.tu-berlin.de>, Anno Siegel wrote:
>>
>>Treatment of singed operands by the mod operation varies wildly, and
>>Perl hands down what it gets.  All the while, there is a perfectly
>>reasonable extension of the modulo operation x%y for all real x and y:
>>Let x%y = x - y*floor(x/y) if y != 0, and let x%0 = x.  The theory
>>can be found in (where else) Knuth, _The Art..._ Vol 1, see index.
>
>What's the logic behind that last definition?  I would rather assume
>that, were x%0 defined at all, the most reasonable value would be 0.
>I'd look in the Knuth book, but I only have volume 2 in my bookshelf
>and in any case the bookshelf isn't here.

Books have a way of being where you aren't, don't they?

Setting x%0 = x preserves the property that x%y = 0 if and only if
x is an integer multiple of y.

>
>>Long ago, when Perl 5 came out, I proposed a patch that implemented
>>this.  Of course it wasn't accepted, it breaks old code.
>
>Grpmh.  Code like that deserves to break..
>
>(tongue only halfway in cheek)

Well, if the problem were just the (non-existent) conventions about
the sign of x%y, I wouldn't worry.  The extension to arbitrary real
arguments is the show-stopper: Currently % truncates its operands
to integers, so you can say rand(15)%7 and expect an integer result.
You can't with the extended definition.

It *would* be fun to be able to say $alpha %= 2*PI.

Anno


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

Date: Wed, 22 Nov 2000 06:37:37 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: Re: [Parse::RecDescent or yacc] question ?
Message-Id: <lb4s10zf4e.fsf@lnc.usc.edu>



> hi there,
> 
> I want to implement grammar that can handle nested<->repeated
> structures.(YACC solution are welcome too!)
> How can I do it ?

download Parse::RecDescent from www.CPAN.org and look in the demo
directory

also, closely read the documentation. you should be fine from
there. if not, ask me AFTER reading this and I will try to help, as I
do a lot with Parse::RecDescent in my free time.

But of course Iam not an expert, I just want to keep people off Damian
so he can focus on more pressing tasks.

> Curently I'm using something like this :
> 
> start : 'for' word(s) 'end'
> 
> word  : ...!'end' ( start | token )
> 
> token : /\S+/
> 
> So I can parse structure like this :
> 
> for
>  .....
>  for
>   .....
>  end
>  .....
>  for
>   .....
>  end
> end
> 
> How to this if I want to add other types of such structures i.e. handle
> for example "while" too.
> I want to preserve only one END terminator as possible i.e. 'end'
> ( but not for...endfor, while...endwhile etc....)
> 
> Also want to trigger action at every 'start' and 'end'...
> 
> Thanx for your help and time.
> If you can mail me directly.
> 
> iVAN
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

-- 
Terrence Brannon


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

Date: Wed, 22 Nov 2000 11:05:00 -0000
From: "Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Subject: Re: Accessing NT shares from UNIX - Remote Invocation ?
Message-Id: <974890719.3314.0.nnrp-04.9e98e5bc@news.demon.co.uk>

Interesting ideas on accessing NT data from UNIX.

My problem is how to remotely invoke NT server applications from UNIX.
Currently, my project gives system managers a browser interface (Netscape),
on both UNIX and NT servers.
From the NT browser, the system can invoke UNIX server processes (using rsh,
I think).  The method is fairly weak at telling the NT browser if anything
has failed on the UNIX server, and what failed.

But from the browser on UNIX (Solaris 2.6), we are crippled by a Javascript
plug-in for invoking applications on NT: it is not possible to pass back any
status info or failure details from NT to UNIX.

Can anyone suggest how to do this please?

Possible tracks include:

1. An rsh daemon running on NT: is there such a daemon?  is this a security
loophole?

2. Sockets: I guess shed-loads of development effort of specific
client-server pairs.  I'd prefer something generic like option 1 above.

3. RMI: a colleague suggested Java Remote Method Invocation - tho' we don't
know much about it, and I'd rather avoid the problems of interfacing Perl to
Java if possible.


Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message
news:slrn91jth0.r2.mgjv@verbruggen.comdyn.com.au...
> However, there's samba out there, and on some platforms it can
> actually mount (via smbfs) SMB drives.

We use Samba, but I guess that's not going to help with remote invocation.

Thanks for ideas and suggestions,
Clyde





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

Date: 22 Nov 2000 08:19:52 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Addition vs. concatenation [was: Beginners Blues II]
Message-Id: <8vfvj8$34j$1@lublin.zrz.tu-berlin.de>

Linc Madison  <lincmad001@telecom-digest.zzn.com> wrote in comp.lang.perl.misc:

 ...

>Indeed, if you study number theory or advanced algebra, I'm sure you
>can find some abstract realm in which it's not a given that addition is
>commutative.

Not so.  It's mathematical tradition to use additive notation for
commutative compositions and multiplicative notation for compositions
that may be non-commutative.  A typical example is the theory of
groups, where the composition is written "*" in general, but authors
usually switch to "+" in the study of Abelian (commutative) groups.

Granted, a mathematician is free to chose any notation, but a paper
that uses "+" for a non-commutative operation is bound to raise a few
eyebrows.

Anno


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

Date: Wed, 22 Nov 2000 09:27:29 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Binding Variables and DBI
Message-Id: <G4F69t.HtL@news.muni.cz>

On Wed, 22 Nov 2000 01:37:52 GMT, Sangam <mysangam@my-deja.com> wrote:
>  I am binding variable names using DBI with Oracle to call Stored
> Procedure. For each variable I have to seperately name them.
> Any idea how I can do the same thing using an array or hash.
> I have tried simple thing, but it didn't work.

	$dbh->do('begin procedure_name(?, ?, ?); end;', {},
		$param1, $param2, $param3);

is the generic way, so you can use

	$dbh->do('begin procedure_name(?, ?, ?); end;', {},
		@param_array);

but make sure the array really has three elements or you get
an error.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Wed, 22 Nov 2000 09:30:17 -0000
From: <vidulats@yahoo.co.uk>
Subject: C to C++ conversion
Message-Id: <t1n4h9ioi1pvf9@corp.supernews.com>

Hi,

My project is in C. 
I want to convert it in C++.
I know that re-coding the entire project is the solution to that.

But, I also heard that the easiest way is by writing Perl script. Which 
can convert my entire project from C to C++.

Can anyone guide on this topic?
Or atleast suggests me some documentation related to this topic.

Thanks in advance,

Regards,
Vidula



--
Posted via CNET Help.com
http://www.help.com/


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

Date: Wed, 22 Nov 2000 07:36:18 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Curses CPAN module install fails under FreeBSD 4.2
Message-Id: <SHKS5.2$QX6.171075584@news.frii.net>
Keywords: some idiot

Compiling Curses-a9 from CPAN fails

  cc -c  -fno-strict-aliasing -I/usr/local/include -O      -DVERSION=\"a9\"  -DXS_VERSION=\"a9\" -DPIC -fpic -I/usr/local/lib/perl5/5.6.0/i386-freebsd/CORE  Curses.c
  In file included from /usr/local/lib/perl5/5.6.0/i386-freebsd/CORE/perl.h:500,
		   from Curses.c:13:
  /usr/local/lib/perl5/5.6.0/i386-freebsd/CORE/embed.h:269: warning: `instr' redefined
  /usr/include/ncurses.h:998: warning: this is the location of the previous definition
  Curses.c: In function `c_sv2chtype':
  Curses.c:91: `na' undeclared (first use in this function)
  Curses.c:91: (Each undeclared identifier is reported only once
  Curses.c:91: for each function it appears in.)
  Curses.c: In function `XS_Curses_addchnstr':
  Curses.c:148: `na' undeclared (first use in this function)


Is this a problem with FreeBSD or am I just blowing it somewhere?

chris

$ perl -v

  This is perl, v5.6.0 built for i386-freebsd

  Copyright 1987-2000, Larry Wall

  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5.0 source kit.

  Complete documentation for Perl, including FAQ lists, should be found on
  this system using `man perl' or `perldoc perl'.  If you have access to the
  Internet, point your browser at http://www.perl.com/, the Perl Home Page.

-- 
    This space intentionally left blank


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

Date: Wed, 22 Nov 2000 09:40:10 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Curses CPAN module install fails under FreeBSD 4.2
Message-Id: <G4F6uy.4zK@news.muni.cz>

On Wed, 22 Nov 2000 07:36:18 GMT, Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
> Compiling Curses-a9 from CPAN fails

IMO the latest is 1.05 and it uses PL_na instead of na, so it compiles
just fine. Use the current version.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Wed, 22 Nov 2000 09:25:59 +0100
From: Pavel Hlavnicka <pavel@gingerall.cz>
Subject: Re: expat
Message-Id: <3A1B8317.4090500@gingerall.cz>

Daywan,

it looks like and expat question rather then the perl one. Version of 
expat using autoconf is quite new thing and is probably not tested with 
Sun native compiler.

I've compiled expat on SunOS 5.8 with gcc w/o any problems.

Pavel

Daywan Singh wrote:

> I have a problem with the installation of the Perl module expat-1.95.1 on SunOS
> 5.8
> 
> I manage to run the following command successfully:
> 
> ../configure
> 
> but when I come to run 'make', I get the following error
> 
> cc -DHAVE_CONFIG_H -DPACKAGE=\"expat\" -DVERSION=\"expat_1.95.1\" -I. -I.. -g
> -Wp,-MD,.deps/xmlparse.pp -c xmlparse.c  -KPIC -DPIC -o xmlparse.o
> command line: fatal: invalid arg for option M  D: No such file or directory
> cc: acomp failed for xmlparse.c
> *** Error code 1
> make: Fatal error: Command failed for target `xmlparse.lo'
> 
> 
> Has anyone else try to install this module? I need to install this module in
> order to use XML::DOM.
> 
> I tried raising a bug report at http://sourceforge.net/bugs but to noavail.
> 
> D Singh
> singhd@lucent.com


-- 
Pavel Hlavnicka
Ginger Alliance Ltd.
Prague; Czech Republic



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

Date: Wed, 22 Nov 2000 01:23:15 -0600
From: Smokin' Dave <smokindave@smokindave.com>
Subject: Re: FAQ?
Message-Id: <d0tm1t87r1qs0n1bnorq5jltc48sl0b7qt@4ax.com>

On Wed, 22 Nov 2000 15:56:29 +1300, "Peter Sundstrom" <peter.sundstrom@eds.com>
wrote:

>
>Smokin' Dave <smokindave@smokindave.com> wrote in message
>news:6j9m1tc1jjm69bjnlrin0k23qnbv5k12b3@4ax.com...
>> Hi, I'm completely new to Perl, and was looking for this group's FAQ, in
>order to
>> avoid asking tired old questions. Can anybody point out a URL for this?
>
>There are hundred's of URL's.  A search on google comes back with half a
>million.
>
>Try the obvious http://www.perl.com/ and http://www.faqs.org/
>
>
Thanks, and thanks to the rest who replied. I've been strictly an HTML guy, and know
virtually nothing about this. Looks like I've got my work cut out for me. :)


--
Smokin' Dave

Hell hath no coffee, no cigarettes.....
Smokin' Dave's Taxicab Diaries
http://www.smokindave.com


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

Date: Wed, 22 Nov 2000 01:27:30 -0600
From: Smokin' Dave <smokindave@smokindave.com>
Subject: Re: FAQ?
Message-Id: <h3tm1tofuqddug6uigi4dd9mrnj0ffj10f@4ax.com>

On Wed, 22 Nov 2000 03:17:09 GMT, wyzelli@yahoo.com (Wyzelli) wrote:

>Smokin' Dave <smokindave@smokindave.com> wrote in
><6j9m1tc1jjm69bjnlrin0k23qnbv5k12b3@4ax.com>: 
>
>>Hi, I'm completely new to Perl, and was looking for this group's FAQ, in
>>order to avoid asking tired old questions. Can anybody point out a URL
>>for this? 
>>
>>TIA
>>
>
>A quick search of this very newsgroup turns up a post entitled:
>'Subject: [Perl] How to find the Perl FAQ'... nuff sed
>
>Wyzelli

Must've been an expired post. I already tried a search for "FAQ", and came up with
nothing. Sure, there's always Deja to fall back on, but okay, so I was lazy this
time.

Thanks.


--
Smokin' Dave

Hell hath no coffee, no cigarettes.....
Smokin' Dave's Taxicab Diaries
http://www.smokindave.com


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

Date: Wed, 22 Nov 2000 06:48:50 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: Re: Free Online Romance Network
Message-Id: <lbvgtgy01a.fsf@lnc.usc.edu>

OnlineRomance@msn.com writes:

> Friend Finder is for active singles who want to meet others for
romance, dating, friendship and more! With over 4,000,000 registered
members and thousands of new people joining each day, your special
someone may be waiting for you now! Click the link below to join for
free - it's fast, easy and anonymous!  
> 

use Lover::Find;
find \&wanted, '/earth/us/nyc';

sub wanted {
 return 1 if /(voluptuous|busty|easy-going)/;
}

-- 
Terrence Brannon


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

Date: Wed, 22 Nov 2000 15:40:10 +0600
From: "Konstantin Stupnik" <skv@iis.nsk.su>
Subject: Re: HELP! bring variables out of a subroutine?
Message-Id: <8vg475$21am$1@nl.novosoft.ru>

Hi!

perl is a very tricky thing :)

If you will write in C something like this:

char* myfunc()
{
  char buf[256];
  strcpy(buf,"Hello, world!");
  return buf;
}

you will break everything,
since variables that are created on stack will be
destroyed after return from function.

In perl everything is rather different.

sub mysub{
  my $str="Hello, world!";
  return $str;
}

this will work fine.

Even this:

sub mysub{
  my $str="Hello, world!";
  return \$str;
}

will work fine!!
You have returned reference to local variable,
and everything will be fine.
Nothing is broken.
Even more, every time you will call this sub,
you will gain reference to new variable!!!

--
Best regards,
  Konstantin.
Brainbench MVP for perl.
<webbgroup@my-deja.com> wrote in message news:8vemlm$544$1@nnrp1.deja.com...
> I have been able to use
>
> return 1;
>
> but how do I bring variables that I set within the subroutine out of
> it?? Doesn't using the return kill the subroutine after it is used??
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Tue, 21 Nov 2000 23:03:01 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to make something in list context?
Message-Id: <slrn91mhbl.klt.tadmc@magna.metronet.com>

On Wed, 22 Nov 2000 03:49:11 GMT, Tim Schmelter 
   <schmelter_tim@hotmail.com> wrote:
>"John Lin" <johnlin@chttl.com.tw> wrote in message
>news:8vfcaa$rve@netnews.hinet.net...
>...snip...
>>     print "$_\n" for <(<DATA>)>;  # directly parenthesize
>
>Close. You want:


No he doesn't (because it doesn't do any globbing, and he wants globbing).


>    print "$_\n" for (<DATA>);
>
>However, the (<>) construct is magic... read up on it in "perldoc perlop" --
>search for the the section "I/O Operators".


Right.


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


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

Date: Wed, 22 Nov 2000 08:46:56 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: How to send back 2 or more gif, if only one cgi call?
Message-Id: <4KLS5.2411$bg5.14900@news-server.bigpond.net.au>

Claude, I think the only way to do such a thing would be to paste the two
gifs together and send them as one.
The actual script is beyond me. Maybe someone else could give some ideas on
perl modules that might do the job.




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

Date: Wed, 22 Nov 2000 05:59:37 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: looking for PERL GUI debugger for UNIX
Message-Id: <dhJS5.681$Bf7.190241280@news.frii.net>

In article <8vfff7$77n$1@charm.magnus.acs.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was NOT sent to Martien Verbruggen
><mgjv@tradingpost.com.au>],
>who wrote in article <slrn91i44v.imr.mgjv@martien.heliotrope.home>:
>> What's this obsession with GUIs anyway? 
>
>Definitely in a lot of situations a GUI debugger works better than a
>command-line one - given sufficient proficiency with both.
>
>Of course, one can debug in Emacs, but I think some fine features of
>the debugger are lost in this case.
>
>Anyone with a public-domain perl-written Curses-based file viewer
>which allows color/styles support for separate lines?  I put enough
>hooks in the standard debugger so that it can drive almost anything
>(for example, a file viewer in a separate window).  tchrist made it
>drive vi, but I do not think we can inform vi about where are the
>breakpoints/actions, which line is current, and which lines are
>breakable.
>
>Hmm, we need a back-channel to allow the viewer to set/remove
>breakpoints, and "continue until this line".  Term::ReadLine::Perl
>(and probably ::Gnu) already supports external event loops, so this
>should not be a problem...
>
>Ilya

I did some work a bit ago writing a simple text viewer that used
the debugers position hooks to update a text displaied inside an
xterm.  No syntax highlighting, No breakpoint markers, no
watches.  But xterm supports all the normal ansi sequences and is
very compatable with Curses.

My vision at that time was that the code viewing window would be
entirely passive while the interactive command line debugger
continued in a seperate window. Using it was a bit like using TECO.
I suppose that they could be combined into a single window in a more IDE
way.

What pieces are available for your project now?  We have the perl
debugger. we have Curses.  Is there a perl-written perl lexer?  Is
there a perl-written perl parser good enough for text highlighting?
-- 
    This space intentionally left blank


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

Date: 22 Nov 2000 08:28:05 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: looking for PERL GUI debugger for UNIX
Message-Id: <8vg02l$d7m$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Chris Fedde
<cfedde@fedde.littleton.co.us>],
who wrote in article <dhJS5.681$Bf7.190241280@news.frii.net>:
> >Anyone with a public-domain perl-written Curses-based file viewer
> >which allows color/styles support for separate lines?  I put enough
> >hooks in the standard debugger so that it can drive almost anything
> >(for example, a file viewer in a separate window).  tchrist made it
> >drive vi, but I do not think we can inform vi about where are the
> >breakpoints/actions, which line is current, and which lines are
> >breakable.
> >
> >Hmm, we need a back-channel to allow the viewer to set/remove
> >breakpoints, and "continue until this line".  Term::ReadLine::Perl
> >(and probably ::Gnu) already supports external event loops, so this
> >should not be a problem...

> I did some work a bit ago writing a simple text viewer that used
> the debugers position hooks to update a text displaied inside an
> xterm.  No syntax highlighting, No breakpoint markers, no
> watches.

The minimum is to highlight the current line, of course...

> My vision at that time was that the code viewing window would be
> entirely passive while the interactive command line debugger
> continued in a seperate window.

This is a useful first approximation.  But you can already do it with
a slave vi (or less?).

> What pieces are available for your project now?  We have the perl
> debugger. we have Curses.  Is there a perl-written perl lexer?  Is
> there a perl-written perl parser good enough for text highlighting?

Why syntax highlight?  If you want it, just use M-x perldb in Emacs...
Debugger needs visual feedback on breakpoint etc much more than the
syntax highlight...

Ilya


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

Date: Wed, 22 Nov 2000 11:14:00 +0100
From: "Michael Guenther" <MiGuenther@lucent.com>
Subject: Re: need some help with regex
Message-Id: <8vg6a9$r6d@nntpb.cb.lucent.com>


metamp@my-deja.com wrote in message <8vff64$pjb$1@nnrp1.deja.com>...
>I'm using CGI.pm and trying to check the if the textfield on the form
>does not contain ilegal character
>

>if ($query->param('texfield_name') != /[^a-zA-Z]/)
>{
>print "result a no ilegal characters";
>}else{
>      print "result b ilegal character detected";
>     }


This one not not working ....
try

 if (not($query->param('texfield_name') = /[^a-zA-Z]/) )
                                          ^^
and change the misspellings

the syntax ! for not usually not work with pattern matching.
I don't know why, but it is always the same.


Maybe someone else can tell us why "!" and "not" are not the same in that
case
( maybe somthing with the binding of the pattern match  .........    don't
know)


Michael






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

Date: Wed, 22 Nov 2000 20:49:19 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: OT:Re: Eurodate mysteries
Message-Id: <slrn91n5kv.imr.mgjv@martien.heliotrope.home>

On 22 Nov 2000 00:23:34 GMT,
	~greg <gm@magpage.com> wrote:
> 
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message news:slrn91luhs.r2.mgjv@verbruggen.comdyn.com.au...
>> On 21 Nov 2000 20:02:54 GMT,
>> ~greg <gm@magpage.com> wrote:
>> > 
>> > Of course it didn't work  -- because Perl converts string '01' 
>> > to numeric 1 and then back to string '1'.  Easy enough to fix,
>> > - once it's realized what was happening.
>> 
>> No, it doesn't. It only does that if you use a string in a numeric
>> context, and then in a string context again.
> 
> I'm not certain where that numeric context was. What I thought was
> that it must have occurred right at the start - in the construction of
> the the hash tables i.e.  that the '01', '02', etc must have been
> stored as numeric 1,2, ...  and then converted back to strings in the
> string context signaled by concatenation but as '1', '2', etc - so
> that e.g. what should have been  '20000131' --for 31 Jan 2000 wound up
> as '2000131'  -- which was then sorted, as a string, after '20001231'
> i.e. 31 Dec 2000, instead of before it,  - because that's what
> happened. 

It happens when you use them as keys for a hash, and you don't quote
them. That is probably what you saw?

my %hash = ( 01 => 'one', 02 => 'two', '01' => 'one', '02' => 'two' );
print "$_ : $hash{$_}" for (keys %hash);

The stuff on the left of the => operator only gets autoquoted as a
string if it is a 'word', according to the documentation. A 'word' in
that definition (identifier) cannot start with a number. It's, IIRC,
anything consisting of alphanumerics and underscore, starting with a
letter or underscore.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.   | enough features yet.
NSW, Australia                  | 


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

Date: Wed, 22 Nov 2000 10:31:26 GMT
From: coluche@my-deja.com
Subject: Re: OT:Re: Eurodate mysteries
Message-Id: <8vg79u$bk1$1@nnrp1.deja.com>


> You can argue what one *SHOULD* do until you're blue in the face,
> and it will get you exactly nowhere.  That's not what people do,
> and you can't change them by applying computer-friedly and human-
hostile
> logic.  Just tell me when you get regular people speaking in time()
> format, and then we can do something.
>
> --tom
>
Greets,
   hey, cool down mate. You are reading waaay too much into what I
wrote. Anyways, it's just my humble opinion (can I have one,please..),
I'm not trying to force it down anybody's throat. BTW, why is it that
such trivialities generate so much heat? I'm sure there are more
deserving causes to spill blood upon, like from which end should one
break a boiled egg. I've been reading this group for a few months now
trying to get some Perl education but I'm still clueless as to why some
individuals, no doubt very talented perl programmers, go ballistic now
and again. What is it? Did they forget coffee this morning, was the
missus not in a good mood/headache _wink wink_ AGAIN aaaaargh this
morning, or did they simply get out of bed on the wrong foot. Anyways
that from me rushing back in oblivion. I'm too sensitive for this ;)
Peace (mais pas sur moi)
-- Coluche ;-)
A scholar once observed some bad manners in one of his students and
told him:"Verily, you are in far greater need of a little bit of
manners than a vast amount of knowledge". Wooow, that's deep. Ponder.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 22 Nov 2000 06:49:08 GMT
From: jbuff1856@my-deja.com
Subject: Posting Guidelines?
Message-Id: <8vfq93$1v4$1@nnrp1.deja.com>

Please forgive this newbie/lurker for daring to suggest to the folks
who've been the heart and soul of this group that they might need some
help.

Although I'm only up to about 700 of the 1000 posts I should read
before I post here, I've noticed several instances where hurt feelings
could have been avoided if there had just been a few posting guidelines
established.

Several months ago, I polled the regular contributors at the newsgroup
where I am most active (alt.dbs.echostar), and wrote
http://www.echostaruser.org/openfaq/general/4.html .

Since then, we've had far fewer problems. HTML posts are down to nearly
zero, and folks seem to be treating one another much better.

Feel free to "borrow" any of the content from my page if you think my
suggestion has merit. Obviously you'll need to rewrite some of it, but
for anyone who can write good perl it should be a trivial exercise.

--jbuff


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 22 Nov 2000 05:26:18 GMT
From: fhinchey@my-deja.com
Subject: Re: quick sorting question
Message-Id: <8vfldm$ufh$1@nnrp1.deja.com>

In article <8vfdgt$og9$1@nnrp1.deja.com>,
  fhinchey@my-deja.com wrote:
> I have a text file with five tab seperated colums. The first three
> columns are numbers, one for year, one for day. The other two contain
> text that doesn't need to be sorted. I would like to sort these lines
> in ascending order beginning with the first column(year), then second
> (month), then third(day). I'm very new to perl and haven't got a hang
> of the sorting functions. Does anyone know a quick way to do this?
Much
> appreciated.
>
> -Frank
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Jeez are you stupid or what! Everyone knows you have to use a
Swarten...negger or something. :-)

I actually did a quick study on this technique and came up with this
code for doing the sort - it works, but maybe there's a more elegant
solution out there. Cheerio!

@sorted = map {$_->[0]}
          sort {$a->[0]<=>$b->[0]
                        ||
                $a->[1]<=>$b->[1]
                        ||
                $a->[2]<=>$b->[2]}
          map{  @f=(split(/\t/,$_))[1,2,3];  [$_,$f[0],$f[1],$f[2]]}
@list;


your truely.
frank


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 22 Nov 2000 05:52:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: quick sorting question
Message-Id: <x7snokd04r.fsf@home.sysarch.com>

>>>>> "f" == fhinchey  <fhinchey@my-deja.com> writes:

  f> Jeez are you stupid or what! Everyone knows you have to use a
  f> Swarten...negger or something. :-)

yeah. the OP is a moron! :)

  f> @sorted = map {$_->[0]}
  f>           sort {$a->[0]<=>$b->[0]
  f>                         ||
  f>                 $a->[1]<=>$b->[1]
  f>                         ||
  f>                 $a->[2]<=>$b->[2]}
  f>           map{  @f=(split(/\t/,$_))[1,2,3];  [$_,$f[0],$f[1],$f[2]]}

why the temp @f (which should be declared with my). just build the anon
array directly:

	map{ [ $_, (split( /\t/ , $_))[1,2,3] ] }

and white space helps with reading that.

  f> @list;

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 22 Nov 2000 06:41:34 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Reg Exp Learning?
Message-Id: <3a1b6a9d.6a89$3b3@news.op.net>

In article <TgvS5.52774$KI6.11526754@typhoon.snet.net>,
_Thomas <webmaster@860.org> wrote:
>I'm not new to perl .. but never really understood reg expressions.... does
>anybody have any url's, reference material that might make things easier for
>me to learn.

Coincidentally, www.perl.com just published an article by Doug
Sheppard that introduces regexes to beginners.  It is on the front
page at
        http://www.perl.com/


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Wed, 22 Nov 2000 06:43:57 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Reg Exp Learning?
Message-Id: <3a1b6b2c.6a95$37b@news.op.net>
Keywords: bushy, c's, divisive, ideolect

In article <slrn91l7n1.ip1.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>When a pattern match isn't doing what you expect, walking through
>what the machine would do invariably exposes the problem.

Although I think this is good advice, I would *not* recommend the
following article:

>   How Regexes Work:
>      http://www.plover.com/~mjd/perl/Regex/

because although it desribes *a* way that regexes *could* work, it
does not actually describe the way they work in Perl.  Perl uses a
different method entirely from the method described in the article.

I should probably put a big disclaimer on the article.  Sorry for any
confusion this has caused.  When I teach the regex class at the Perl
conference, I talk about how the machine really does work, but I've
never written it up as an article.  Sorry!


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Wed, 22 Nov 2000 11:06:12 +0100
From: Felix =?iso-8859-1?Q?Dr=FCke?= <fd@orga.com>
Subject: rounding with "printf %f"
Message-Id: <3A1B9A94.9EC5DA9C@orga.com>

Hi,

The "printf %.0f" command doesn't give the result that I
expect:

$ perl -e 'printf "%.0f\n",6.5'
6
$ perl -e 'printf "%.0f\n",6.501'
7
$

I expect 6.5 also to be rounded to 7. Why doesn't perl do this?
Is there another way for rounding, which gives me the result
that I expect?

Felix


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

Date: Wed, 22 Nov 2000 10:43:56 GMT
From: Alex Hart <news@#nospam#althepal.com>
Subject: running a script as root
Message-Id: <MrNS5.4441$Be3.448998@typhoon1.ba-dsg.net>

Is it possible to allow anyone to run a particular script as root?
Specifically, say I want to allow visitors to my website to create an
account for themselves. If I have a perl script which can create an
account, can I allow them to run this script as root without allowing
them any other privleges?

- Alex Hart

$j="592888088758319859281631592858792919873179698955";
$p="push\@_,";$c="chop(\$_)";$_="$p$p($c.$c)+19;eval;
+".$j;eval;%_=map{chr}reverse@_;foreach(sort+keys%_){print$_{$_}}




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

Date: Wed, 22 Nov 2000 06:39:32 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: Re: Simple question
Message-Id: <lbzoisy0gr.fsf@lnc.usc.edu>

nobull@mail.com writes:

> I assume that what you want to do is find out if the list ("Green",
> "Blue", "Black") contains the element $Selection.  You should see the
> FAQ "How can I tell whether a list or array contains a certain
> element?"

I wonder if the FAQ has Q::S as a new answer to this question?


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

Date: Tue, 21 Nov 2000 23:12:40 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting question
Message-Id: <slrn91mhto.klt.tadmc@magna.metronet.com>

On Wed, 22 Nov 2000 04:46:49 GMT, Timothy Valis <junk@yada.net> wrote:

>I have an ASCII text file, (Database output) which I need to sort.  I need
>to select entire lines and sort on 2 column sets, numerically first on a 9
>digit number in columns 4-12, then on a 2 digit number in columns 1-2.  Any
>ideas how to approach this?  


One approach would be to provide input data along with the
desired output, then someone would have data to work with.

I'd have coded it up if I wasn't too lazy to dream up data
to try it with...


>I am somewhat new to perl, but have a few
>reference books here and working with perl.org/perl.com as well.  Any help
>would be greatly appreciated.


Books and websites are way down on the list of "places to look"
for solutions to Perl problems.

The best resources are the ones that are already on your hard disk.

1) Perl FAQs  ( perlfaq[1-9].pod )

   perldoc -q sort


2) other Standard docs

   perldoc -f sort

   perldoc -f split


3) Usenet archive (eg. deja.com)

4) books, local guru, websites...



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


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

Date: Wed, 22 Nov 2000 06:22:47 GMT
From: tlynch001@my-deja.com
Subject: strange socket problem
Message-Id: <8vfonk$vg$1@nnrp1.deja.com>



My perl client has to send the name of a file to a server written
in 'C'.

The format of the message I am sending is:

ID(1 byte), Length of File Name(1 byte), File Name (? bytes), CheckSum
(2 bytes).

When I send a file whose name is only 2 or 3 bytes, everything is OK.
When I send a file whose name is 4 bytes, I receive an error.  The
message length is 8, but 'SEND' returns a 9.

Here is part of the code in question.  The checksum part is a little
flaky but it was the only way I could make it work.

sub SendFileName{

   $FIL = chr(16);

   # Put together the FIL packet...

   my($filename) = @_;

   print "Filename is $filename\n";

   $Length = chr(length($filename));     #that chr() makes it a char
   $FilePacket = $FIL.$Length.$filename; # no checksum yet...

   # The next part is a little weird.

   $CheckSum = unpack("%16C*", $FilePacket);

   # Concantinate using '.'

   $FilePacket = $FIL.$Length.$filename.chr($CheckSum >> 8).chr
($CheckSum);

   # Send the file name...
   send(SOCKET, $FilePacket, 0, $portaddr) == length($FilePacket)
      or die "cannot send to $HOSTNAME($PORTNO) : $!";

   # And it dies here if the file name has 4 characters.

Thanks for any help you can provide.

tlynch
tlynch001@earthlink.net


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 22 Nov 2000 09:32:21 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: strange socket problem
Message-Id: <G4F6Hx.2n@news.muni.cz>

On Wed, 22 Nov 2000 06:22:47 GMT, tlynch001@my-deja.com <tlynch001@my-deja.com> wrote:
> 
> When I send a file whose name is only 2 or 3 bytes, everything is OK.
> When I send a file whose name is 4 bytes, I receive an error.  The
> message length is 8, but 'SEND' returns a 9.

Use strace or truss to see what is really being send to the
socket.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: 22 Nov 2000 08:43:17 +0000
From: nobull@mail.com
Subject: Re: strange socket problem
Message-Id: <u98zqc8hoi.fsf@wcl-l.bham.ac.uk>

tlynch001@my-deja.com writes:

> The format of the message I am sending is:
> 
> ID(1 byte), Length of File Name(1 byte), File Name (? bytes), CheckSum
> (2 bytes).
> 
> When I send a file whose name is only 2 or 3 bytes, everything is OK.
> When I send a file whose name is 4 bytes, I receive an error.  The
> message length is 8, but 'SEND' returns a 9.

Is this on Windows?  Did you binmode() the socket?  If not then ISTR
that if any of the bytes in the string happen to be 0x0A then Perl
will put a 0x0D in front of them.  This will increase the number of
bytes transmitted.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 22 Nov 2000 05:09:49 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Tom Christiansons' 'style'
Message-Id: <xyIS5.678$Bf7.190671872@news.frii.net>

In article <3A1AA950.AF59E177@aol.com>, John Crowley  <crowj@aol.com> wrote:
>Monte Phillips wrote:
>> 
>> Tom Christianson loudly and boorishly proclaimed -->
>> [elided]
>> Just my opinion of course.
>
>Hmmm.
>
>Tom co-wrote "Programming Perl" and is instrumental in the
>existence and continued application of the language.
>
>You have 2 postings in this newsgroup in the past months and one of
>them refers to a Unix issue.

 10 points for commenting below quoted text.
-10 points for failing to delete excess quoted text.
 -2 points for posting with an aol.com address.
----
 -2 score for this posting.

:-)

chris

-- 
    This space intentionally left blank


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

Date: 22 Nov 2000 06:45:16 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: Tom Christiansons' 'style'
Message-Id: <slrn91mqrs.po.dha@panix2.panix.com>

On Wed, 22 Nov 2000 03:11:54 GMT, Tim Hammerquist <tim@degree.ath.cx> wrote:
>John Crowley <crowj@aol.com> wrote:
>> You have 2 postings in this newsgroup in the past months and one of
>> them refers to a Unix issue.
>
>I fail to see how the platform in question is relevant to Perl?  This
>seemed vaguely derogatory toward Unix and I wondered if you have any
>quarrels or relevancy issues with Unix - the birthplace of Perl?

As I read it, what he was trying to say was that one of the posts
referred to a unix issue that was not relevant to perl.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
It didn't bother me before there was a for modifier, and now that
there is one, it still doesn't bother me.  I'm just not very easy to
bother.	      - Larry Wall


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4947
**************************************


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