[13709] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1119 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 19 15:05:44 1999

Date: Tue, 19 Oct 1999 12:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940359912-v9-i1119@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 19 Oct 1999     Volume: 9 Number: 1119

Today's topics:
        $ is sneaky, point me to a faq or help please <bholdren@NOSPAMMY.linkohio.com>
    Re: $ is sneaky, point me to a faq or help please <marshalc@americasm01.nt.com>
        array (GiN)
    Re: array <nguyend7@msu.edu>
    Re: array (Craig Berry)
    Re: array <dave@dave.org.uk>
        Attempt to free unreference scalar? <jboes@qtm.net>
    Re: Baffled! (Joe Petolino)
        Building Perl with @INC using ENV var <lchen@opentext.com>
    Re: Can't get Perl working with Apache <kporter@clara.co.uk>
    Re: Can't get Perl working with Apache <kporter@clara.co.uk>
    Re: creating a list of unique records (Kragen Sitaker)
    Re: creating a list of unique records (Michael Budash)
    Re: embedding perl in win32 <todd@solidconcepts.com>
    Re: erorr output to browser? <jeff@vpservices.com>
    Re: formatting text with filling '.'s (Brett W. McCoy)
    Re: help for functioin fork under win98 (Scott McMahan)
    Re: How to get the system time?? (Craig Berry)
    Re: How to print password by "crypt" ? (Kragen Sitaker)
    Re: How to write isdigit() in Perl (Kragen Sitaker)
        Kiling a process opened with -| (Bill Moseley)
        linux perl editor? <mhrobards@nospam.tasc.com>
    Re: linux perl editor? (Brett W. McCoy)
        Manipulating variables <pollayil20@yahoo.com>
    Re: Mastering Algorithms With Perl-- Reviews <dave@dave.org.uk>
    Re: Mastering Algorithms With Perl-- Reviews (Scott McMahan)
    Re: Monitoring the clicks of a banner <amonotod@netscape.net>
        Newbie regex question on quoting jhagerty@my-deja.com
    Re: Newbie regex question on quoting <nguyend7@msu.edu>
    Re: newbie <bdkruse@NULLSTRINGimation.com>
    Re: NT: How can I change drive within a perl script? (Scott McMahan)
        odbc extension for win32 perl rbansal@zip2.com
    Re: OT: Din paper sizes (was Re: PDFlib size settings) (Kragen Sitaker)
    Re: perl and encrypted cookies (Kragen Sitaker)
    Re: Perl and IIS issues w/ Perl [USE] command. (Scott McMahan)
        PERL/C API - Passing array by reference <mdye@katech.colorado.edu>
    Re: PERL/C API - Passing array by reference <dan@tuatha.sidhe.org>
    Re: Q: Truncate string length? (Bart Lateur)
        Why does this compile? - THANKS! (James Moody)
    Re: why doesn't my script work? (Kragen Sitaker)
    Re: why doesn't my script work? <dwozmak@rational.com>
        Writing to a file <colin@dvdtimes.co.uk>
    Re: Writing to a file <nguyend7@msu.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 19 Oct 1999 13:19:50 -0400
From: "Thomas B. Holdren" <bholdren@NOSPAMMY.linkohio.com>
Subject: $ is sneaky, point me to a faq or help please
Message-Id: <aN1P3.5$Y31.121@wdc-read-01.qwest.net>

Dear Perlizers,

I'm working with AtDot, and some of you may not know what it is, but its a
hotmail-esque system.  Blah blah anyway, as its splitting emails into its
different compartments, I'm hitting a snag...

All e-mails from everywhere work fine... excpet hotmail.  Hotmail puts a $
in the boundary definition.  I love MS!  Anyways, the point is this... AtDot
finds boundaries kinda like this pseudocode:

#pseudocode, ok?  I know it's not correct!
$message =~ m/boundary="(.*)"/i
$boundary = $1;
($mess, @attach) = split (/\-\-$boundary/, $message);

But MS puts a '$' in the boundary, and I can't match the boundaries on
messages with $ in the boundary.  If I s/\$//g; the whole message it then
works, but I can't go removing $'s from e-mails just because.  So what am I
missing?  Is perl thinking that whatever is after the $  is a variable in
the $boundary variable during the split?  That's the only thing I can think
it is.  How can I negate this?

Thanks in advance for any help you can give.

Sincerely,

Thomas Brian Holdren
--
---------------
Systems Administrator
Linux/OSS Advocate
RMS Fan (GO RMS LINUX!)

"If you can't beat 'em, emulate 'em!"
-JLL

Yes, I use Outlook.  May God have mercy on my soul.




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

Date: Tue, 19 Oct 1999 13:26:10 -0500
From: Marshall Culpepper <marshalc@americasm01.nt.com>
Subject: Re: $ is sneaky, point me to a faq or help please
Message-Id: <380CB7C2.9AB89521@americasm01.nt.com>

Thomas B. Holdren wrote:

> [....]
> #pseudocode, ok?  I know it's not correct!
> $message =~ m/boundary="(.*)"/i
> $boundary = $1;
>

you might try and just search out the $1 (boundary) variable instead of the
whole message...
so something like..

$boundary = ($1 =~ s/\$//g);

My guess is this would just remove the MS '$' from the boundary only and not
the entire message..

> ($mess, @attach) = split (/\-\-$boundary/, $message);

Hope that helps..

~Marshall

--
perl -e '@^S = (q(uJ)=>lc(q(TS))=>qq( )=>q(noAt)=>lc(q(H))=>lc(q(RE))=>qq( )=>
(P)=>lc(q(RE))=>q(l)=>qq( )=>q(H)=>q(kca)=>q(re)=>q
q(\n));sub __{map {sort split //} @_};eval("\$F\=\\\@\^S"); print __ @$F'



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

Date: 19 Oct 1999 18:28:06 GMT
From: GiN@hookers.org (GiN)
Subject: array
Message-Id: <slrn80pee8.1ii.GiN@Avelon.net>


I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");

what is the simpliest way to remove "wuuh" from @arr?

i am currently using foreach etc..

thanks advanced!

GiN



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

Date: 19 Oct 1999 18:41:54 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: array
Message-Id: <7uie1i$7cm$1@msunews.cl.msu.edu>

GiN <GiN@hookers.org> wrote:

: I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");

: what is the simpliest way to remove "wuuh" from @arr?


@arr = grep { $_ ne "wuuh" } @arr;


-- 
       Dan Nguyen          | It is with true love as it is with ghosts;
    nguyend7@msu.edu       | everyone talks of it, but few have seen it.
     dnn@debian.org        |               -Maxime De La Rochefoucauld
            25 2F 99 19 6C C9 19 D6  1B 9F F1 E0 E9 10 4C 16


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

Date: Tue, 19 Oct 1999 18:55:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: array
Message-Id: <s0pfl3scr0136@corp.supernews.com>

GiN (GiN@hookers.org) wrote:
: I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
: 
: what is the simpliest way to remove "wuuh" from @arr?
: 
: i am currently using foreach etc..

Perhaps the simplest to write is is

  @arr = grep { $_ ne 'wuuh' } @arr;

As usual, there is more than one way to do this, and which way you choose
depends on a combination of optimization and esthetic considerations.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Tue, 19 Oct 1999 20:04:32 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: array
Message-Id: <lMAMOPJ7sgrTyTKihd+7F+z8qCDl@4ax.com>

On 19 Oct 1999 18:28:06 GMT, GiN@hookers.org (GiN) wrote:

>
>I have an array: @arr = ("weeh", "waah", "wuuh", "wiih", "wooh");
>
>what is the simpliest way to remove "wuuh" from @arr?
>
>i am currently using foreach etc..
>
>thanks advanced!

@arr = @arr[0, 1, 3, 4];


hth,

Dave...

--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: Tue, 19 Oct 1999 17:10:05 GMT
From: Jeff Boes <jboes@qtm.net>
Subject: Attempt to free unreference scalar?
Message-Id: <7ui8l0$jio$1@nnrp1.deja.com>

I'm getting this error from a script:

Attempt to free unreferenced scalar during global destruction.

It appears this is causing a core dump. Version is 5.004_04 built for
aix, modules in use include various Mail::*, DBI, Carp, and a home-
grown module that uses PLMQ from IBM. Anyone have any ideas how to
track this down? Where are messages like this documented?

--
Jeff Boes  jboes@qtm.net
http://www.qtm.net/~jboes/


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


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

Date: 19 Oct 1999 17:06:30 GMT
From: petolino@joe.Eng.Sun.COM (Joe Petolino)
Subject: Re: Baffled!
Message-Id: <7ui8em$b0n$1@engnews2.Eng.Sun.COM>

>[please keep proper attributes of your quotes. I have no idea who you
>are quoting right now]

[Why does it matter who I'm quoting?  I generally remove all the attributions
 from quoted text, since I'm replying to the ideas that I'm quoting, not the
 person who wrote them.  It avoids the "I didn't say that!" followups that
 so often come after several levels of quoting by various newsreaders.
 But none of this has anything to do with Perl.]

>>             Is it even defined what happens when you use a literal string
>> that can't be parsed as a regular expression match?  

>What do you mean? I can't think of any good examples.

By 'regular expression match', I mean a Perl pattern match, i.e. something
that can appear on the right side of a '=~', like '/foo/' or 'm{bar}'.  In
these examples, 'foo' and 'bar' are regular expressions, and '/foo/' and
'm{bar}' are pattern matches which use them, if I'm correctly interpreting
the terminology used in the "Regular Expressions" chapter of the Camel book.

On closer reading of the documentation, I see that my question was answered,
although the answer is not as clear as it could be (an example would have
helped). From the Camel book:

    As a special case, specifying a space " " will split on whitespace . . .
     . . .  (Other than this special case, if you supply a string instead
    of a regular expression, it'll be interpreted as a regular expression
    anyway).

This doesn't follow the same terminology (of pattern match vs. regular
expression) that I've referenced above.  On first reading it, it wasn't
clear to me whether a string of '/foo/' would be interpreted as m{foo}
or m{/foo/}.  An improved version of that last sentence might read:

    ( . . .   if you supply a string instead of a pattern match, it'll be
    interpreted as a pattern match if it looks like a pattern match;
    otherwise it will be interpreted as a pattern match which uses the
    string as a regular expression).

-Joe


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

Date: Tue, 19 Oct 1999 14:14:46 -0400
From: "Lawrence K. Chen, P.Eng." <lchen@opentext.com>
Subject: Building Perl with @INC using ENV var
Message-Id: <380CB516.D467811D@opentext.com>

Is it possible to build Perl where the pathnames contained in @INC are rooted
under an environment variable?

Explanation:

We have a commercial software product and have been bundling a standard
version of Perl with it, except that the pathnames in @INC reflect our build
environment so they don't work when the customer installs it (unless they
recreate the same directory structure).  This hasn't been a concern because we
don't rely on any Perl modules, etc.

But, now that the open source community is developing Perl modules for our
software (a version of which we plan to support), I think its time we update
how Perl is distributed with the software.

Due to the nature of the software, it can not be installed by the root user
and no assumption is made about the installer being able to become root.  So,
in the event that there is no Perl available on the system (or its too old),
we want to be able to install our own Perl and have it function under what
ever toplevel directory our product is installed under

-- 
    Who: Lawrence Chen, P.Eng.          Email: lchen@opentext.com
   What: Software Developer               URL: http://www.opentext.com/basis
  Where: Open Text, BASIS Division      Phone: 614-761-7449
         5080 Tuttle Crossing Blvd.       Fax: 614-761-7269
         Dublin, OH  43016                ICQ: 12129673


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

Date: Tue, 19 Oct 1999 18:10:21 GMT
From: kev <kporter@clara.co.uk>
Subject: Re: Can't get Perl working with Apache
Message-Id: <380CC523.CDB48C1@clara.co.uk>

Kragen Sitaker wrote:

> In article <380C9E8F.83F8F2AB@fast.no>, kev  <kevin.porter@fast.no> wrote:
> >Ok, I should have posted the log file too. Two lines are produced when an
> >attempt is made to look at a URL that points to a perl script:
> >
> >[Mon Oct 18 20:20:13 1999] [error] (8)Exec format error: exec of
> >/home/httpd/cgi-bin/test1.php3 failed
> >[Mon Oct 18 20:20:13 1999] [error] [client 127.0.0.1] Premature end of
> >script headers: /home/httpd/cgi-bin/test1.php3
> >
> >What do you think?
>
> If it's a PHP page, it's not a Perl script, and is also not a CGI.
> Take it out of the CGI directory and set up PHP so Apache knows what to
> do with it.
>

Sorry, in my rush I posted the wrong lines from the log file. Here's the real
one:

"...script not found or unable to stat: /home/httpd/cgi-bin/perl1.pl"

The script does have that path and the permissions are fine, and it begins
with a #!

- Kev

>
> The errors here suggest that it doesn't begin with #!, which also
> suggests it's not a Perl script.
> --
> <kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
> Tue Oct 19 1999
> 21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
> <URL:http://www.pobox.com/~kragen/bubble.html>



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

Date: Tue, 19 Oct 1999 18:13:34 GMT
From: kev <kporter@clara.co.uk>
Subject: Re: Can't get Perl working with Apache
Message-Id: <380CC5E5.C507C147@clara.co.uk>

Well I'm at home now, I've made the AddHandler line is OK (with '.'s).
At this point in my struggles, trying to access the perl scipt through the
server results in the browser bringing up a "Save As" dialogue box.

What's going on?

thanks,

- Kev




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

Date: Tue, 19 Oct 1999 17:45:19 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: creating a list of unique records
Message-Id: <P62P3.18724$E_1.1037629@typ11.nn.bcandid.com>

In article <380BDDB6.F7C59A69@syspac.com>,
Steve Kirby  <poser@syspac.com> wrote:
>creating a list of unique records:
>
>I'm looking for the most efficient way to go through a sorted list and
>print only one case of each unique record to a file.
>
>I know it is somewhat simple, but I have a huge list and want it so be
>somewhat speedy as I will run it quite often. 

Use the Unix command 'uniq' if you can.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 19 Oct 1999 12:02:02 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: creating a list of unique records
Message-Id: <mbudash-1910991202020001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <s0p8l0i7r0131@corp.supernews.com>, cberry@cinenet.net (Craig
Berry) wrote:

>Michael Budash (mbudash@sonic.net) wrote:
>: In article <s0nubbmcr0118@corp.supernews.com>, cberry@cinenet.net (Craig
>: Berry) wrote:
>: >Given that the original poster already has a sorted list, which they
>: >presumably want to stay sorted, a hash might not be the best approach.
>: 
>: true. never said "best" ... TMTOWTDI ...
>
>Amen.  Just trying to optimize within the solution space.
>
>: i'm damn sure no expert, but here's another way that could conceivably
>: take less resources than filling an array with acknowledged dupes,
>: assuming the 'list' is actually read in from a file, which they often are:
>: 
>: open (LIST, "list") or die ($!);
>: while (<LIST>) { $hash{$_} = 1; }
>: close LIST;
>: 
>: foreach (sort keys %hash) { print; }
>
>This will lose the input ordering unless you take some other step to
>record it or recreate it.  But it's certainly the case that you can
>improve on reading the whole thing into memory.

foreach (sort keys %hash) { print; }
         ^^^^

??
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Tue, 19 Oct 1999 17:08:02 GMT
From: Todd Smith <todd@solidconcepts.com>
Subject: Re: embedding perl in win32
Message-Id: <YqQMOCRX9pcUhj=1w0QEGP1f32Mm@4ax.com>

Santosh Joseph <sjoseph7@worldnet.att.net> wrote:

Do a File in Files or grep through the header files and see where
win32_chdir is defined. You should be able to deduce what header files
and defines are required to get things going.

>So, I downloaded the most recent ActiveState perl (520) and started
>reading the perlwin32faq10: Embedding and Extending
>
>I copied and pasted the first example and I get these errors when I
>compile:
>
>****************
>MyPerl.cpp
>C:\Perl\lib\CORE\perlhost.h(41) : error C2065: 'win32_mkdir' :
>undeclared identi
>fier
>C:\Perl\lib\CORE\perlhost.h(45) : error C2065: 'win32_chdir' :
>undeclared identi
>fier
>C:\Perl\lib\CORE\perlhost.h(49) : error C2065: 'win32_rmdir' :
>undeclared identi
>fier
>MyPerl.cpp(52) : error C2352: 'CPerlObj::Perl_newXS' : illegal call of
>non-stati
>c member function
>****************
>
>My Makefile and MyPerl.cpp look exactly the same as in the faq.  Is
>there a compiler switch that should be included? Has anybody been able
>to sucessfully compile this example?
>
>I was able to build win32 perl on my machine.
>
>Thanks,
>-Santosh


-----------------------------------------------------------------
Todd Smith               | Email:   todd@solidconcepts.com
Solid Concepts, Inc.     | WebSite: http://www.solidconcepts.com
Valencia, CA             | WebSite: http://www.solidview.com
Phone: (661) 257-9300    | Fax:     (661) 257-9311
-----------------------------------------------------------------


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

Date: 19 Oct 1999 17:12:38 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: erorr output to browser?
Message-Id: <380CA65B.F90B7FA5@vpservices.com>

amonotod wrote:
> 
> In article <7ui1ps$e85$1@nnrp1.deja.com>,
>   newsmf@bigfoot.com wrote:
> > Wheen debugging perl cgi-scripts, how can I get the error output to
> > show up in the browser instead of just getting the generic "Internal
> > Server Error" message?
>
> There really is no way to do what you ask

Bzzzt!  Wrong answer.  You could redefine your DIE, or more simply:

	use CGI::Carp qw(fatalsToBrowser);

-- 
Jeff


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

Date: Tue, 19 Oct 1999 17:36:10 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: formatting text with filling '.'s
Message-Id: <slrn80pb8o.cp1.bmccoy@moebius.foiservices.com>

Also Sprach Jared Evans <jared@frontiernet.net>:

>Is there an easy way to produce this output:
>
>Eggs..............$2.00
>Bacon.............$3.00
>One gallon Milk...$4.00
>
>As you can see the prices are all lined up and the area between the
>item and prices are filled with '.' instead of spaces.
>
>I could do character counting and add the right number of dots to each line,
>but am wondering if there was a dirty n' easy trick to do with with something
>like Format?

If you can calculate on the fly how may dots you need (by calculating the
length of the starting and ending strings and finding the difference), you
can use the x operator to fill in the proper space:

#$num_dots is the number of dots you need:

print 'Eggs' , '.' x $num_dots, '$2.00\n';

You may be able to use a format to do that also.  Consult your
documentation for more details on that.

-- 
Brett W. McCoy                             bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------


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

Date: Tue, 19 Oct 1999 18:56:20 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: help for functioin fork under win98
Message-Id: <o93P3.1156$Mg4.103331@newshog.newsread.com>

Federico (artax@shineline.it) wrote:
> .... when i try to use the fork function with the Win98 Perl 5 compiler this
> error message compares: "the Unsupported fork functioin is unimplemented at
> line...". Why? How can i do?

I discuss this issue in some detail in my book, Automating Windows With Perl.
The process model between UNIX and NT is so different that a native
fork() is impossible. Some runtime environments support it, if you
use the runtime environment.

As I was finishing it, ActiveState announced the goal was to make the
next release of Perl support fork(). I don't understand how they're
going to do it exactly, but it apparently involves cloning the running
interpreter itself in a new thread or process. It's going to be
hairy, whatever they come up with. It's certainly possible, since Perl
is an interpreter, to do stuff you couldn't do in C.

Scott

http://autoperl.skwc.com Automating Windows With Perl


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

Date: Tue, 19 Oct 1999 17:39:59 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to get the system time??
Message-Id: <s0pb7fjcr0159@corp.supernews.com>

Abel =?iso-8859-1?Q?Almaz=E1n?= (abel.almazan@ogilvyinteractive.es) wrote:
: I want to get the system time, if it's possible in the format :
: 
:     hh:mm:ss
: 
: How can i do?? Exists a system call??

perldoc -f localtime
perldoc POSIX   - see the 'strftime' function, %T format spec

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Tue, 19 Oct 1999 17:52:09 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to print password by "crypt" ?
Message-Id: <dd2P3.18748$E_1.1039096@typ11.nn.bcandid.com>

In article <6PJXt2iG$GA.131@news.thrunet.com>,
Yeong Mo/Director Hana co. <hmaster@factory.co.kr> wrote:
>I have my own script.
>There are already certain ID and passwd like follows;
>$ID = "aaa"
>$password = "bbb"
>
>So, I only need to print ID and password in .htpasswd file something like
>ID:32FaNzLNPWjoM.
>
>I guess the following lines are the key.
>Am I right ?
>
>$hash{$user} = crypt($FORM{new}, $salt)
>
>if (open(OUT, ">$file")) {
>  flock(OUT,2);
>  print OUT "$ID:$hash{$name}";
>close OUT;
>}

You are destroying the password file when you open it, then printing a
single value into it, so all other accounts will be deleted.  And if
open() fails, you silently fail to update the file.

Also, if $file is ".htpasswd" and someone tries to fetch a web page
while you're doing this, .htpasswd may be empty and they may get
spuriously denied access.  (This may be acceptable, depending on your
application.) Create a new file and rename it to .htpasswd when you're
done.  (Is there a safe way to do this on Win32?  rename() doesn't work
there.)

Also, I notice you're crypting $FORM{new}, not $password, which makes
me wonder what $password is for, and you have apparently three
different names for the username: $ID, $user, and $name.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 19 Oct 1999 17:20:22 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to write isdigit() in Perl
Message-Id: <qL1P3.18597$E_1.1035199@typ11.nn.bcandid.com>

In article <380C41AB.22B833BD@ife.ee.ethz.ch>,
Alex Rhomberg  <rhomberg@ife.ee.ethz.ch> wrote:
>Simple: There are no Roman page numbers in your example. The second line
>are american page numbers. Roman page numbers are only capitals

Well, if you want to get sticky about it, the same is true of Roman (or
"Latin") letters.  Lowercase was an invention of the Middle Ages.  But
I don't see anybody getting upset that the ISO Latin-1 set includes
lowercase letters, or letters with accents, for that matter.

I wish people would be nice to poor posters like this one, who
obviously don't know what a FAQ is and need to be told 'perldoc
perlfaq'.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 19 Oct 1999 11:09:15 -0700
From: moseley@best.com (Bill Moseley)
Subject: Kiling a process opened with -|
Message-Id: <MPG.127653a42898feeb98980f@nntp1.ba.best.com>

I fork & exec using open( PROG, '-|' ) and then I want to close PROG, 
but I may or may not have read everything from PROG.

It other words, I want to avoid having the close() return a error 13 
(write on closed pipe?) error.

Is this close?

 my $pid = open( PROG, "-|" );

 if ( $pid ) {
    read_results( *PROG  );

    # Close but may not have read everything from PROG
    # in the read_results sub

    local $SIG{CHLD} = 'IGNORE';  # Do I need this?

    kill 'HUP', $pid;             # or this?

    close( PROG ) || 
      die("Bad close on 'program' \$!=$! \$?=" . $? & 255) );

Just using close I get an error when closing early.

What do I need to do, and why?

Thanks,

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


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

Date: Tue, 19 Oct 1999 12:39:39 -0500
From: "Marc H. Robards" <mhrobards@nospam.tasc.com>
Subject: linux perl editor?
Message-Id: <7uiadc$t4f$1@birch.prod.itd.earthlink.net>

Anyone have any recommendations for a perl editor under Linux?  Or is emacs
or vim the way to go?  I've just started using Linux, so any suggesstions
would be appreciated.

Thanks
Marc Robards





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

Date: Tue, 19 Oct 1999 18:20:41 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: linux perl editor?
Message-Id: <slrn80pds7.cp1.bmccoy@moebius.foiservices.com>

Also Sprach Marc H. Robards <mhrobards@nospam.tasc.com>:

>Anyone have any recommendations for a perl editor under Linux?  Or is emacs
>or vim the way to go?  I've just started using Linux, so any suggesstions
>would be appreciated.

emacs or vi are the way to go.

-- 
Brett W. McCoy                             bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------


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

Date: Tue, 19 Oct 1999 21:23:32 +0400
From: APS <pollayil20@yahoo.com>
Subject: Manipulating variables
Message-Id: <380CA913.3787063F@yahoo.com>

Hi there,

Please help in to set this:

Part of the function:

$weight = $form{'total_weight'}

if ($weight <= "$n_weight") {
    $match = 1;
    print "<html><head><title>Result</title></head>\n";
    print "<body>\n";
    print "Zone: <b>$charge</b><br>\n";
    print "</body></html>\n";
    }

Where, $n_weight and $charge are taken from a flt. file db., for eg:
500,50.00
1000,75.00
1500,99.00
2000,124.00

The problem is that, the print shows all the charge values greater than
the $weight

Is there any solution whereby I could take just the value that matches
(less than or equal to) the $weight

Please help.

Thanks in advance




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

Date: Tue, 19 Oct 1999 20:00:01 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Mastering Algorithms With Perl-- Reviews
Message-Id: <i78MOKaV3W9nk02PcwlRretuYWJM@4ax.com>

On Tue, 19 Oct 1999 16:47:33 GMT, sqz1909@is2.nyu.edu (Sergej  Zoubok)
wrote:

>Has anyone read "Mastering Algorithms With Perl" by Jon Orwant, et al.? It
>seems like an ideal addition to my Perl reference shelf but I've been
>unable to find a copy to browse. I'd be interested, as I hope others
>would be, in hearing more about it.

It's great. Buy it!

--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: Tue, 19 Oct 1999 18:58:26 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Mastering Algorithms With Perl-- Reviews
Message-Id: <mb3P3.1157$Mg4.103331@newshog.newsread.com>

Sergej  Zoubok (sqz1909@is2.nyu.edu) wrote:
> Has anyone read "Mastering Algorithms With Perl" by Jon Orwant, et al.?

I have gotten a copy of it, but haven't had time to read it in any
detail. It looks really interesting. It's extremely high-level, and
doesn't go into the bit-twiddling and pointer stuff a similar C book would
have to go into. The algorithms look Perlish rather than like most early
C++ algorithms books, like C versions with a global search-and-replace
to change C to C++. Should be great for people who want to really do
non-trivial programming in Perl.

Scott



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

Date: Tue, 19 Oct 1999 18:04:54 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Monitoring the clicks of a banner
Message-Id: <7uibrs$lvv$1@nnrp1.deja.com>

  heron@hell.com (Kendar) wrote:
> Does anyone know of any script that would monitor
> the clicks on a given banner? I have CGI access.
http://www.geocities.com/amonotod

> Thank you in advance!
You're quite welcome!

HTH,
amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


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


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

Date: Tue, 19 Oct 1999 17:41:25 GMT
From: jhagerty@my-deja.com
Subject: Newbie regex question on quoting
Message-Id: <7uiag1$l24$1@nnrp1.deja.com>

Some brainiac is the text that I am parsing decided to leave astersiks
as a marker.  I don't want the marker so i need to strip out the
asterisks.

Reading the Perl doc's it appears that I should be able to substitute
the asterisks out by quoting the metacharacter out.  This is what I am
trying to do with:

$string =~ s/\*//gs;

However, this is matching the entire string and leaving me nothing.

Help?

joe


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


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

Date: 19 Oct 1999 18:45:05 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: Newbie regex question on quoting
Message-Id: <7uie7h$7cm$2@msunews.cl.msu.edu>

jhagerty@my-deja.com wrote:
: $string =~ s/\*//gs;

Can you give an example of $string.... Because my test of it worked.

#!/usr/bin/perl
$string = "*foo * bar *";

$string =~ s/\*//gs;
print $string, "\n";   #foo  bar

-- 
       Dan Nguyen          | It is with true love as it is with ghosts;
    nguyend7@msu.edu       | everyone talks of it, but few have seen it.
     dnn@debian.org        |               -Maxime De La Rochefoucauld
            25 2F 99 19 6C C9 19 D6  1B 9F F1 E0 E9 10 4C 16


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

Date: Tue, 19 Oct 1999 13:10:32 -0500
From: "Brian Kruse" <bdkruse@NULLSTRINGimation.com>
Subject: Re: newbie
Message-Id: <s0pd0tgfr0141@corp.supernews.com>


Ran Shoham <rshoham@acs5.acs.ucalgary.ca> wrote in message
news:7ugr53$i4g$1@nserve1.acs.ucalgary.ca...
> Hi there, I'm a Perl newbie.

So you might want to read the FAQs and documentation that come with perl.
Lots to learn.

> <someword>: <number_of_files> <filename1.txt> <filename1.txt> ....
>
>
> I want to do something like the following:
>
> while ($line = <FILE>) {
>    ($word, $number, $array_of_files) = split(" ", $line);
>

@array = split /[: ]+/, $line;

$array[0] holds someword, $array[1] holds number_of_files, $array[2]
 ...$array[n] hold file names.

-Brian




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

Date: Tue, 19 Oct 1999 18:59:42 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: NT: How can I change drive within a perl script?
Message-Id: <yc3P3.1158$Mg4.103331@newshog.newsread.com>

Richard Yates (r.j.yates@open.ac.uk) wrote:
> or find out what drive I'm on "now".

> I'm asking this on behalf of a colleague.........

In my experiments, I found chdir works with full paths.

	chdir("x:/what/ever");
	chdir("m:/");

I'm not sure how you find out the current drive. Probably have
to use a shell command.

Scott


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

Date: Tue, 19 Oct 1999 16:59:15 GMT
From: rbansal@zip2.com
Subject: odbc extension for win32 perl
Message-Id: <7ui80q$itb$1@nnrp1.deja.com>

I am trying to install ODBC extension for win32
perl. After installation, when I run the test
script, the following error comes

Can't locate loadable object for module Win32ODBC
in @INC (@INC contains
D:\perl\lib/MSwin32-x86
D:\perl\lib
D:\perl\site\lib
at...

What should I do to correct the error.

Thank you

Ravi


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


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

Date: Tue, 19 Oct 1999 17:15:51 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: OT: Din paper sizes (was Re: PDFlib size settings)
Message-Id: <bH1P3.18525$E_1.1034378@typ11.nn.bcandid.com>

In article <slrn80o496.e3k.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Kragen Sitaker (kragen@dnaco.net) wrote on MMCCXXXIX September MCMXCIII
>in <URL:news:7sOO3.15758$E_1.910711@typ11.nn.bcandid.com>:
>?? 
>?? A4 paper is an abstraction.  Its sides have exactly a 1:sqrt(2) ratio.
>?? A4 paper does not exist in the real world, because real-world objects
>?? do not have exact sizes.  The same is true of US letter paper, which is
>?? 8.5" x 11".
>
>Uhm, 11/8.5 doesn't come anywhere near sqrt(2). 

Well, it's not too far off -- about 8.5% too short -- but that wasn't
what I was saying.  I meant that exactly-8.5"x11" paper is an
abstraction and does not exist in the real world, just like exactly-A4
paper.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 19 Oct 1999 17:10:48 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: perl and encrypted cookies
Message-Id: <sC1P3.18446$E_1.1033837@typ11.nn.bcandid.com>

In article <7uh0n5$13k$1@plonk.apk.net>,
Jody Fedor <JFedor@datacom-css.com> wrote:
>A very smart idea!  We encrypt our cookies too.  I wouldn't want any of
>our customers lending their computers to someone and them being able to
>extract Credit Card numbers, Expiration Dates and Credit Card type
>from looking at their cookies!

Maybe you shouldn't be sending the credit card numbers and expiration
dates back to the browser, encrypted or otherwise.  It would be a real
shame if your encryption scheme turned out to be less secure than you
think it -- for example, having guessable keys.  Maybe you shouldn't
even be storing the numbers on your web server.  It would be a real
shame if somebody cracked your web server and got the credit card
numbers of all your current customers.  Storing the numbers on a
back-end system separate from the web server would still allow crackers
to capture credit card numbers from existing customers, but not new
ones.


-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 19 Oct 1999 19:01:59 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Perl and IIS issues w/ Perl [USE] command.
Message-Id: <He3P3.1159$Mg4.103331@newshog.newsread.com>

Zowwie (apage.net@usa.net) wrote:
> Why is IIS stripping the @INC array?

It is not. IIS runs processes under a weird username which doesn't (most
likely) have all the Perl environment variables set.  It runs fine from
the command line, because that user has all the environment variables set.

Scott


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

Date: Tue, 19 Oct 1999 11:27:53 -0600
From: Mike Dye <mdye@katech.colorado.edu>
Subject: PERL/C API - Passing array by reference
Message-Id: <380CAA19.2947C358@katech.colorado.edu>

I'm trying to create an C XS extension for perl that takes a refrence to
an array as an argument. Does anybody know the proper "type casting"
typemap that can turn the perl-style reference to an array into C
pointer to an array (of type double)?

Any help or pointer to help would be mucho appreciated!

-Mike



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

Date: Tue, 19 Oct 1999 19:27:15 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: PERL/C API - Passing array by reference
Message-Id: <nC3P3.1603$IZ5.24518@news.rdc1.ct.home.com>

Mike Dye <mdye@katech.colorado.edu> wrote:
> I'm trying to create an C XS extension for perl that takes a refrence to
> an array as an argument. Does anybody know the proper "type casting"
> typemap that can turn the perl-style reference to an array into C
> pointer to an array (of type double)?

You can't do this that easily. You're better off taking a reference
in and having your code iterate through the array and explicitly
snag the double values (well, NV values) out of the array with
SvNV.

				Dan


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

Date: Tue, 19 Oct 1999 17:35:59 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Q: Truncate string length?
Message-Id: <380cab5a.4721847@news.skynet.be>

emlyn_a@my-deja.com wrote:

>Ha ha. I didn't realize you could make a $var equal to a substr($var,
>0, 500).

Then did you realize you can effectively truncate a string, by assigning
TO substr()?

	substr($var, 500) = '' if length($var)>500;

-- 
	Bart.


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

Date: 19 Oct 1999 18:11:35 GMT
From: moody+@pie.ius.cs.cmu.edu (James Moody)
Subject: Why does this compile? - THANKS!
Message-Id: <7uic8n$k9r$1@goldenapple.srv.cs.cmu.edu>

Wow, quick responses!

The answer is that the '&' is being interpreted as a bitwise-AND operator rather
than as a superflous subroutine operator.  That, of course, is the only
lexically-correct interpretation.

Thanks for the replies and the tips on how to find/prevent these errors
in the future.  I'll pass them along.

				--Jim



In article <7ui51l$i4c$1@goldenapple.srv.cs.cmu.edu>, moody+@pie.ius.cs.cmu.edu (James Moody) writes:
|> A friend asked for help debugging a script he modified.  Basically, he added a
|> couple of routines to someone else's script. 
|> 
|> I tracked down the problem to a missing semicolon. The resulting statement
|> compiled and ran, but I don't know why or what it means syntactically.
|> 
|> Here's a really stripped down version wich illustrates the problem:
|> 
|> 
|>     sub jumbo {
|>        print "$foo \n";
|>        1;
|>     }
|> 
|>     $foo = "Hello!";   #<--  Note this semicolon!
|>     &jumbo;
|> 
|> 
|> 
|> In this example $foo is created on assignment.  Obviously, if you ran this,
|> the result would be the string 'hello!' printed out on a line by itself.
|> 
|> Now, if the indicated semicolon was missing, the main part of the script would
|> be:
|> 
|>     $foo = "Hello!" &jumbo;
|> 
|> This compiles! The execution result is a blank line.
|> 
|> My question is why does it compile?!?! I this in fact correct syntax?
|> What is going on on the right side of that statement?  How can a scalar and a
|> return value be assigned to a variable without an error message being triggered?
|> 
|> I mean, this does not compile:
|> 
|>   $foo = "Hello!" 1;
|> 
|> so why should 
|> 
|>   $foo = "Hello!" <something that returns '1'>;
|> 
|> 
|> Just curious.
|> 
|> -------------------+---------------------------------+-----------------
|> James E. Moody Jr. | Center for Orthopaedic Research |                 
|> Project Engineer   | Suite 309, 5200 Centre Avenue   |     412.623.2943
|> moody@cor.ssh.edu  | Pittsburgh, PA 15232            | FAX 412.623.1108
|> -------------------+---------------------------------+-----------------


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

Date: Tue, 19 Oct 1999 17:17:01 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: why doesn't my script work?
Message-Id: <hI1P3.18543$E_1.1034544@typ11.nn.bcandid.com>

In article <7uh3cb$oss$1@nnrp1.deja.com>,  <mr_potato_head@my-deja.com> wrote:
>Hi,
>  I have a small part of my script here and it works great when I run it
>from the command line.

Maybe you should download Big Brother and use that instead?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 19 Oct 1999 13:23:30 -0400
From: David Wozmak <dwozmak@rational.com>
Subject: Re: why doesn't my script work?
Message-Id: <380CA912.831BA14F@rational.com>

You are calling a shell command that will fail if the user has
insufficient permissions on the called machine. Thus, when 'nobody' or
'www' tries to run the shell, it gets a permission error.  Your split
then politely puts nothing into @uptime_array, and then you remove the
last character from array position 12.  Probably that is what prevented
you from getting an uninitialized value error (had you turned on
Warn...).  So if the shell command failed, your test for the value of
$uptime_array[12] will turn up that it is NOT greater than three, since
null is certainly not greater than three.

To fix this, you need to have permissions on the other machines, or at
least an account and password on each machine, to use in your shell
command.  Also, you need to make your code less fragile, by adding a
check for null or bad values in the array.

Another thing you could have done to find this problem easily, is to put
a 
print "uptime value: $uptime_array[12]\n";
line in your code...interesting what comes up when you do that!

dwoz

mr_potato_head@my-deja.com wrote:
> 
> Hi,
>   I have a small part of my script here and it works great when I run it
> from the command line.  But when I call this exact same script from my
> browser via cgi, then it get the wrong answer everytime.  If my
> $uptime_array[12] = say 5, then the red ball is picked if I run this at
> the command line.  If I run this in the cgi, then it picks the green
> ball.  I have no clue why it does this. 

<snip>

 I don't understand why I get these results.
> Help, Help, Help.  Thanks in advance...
> 
> @host_list = ("othermachine");
> foreach $host ( @host_list ) {
>    $uptime{$host} = `rsh othermachine uptime`;
> }
> foreach $host ( @host_list ) {
>    @uptime_array = split(/ +/, $uptime{$host});
>    chop $uptime_array[12];
>    if ($uptime_array[12] > 3 ) {
>       $load{$host} = "http://my.computer.com/icons/red_ball.gif";
>    }else{
>       $load{$host} = "http://my.computer.com/icons/green_ball.gif";
>    }
> }
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


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

Date: Tue, 19 Oct 1999 19:52:29 +0100
From: "DVD Times" <colin@dvdtimes.co.uk>
Subject: Writing to a file
Message-Id: <380cbe1b$0$10070@znews.zetnet.co.uk>

Hi everyone,

I'm new to Perl and I need a little guidance.

What I want to do is take a value entered on an HTML form and store it in a
file on the server so I can see what people have entered.

Is there a simple piece of code to do this? If anyone could help I'd be very
grateful.

--

Cheers,

Colin Polonowski
DVD Times - http://www.dvdtimes.co.uk/
** Region 1 and 2 DVD News, Reviews and Features **





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

Date: 19 Oct 1999 18:58:41 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: Writing to a file
Message-Id: <7uif11$7cm$3@msunews.cl.msu.edu>

DVD Times <colin@dvdtimes.co.uk> wrote:
: I'm new to Perl and I need a little guidance.

: What I want to do is take a value entered on an HTML form and store it in a
: file on the server so I can see what people have entered.

And your perl question is?

-- 
       Dan Nguyen          | It is with true love as it is with ghosts;
    nguyend7@msu.edu       | everyone talks of it, but few have seen it.
     dnn@debian.org        |               -Maxime De La Rochefoucauld
            25 2F 99 19 6C C9 19 D6  1B 9F F1 E0 E9 10 4C 16


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

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


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