[9232] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2827 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 10 06:07:18 1998

Date: Wed, 10 Jun 98 03:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 10 Jun 1998     Volume: 8 Number: 2827

Today's topics:
    Re: accessing a:\ <steph@hotkey.net.au>
    Re: Advanced Perl Programming Book <frankie@etsetb.upc.es>
        base64 encoding (Vitali Chkebelski)
    Re: Capitalizing acronyms (Re: Is PERL case sensitive?) jimbo@soundimages.co.uk
    Re: Command line substitution thru subdirectories <uwe.honekamp@etas.de>
    Re: Command line substitution thru subdirectories (Xuming Wang)
    Re: Command line substitution thru subdirectories (Ilya Zakharevich)
        Does Blat work with Exchange? <mcate@gmu.edu>
    Re: Downloading Perl <dfetter@shell4.ba.best.com>
    Re: efficient comparisons <devs@usa.net>
    Re: Email address checker - comments welcome <frankie@etsetb.upc.es>
        flock <devs@usa.net>
        Guestbook script for FP98 <seashore@wxs.nl>
    Re: Guestbook script for FP98 (Jouke Visser)
    Re: How can I write to specific line ? <ric@apartmentzone.com>
        htpasswd <worm@theworm.net>
    Re: htpasswd <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: McCabe complexity analysis <Harald.Joerg@mch.sni.de>
    Re: McCabe complexity analysis (Stefaan A Eeckels)
    Re: Need to plot charts (gif format ?) from ascii data <quednauf@nortel.co.uk>
        Newbie: Unrecongized character <ebrown2@ix.netcom.com>
        NT and .htpasswd - .htaccess <shodan@skynet.be>
    Re: pack/unpack seps <devs@usa.net>
        Pipes between C program and perl script <krakousz@iai.fzk.de>
    Re: Piping into telnet from Perl NT (Tye McQueen)
    Re: READING MAIL BY PERL <dan@ukonline.net>
        Reading STDOUT from Win32::Process::Create ianwills@my-dejanews.com
    Re: Return cell contents to HTML dropdown menu <quednauf@nortel.co.uk>
    Re: RFD: comp.lang.perl.moderated moderated rhys@primenet.com
    Re: Saving dynamically created images <antti.boman***SP@MPROTECTION***mindcom.fi>
        strings.. (Antti-Jussi Korjonen)
    Re: strings.. <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: strings.. (Daniel Grisinger)
    Re: strings.. (Todd C. Ames)
    Re: very quick s/// question <ion@aroma.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 10 Jun 1998 16:15:19 +1000
From: Stephan Carydakis <steph@hotkey.net.au>
Subject: Re: accessing a:\
Message-Id: <357E2477.36DF@hotkey.net.au>

Clinton Pierce wrote:
> 
> In article <357C09F9.185D@idt.net>,
>         Kevin Thorley <kthor@idt.net> writes:
> >I'm writing a script to access the a: drive and return a list of its
> >contents.  But I keep getting "Bad command or file name."  Here's the
> >code
> >
> >chdir( "a:" );
> >while( <"*.*"> ){
> >print "$_\n" ;
> >}
> >
> >It works fine if I use any directory on the c: drive.  It seems to be
> >going to the a: drive that is causing problems.
> 
> What's wrong with opendir/readdir?  It requires a lot less magic, and
> is more likely to do what you'd expect:
> 
>         opendir(DIR, "A:/") || die "Can't open A:/: $!\n";

just a point, according to the camel, "or die" should be used instead of
"|| die" because of precedence??

>         @FILES=readdir DIR;
>         closedir(DIR);
> 
>         print join("\n", @FILES), "\n";
> 
> Haven't tested that code on a DOS machine though.  I SUSPECT that
> an opendir on "A:/" will do the right thing.  Perl usually does.
> 
> --
> +------------------------------------------------------------------------+
> |  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
> |  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
> | fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
> +------------------------------------------------------------------------+
> GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*


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

Date: Fri, 05 Jun 1998 14:46:15 +0200
From: Francesc Guasch <frankie@etsetb.upc.es>
Subject: Re: Advanced Perl Programming Book
Message-Id: <3577E897.87A34DAB@etsetb.upc.es>

Glen G. Walker wrote:
> 
> In article <356D7DFA.63FC4F6E@gpu.srv.ualberta.ca>,
> Andrew Johnson  <ajohnson@gpu.srv.ualberta.ca> wrote:
> >Christopher R. Redinger wrote:
> >!
> >! Okay, I've searched the FAQ, I've read the groups, and I can't
> >! seem to find the answer to this FAQ (at least around here). We've
> >! got the "Camel Book," we've got the "Llama Book," heck we've even
> >! got the "Hip Owls" book. The question of the month around here as
> >! been, what the heck is on the cover of Advanced Perl Programming
> >! by O'Reilly?? We've been calling it the "Puma Book." But, I'm not
> >! too sure about the accuracy of that one. Any ideas?
> 
> I would be interested in hearing what people think of the "Mouse Book"
> (CGI Programming). As a complete PERL beginner, I am finding it a big
> help, but everybody else I talk to thinks that it is useless.

I find it very helpfull !
It teaches CGI , mostly using perl, but if you wanna learn perl
you'll need other books.

-- 
mailto:frankie@etsetb.upc.es	http://www.etsetb.upc.es/~frankie
 ^-^.-----,       
 o o _     )       	Errors, like straws, upon the surface flow;
  Y (_, (__(Ssss    He who would search for pearls must dive below.


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

Date: 8 Jun 1998 09:11:48 GMT
From: v.chkebelski@t-online.de (Vitali Chkebelski)
Subject: base64 encoding
Message-Id: <6lg9sk$c9t$1@news01.btx.dtag.de>

I'm sending mail with mime-attachments encoded with perl MIME-library
function encode_base64.

They are good understood by Netscape mail-client, but not by MS Exchange
and Eudora.
The comparison between source text of mine and those of Netscape message
shows a slight difference in encoding of the same file (for example
gif-file).

Any help would be appriciated!

Vitali Chkebelski
Chemnitz, Germany

v.chkebelski@nutzwerk.de


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

Date: 10 Jun 1998 07:40:44 +0100
From: jimbo@soundimages.co.uk
Subject: Re: Capitalizing acronyms (Re: Is PERL case sensitive?)
Message-Id: <u67i9kbdf.fsf@JIMBOSNTSERVER.i-have-a-misconfigured-system-so-shoot-me>

Tom Phoenix <rootbeer@teleport.com> writes:
> 
> On Sat, 6 Jun 1998, REUBEN LOGSDON wrote:
> 
> > PERL is an acroynm for "Practical Extraction and Report Language".  It's
> > common practice to capitalize acronyms. 
> 
> You're right, but once the acronym becomes a word (such as laser, scuba,
> or zip code) the caps are dropped. Thus the FAQ turns out to be correct
> once again. :-)

Reuben remains correct. Although an acronym becomes a noun through
common usage, which is a beautiful feature of English, it still
retains it's origin as an acronym. This would certainly remain an
entry in any dictionary including Perl as an entry. Thus, using the
form PERL, while seemingly a problem with cultural fanatics, would
remain perfectly resonable. The form Perl may be the accepted and/or
acceptable form of usage but the form PERL is not incorrect or
inaccurate within the acronym context under any circumstance.

Jim Brewer


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

Date: 10 Jun 1998 05:33:40 GMT
From: "Uwe Honekamp" <uwe.honekamp@etas.de>
Subject: Re: Command line substitution thru subdirectories
Message-Id: <01bd9431$4df397c0$931a0180@fe13803>


Abigail <abigail@fnx.com> wrote in =
<6lkjq2$7vj$1@client3.news.psi.net>...

> $ find . -name '*.htm' | xargs perl -i.old -p -e "s/foo/bar/g"

On win32, however, you have to install a proper working find and xargs.
These (and more) can be found at www.cygnus.com/win32.

Disclaimer: I'm running NT, never checked find and xargs on win95

--

Uwe Honekamp * ETAS GmbH * Borsigstr. 10 * D-70469 Stuttgart =20
uwe.honekamp@etas.de * voice: ++49/(0)711/89661-143 * fax: -107





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

Date: Wed, 10 Jun 1998 04:49:43 GMT
From: xuming@email.unc.edu (Xuming Wang)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <35820c65.186981408@152.2.25.74>

[no courtesy cc of this posting sent to cited author via email]

Tom Christiansen <tchrist@mox.perl.com> wrote:

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, 
>    xuming@email.unc.edu (Xuming Wang) writes:
>:C:\>find . -name '*.htm' | xargs perl -i.old -p -e "s/foo/bar/g"
>:FIND: Parameter format not correct
>:Bad command or file name
>
>Stop bitching about not having tools.  It's not our fault that you're
>too lazy, stupid, or rude to bother to install an operating system.
>You can't get any useful work done with your problem.  If you want
>to program, install a programming environment.  If you prefer to 
>watch MTV, you know where to find it.
>
>--tom

Tom,

sorry I bitched about not having tools.  surely it's not your fault that
I am too lazy, stupid, or rude to bother to install one operating
system.  instead, I have three OS' installed on my home PC.  yes I
should have more tools installed to write a one line Perl script.  but
it would be better if you point out that your answer to a Perl question
on a Perl news group requires something other than Perl.  thanks.

now calm down and don't be angry that I found your another mistake: I
don't know where to find MTV.  your FAQ and Perl manpages don't have an
entry for it.

--
Xuming Wang


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

Date: 10 Jun 1998 07:42:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <6llddk$jpk$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Bob Roklan 
<roklan_r@code80.npt.nuwc.navy.mil>],
who wrote in article <357DA4E9.DA495FD6@code80.npt.nuwc.navy.mil>:
>  I am running Perl 5.003 on Windows 95. I would like to specify a
> substitution string for multiple files spanning specified directory and
> its subdiredirectories.
> 
> I know that the following would work for the current directory....
> 
>     perl -i.old -p -e "s/foo/bar/g" *.htm
> 
> but how can I tell perl to do the same for a specified directory and
> down?

Use pfind (search on CPAN in my directories).  Line will be like

    pfind -bak=.old . '/\.htm$/' '=~ s/foo/bar/g'

(in Unixish shells, you will need double quotes).

Ilya


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

Date: Wed, 10 Jun 1998 01:33:23 -0400
From: "Matthew Cate" <mcate@gmu.edu>
Subject: Does Blat work with Exchange?
Message-Id: <6ll5qh$oet@portal.gmu.edu>

Does Blat work with MS Exchange 5.5?

If not, what does?

Thanks,

Matthew Cate





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

Date: 10 Jun 1998 06:11:22 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: Downloading Perl
Message-Id: <6ll82a$lc4$1@nntp1.ba.best.com>

Rainer Pielmann <pira0011@rz03.FH-Karlsruhe.DE> wrote:
> Hello,

> I am new to Perl. Can anyone tell me where I can download a full
> operational Perl version for a Windows 95 system?

Install Linux on the system, and a fully functional Perl will there.

HTH,
David.
-- 
            David Fetter         888 O'Farrell Street Apt E1205
   shackle@ren.glaci.com          San Francisco, CA 94109-7089 USA
  http://www.best.com/~dfetter     +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)

An injunction delaying Windows 98 would clearly have a negative impact
on the country as a whole.
                                     Compaq President & CEO Eckhard Pfeiffer,
                                     explaining why Microsoft shouldn't be
                                     prosecuted under anti-monopoly laws.


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

Date: Tue, 09 Jun 1998 23:57:30 -0500
From: Deva Seetharam <devs@usa.net>
Subject: Re: efficient comparisons
Message-Id: <6ll38m$gk2@newsops.execpc.com>



Darwin O.V. Alonso wrote:

> Programming Perl (2nd Ed page 540) makes a point that
> $foo = $a || $b || $c; is much faster than the "if (){}else{}" construct.
>
> In trying to find both the minimum and maximum values in an array, I
> have the following snippet of code:
>
> $min = $max = $ar[0];
> for $i ( 1  .. $#ar ) {
>   ( ($ar[$i] < $min ) && ($min = $ar[$i]) )   # min?
>   ||
>   ( ($ar[$i] > $max ) && ($max = $ar[$i]) );  # if not min, maybe max?
> }
>
> If it makes any difference, $#ar = 3000.
>
> Does anyone have any suggestions on making that code more efficient?
> How about more conceise, and equally efficient?
> I tried constructs like "$mini > $t[$i] &&= $t[$i];"
> but could not get them to run.
>
> Thanks,
> Darwin

  I am sure about the relative efficiency of this code.
  But, it is concise.

 @sortedArray =  sort {$x <=> $y} @ar;

 $sortedArray[0] will be min;
$sortedArray[$#sortedArray] will be max;

hope that helps and makes sense.
Sorry, if not efficient enough for you.

Deva




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

Date: Wed, 03 Jun 1998 18:59:33 +0200
From: Francesc Guasch <frankie@etsetb.upc.es>
Subject: Re: Email address checker - comments welcome
Message-Id: <357580F5.45B10245@etsetb.upc.es>

Ronald J Kimball wrote:
> 
> Larry Rosler <lr@hpl.hp.com> wrote:
> 
> > /^ [^\s@?]+ @ (?: \w[^\s.]* \. )+ \w\w+ $/x
> 
>   DB<1> $re = '^ [^\s@?]+ @ (?: \w[^\s.]* \. )+ \w\w+ $'
> 
>   DB<2> p 'invalid@address@foo.bar' =~ /$re/x
> 1
>   DB<3> p 'also@invalid.__' =~ /$re/x
> 1
> 


I was looking for one that searches a valid mail address in a text,
How could I do the inverse of the search above ?

-- 
mailto:frankie@etsetb.upc.es       http://www.etsetb.upc.es/~frankie
 ^-^.-----, 
 o o _     )             Errors, like straws, upon the surface flow;
  Y (_, (__(Ssss     He who would search for pearls must dive below.


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

Date: Wed, 10 Jun 1998 00:12:23 -0500
From: Deva Seetharam <devs@usa.net>
Subject: flock
Message-Id: <6ll44f$gk2@newsops.execpc.com>

I have to modify a HTML template, whenever a CGI script is
accessed.
So, I used the following piece of code.

use Fcntl ':flock';
 ...
 ...
open (TEMPLATE, "+<....") or die "....";
flock(TEMPLATE,  LOCK_EX) or die "....";

open (TEMPFILE, ">...") or die "....";
flock(TEMPFILE, LOCK_EX) or die ".....";

# Copy the Template to tempfile. While copying, make
# the necessary changes.
while ($record = <TEMPLATE>)
{
     $record = ~  s/.../.../;
     print TEMPFILE $record;
}

close(TEMPLATE);
close (TEMPFILE);

# tempfile and template contains the name of the files.
rename ($tempfile, $template);
***************************************
This script works perfectly if run in single user mode.
But, if multiple users execute the script simultaneously, it
does not update the  TEMPLATE properly.

Please Advise.

Thanks,
Deva








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

Date: Wed, 10 Jun 1998 09:24:28 +0200
From: "C. Koelewijn" <seashore@wxs.nl>
Subject: Guestbook script for FP98
Message-Id: <357E34AC.7A1C@wxs.nl>

Does anybody know a Perl or Java script for a guestbook that works with
FP98? I've tried Matt Wright's Perl script and it makes the necessary
pages, but Frontpage constantly makes a mess of these pages. I don't use
the FP Extensions.

Thanks in advance,

Martin van Duijn, The Netherlands <vanduyn@seashore.nl>


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

Date: Wed, 10 Jun 1998 08:01:59 GMT
From: jouke@RemoveThisToReplycom-bat.nl (Jouke Visser)
Subject: Re: Guestbook script for FP98
Message-Id: <357e3d31.3751047@news.telecom.ptt.nl>

FP98 and all versions before makes a mess of *all* pages created with
it. The Perl script isn't the issue here. It's a FP problem, which is
off-topic here.

Greetings,

Jouke Visser.

On Wed, 10 Jun 1998 09:24:28 +0200, "C. Koelewijn" <seashore@wxs.nl>
wrote:

>Does anybody know a Perl or Java script for a guestbook that works with
>FP98? I've tried Matt Wright's Perl script and it makes the necessary
>pages, but Frontpage constantly makes a mess of these pages. I don't use
>the FP Extensions.
>
>Thanks in advance,
>
>Martin van Duijn, The Netherlands <vanduyn@seashore.nl>



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

Date: Tue, 9 Jun 1998 17:36:57 -0500
From: "Ricky" <ric@apartmentzone.com>
Subject: Re: How can I write to specific line ?
Message-Id: <6lkad8$pin$1@news.insnet.com>

the only way i know of is to loop through every line of the file till you
find the one you want, writing all the lines that don't match to a temporary
file.  then when you find the one you want, change it and write it to the
temporary file and continue with the loop.  when that's done, rewrite the
temporary file to the original file.  here's an example:

open(FILE,"/path/to/file.txt") || die "ooh you dirty rat";
open(TEMP,">/path/to/temp.txt") || die "how dare you";

while(<FILE>){
    # say you're looking for a line that has the pattern --start-- at the
beginning
    if($_ =~ /^--start--/){
            &change_it;
    }else{
            print TEMP $_;
    }

close FILE;
close TEMP;

# then rewrite it

open(TEMP,"/path/to/temp.txt") || die "well i have never. . .";
open(FILE,"/path/to/file.txt") || die "that didn't hurt";

print FILE $_;

close TEMP;
close FILE;

# here's the change_it

sub change_it{

    print TEMP $new_string;

}

this is a super basic little script.  maybe it'll be a little more
complicated in your situation.  also, i'm pretty good with perl but not
quite a guru.  also, i don't know as much about perl 5 yet.  i would
investigate to see if there's any way you can open a file in I-O mode.  i
havn't seen this but i know it's available in other languages.  i figure
it's only a matter of time before it gets implemented in perl if it hasn't
already.  although i'm not sure this is the best way to do it, it certainly
is one way of doing it.  what may be worse is that you probably already know
this.  lol -  but i hope it helps.

ricky


oh, by the way, you might have to chmod(); the temp file so you can have the
correct permissions before you open it that first time.  so you'd have to
open it, thereby creating it if it doesn't exist, then close it, then
chmod(); it with the appropriate permissions ( 0750 probably ) and then
continue with the rest of it.






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

Date: Wed, 10 Jun 1998 16:58:02 +1000
From: "Tim O'Leary" <worm@theworm.net>
Subject: htpasswd
Message-Id: <6llb9r$keu$1@nswpull.telstra.net>

I am wondering if any of you shell wizards can help me.

I have an ascii file containing a list of usernames and passwords seperated
by commas.

Each line is in the form  username,password

I want to send this to the htpasswd command which has the format

htpasswd ./.htpasswd username

This then prompts you for a password followed by verification (identical to
the passwd command)

I really dont want to have to type each in manually - so any help would be
appreciated.

Thanks in advance,

Tim




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

Date: 10 Jun 1998 09:12:12 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: htpasswd
Message-Id: <7xogw1lohf.fsf@beavis.vcpc.univie.ac.at>

Re: htpasswd, Tim <worm@theworm.net> said:

Tim> Each line is in the form username,password

separate using: split /,/;

Tim> I want to send this to the htpasswd command which has

Actually what you *want* to do is to create a user database
for authentication.  htpasswd is one such tool for doing
this but you don't really *want* to use it here :-)

Tim> the format
Tim> htpasswd ./.htpasswd username
Tim> This then prompts you for a password followed by
Tim> verification (identical to the passwd command)

There (but of course) is a module for this:

    use HTTPD::UserAdmin;

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: Wed, 10 Jun 1998 10:09:43 +0200
From: Harald Joerg <Harald.Joerg@mch.sni.de>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: McCabe complexity analysis
Message-Id: <357E3F47.C91B6F9B@mch.sni.de>

[mailed and posted]

Tom Christiansen wrote:
> [...]
> I wonder why these allegedly respected authors seem
> to thing there's some different between
> 
>     if (p)
> 
> and
> 
>     if (p == NULL)
> 
> When of course, there isn't.

There is a difference for the human writer/reader:
I stick to
      if (p)
because I don't have any chance to mistype:
      if (p = NULL)  /* will hardly ever be true */
or to reverse the logic inadvertently (happens to the best):
      if (p == NULL) /* exactly the opposite of if (p) */

Russ Allbery says he dislikes assignments inside an if
condition in <URL:news:m3bts2otbm.fsf@windlord.Stanford.EDU>,
but perl makes a difference: I got into the habit to write
      if (my $p = some_function(@some_arguments))
because then it is clear that $p is to be used only within the
if block.
-- 
Oook,
--haj--


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

Date: 10 Jun 1998 08:20:04 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: McCabe complexity analysis
Message-Id: <6llfjk$duo$1@justus.ecc.lu>

[Posted and mailed]

In article <6lkena$qbl$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
> I wonder why these allegedly respected authors seem
;-) 
> to thing there's some different between 
> 
>     if (p) 
> 
> and 
> 
>     if (p == NULL)
> 
> When of course, there isn't.
Would you believe that I started writing the explicit test because
the Microsoft C++ compiler generates the following:

	Warning C4706: Assignment within conditional expression.

when you write:

	if (!(handle = fopen(file_name, mode)))

but not when using the '== NULL' idiom.

-- 
Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
A consultant is a person who borrows your watch, tells you what
  time it is, pockets the watch, and sends you a bill for it.


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

Date: Wed, 10 Jun 1998 09:59:40 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Need to plot charts (gif format ?) from ascii data
Message-Id: <357E4AFC.2814CA61@nortel.co.uk>

Vinit Jindal wrote:
> 

> Any other suggestions for posting charts on the web prepared from
> ascii data.
> 

ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/modules/by-module/GIFgraph/

That is the place where my LOCAL CPAN has the GIFgraph stored. I haven't
used it, but the name sort of implies its function. For this to work you
will need the gif module for Perl, ->

ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/modules/by-module/GD/

which is the essential bit for outputting gif file content.

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Wed, 10 Jun 1998 00:07:04 -0700
From: Ellington Brown <ebrown2@ix.netcom.com>
Subject: Newbie: Unrecongized character
Message-Id: <357E3098.5429C223@ix.netcom.com>

I am new to perl I can't get my guestbook to run. I have other perl
scripts that are running. When I execute the following perl script I
receive an error message:

public_html/cgi> perl guestbook.pl
Unrecognized character \276 at guestbook.pl line 1.

What character is it looking for? I think that there is a unseen
character located on the first line of the program. I just wish I could
see it. Any suggestions or comments?

Thanks
Elton



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

Date: Wed, 10 Jun 1998 11:14:11 +0200
From: Pierre Mengal <shodan@skynet.be>
Subject: NT and .htpasswd - .htaccess
Message-Id: <357E4E63.49F5DBEB@skynet.be>

Hi there,

I have a problem to resolve :

I must protect a dir with login and password,  but the user database
must be a single file editable by a CGI.

Can someone help me ?

Thanks a lot

Pierre Mengal

WWW.TB-303.COM
WWW.ZONE-ZERO.COM



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

Date: Tue, 09 Jun 1998 23:42:55 -0500
From: Deva Seetharam <devs@usa.net>
Subject: Re: pack/unpack seps
Message-Id: <6ll2d7$gk2@newsops.execpc.com>



Ruben I Safir wrote:

> Does anyone know what the difference between
> the a1 and c is in unpack?
>
> Ruben

a - Ascii string, null padding.
c - char value.

pack "c2", 69,70;                    # "EF"
pack "a6", "a", "b", "c", "d";      # "abcd\0\0" - Notice the null
padding.

Please refer to camel book, for complete list/discussion.

Deva





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

Date: Wed, 10 Jun 1998 11:11:39 +0200
From: Christian Krakowski <krakousz@iai.fzk.de>
Subject: Pipes between C program and perl script
Message-Id: <357E4DCB.37D6AEED@iai.fzk.de>

I need IPC between a C program and a PERL program.
Is it possible to solve this problem with anonymous pipes?
The C code below works fine when I substitute "program"
with "mathematica".  The PERL program I wrote blocks
when it reads from <STDIN>.

Every answer makes me happy.

Thanks in advance

Christian

PS: I work on Solaris 2.6 with the latest PERL version
       and suncp4.2.
---------------------------------------

int main (int argc, char *argv[]) {
    int     pipe_p2s [2];           /* pipe to program */
    int     pipe_s2p [2];           /* pipe from program */
    int     pipe_se2p [2];
   FILE*   tsim;
   FILE*   fsim;
   FILE*   efsim;

    int ii;
    int sim_pid;
    struct rlimit rlp;

   pipe (pipe_p2s);
   pipe (pipe_s2p);
   pipe (pipe_se2p);
   sighold (SIGCHLD);

    switch (sim_pid = fork()) {
    case -1 :
 {
     fprintf (stderr, "error: fork failed");
     close (pipe_p2s[0]);
     close (pipe_p2s[1]);
     close (pipe_s2p[0]);
     close (pipe_s2p[1]);
     close (pipe_se2p[0]);
     close (pipe_se2p[1]);
     break;
 }

    case  0 :
       { /* child, used to run program */
    dup2 (pipe_p2s[0], 0);                     /* redirect stdin  (0) */

    dup2 (pipe_s2p[1], 1);                     /* redirect stdout (1) */

    dup2 (pipe_se2p[1], 2);                    /* redirect stderr (2) */

    getrlimit (RLIMIT_NOFILE, &rlp);
    for (ii = rlp.rlim_cur;  ii > 2;  ii--)
        (void) close(ii);           /* close all open file descriptors
*/
    for (ii = 0;  ii < NSIG;  ii++)    /* disable all signal handlers */

        (void) signal(ii, SIG_DFL);

    execlp ("program", "program", (char *) 0);
    fprintf (stderr, "STDERR: %s\n", strerror (errno));
    _exit(-1);
       } /* child, used to run simulator program */

   default:       /* parent */
       sigrelse (SIGCHLD);
       close (pipe_p2s[0]);
       close (pipe_s2p[1]);
       close (pipe_se2p[1]);
       sleep (1);
       break;
   } /* CASE */
   tsim  = fdopen (pipe_p2s[1], "w");
   fsim  = fdopen (pipe_s2p[0], "r");
   efsim = fdopen (pipe_se2p[0], "r");
}




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

Date: 10 Jun 1998 01:59:55 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: Piping into telnet from Perl NT
Message-Id: <6llatb$g6q@fohnix.metronet.com>

"Walter Klomp" <walter@swiftech.REMOVE.THIS.net.sg> writes:
) 
) I am trying to write a small script which opens a telnet session and sends
) some commands. With the
) 
) open (TELNET,"| telnet hostname port") || die "Cannot Fork!\n";
) 
) I am not very successful. It opens the telnet program, but successively
) doesn't pipe into it the commands I want to send to it.
) 
) Anybody did this already successfully on a WinNT box or Win95 box ?
) 
) Any help appreciated.

Good luck finding a telnet for WinNT/Win95 that reads from STDIN.
Perhaps using the non-GUI version of Kermit (i.e. not Kermit95)
would work?
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Tue, 9 Jun 1998 11:35:57 +0100
From: "Dan Hopkins" <dan@ukonline.net>
Subject: Re: READING MAIL BY PERL
Message-Id: <6lj32p$o7q$1@morse.news.easynet.net>


Mathijs Oosterom wrote in message
<01bd9328$107c5300$a44a6dc2@earl.esense.nl>...
>Hi all,
>
>I want a Perl script on my Linux-server to read incoming mail on a certain
>account, especially for the script. The Perl-script should read the mail
>and execute commands in that mail.
>
>What is the best way to let a Perl-script read mail? Now I let the script
>read the /var/spool/mail/xxxxx file, but I don't klow if that's the best
>way to do it. My server software is RedHat.


I have a similar system ..... but it's probably far from the best
implementation ! (hey, it was my first Perl project)
Anyway, cron runs a perl script every x mins. Connect to mail server using
Net::POP3. Read and parse mails using a handful of POP3 commands.

I'd prefer that the script was activated by incoming mail rather than
parsing stored mail every few minutes. But if you want a relatively simple
method.... hope it helps.


Dan.





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

Date: Wed, 10 Jun 1998 09:40:12 GMT
From: ianwills@my-dejanews.com
Subject: Reading STDOUT from Win32::Process::Create
Message-Id: <6llk9s$sn8$1@nnrp1.dejanews.com>

I have successfully created a process using Win32::Process::Create, however I
have no idea how to read STDOUT from this process.

Can someone help ?

Ian Wills

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Wed, 10 Jun 1998 09:53:00 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Return cell contents to HTML dropdown menu
Message-Id: <357E496B.D5EFE73A@nortel.co.uk>

Dave wrote:
> 
> I am looking for a snippet that reads the contents of a cell in a database
> and returns those contents to a dropdown box in HTML.  Anybody got anything?

$form = CGI -> new();

$form -> popup_menu(-NAME=>'dropdowntheclothing', 
-VALUES=>\@subgroups);

Where subgroups is any kind of array that you have created somewhere.



-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 9 Jun 1998 22:07:00 -0700
From: rhys@primenet.com
Subject: Re: RFD: comp.lang.perl.moderated moderated
Message-Id: <6ll49k$10d@nntp02.primenet.com>

In article <pudge-0406981325560001@192.168.0.3>,  pudge@pobox.com (Chris
Nandor)  wrote:


>And I don't understand what you want me to do anyway.  You ask for no
>mailed copies in your header:
>
>Mail-Copies-To: never
>
>But that, presumably, means no copies to the From: and Reply-to:
>addresses.  Since those address are invalid anyway, I figure I am SUPPOSED
>to mail copies to your unmunged address, since you did not tell me
>explicitly not to.  And now I am just confused enough that I think maybe
>you did not really MEAN for me not to send replies to either address --
>after all, you don't really mean the From: header, so why should you mean
>the Mail-Copies-To: header? -- so I just mail to both of them,
>see-my-sig@his.com and kendall@his.com (oops, should I not have posted
>that on Usenet?).
>
>C'est la vie, you've got me all confused, so I'll just send it out now,
>with all the addresses there.

This above is one of the reasons I am voting NO on clpm.  

This is the second reason I am voting NO on clpm:

From: pudge@pobox.com (Chris Nandor)
Newsgroups: news.groups
Subject: Re: Mungaholic (was: RFD: comp.lang.perl.moderated moderated)
Message-ID: <pudge-0606981921090001@dynamic162.ply.adelphia.net>

I am half a mind to send your real e-mail address to all the spammers. 

***

This is the third reason I am voting NO on clpm:

From: pudge@pobox.com (Chris Nandor)
Newsgroups: news.groups
Message-ID: <pudge-1103981106490001@ppp-49.ts-1.kin.idt.net>

Actually, it does just that.  Because your demeanor gives justification
for proponents and moderators to killfile all your messages, so they
never get read.  If they do not read it, they have no responsibility to
deal with it.

***

IMO, Mr. Nandor has not demonstrated that he will be a fair and
impartial moderator.  Nor would I be comfortable with him having access
to the registration list of posters' real email addresses.

-- 

rhys@primenet.com 
Never munged, never will.           
But I don't get my knickers in wad over those who do.  
Please do not email copies of Usenet posts.                     


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

Date: Wed, 10 Jun 1998 11:38:31 +0300
From: "Antti Boman" <antti.boman***SP@MPROTECTION***mindcom.fi>
Subject: Re: Saving dynamically created images
Message-Id: <6llgm9$nqd$1@hiisi.inet.fi>

>Hmmm, sounds like stealing to me . . .


Agreed.

>Why not just use the <IMG SRC> call from their site?


Let's cite him:
>> site but the site that displays the current map dynamically creates
>> the image, so the name is not consistent.

Quite obviously this is the main problem. He obviously wants a script that
checks the name.

Good luck finding one :)

-a




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

Date: 10 Jun 1998 06:41:23 GMT
From: aajii@aajii.ton.tut.fi (Antti-Jussi Korjonen)
Subject: strings..
Message-Id: <6ll9qj$18f$1@baker.cc.tut.fi>

How would I easily determine, if a string contains only digits or
alphabets and nothing else?

--
  
         __/                __/ __/  __/     Antti-Jussi Korjonen
      __/ __/    __/       __/ __/__/       Vaajakatu 5 D 85
    __/    __/      __/   __/ __/__/       33720 TAMPERE, FINLAND
  __/       __/    __/__/__/ __/  __/     tel. +358-(0)40-577 83 23
                                         Antti-Jussi.Korjonen@sonera.fi
   --------->>  http://www.students.tut.fi/~k150556  <<---------
     


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

Date: 10 Jun 1998 08:57:35 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: strings..
Message-Id: <7xpvghlp5s.fsf@beavis.vcpc.univie.ac.at>

Re: strings.., Antti-Jussi <aajii@aajii.ton.tut.fi> said:

Antti-Jussi> How would I easily determine, if a string
Antti-Jussi> contains only digits or alphabets and nothing
Antti-Jussi> else?

Using regexps is easiest...

    perldoc perlre

and the following in particular.

        \w \d \W \D

did you also do

    perldoc perlfaq ?

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


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

Date: Wed, 10 Jun 1998 07:06:46 GMT
From: dgris@perrin.dimensional.com (Daniel Grisinger)
Subject: Re: strings..
Message-Id: <6llasf$ai9$1@perrin.dimensional.com>

In article <6ll9qj$18f$1@baker.cc.tut.fi>,
Antti-Jussi Korjonen <Antti-Jussi.Korjonen@sonera.fi> wrote:
>How would I easily determine, if a string contains only digits or
>alphabets and nothing else?
>
You'd type perldoc perlre from your command prompt.

Daniel


-- 
Daniel Grisinger       dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
                        Dave Clark


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

Date: Wed, 10 Jun 1998 07:43:31 GMT
From: ames0009@tc.umn.edu (Todd C. Ames)
Subject: Re: strings..
Message-Id: <357e33a4.2122672@news.tc.umn.edu>

On 10 Jun 1998 06:41:23 GMT, aajii@aajii.ton.tut.fi (Antti-Jussi
Korjonen) wrote:

>How would I easily determine, if a string contains only digits or
>alphabets and nothing else?
>
>--
>  

Depends what you are trying to do, but one way would be to use =~ with

/D     matches anything other than a  digit

if ($yourstring =~ /\D/) {   
	do stuff;

 #if the string contained any non-digit it would return true.
so this would tell you whether or not the string contained only
digits. 

if ($yourstring =~ /[^a-zA-Z]/) {
	do stuff;

#this would return true if any non letter was matched,
thus you would know that the string is NOT all letters.

That's one way - I'm sure not the best.

T. Ames

>>>>>>>>>>>>>>>>>>>
Todd C. Ames
ames0009@tc.umn.edu
University of Minnesota


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

Date: Wed, 10 Jun 1998 01:13:25 -0700
From: "Ion Chalmers Freeman" <ion@aroma.com>
Subject: Re: very quick s/// question
Message-Id: <357e4140.0@news.prostar.com>

James,
    try $str =~ s/\s(\w)/\*/g, if you just want to replace whitespace that
precedes tokens with asterices. The difficulty you're having is that the
test does not start over from the beginning of the string. s/// sees
'a b' as a match, and replaces it with 'a*b', but then all it has is ' c',
which doesn't match.
ion


Ala Qumsieh wrote in message <35755AEE.3861EA01@matrox.com>...
James Lawrence wrote:

> can you tell me what's wrong with this?
> --------
>
> #!/usr/bin/perl -w
>
> $str = "a b c" ;
> $str =~ s/(\w)\s(\w)/$1\*$2/g ;

The first (\w) is matching the "a" and the second one is matching the
"b". So that puts a "*" in between and looks at *THE REST* of the
variable for more matching!

> print "$str\n" ;
>
> --------
>
> I want to convert "a b c" into "a*b*c" but I get "a*b c"
> instead.
>
> -jl

If this is all what you want, then you should use either:

tr/ /*/;

or

s/\s/\*/g;

Hope this helps.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)







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

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

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2827
**************************************

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