[9778] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3371 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 5 21:06:26 1998

Date: Wed, 5 Aug 98 18:00:22 -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, 5 Aug 1998     Volume: 8 Number: 3371

Today's topics:
        'use' and import issue <matthies@fsinfo.cs.uni-sb.de>
    Re: 'use' and import issue (Sean McAfee)
    Re: -- Can Multiple ACTIONS be called from one POST? (brian d foy)
    Re: 500 Server error <minich@globalnet.co.uk>
    Re: [Q]s on non-blocking system calls ("forks") (nobody)
    Re: Attaching a file to an email with a cgi script <palincss@tidalwave.net>
    Re: Attaching a file to an email with a cgi script <maierc@chesco.com>
        can you un encrypt htpasswd? <stanz@en.com>
    Re: can you un encrypt htpasswd? (brian d foy)
    Re: comp.lang.perl.announce redux <dsautereau@magic.fr>
        Compiling Perl 5.005 on Slackware 3.4 <amutiso@icequake.ca>
    Re: hiding user input (Greg Bacon)
    Re: IPC semaphores in Perl under FreeBSD (Michael Searle)
    Re: IPC semaphores in Perl under FreeBSD (void)
        Long Server side Process from CGI <jhouldin@starvision.com>
    Re: Long Server side Process from CGI <rootbeer@teleport.com>
    Re: mirror.pl 2.4, is there anything better or newer av (Chris L. Mason)
    Re: op/rand test problem on SunOS 5.5.1 (Martien Verbruggen)
        perl 5.005: Binary Distribution for Win32? <mschilli@blaxxun.com>
        Perl/Tk-Win32? (nobody)
    Re: Perl/Tk-Win32? <dtbaker_@flash.net>
    Re: perlfaq - frequently asked questions about Perl (pa (Greg Bacon)
    Re: Power (ie C's 4^7) (nobody)
    Re: Power (ie C's 4^7) (Craig Berry)
    Re: Problem with variables in simple script... (Rodney Broom)
        Proper Pattern Match <mike@newfangled.com>
        rename problem <peter@richmd.demon.co.DELETE.uk>
    Re: rename problem <peter@richmd.demon.co.DELETE.uk>
    Re: rename problem <minich@globalnet.co.uk>
    Re: rename problem <alastair@calliope.demon.co.uk>
        setting a password on a linux system via cgi..... <bandahr@the-neighborhood.com>
    Re: split & empty patterns <matthies@fsinfo.cs.uni-sb.de>
    Re: Teaching Perl <palincss@tidalwave.net>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 5 Aug 1998 22:54:32 GMT
From: Niklas Matthies <matthies@fsinfo.cs.uni-sb.de>
Subject: 'use' and import issue
Message-Id: <6qanr8$jo8$1@hades.rz.uni-sb.de>

Hi,

I'm beginning to write a non-trivial Perl application (several class and
non-class modules/packages), which use and/or require each other.

Often it is the case that I use a couple of functions from some module Foo
within a few functions/methods (say, fun1 to fun3) of module Bar (Foo may
be a collection of some utility functions, for example).
For notational convenience, I'd like too 'use' Foo in those places, rather
than only 'require' it, to have some functions of Foo imported into the
namespace within fun[1-3].

Now, since Foo actually hasn't much to do with Bar, other than happening
to being used by fun[1-3], it wouldn't be really appropriate to put a
'use Foo qw( ... );' somewhere at the beginning of package Bar. Two other
reasons for not doing this are that there a lots of other functions/methods
in Bar that don't need Foo (and that should not access it by accident), and
that when using Foo functions in fun[1-3] it is harder to find out which
package they come from when the 'use Foo' is somewhere far away at the
beginning of the file.

Okay, now what I could do is the following:

  package Bar;

  # ...

  sub fun1 {
    use Foo qw ( <subs used in fun1> );
    # ...
  }

  # etc, same for fun2 and fun3

What's nice is that the 'use'es are near the function calls that use them,
so when I decide to put fun[1-3] in some other package, I don't need to
care about (re)moving the 'use'es around, and everyone sees that Foo is
used in those functions, and even what functions are used.

Drawback 1: Now Foo::import will be called three times! Ugh.
Drawback 2: The imported functions from Foo will still be seen in functions
            of package Bar other than fun[1-3], because they are imported
            to the global (one-and-only, that is) symbol table of package
            Bar. Darn.

Now, what I'd actually want is something like

  my use Foo;

or

 use Foo my qw( ... );

or the same with local instead of my, if must be (you get the drift).

Am I missing something, or am I stuck with the somewhat uncomfortable
solution above? Or can it be made more "comfortable" some way?

-- Niklas


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

Date: Thu, 06 Aug 1998 00:50:03 GMT
From: mcafee@galaga.rs.itd.umich.edu (Sean McAfee)
Subject: Re: 'use' and import issue
Message-Id: <%47y1.542$hF4.2675987@newbabylon.rs.itd.umich.edu>

In article <6qanr8$jo8$1@hades.rz.uni-sb.de>,
Niklas Matthies  <matthies@fsinfo.cs.uni-sb.de> wrote:
[snip; basically wants a scoped import]
>Now, what I'd actually want is something like

>  my use Foo;
>or
> use Foo my qw( ... );

>or the same with local instead of my, if must be (you get the drift).

How about this:

sub fun1 {
	local (*barfun1, *barfun2) = (\&Bar::fun1, \&Bar::fun2);
	&barfun1;  # now refers to &Bar::fun1
	&barfun2;
	# ...
}

You could even use another subroutine to make things a bit prettier:

sub subrefs { my $class = shift; map { \&{"${class}::$_"} } @_ }

sub fun1 {
	local (*barfun1, *barfun2) = subrefs 'Bar', 'fun1', 'fun2';
	# ...
}

>Am I missing something, or am I stuck with the somewhat uncomfortable
>solution above? Or can it be made more "comfortable" some way?

I doubt that there's a truly elegant solution to your problem as stated.
If I were you, I'd review my package structure and try to separate the
functionality a bit more.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Wed, 05 Aug 1998 18:59:15 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: -- Can Multiple ACTIONS be called from one POST?
Message-Id: <comdog-ya02408000R0508981859150001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35C75167.6464@yeahright.net>, Webcruiser <kamenar@yeahright.net> posted:

>On a submit, can I call two different cgi scripts from one submit
>action? If so, how?

the answer would b ethe same whether you were using Perl or another
language, which should be a signal to you that this isn't a Perl
question.

perhaps you want the CGI Meta FAQ.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Wed, 5 Aug 1998 23:03:05 +0100
From: "Martin" <minich@globalnet.co.uk>
Subject: Re: 500 Server error
Message-Id: <6qaktd$big$1@heliodor.xara.net>

Thanks to Alistair, I managed to resolve the problem. I've
always worked on an NT server where there was no
problem with this but on a Unix it didn't like my checking
of the return of an open command. I used or but the error
logs told me this was the problem. I changed it for || and
got no further problems.

Martin




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

Date: 5 Aug 1998 04:54:35 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: [Q]s on non-blocking system calls ("forks")
Message-Id: <6q8oib$fq1@newsserver.trl.OZ.AU>

Standard UNIX knowledge.  exec() doesn't create a new process.  It simply
loads a new executable in to the current process space.

Regards,
AC.

k y n n (kj0@mailcity.com) wrote:


: Oh, wow!  What a surprise.  I didn't know that the exec'd process
: retained the pid of the exec'ing script.  (BTW, is this documented
: anywhere?)

: Thank you very much!

: K.

: In <Ewz1G8.KsL@world.std.com> aml@world.std.com (Andrew M. Langmead) writes:

: >k y n n <kj0@mailcity.com> writes:

: >>My duct-tape-&-buble-gum solution: 1) use perl's fork() to spawn a
: >>child perl process; 2) have this child issue the system("frobozz")
: >>call; 3) have the parent perform several chancy, totally non-portable
: >>manipulations with the output of ps and the child's pid to figure out
: >>frobozz's pid (it turns out to be a greatgrandchild process).

: >Why not have your script just fork() and exec() "frobozz" directly?
: >Then the PID of 'frobozz" is the return value of fork().
: >-- 
: >Andrew Langmead


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

Date: Wed, 05 Aug 1998 18:59:35 -0700
From: Steve Palincsar <palincss@tidalwave.net>
Subject: Re: Attaching a file to an email with a cgi script
Message-Id: <35C90E06.564@tidalwave.net>

chris_wellner@my-dejanews.com wrote:
> 
> There have been a couple questions and answers on this topic but I'm still
> having some trouble.  I need to have a script-generated email attach a
> document to the email.  Someone suggested MIME::Lite but the documentation
> say that's just for GIFs.  Can I attach anything with it?  I doubt it but
> maybe that's the case. . .  There was another response about Mail:: but the

You must have misunderstood what you read.  I use MIME::LITE routinely
to
mail PDF attachments.  It's an extremely simple module to use.


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

Date: Tue, 04 Aug 1998 20:32:27 -0400
From: Charles Maier <maierc@chesco.com>
Subject: Re: Attaching a file to an email with a cgi script
Message-Id: <35C7A81A.C745E300@chesco.com>

chris_wellner@my-dejanews.com wrote:
> 
> There have been a couple questions and answers on this topic but I'm still
> having some trouble.  I need to have a script-generated email attach a
> document to the email. 

I just finished work on a site (N/T) where Sendmail was not an option.
Instead I wrote the code to use Sender.pm. It was not my choicee. The
client ISP dictated this. This module uses Sockets and talks directly to
a SMTP server. Having done this... I am rethinking using Sendmail on
future projects. It just makes my code more portable.

Sender.pm (Rev 0.6) and the following modules will send a file as a
attachment along with normal email messages.

FileHandle;
Socket;
MIME::Base64;
MIME::QuotedPrint;

Its pretty well documented. 
-- 
Chuck Maier
CDM Consulting Services
http://www.cdmcon.com
(610) 942-2726


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

Date: Wed, 05 Aug 1998 22:54:44 GMT
From: stan zylowski <stanz@en.com>
Subject: can you un encrypt htpasswd?
Message-Id: <35C81C16.7E6E@en.com>

can you un encrypt htpasswd file for those that forget it?


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

Date: Wed, 05 Aug 1998 19:27:29 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: can you un encrypt htpasswd?
Message-Id: <comdog-ya02408000R0508981927290001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35C81C16.7E6E@en.com>, stanzz@en.com posted:

>can you un encrypt htpasswd file for those that forget it?

nope.  it uses crypt.

see the crypt man page for details. :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Thu, 06 Aug 1998 02:20:10 +0200
From: Damien SAUTEREAU <dsautereau@magic.fr>
Subject: Re: comp.lang.perl.announce redux
Message-Id: <35C8F6BA.A2F3757@magic.fr>

Abigail a icrit:

> ++ Oh...oh...so, out of idle curiousity, have the FAQ, the docs (all 1256 pages)
> ++ and the other readily available sources of information been translated
> ++ into other languages?
>
> No, it hasn't. Or at least, not that I know of. (It would be nice if someone
> did though). But have you considered the fact there's a world of difference
> between being able to read a language and to write it? I can read German.
> But I won't be able to write a meaningful posting in German.
>

I do agree. This is my first post in clp* while I have been reading them for more than 3 years.
(   Well, nobody is perfect ;-)   )
I guess clpa has no equivalent in any other Perl's hierarchy. So if it has an international audience we should expect and accept non-english posting.
Accepting only posts in English means refusing potentialy good Perl programming announcements.
Personnaly I don't read clp* for English language but for Perl language.

--
Damien Sautereau.



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

Date: Thu, 06 Aug 1998 00:44:56 GMT
From: Anthony Mutiso <amutiso@icequake.ca>
Subject: Compiling Perl 5.005 on Slackware 3.4
Message-Id: <35C8FCD8.149C7B41@no.spam>

It would appear that I have linuxthreads in my gclib. I have the
pthread  header files. 

I configure perl ala "./Configure -Dusethreads -des" and try to build
but run into an immediate problems, (see below).

Are there any suggestions?

Thanks

Anthony
amutiso  @ <remove this and glue> acm.org

twiga:/usr/scratch/perl5.005_01# make
`sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
          CCCMD =  cc -DPERL_CORE -c -D_REENTRANT -Dbool=char -DHAS_BOOL
-I/usr/
local/include -O2
In file included from miniperlmain.c:11:
perl.h:1146: parse error before `perl_cond'
perl.h:1146: warning: data definition has no type or storage class
In file included from perl.h:1953,
                 from miniperlmain.c:11:
thread.h:203: parse error before `perl_cond'
thread.h:203: warning: no semicolon at end of struct or union
thread.h:204: warning: data definition has no type or storage class
thread.h:206: parse error before `}'
thread.h:206: warning: data definition has no type or storage class
In file included from perl.h:1979,
                 from miniperlmain.c:11:
perlvars.h:28: parse error before `PL_eval_cond'
perlvars.h:28: warning: data definition has no type or storage class
perlvars.h:33: parse error before `PL_nthreads_cond'
perlvars.h:33: warning: data definition has no type or storage class
make: *** [miniperlmain.o] Error 1
twiga:/usr/scratch/perl5.005_01#


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

Date: 6 Aug 1998 00:42:26 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: hiding user input
Message-Id: <6qau5i$cio$1@info.uah.edu>

In article <35C89153.91AF1746@interactive.ibm.com>,
	John Call <johnc@interactive.ibm.com> writes:
:  I agree with you to a point but would like to ask this: What if
: someone doesn't know about the FAQs?

Maybe tchrist and gnat and rootbeer should crank up their posting
respective frequencies... :-(

Greg
-- 
Artifical insemination is when the farmer does it to the cow instead of the
bull. 
    -- Funny Answers to Science Test Questions


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

Date: Wed, 05 Aug 1998 23:07:17 BST
From: searle@longacre.demon.co.uk (Michael Searle)
Subject: Re: IPC semaphores in Perl under FreeBSD
Message-Id: <n710DA06A@longacre.demon.co.uk>

"Vladimir I. Kulakov" <kulakov@kulakov.msk.ru> wrote:

> Trying to use 'semget', 'semctl' and the like syscalls in Perl 5 for
> FreeBSD 2.2.5 I've got the message "IPC system V is not supported on
> this mashine" ;( So, I've rebuilded the kernel, turning the "SEMAPHORES"
> option on, but the problem is still the same ;( Is there any way to make
> semaphores work right with Perl under FreeBSD?

The option should be SYSV_SEM - at least it is on an earlier FreeBSD. Check
the LINT kernel config file, it should be in there with the other SysV IPC
options.

-- 
Michael Searle - csubl@csv.warwick.ac.uk


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

Date: 5 Aug 1998 19:13:37 -0400
From: float@interport.net (void)
Subject: Re: IPC semaphores in Perl under FreeBSD
Message-Id: <slrn6shpp0.lqn.float@interport.net>

Close: it's SYSVSEM, plus SYSVSHM and SYSVMSG.

On Wed, 05 Aug 1998 23:07:17 BST, Michael Searle
<searle@longacre.demon.co.uk> wrote:
>"Vladimir I. Kulakov" <kulakov@kulakov.msk.ru> wrote:
>
>> Trying to use 'semget', 'semctl' and the like syscalls in Perl 5 for
>> FreeBSD 2.2.5 I've got the message "IPC system V is not supported on
>> this mashine" ;( So, I've rebuilded the kernel, turning the "SEMAPHORES"
>> option on, but the problem is still the same ;( Is there any way to make
>> semaphores work right with Perl under FreeBSD?
>
>The option should be SYSV_SEM - at least it is on an earlier FreeBSD. Check
>the LINT kernel config file, it should be in there with the other SysV IPC
>options.
>
>-- 
>Michael Searle - csubl@csv.warwick.ac.uk


-- 
	I'm making $65,000 a month just by picking my nose,
	spam me for details.

		--Tero Paananen on n.a.n.a.e.


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

Date: Wed, 05 Aug 1998 15:09:29 -0700
From: Julian Houlding <jhouldin@starvision.com>
Subject: Long Server side Process from CGI
Message-Id: <35C8D818.D76EB2E9@starvision.com>

Hi,

I need to start a server side process from a Perl CGI script which will
continue running on the server even after the CGI script has returned.

Any ideas?

Thx.





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

Date: Wed, 05 Aug 1998 22:13:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Long Server side Process from CGI
Message-Id: <Pine.GSO.4.02.9808051513020.14291-100000@user2.teleport.com>

On Wed, 5 Aug 1998, Julian Houlding wrote:

> I need to start a server side process from a Perl CGI script which will
> continue running on the server even after the CGI script has returned.
> 
> Any ideas?

Sure, do it the same way that you'd do it from a non-Perl CGI script. If
you're not sure about how to do that, check the docs, FAQs, and newsgroups
about CGI programming and your server. Good luck!

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



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

Date: 6 Aug 1998 00:24:47 GMT
From: cmason@unixzone.com (Chris L. Mason)
Subject: Re: mirror.pl 2.4, is there anything better or newer available?
Message-Id: <6qat4f$4cd$1@nntp2.uunet.ca>

In article <strider-0308981323240001@ppp-67-194.dialup.winternet.com>,
Raul Almquist <admin1@shadowmac.org> wrote:
>  Currently we are using software listed in the subject, but several
>functions are either no longer supported in this version or else not even
>listed as having been available at any time.
>

Hi,

You might find rsync to be a useful utility.  It's a compiled C program,
not perl, but it has great features for mirrorring files.  It's also
fast because it just copies the differences (even with binary files).
I use it myself for publishing my web site.  I work on things on a local
machine, and when I'm happy I just run a script that uses rsync to update
the live site.  Each file that's copied is copied into a temporary file
first, then moved into place as a binary operation, so users never get
served garbage.  I've found it to be quick and reliable.

It's also possible to install it as an "anonymous" daemon to let other
people mirror off your site.

More info is available at:

http://samba.anu.edu.au/rsync/


Chris

-- 
-----------------------------------------------------------------
Chris L. Mason           For UNIX software ratings and reviews as
cmason@unixzone.com      well as industry news and opinions visit

                         UnixZone:       http://www.unixzone.com/
-----------------------------------------------------------------


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

Date: 5 Aug 1998 23:50:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: op/rand test problem on SunOS 5.5.1
Message-Id: <6qar48$d7d$2@nswpull.telstra.net>

In article <6q4cvn$i3c$1@news.mel.aone.net.au>,
	"Scott A Baxter" <sbaxter@c031.aone.net.au> writes:
> I am trying to install perl 5.003 on SunOS 5.5.1 and I find that when I run
> the make test op/rand fails on test2.

Take my advice: Don't install 5.003. get the latest, which is perl
5.005_01, or maybe even 5.005_02 by the time you read this.

perl 5.003 should be regarded as dead. Not as dead as perl 4, but
close to it :)

> When I ran Configure the script said that the number of bits returned by my
> rand function was 31. I accepted the default and I suspect that this may be
> the problem. I am not sure what value I should use.

On SunOS 5.5.1 the default number of bits for rand is 15 (RAND_MAX =
32767). I don't know why Configure guessed wrong.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Wed, 05 Aug 1998 17:04:28 -0700
From: Michael Schilli <mschilli@blaxxun.com>
Subject: perl 5.005: Binary Distribution for Win32?
Message-Id: <35C8F30C.6C42669F@blaxxun.com>

Hi 5.005 gurus,

I understand 5.005 compiles well on Win32 - but since I don't have a C
Compiler on my Windows box: is there a binary distribution for Win32?

Thanks,

-- Michael

----------------------------------------------------------
  Michael Schilli                 http://perlmeister.com
----------------------------------------------------------


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

Date: 5 Aug 1998 22:56:57 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Perl/Tk-Win32?
Message-Id: <6qanvp$j2j@newsserver.trl.OZ.AU>

Can anyone tell me if the Tk package runs under Win95?  'use Tk' fails
on the standard bindist5.004_02 and the Tk package off CPAN seems to
require UNIX.

The ease-of-use of Tcl/Tk windowing has always impressed me, but the
underlying Tcl is nowhere near as powerful as Perl (please, no flames,
this is my opinion only).

While I could power up the Linux disk for development, that's inconvenient
and the inability to run under NT/95 reduces the market for products
somewhat.

AC.



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

Date: Wed, 05 Aug 1998 18:26:39 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: Perl/Tk-Win32?
Message-Id: <35C8EA2F.4D9E@flash.net>

nobody wrote:
> 
> Can anyone tell me if the Tk package runs under Win95?  'use Tk' fails
> on the standard bindist5.004_02 and the Tk package off CPAN seems to
> require UNIX.
----------
hhmmm, the standard GS download I got off CPAN was
perl5_00402-bindist04-bc.zip.While I have not messed with trying to
write any test programs of my own using TK, I did stumble across some
examples in the install, and they seem to run fine on my machine.
(vanilla p133 running windows95). I'd say it may be best to go looking
for the example in your install.

Dan

# If you would like to reply-to directly, remove the _ from my username
* Use of my email address regulated by US Code Title 47,
Sec.227(a)(2)(B)  *


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

Date: 6 Aug 1998 00:46:14 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <6qaucm$cio$2@info.uah.edu>

In article <opgg1fbupk9.fsf@harper.uchicago.edu>,
	Peter A Fein <p-fein@uchicago.edu> writes:
: Is clp.moderated up yet & if so who do I need to beg to let me in?

The newgroup went out June 13 or 14, I believe.  Bug your news admin
if it hasn't shown up on your news server.  One need only send an
on-topic submission to be permitted inside. :-)

: No such junky replies, I promise. ;)

Deal.

Greg
-- 
Don't worry about people stealing your ideas. If your ideas are any good,
you'll have to ram them down people's throats. 
    -- Howard Aiken 


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

Date: 5 Aug 1998 04:52:00 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: Power (ie C's 4^7)
Message-Id: <6q8odg$fq1@newsserver.trl.OZ.AU>

Er, C doesn't actually have a ^ operator (I think it has a pow() function).
It's interesting that, even though I code every day, I don't think I've
EVER used that function.

>From the perl manpage:

Here's what perl has that C doesn't:

**      The exponentiation operator.

I think that's the same as in some BASICs (**).

AC.

Thomas van Gulick (melkor@valimar.middle.earth) wrote:
: I couldn't find it in the perlop pages so I'll try here, is there some sort
: of power function in perl ala the ^ operator in C, or do I have to do it all
: myself?

: Thomas
: -- 
: http://utumno.student.utwente.nl/
: melkor@utumno.student.utwente.nl


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

Date: 5 Aug 1998 22:57:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Power (ie C's 4^7)
Message-Id: <6qanvs$9v2$1@marina.cinenet.net>

nobody (ac1@fspc.netsys.itg.telecom.com.au) wrote:
: Er, C doesn't actually have a ^ operator

Yes it does, and it means the same thing as Perl's ^ operator.  Wow, talk
about your coincidences... :)

: (I think it has a pow() function).

It does indeed.

: It's interesting that, even though I code every day, I don't think I've
: EVER used that function.

It really only comes up in scientific, engineering, and certain types of
financial programming -- and even in these, pow() is frequently bypassed
in favor of more numerically-friendly techniques and functions.

: From the perl manpage:
: 
:   Here's what perl has that C doesn't:
: 
:   **      The exponentiation operator.
: 
: I think that's the same as in some BASICs (**).

Also Fortran's.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Thu, 06 Aug 1998 00:26:09 GMT
From: broomer2@primenet.com (Rodney Broom)
Subject: Re: Problem with variables in simple script...
Message-Id: <BK6y1.6968$DI5.15553022@news.rdc1.az.home.com>



>I don't what the problem is,

That's fair, what you need isn't a solution, but rather the tools to find out 
how to create a solution that works for you.

>The email I get has no message, nor does the confirmation message printed on
>the persons browser get the message he just typed in.

I'm assuming from this that you do get return both at the browser and at the 
email address.

>Any suggestions as to why this could be? Here is the script:

Yep.
First, test your input device. Make it get the data from your HTML form and 
then just DUMP it back to the browser. Then make it DUMP the data back to the 
email address. Then worry about how to process the data to look good.

Second, try hand building a string like the one that would come from the 
browser. The load it into a variable in place of using:
%input = &GetFormInput();
That will help you learn how you like to process the data for storage and 
output.

>From here, execute your script at the command line.
$ perl -c myscript.pl
will only test the script for syntax. It should return:
myscrip.pl syntax OK
Now execute it with:
$ perl -w myscript.pl
The "w" turns on Perl's warning device, VERY helpful.

Once you have the script doing what you want it to at the command line, and 
you have a set of tested CGI functions, put it on the web and see what you 
get. Also, modules are great for rapid development. But if we don't clearly 
understand what they do, we can't be sure of exactly what to expect of them.

A side note. BEWARE OF TAINTED DATA ! Anything that comes directly from the 
user should be considered to be with malicious intent. A good (or clumsy) 
hacker will easily take advantage of a script that directly uses what he/she 
has typed into your form. Like sending "<" and ">" characters in order to foil 
your HTML.

Good luck,
Rodney


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

Date: Wed, 05 Aug 1998 14:33:10 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
Subject: Proper Pattern Match
Message-Id: <35C8A551.682783FD@newfangled.com>

Is this a proper pattern match???? This is a snippet for a script I am
writing to take all the lines of $filename (a plain text file DB.... it
goes line by line, 8 feilds on each line seperated by '|' symbols) and
match the user input ($dealer) to the first field ($place) and if in
fact it does match to print that record. There should be approx. 8
records printing but the script generates no output:

foreach $i (@indata) {
    chop($i);
    ($place,$addr1,$addr2,$addr3,$city,$state,$zip,$phone) =
split(/\|/,$i);
        foreach $dealer (@dealer) {
            if ($place !~ /\Q$dealer\E/ix) {
            print
"<li>$place,$addr1,$addr2,$addr3,$city,$state,$zip,$phone<br>\n";
            last;
            }
        }
}

Note the usage of \Q, \E and /ix...... Is /x required??? There is a lot
of white space in the $place field so I felt it was but am now
unsure....

<----------- ENTIRE SCRIPT  STARTS HERE -------------->
#!/usr/bin/perl

# Lets DEFINE!!!!
$filename = "etonic.dbf";

# Go get the query string
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
    ($name,$value) = split(/=/,$pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/~!/ ~!/g;
    $FORM{$name} = $value;
}

# Start the results page
print "Content-type:text/html\n\n";
print "<html><head><title>Search Results Page</title></head><body>\n\n";

# Open the database and grab all the dealers and info
open(INF,$filename);
@indata = <INF>;
close(INF);

# Header for list
print "A dealer near you is:<br><ul>\n";

# Take each field and seperate, then search
foreach $i (@indata) {
    chop($i);
    ($place,$addr1,$addr2,$addr3,$city,$state,$zip,$phone) =
split(/\|/,$i);
        foreach $dealer (@dealer) {
            if ($place !~ /\Q$dealer\E/ix) {
            print
"<li>$place,$addr1,$addr2,$addr3,$city,$state,$zip,$phone<br>\n";
            last;
            }
        }
}

# Finish up HTML
print "<br></ul>\n\n</body></html>";
<----------- ENTIRE SCRIPT  ENDS HERE -------------->

thanks......mike

-----------------------------------------------------------
Michael S. Brito, Jr., Web Developer
Newfangled Graphics Co. Inc.
mike@newfangled.com
-----------------------------------------------------------




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

Date: Wed, 05 Aug 1998 23:15:56 +0100
From: Peter Richmond <peter@richmd.demon.co.DELETE.uk>
Subject: rename problem
Message-Id: <35C8D99C.F53671B9@richmd.demon.co.DELETE.uk>

Hi,

ive tried this

rename $old, $new;

but it does work! is it wrong? anyone help?
-- 
Peter Richmond.
--
Home : Sunderland, United Kingdom
Web  : www.richmd.demon.co.uk
Pager: 01426 281 367


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

Date: Thu, 06 Aug 1998 01:43:50 +0100
From: Peter Richmond <peter@richmd.demon.co.DELETE.uk>
Subject: Re: rename problem
Message-Id: <35C8FC46.302F11A7@richmd.demon.co.DELETE.uk>

Peter Richmond wrote:
> 
> Hi,
> 
> ive tried this
> 
> rename $old, $new;
> 
> but it does work! is it wrong? anyone help?

but it does NOT work! is it wrong? anyone help?

-- 
Peter Richmond, dont drink and try to write perl!
--
Home : Sunderland, United Kingdom
Web  : www.richmd.demon.co.uk
Pager: 01426 281 367


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

Date: Thu, 6 Aug 1998 01:56:33 +0100
From: "Martin" <minich@globalnet.co.uk>
Subject: Re: rename problem
Message-Id: <6qav1b$lu6$1@heliodor.xara.net>

>ive tried this
>
>rename $old, $new;
>
>but it does work! is it wrong? anyone help?


Is it a Unix server? I often find brackets help a lot when
something should work but doesn't! Try:

rename($old, $new);

Remember, rename does not work across system
boundaries! (I haven't got a clue what that means btw,
but it doesn't the manpage says so so it must be true).

Martin




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

Date: Thu, 06 Aug 1998 02:00:19 +0000
From: Alastair <alastair@calliope.demon.co.uk>
Subject: Re: rename problem
Message-Id: <35C90E33.40CF58E4@calliope.demon.co.uk>

Peter Richmond wrote:
> 
> Hi,
> 
> ive tried this
> 
> rename $old, $new;
> 
> but it does work! is it wrong? anyone help?
         ^^^^^^^^^

Does it?

You don't exactly give us much to work on do you? What
you've written is fine but it's always a good idea to check
for the error condition and hopefully print out whatever
useful message might be available e.g.

rename $old,$new or die "could not rename : $!";

Perhaps this prints something useful?

-- 
------------------------------------------------
Alastair

work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk
HQ    : London SW9
------------------------------------------------


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

Date: Wed, 5 Aug 1998 19:36:38 -0400
From: "Brad Jones" <bandahr@the-neighborhood.com>
Subject: setting a password on a linux system via cgi.....
Message-Id: <D18A8EA45D76EB42.E35B32E85E99D83E.647F782C07B52953@library-proxy.airnews.net>

Hello all, anyone have a suggestion as to how to allow a new user to create
an account and change a password via a cgi script? I think I have the
creating the user part taken care of but don't know how I can set the
password for the account using passwd program......Any help is greatly
appreciated......

Brad




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

Date: 5 Aug 1998 22:08:33 GMT
From: Niklas Matthies <matthies@fsinfo.cs.uni-sb.de>
Subject: Re: split & empty patterns
Message-Id: <6qal51$j7s$1@hades.rz.uni-sb.de>

In comp.lang.perl.misc, Tom Phoenix <rootbeer@teleport.com> writes:
> On 5 Aug 1998, Niklas Matthies wrote:
> 
>> I think this issue should be clarified in some future version of the
>> documentation (who's responsible for this, actually?),
> 
> You are. :-)  If you don't like the docs, submit a patch with the perlbug
> program. Thanks!

Done. :)

-- Niklas


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

Date: Wed, 05 Aug 1998 19:02:54 -0700
From: Steve Palincsar <palincss@tidalwave.net>
Subject: Re: Teaching Perl
Message-Id: <35C90ECE.662@tidalwave.net>

By leaving out regular expressions you have omitted what is probably
its most powerful unique feature.  Also - a beginning intro IMO
doesn't need to get into references or what you describe as subroutine
semantics.

Daniel Grisinger wrote:
> 
> I have been asked by my boss to teach a one day perl
> course to a group of C, C++, and Powerbuilder
> developers.  I have never taught anyone Perl before,
> though, and would like some input about my classroom
> plan.
> 
> Since I only have one day, and since none of the people
> I will be working with have any knowledge of perl
> at all, I am going to try to present a broad overview
> of the basics of programming in perl.  I'm currently
> planning on presenting the following topics-
> 
> 1.  Data types
>       This will cover scalars, arrays, and hashes (I don't
>       think I'll try to explain typeglobs, though).  I
>       will also focus on the difference between a list and
>       an array.
> 
> 2.  References
>       Since I will be dealing with C and C++ guys I don't
>       expect many difficulties explaining perl's equivalent
>       of pointers.
> 
> 3.  Context
>       The difference between scalar and list context.  From
>       everything I've read about Chip's and Tom's teaching
>       experiences this is one of the most important things
>       to impart.
> 
> 4.  Subroutine semantics
>       The semantic and syntactic differences between calling
>       C<some_sub()> and C<&some_sub()>.  I will also cover
>       @_ and the issues to be aware of when passing complex
>       datatypes.  I will not cover prototypes.
> 
> 5.  Where to find more
>       I intend to spend some time familiarizing the class
>       with where the perl documentation can be found, how
>       to search it effectively, and what it contains.  My
>       thought is that if I can provide my students with
>       the basic knowledge and understanding of the available
>       resources I will be doing them a greater favor than
>       if I just tried to explain everything about perl
>       in 8 hours.
> 
> I am wondering if I am setting myself up for problems with
> the above course-plan.  I'd really like to get some input,
> especially from people who have taught perl classes before.
> In particular, I am afraid that the above topic group
> may miss something important.
> 
> Regards,
> dgris
> --
> Daniel Grisinger           dgris@perrin.dimensional.com
> "No kings, no presidents, just a rough consensus and
> running code."
>                            Dave Clark


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

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

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


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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