[13895] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1339 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 12:10:28 1999

Date: Wed, 10 Nov 1999 09:10:14 -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: <942253814-v9-i1339@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 10 Nov 1999     Volume: 9 Number: 1339

Today's topics:
        Perl Wizards <nobody@logica.com>
    Re: Perl Wizards (Sam Holden)
    Re: Perl Wizards <stampes@xilinx.com>
    Re: PERLHUMOR: self-printing resume <jeffp@crusoe.net>
    Re: PERLHUMOR: self-printing resume (Abigail)
    Re: PERLHUMOR: self-printing resume (Bart Lateur)
    Re: radio button in HTML.......help <flavell@mail.cern.ch>
    Re: Remebering environmentvariables (Tad McClellan)
    Re: replace " " with &nbsp; <curtisj@bannerfusion.com>
    Re: Tim O Reilly interview. Very good read. (Michael Houghton)
    Re: timeout operation for less than 1 second <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
        urgent help please (Samadhi)
    Re: Using Perl to fill in html fields (Randal L. Schwartz)
    Re: Using Perl to fill in html fields (Greg Bacon)
    Re: using the 'Location :' command (Randal L. Schwartz)
        win32 timer/timeout workaround using perl/tk <dthusma@home.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 10 Nov 1999 14:23:16 -0000
From: "Nobody" <nobody@logica.com>
Subject: Perl Wizards
Message-Id: <80bv4l$chm@romeo.logica.co.uk>

I am trying to reuse some perl code that has been given to me.  I am having
problems with this particular line :

grep(m!$/bin/(.{10}) ! && $ps{$1}++, &safe_backtic("ps -ef"));

I don't understand the first pattern matching statement (or if it is a
pattern matching statement !) m! ....!

What do the ! ... ! do ?

Also are the results of this pattern matching being back substituted into
$ps{$1} ??

Any help from perl wizards out there would be useful ..





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

Date: 10 Nov 1999 14:53:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Wizards
Message-Id: <slrn82j1ni.4jd.sholden@pgrad.cs.usyd.edu.au>

On Wed, 10 Nov 1999 14:23:16 -0000, Nobody <nobody@logica.com> wrote:
>I am trying to reuse some perl code that has been given to me.  I am having
>problems with this particular line :
>
>grep(m!$/bin/(.{10}) ! && $ps{$1}++, &safe_backtic("ps -ef"));
>
>I don't understand the first pattern matching statement (or if it is a
>pattern matching statement !) m! ....!
>
>What do the ! ... ! do ?

Why don't you read the documentation about m/PATTERN/cgimosx in perlop
yourself.

>
>Also are the results of this pattern matching being back substituted into
>$ps{$1} ??

Why don't you read the documentation in perlre yourself.

>Any help from perl wizards out there would be useful ..

I'm not a wizard so I guess my help won't be useful, so I won't give any
other than the references above.


-- 
Sam

Another result of the tyranny of Pascal is that beginners don't use
function pointers.
	--Rob Pike


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

Date: 10 Nov 1999 15:51:25 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: Perl Wizards
Message-Id: <80c49t$9r2@courier.xilinx.com>


Please try and select more useful subject lines.  This is not a 
question for a 'wizard', and indeed most 'wizards' will likely
ignore it, or flame you for using such a poor subject line.

Nobody <nobody@logica.com> wrote:
: I am trying to reuse some perl code that has been given to me.  I am having
: problems with this particular line :

: grep(m!$/bin/(.{10}) ! && $ps{$1}++, &safe_backtic("ps -ef"));

: I don't understand the first pattern matching statement (or if it is a
: pattern matching statement !) m! ....!

: What do the ! ... ! do ?

Let's see...this seems very strange to me...It is a pattern match, they
are simply using m!! instead of m// so they won't have to escape their
slashes.  That part is easily understood.

However, I'd be surprised if this works as expected.  The match, as I
understand it, is looking for an occurance of $/ (input record 
separator), followed by 'bin/' and then ten characters and a space.

: Also are the results of this pattern matching being back substituted into
: $ps{$1} ??

The first ten characters following the 'bin/' go into $1

: Any help from perl wizards out there would be useful ..

I honestly have not seen the syntax above before though.  Could
someone help explain it?  Specifically, what is it saying to use
that && and a second expression in the grep?

-- 
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Wed, 10 Nov 1999 09:34:40 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: PERLHUMOR: self-printing resume
Message-Id: <Pine.GSO.4.10.9911100933540.19132-100000@crusoe.crusoe.net>

[posted & mailed]

On Nov 10, Rick Delaney blah blah blah:

> strict wouldn't catch that since $a and $b are exempt as the globals
> used by sort.  An oversight on your part, I'm sure, but I point this out
> in case someone actually tries it and is confused.
> 
> This is poorly documented.  I knew it but couldn't find it anywhere in
> the docs.  Anyone?

I went right to sort()'s documentation, where I expected it:

From perldoc -f sort:

  If you're using strict, you I<MUST NOT> declare C<$a>
  and C<$b> as lexicals.  They are package globals.  That means
  if you're in the C<main> package, it's

    @articles = sort {$main::b <=> $main::a} @files;

  or just

    @articles = sort {$::b <=> $::a} @files;

  but if you're in the C<FooPack> package, it's

    @articles = sort {$FooPack::b <=> $FooPack::a} @files;

-- 

  MIDN 4/C PINYAN, USNR, NROTCURPI     http://www.pobox.com/~japhy/
  jeff pinyan: japhy@pobox.com     perl stuff: japhy+perl@pobox.com
  "The Art of Perl"               http://www.pobox.com/~japhy/book/      
  CPAN ID: PINYAN  http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
  PerlMonth - An Online Perl Magazine     http://www.perlmonth.com/



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

Date: 10 Nov 1999 09:01:05 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: PERLHUMOR: self-printing resume
Message-Id: <slrn82j2c9.6es.abigail@alexandra.delanet.com>

Rick Delaney (rick.delaney@home.com) wrote on MMCCLXII September MCMXCIII
in <URL:news:382975DC.AAA7CAC9@home.com>:
## [posted & mailed]
## 
## Uri Guttman wrote:
## > 
## > also you my all the vars above, why not $a? strict would have caught it.
## 
## strict wouldn't catch that since $a and $b are exempt as the globals
## used by sort.  An oversight on your part, I'm sure, but I point this out
## in case someone actually tries it and is confused.
## 
## This is poorly documented.  I knew it but couldn't find it anywhere in
## the docs.  Anyone?


Well, it's documented at the most obvious place: perldoc -f sort.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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


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

Date: Wed, 10 Nov 1999 15:43:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: PERLHUMOR: self-printing resume
Message-Id: <382b9237.2851541@news.skynet.be>

Abigail wrote:

>## strict wouldn't catch that since $a and $b are exempt as the globals
>## used by sort.  An oversight on your part, I'm sure, but I point this out
>## in case someone actually tries it and is confused.
>## 
>## This is poorly documented.  I knew it but couldn't find it anywhere in
>## the docs.  Anyone?
>
>Well, it's documented at the most obvious place: perldoc -f sort.

That is the "most obvious place" if you know why $a and $b needn't be
declared for "use strict". And if you do know, there's no more reason to
look it up.

-- 
	Bart.


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

Date: Wed, 10 Nov 1999 15:12:58 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: radio button in HTML.......help
Message-Id: <Pine.HPP.3.95a.991110151141.5592E-100000@hpplus01.cern.ch>

On Wed, 10 Nov 1999, ÀÌÁØÇõ wrote:

> I set three radio buttons in html...
> How can I get the button status(check or not) in perl..?

CGI.pm

> like this..
> in Html
> < input type="button" name="trflag" value="1">
> <input type="button" name="trflag" value="2">
> <input type="button" name="trflag" value="3">

These are not radio buttons in HTML.  Try an HTML tutorial.



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

Date: Wed, 10 Nov 1999 04:02:32 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Remebering environmentvariables
Message-Id: <slrn82id58.q9i.tadmc@magna.metronet.com>

On Wed, 10 Nov 1999 09:08:22, <nproj-2@mdstud.chalmers.se> wrote:

>If I
>set the environmentvariable teamid in the login-script like this:
>
>$ENV{'teamid'}= *Teamid extracted from database*
>
>And then click on another link, the variable is not there anymore.
>
>Does anyone know how to do this? Please help, because I'm really stuck.


   Perl FAQ, part 8:

      "I {changed directory, modified my environment} in a perl script.  
       How come the change disappeared when I exited the script?  
       How do I get my changes to be visible?"


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


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

Date: Wed, 10 Nov 1999 11:09:57 -0500
From: "Curtis Jones" <curtisj@bannerfusion.com>
To: <comp.lang.perl.misc@list.deja.com>
Subject: Re: replace " " with &nbsp;
Message-Id: <003f01bf2b96$09903e00$8b00000a@aascatl.com>

For each item in the array @list, it globally replaces all occurences of " "
with "&nbsp;".

I hope.... :-)

my $lcnt = -1;
foreach ( @list ) {
    $lcnt++;
    $list[$lcnt] =~ s/ /\&nbsp;/g;
    print $list[$lcnt] . "\n";
}

-Curtis


> I am not too good with simple search and replace, and what i need is not
> simple, in my mind, so I hope someone can help me.
>
> I need a line, or lines, of code that will take each element in a list,
> check for any leading spaces, and change those into non-breaking spaces
> (&nbsp;).
>
> I know I will need something like:
>
> foreach $item (@list) {
>
> search replace code
>
> }
>
> But I have no clue how to tell it to change all " " to "&nbsp;" until
there
> is not a " " then stop and go to the next.
> Basically if i had the line (without quotes) "   Hello World!" I would
want
> the code to change it to "&nbsp;&nbsp;&nbsp;Hello World!"
>
> I hope that the non-breaking spaces were not interpreted as merely " " so
> you can see what i was writing.
>
> Just so you know, this is for a message board script, so if people indent
> their paragraphs, it will come out that way in the browser.
>
> Thanks,
> Blair




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


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

Date: 10 Nov 1999 09:39:09 -0500
From: herveus@Radix.Net (Michael Houghton)
Subject: Re: Tim O Reilly interview. Very good read.
Message-Id: <80c02d$3tc$1@saltmine.radix.net>

Howdy!

In article <80bm8v$lu1$1@nnrp1.deja.com>,
ivan walsh  <ivanwalsh@my-deja.com> wrote:
>Hello All,
>
>Anyone who enjoys the O'Reilly books might be interested in this
>interview with Tim O Reilly.
>
>His ideas are worth a read if your involved in open source, Microsoft's
>future, Linux, or the Next Big Thing.
>
>http://www.softwareireland.com/terrybyte/tim_oreilly.asp
>
It would be much easier to digest if you did not force the font size
so small. Parts of that page are completely unreadable, since I am
not using a platform which understands "verdana" as a font.

yours,
Michael
-- 
Michael and MJ Houghton   | Herveus d'Ormonde and Megan O'Donnelly
herveus@radix.net         | White Wolf and the Phoenix
Bowie, MD, USA            | Tablet and Inkle bands, and other stuff
                          | http://www.radix.net/~herveus/


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

Date: Wed, 10 Nov 1999 06:03:11 -0800
From: Mark Bluemel <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
Subject: Re: timeout operation for less than 1 second
Message-Id: <17599f0b.ee48c61a@usw-ex0101-003.remarq.com>

Try reading the FAQs - especially Perlfaq8 "System Interaction" where
it answers the question:-

        How can I sleep() or alarm() for under a second?

HTH
--

Mark Bluemel
"Not a Perl Hacker Yet"


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Wed, 10 Nov 1999 17:06:28 GMT
From: samadhi@latinmail.com (Samadhi)
Subject: urgent help please
Message-Id: <382aa600.6849262@192.168.0.1>

Hi, I want to convert a string like this: "sample line 01<br>sample
line
02<br>etc" in this other (to send a e-mail):

          sample line 01
          sample line 02
          etc

can you help me please please please please?

many many many thanks, I am despaired...

Toni

ORIGINAL SPANISH VERSION:

buenas, estoy iniciándome en Perl y me ha surgido un serio problema:

mediante un formulario del web paso a mi cgi en perl una cadena que
contiene
varios datos (p. ej.: "sample line 01<br>sample line
02<br>telephone<br>etc") la cual envía un e-mail a una dirección de
correo.
Lo que ocurre es que quisiera presentar dicha información en varias
líneas
(es decir: "sample line 01 \nsample line 02 \ntelephone \netc") pero
no
tengo la sufiente experencia en perl como para programar eso...

me imagino se debería utilizar una sentencia 'split' o alguna de esas
instrucciones complejas y casi mágicas que incluye el maravilloso perl
pero... ¿cómo se hace por favor?

gracias a todos y saludos,

Toni


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

Date: 10 Nov 1999 06:55:01 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Using Perl to fill in html fields
Message-Id: <m1vh7az9a2.fsf@halfdome.holdit.com>

>>>>> "Asher" == Asher  <asher@magicnet.net> writes:

Asher> http://www.stonehenge.com/merlyn

That URL doesn't exist.  This one does:

        http://www.stonehenge.com/merlyn/

But that's only my home page.  For Web stuff, you want my WebTechniques
and LinuxMagazine columns, online at:

        http://www.stonehenge.com/merlyn/WebTechniques/
        http://www.stonehenge.com/merlyn/LinuxMagazine/

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 10 Nov 1999 15:32:48 GMT
From: gbacon@ruby.itsc.uah.edu (Greg Bacon)
Subject: Re: Using Perl to fill in html fields
Message-Id: <80c370$nnk$2@info2.uah.edu>

In article <m1vh7az9a2.fsf@halfdome.holdit.com>,
	merlyn@stonehenge.com (Randal L. Schwartz) writes:

:         http://www.stonehenge.com/merlyn/LinuxMagazine/

That URL doesn't exist.  This one does:

        http://www.stonehenge.com/merlyn/LinuxMag/

Heh. :-)

Greg
-- 
Usenet is like a herd of performing elephants with diarrhea; massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it.
    -- Gene Spafford


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

Date: 10 Nov 1999 06:52:13 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: using the 'Location :' command
Message-Id: <m13due1js2.fsf@halfdome.holdit.com>

>>>>> "stuart" == stuart  <stuart@ecs-telecom.demon.co.removethisfirst.uk> writes:

stuart> I use

stuart> 		print "Content-type: text/plain\n";
stuart> 		print "Location: $fullpath \n\n";

stuart> with $fullpath containing 'file://t:\docs\filename.doc' and
stuart> this works up to a point.

You probably don't want \d or \f there.  Too likely to get
double-quote managled.  Use /'s... they work much better in a URL and
even work in DOS-system filenames.

stuart> The point being that if the filename contains spaces then the browser 
stuart> (IE5) doesn't display the document.

stuart> Any clues to what I'm doing wrong? ;-)

Yes, the Location has to be a URI, not a filename.  You missed the
step about URI encoding.  See URI::Escape to see how to do that (found
in LWP, which every good Perl web hacker already has installed).

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 10 Nov 1999 15:30:59 GMT
From: Darrin H <dthusma@home.com>
Subject: win32 timer/timeout workaround using perl/tk
Message-Id: <38299353.62AA4D32@home.com>

This issue sux.  All I wanted (and it seems many others wanted) was to
have an application that allows a user to set timeouts on the win32
platform.

Here is a workaround I just did over breakfast.  Interested parties,
please use
and offer suggestions, as I am writing this on a sun box, until this
afternoon when
I have access to a winblows system.

Being it is a WORKAROUND, KISS applies, ie: if it works, no fancy stuff.

In essence, it uses the tk command AFTER and runs a delta timer against
the
timeout(maxruntime) value.  If a user wishes to reset this timeout (ie:
cancel it),
(s)he just sends across alarm2(0,$top).

Here is ye olde code
----------------------------------------------------------------
use Tk;

sub alarm2 {
        #($maxruntime)=@_;
        if ($maxruntime == 0 ) {
                # resetting, just die out
#print "<--reset alarm, exiting\n";
        } else {
                my $runtime=time-$^T;
                my $delta=$runtime-$maxruntime;
#print "-->alarm is armed, delta is $delta max is $maxruntime run is
$runtime\n"
;
                if ($delta > 0) {
                        die "ALARM MAXRUNTIME $maxruntime exceeded\n";
                };
                $id=$top->after(1000,\&alarm2);
        };
};

($top) = MainWindow->new();
$top->title("Balsa NT alarm test");
$top->withdraw();
$cmd="sleep 4";
$maxruntime=7;

eval {
        $id=$top->after(1000,\&alarm2);
        print "running cmd\n";
        #status=0 for success
        $stat=system($cmd);  #obviously change this to read
        #use Win32::Process;
        #Win32::Process::Create($ProcAA,
         #                      "$full_path_of_command",
         #                      "$command +any ARGVS",
         #                      0,
         #                     DETATCHED_PROCESS,
         #                     ".");

        die "adb pgm exit :$?" unless $stat == 0;
        #print "\t-->finished command, resetting alarm\n";
        alarm2(0);
     };
if ( $@ ) {
        print "Alarm triggered, event timedout\n";
}else {
        print "finished command, all is well\n";
};

------------------------------------------------------------------
Hope this helps everyone, except that one guy in Boise, I never really
did like him.



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

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


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