[13929] in Perl-Users-Digest

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

No subject found in mail header

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 17:48:11 1999

Date: Tue, 9 Nov 1999 00:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942134712-v9-i1325@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 Nov 1999     Volume: 9 Number: 1325

Today's topics:
    Re: A different turn ( WAS Re: Bye Tom? ) (David H. Adler)
    Re: A different turn ( WAS Re: Bye Tom? ) (Ilya Zakharevich)
    Re: Alternative to <*> (Martien Verbruggen)
    Re: Alternative to <*> (Tad McClellan)
        Click the banner, get the click counted, and go to dest (Kendar)
    Re: copyleft notice? <slanning@bu.edu>
    Re: FAQs everywhere? (Martien Verbruggen)
    Re: FAQs everywhere? lee.lindley@bigfoot.com
    Re: FAQs everywhere? (Eric Bohlman)
    Re: Help with HTML forms and MYSQL insert (Shawn Smith)
    Re: Help with IF statements (Martien Verbruggen)
    Re: Help with IF statements (Abigail)
    Re: How do U parse from the end of the line? (Martien Verbruggen)
    Re: How to use stat function ? <slanning@bu.edu>
    Re: How to use stat function ? (Abigail)
    Re: perl and scroll in web pages. How? <slanning@bu.edu>
    Re: perl and scroll in web pages. How? (Martien Verbruggen)
    Re: perl as first language? <wyzelli@yahoo.com>
    Re: perl as first language? <uri@sysarch.com>
    Re: perl as first language? (Martien Verbruggen)
    Re: perl as first language? (Tad McClellan)
        perl/cgi create user using user nobody (webserver) amir@infoteen.com
    Re: PERL/CGI Programmer Wanted for Contract Job and Pos (Craig Berry)
    Re: Running a program in background. (Abigail)
    Re: setting environment variables (Maurice E. Jarrell)
    Re: setting environment variables <slanning@bu.edu>
    Re: setting environment variables (Tad McClellan)
    Re: splitting, without losing the thing you split with (Craig Berry)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 9 Nov 1999 05:58:17 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: A different turn ( WAS Re: Bye Tom? )
Message-Id: <slrn82fdvp.mgb.dha@panix7.panix.com>

In article <807cvm$fg9$1@gellyfish.btinternet.com>, Jonathan Stowe wrote:
>On 8 Nov 1999 05:26:53 GMT David H. Adler wrote:
>> In article <9IoV3.54879$23.2054646@typ11.nn.bcandid.com>, Kragen Sitaker wrote:
>>>
>>>http://www.fufme.com/ (via tbtf-irregulars from Jamie McCarthy)
>> 
>> I note that the FAQ says that Mac and Linux compatable versions are
>> still being developed, so that's probably not helpful to the powerbook
>> owner...  :-)
>> 
>And its a little worrying that only Windoze is supported - what if it blue
>screens at an inconvenient moment (as it always does anyway)

Appropriate color in this context, though... :-)  I suppose mac users
will have to make do with the iBrator (http://www.ibrator.com).

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Goldfish: The wimp-ass knight never comes out of the castle to fight
me for dominion over the fish tank.  So I must continue patrolling,
for I am lord and master!	- top5 list: Pet Peeves of Pets


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

Date: 9 Nov 1999 08:04:05 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: A different turn ( WAS Re: Bye Tom? )
Message-Id: <808khl$qun$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Kragen Sitaker
<kragen@dnaco.net>],
who wrote in article <9IoV3.54879$23.2054646@typ11.nn.bcandid.com>:
> >You'd be surprised at the peripherals they're making nowadays.
> >
> >As long as you've got a PCMCIA slot free and a nice bottle of wine...
> 
> http://www.fufme.com/ (via tbtf-irregulars from Jamie McCarthy)

Gives new meaning to "laptop computer".  BTW, where IBM hides 5" bays
on Thinkpads?  I spent a couple of hours, but could not open one...

Ilya


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

Date: Tue, 09 Nov 1999 05:31:36 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Alternative to <*>
Message-Id: <YkOV3.368$RV5.9338@nsw.nnrp.telstra.net>

On Tue, 09 Nov 1999 02:55:38 GMT,
	vitanut@my-deja.com <vitanut@my-deja.com> wrote:
> I have a script that reads the contents of the current working
> directory into an array with the following code:
> 
> @array = <*>;
> 
> This script is on a Concentric Host server which uses a cgi management
> system called VDE. I believe that the VDE is not allowing the script to
> execute this code. Does anyone know how to get around this? Is there a
> system call I can use from my script instead? Concentric has not been
> able to help me so far.

Well... Normally I'd advice people to not use globbing like that, but
instead to use the opendir, readdir and closedir functions, together
with a grep or so. Maybe those will be allowed by VDE.

I don't know VDE, but maybe it just prevents forks or stuff like that:

The perldelta for 5.004 says:
     No glob() or <*>
          These operators may spawn the C shell (csh), which
          cannot be made safe.  This restriction will be lifted
          in a future version of Perl when globbing is
          implemented without the use of an external program.

The perldelta for 5.005 does not mention this anymore. This very
likely means that 5.005+ does not use the shell anymore (someone
correct me if I'm wrong). That may just be what could solve your
problem. Get them to install perl 5.005_03.

But I'd still use readdir. It's just nicer, neater and cleaner :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: Mon, 8 Nov 1999 20:08:49 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Alternative to <*>
Message-Id: <slrn82et11.n9a.tadmc@magna.metronet.com>

On Tue, 09 Nov 1999 02:55:38 , vitanut@my-deja.com <vitanut@my-deja.com> wrote:
>I have a script that reads the contents of the current working
>directory into an array with the following code:
>
>@array = <*>;
>
>Does anyone know how to get around this?


   I only use filename globs in dirty hacks (they are slow,
   non-portable and lack power).

   For code that I get paid to write, I use opendir/readdir/grep.


# UNTESTED
opendir(CD, '.') || die "could not open current directory $!";
my @array = readdir(CD);
closedir(CD);


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


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

Date: Tue, 09 Nov 1999 06:27:39 GMT
From: heron@hell.com (Kendar)
Subject: Click the banner, get the click counted, and go to destination (CGI)?
Message-Id: <3827be19.216385406@news.supernews.com>

I need to be able to do the following:

When the user clicks into a banner, he/she activates a perl/cgi
program which registers the click for that banner and sends the
user to the supposed destination. Does anyone know of such a cgi
program?

Thanks!

medusa@beaute.org



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

Date: 09 Nov 1999 01:24:29 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: copyleft notice?
Message-Id: <kusso2gmbc2.fsf@bottom.bu.edu>

"Donald \"Don\" Learner" <d.learner@gte.net> writes:
> What does this mean? I have looked in several books but
> can not find it as a command or reserved word. Thanks!

See near the middle of http://www.gnu.org/gnu/thegnuproject.html
where it talks about copyleft.

(btw, can we skip the license flame war? please... :)

-- 
"Besides a mathematical inclination, an exceptionally good mastery of
one's native tongue is the most vital asset of a competent programmer."
--Edsger Dijkstra


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

Date: Tue, 09 Nov 1999 05:23:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FAQs everywhere?
Message-Id: <OdOV3.364$RV5.9338@nsw.nnrp.telstra.net>

On Mon, 08 Nov 1999 19:50:54 -0800,
	David Amann <dove@synopsys.com> wrote:
> Hi all,
> 
> I've been off the newsgroup for awhile and when I come back what do I
> see but FAQs everywhere!  This is pretty neat.
> 
> I have some questions.  Do the FAQs actually get posted automatically
> depending on what people are asking, or is it just a random posting?
> Does someone make sure which FAQs should be posted or is there some sort
> of automatic matching going on?

Each day a few questions from the FAQ get posted. I am not entirely
sure how Tom's program picks them, but that's not that important.
They're unrelated to the questions asked, apart from the fact that
almost half of the questions asked here are actually in the FAQ :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I took an IQ test and the results
Commercial Dynamics Pty. Ltd.   | were negative.
NSW, Australia                  | 


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

Date: 9 Nov 1999 05:10:15 GMT
From: lee.lindley@bigfoot.com
Subject: Re: FAQs everywhere?
Message-Id: <808abn$jld$1@rguxd.viasystems.com>

David Amann <dove@synopsys.com> wrote:
:>Hi all,

:>I've been off the newsgroup for awhile and when I come back what do I
:>see but FAQs everywhere!  This is pretty neat.

:>I have some questions.  Do the FAQs actually get posted automatically
:>depending on what people are asking, or is it just a random posting?
:>Does someone make sure which FAQs should be posted or is there some sort
:>of automatic matching going on?

It is Tom Christiansen's dirty little trick on c.l.p.misc. There is
no human intervention; it is just some simple automation that dumps
them in at a controlled pace.  The argument is that if you are a
regular reader, you can configure your newsreader to ignore them.
There are several other reasonable arguments that support them as a
good thing.

They provide some added value to the NG, but it is rude and arrogant
that he posts them and yet does not take responsibility for it by
participating in the c.l.p.misc fray.  He stopped posting them for a
while when he left the NG, but then it started up again.  

Whatever the reasons, there was never a consensus that these postings
were welcome on c.l.p.misc and therefore it is by definition an
imposition on the NG.  Since these posts are consistent in the
Subject line, they are easy to ignore and so it is only a minor
imposition. (And I do not object as much as it may appear that I do
from this post.)

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: 9 Nov 1999 05:49:53 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: FAQs everywhere?
Message-Id: <808cm1$m3e$1@nntp5.atl.mindspring.net>

David Amann (dove@synopsys.com) wrote:
: I have some questions.  Do the FAQs actually get posted automatically
: depending on what people are asking, or is it just a random posting?
: Does someone make sure which FAQs should be posted or is there some sort
: of automatic matching going on?

Tom C. posts them in a more-or-less deterministic sequence every six 
months or so.



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

Date: Tue, 09 Nov 1999 05:13:32 GMT
From: SPAMshawns@unt.edu (Shawn Smith)
Subject: Re: Help with HTML forms and MYSQL insert
Message-Id: <3827ad31.37785200@news.unt.edu>

On 8 Nov 1999 21:52:03 -0000, Jonathan Stowe <gellyfish@gellyfish.com>
wrote:

>Dont know what your database looks like, dont know what your form looks
>like and I dont have MySQL and this machine - but heres an example that
>inserts into a database anyhow :

Thanks for all your help.  I can now insert and select my db via perl.
Now to the hard part of my project that I cannot get help with,
decomposing the real db my teacher game me into bcnf.


All the best,
Shawn Smith !UNT Proud!
My freeware: http://people.unt.edu/~shawns 
ICQ: 475-8706 AOL/Netscape IM: "mrgitdown"
"Whatever you do will be insignificant, but 
it is very important that you do it."
--Mahatma Gandhi 




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

Date: Tue, 09 Nov 1999 05:41:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help with IF statements
Message-Id: <3uOV3.375$RV5.9338@nsw.nnrp.telstra.net>

On Tue, 09 Nov 1999 01:42:49 GMT,
	jim and lois flaherty <kf4dmb@tds.net> wrote:

> No matter what the code on the form which is a drop Box . the script always
> selects
> engelhardt

If your drop down box has any thing that makes the $code = '40', then
it will not select Engelhardt. Your problem is that the last if-else
will always be executed, and the else case of that condition sets
things to engelhardt. I suspect that most of the time, $code ne "40". 

What you need is the last part of the perlsyn documentation, which
talks about Perl's version of a switch statement:

# perldoc perlsyn
/Basic BLOCKS and Switch Statements

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | You can't have everything, where
Commercial Dynamics Pty. Ltd.   | would you put it?
NSW, Australia                  | 


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

Date: 9 Nov 1999 00:17:19 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Help with IF statements
Message-Id: <slrn82ffa9.6es.abigail@alexandra.delanet.com>

jim and lois flaherty (kf4dmb@tds.net) wrote on MMCCLXI September
MCMXCIII in <URL:news:t_KV3.182$4D5.116994@ratbert.tds.net>:
%% I have a form and the script e-mails the results to the proper person.
%% Everything works fine execpt
%% the IF statement I have .
%% 
%% 
%% $adpso = $formdata{'adpso'};
%% $code = $formdata{'dept'};
%% 
%% 
%% if($code eq "03") {
%%   $adpso = "schmidt"
%% }
%%   else
%%  {
%% }
%% 
%% if($code eq "20") {
%%   $adpso = "MR Lowe"
%% }
%%   else
%%  {
%% }
%% 
%% if($code eq "40") {
%%   $adpso = "Paipe"
%% }
%%   else
%%  {
%%    $adpso = "engelhardt"
%% }
%% 
%% No matter what the code on the form which is a drop Box . the script always
%% selects
%% engelhardt


Well, if $code isn't 40, yeah. Are you sure $code contains what you
think it contains? You might expect that if $code is 20, $adpso will
be "MR Lowe", but that ain't the case. In fact, more than half of the
code you write is pointless. You can write it in 2 lines:

    $code  = $formdata {dept};
    $adpso = $code == 40 ? "Paipe" : "engelhardt";

Which is probably not what you want. However, this might:

    %adpso = ( 3 => "schmidt",
              20 => "MR Lowe",
              40 => "Paipe");
    $code  = $formdata {dept};
    $adpso = $adpso {$code} || "engelhardt";



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


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


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

Date: Tue, 09 Nov 1999 05:35:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do U parse from the end of the line?
Message-Id: <eoOV3.373$RV5.9338@nsw.nnrp.telstra.net>

On 9 Nov 1999 02:17:07 GMT,
	Rob Manchester <chesta@brown.edu> wrote:

> NT? NT has paths that start with /?

Sure it does. The following will happily work on NT, providing you
have a currentdrive:\temp

C:\DOS\MENU\NT> perl -w
opendir(DIR, "/temp") or die $!;
print readdir(DIR);
closedir(DIR);
__END__

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.   | again. Then quit; there's no use
NSW, Australia                  | being a damn fool about it.


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

Date: 09 Nov 1999 01:02:58 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: How to use stat function ?
Message-Id: <kusyac8mcbx.fsf@bottom.bu.edu>

Adrian Chin <Achin@inprise.com> writes:
>     $mode = (stat $file) [2];
> 
> it prints out :
> 
> mode = 16893 for a directory which is drwxrwxr-x
> mode = 33261 for a file which is -rwxr-xr-x
> 
> How come 9 and 8 existed in the mode result ?

Because 9 and 8 are decimal numbers, which presumably
is what you were printing out, a la 'print "$mode\n";'.
However, file permissions are given as *octal* numbers.
You need to use octal; e.g., 'printf("%o\n", $mode);'.

-- 
"How can we make our teaching so potent in the motional life of man,
that its influence should withstand the pressure of the elemental
psychic forces in the individual?" --Albert Einstein


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

Date: 9 Nov 1999 00:26:16 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: How to use stat function ?
Message-Id: <slrn82ffr2.6es.abigail@alexandra.delanet.com>

Adrian Chin (Achin@inprise.com) wrote on MMCCLXI September MCMXCIII in
<URL:news:38279C12.8FBB76DA@inprise.com>:
$$ Hi
$$ 
$$ I am confused on how stat () actually works.
$$ 
$$ I have :
$$ 
$$     $mode = (stat $file) [2];
$$ 
$$ it prints out :
$$ 
$$ mode = 16893 for a directory which is drwxrwxr-x
$$ mode = 33261 for a file which is -rwxr-xr-x
$$ 
$$ How come 9 and 8 existed in the mode result ?


Because 9 and 8 are valid numbers.

stat returns a number. If you print out numbers, by default, Perl uses
a base 10 alphabet to display the numbers.

If you want Perl to use a base 8 alphabet, say so.

    $ perl -we 'printf "%04o\n" => 16893 & 07777'
    0775
    $ perl -we 'printf "%04o\n" => 33261 & 07777'
    0755
    $

Which is of course all documented in the manual.


Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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


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

Date: 09 Nov 1999 00:42:44 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: perl and scroll in web pages. How?
Message-Id: <kus1za0nru3.fsf@bottom.bu.edu>

luisdlr <luisdlr@yahoo.com> writes:
> I do not know how to do the scrolling in my web page using perl.

You use the HTML <SELECT> tag to do scrolling lists. You can
process the input of this from a <FORM> by using (the) CGI.
Naturally, you can generate a <SELECT> tag (among others)
using Perl, or you can use the CGI module which damn near
every CGI programmer within several light years of Earth
uses. Enter "perldoc CGI" on the command-line.

-- 
qualification: I'm a dimwit according to someone who emailed me


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

Date: Tue, 09 Nov 1999 05:44:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl and scroll in web pages. How?
Message-Id: <QwOV3.377$RV5.9338@nsw.nnrp.telstra.net>

On Tue, 09 Nov 1999 01:29:07 GMT,
	luisdlr <luisdlr@yahoo.com> wrote:

> I do not know how to do the scrolling in my web page using perl.

You'll find that most web browsers do the scrolling themselves. No
need for any magic incantations. I'm a bit at a loss about what you
really want, but I am pretty sure, if not almost certain, that it is
not a Perl issue. It's either a HTML issue, a browser issue, or a CGI
issue, and those things get discussed in the comp.infosystems.www.*
hierarchy. You might have more luck there.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | That's not a lie, it's a
Commercial Dynamics Pty. Ltd.   | terminological inexactitude.
NSW, Australia                  | 


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

Date: Tue, 9 Nov 1999 14:35:55 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: perl as first language?
Message-Id: <%ZNV3.23$kK3.2549@vic.nntp.telstra.net>

Uri Guttman <uri@sysarch.com> wrote in message
news:x77ljs1cz3.fsf@home.sysarch.com...
> as for perl, in some ways it makes for a good first language. i am
> reading johnson's book now and it is very well written. the first
> chapters are very general about programming concepts and coding safety
> (strict, -w, formatting, etc). i haven't gotten to the real perl stuff
> yet but i am looking forward to it. it is great to see a second
> excellent perl book from manning. this bodes well for them.

What are the details on that book? (so maybe I can get me one...)

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

Wyzelli




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

Date: 09 Nov 1999 00:16:21 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: perl as first language?
Message-Id: <x74sew1byy.fsf@home.sysarch.com>

>>>>> "W" == Wyzelli  <wyzelli@yahoo.com> writes:

  W> Uri Guttman <uri@sysarch.com> wrote in message
  W> news:x77ljs1cz3.fsf@home.sysarch.com...
  >> as for perl, in some ways it makes for a good first language. i am
  >> reading johnson's book now and it is very well written. the first
  >> chapters are very general about programming concepts and coding safety
  >> (strict, -w, formatting, etc). i haven't gotten to the real perl stuff
  >> yet but i am looking forward to it. it is great to see a second
  >> excellent perl book from manning. this bodes well for them.

  W> What are the details on that book? (so maybe I can get me one...)

it's on my perl book page. see my .sig.

uri

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


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

Date: Tue, 09 Nov 1999 05:17:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl as first language?
Message-Id: <88OV3.362$RV5.9338@nsw.nnrp.telstra.net>

On 8 Nov 1999 22:45:29 -0600,
	Abigail <abigail@delanet.com> wrote:

> I disagree with Perl, for the same reason I don't recommend C. It's way
> too messy and there's too much rope. That's great for someone who knows
> what they are doing, but not good for someone who doesn't. First learn
> to program, then you know how to exploit the mess and ropes of Perl and C.

In general, yes, C and Perl are not the best languages to learn
programming. But don't forget that the OP was asking for programming
in the specific context of system administration. Perl and C
immediately jump up as the two most applicable languages. Now it will
be up to the OP to figure out whether it's going to be worth the
trouble to first learn to program correctly in one of the restrictive
and more organised languages, and then to become familiar with a
language that will actually do the job, or whether it is better to
just take the plunge and learn to program in the language that you're
going to end up with anyway.

I'd favour the second option :) And a good book on how to program in a
good way in Perl could be helpful. Other's have already suggested a
goo perl one. The comp.lang.c FAQ probably has a few good C ones.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd.   | bundled with your Microsoft product.
NSW, Australia                  | 


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

Date: Mon, 8 Nov 1999 20:55:51 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: perl as first language?
Message-Id: <slrn82evp7.nch.tadmc@magna.metronet.com>

On Tue, 9 Nov 1999 14:35:55 +0930, Wyzelli <wyzelli@yahoo.com> wrote:
>Uri Guttman <uri@sysarch.com> wrote in message
>news:x77ljs1cz3.fsf@home.sysarch.com...

>> as for perl, in some ways it makes for a good first language. i am
>> reading johnson's book now and it is very well written.

>> yet but i am looking forward to it. it is great to see a second
>> excellent perl book from manning. this bodes well for them.
>
>What are the details on that book? (so maybe I can get me one...)


   http://www.browsebooks.com/Johnson/


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


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

Date: Tue, 09 Nov 1999 05:44:49 GMT
From: amir@infoteen.com
Subject: perl/cgi create user using user nobody (webserver)
Message-Id: <808cch$8pl$1@nnrp1.deja.com>

I am in desperate need of help. How can I let the user, nobody (my
webserver Apache is running as nobody) create users? or how can I have
this script run as root. I tried this:
chown root:nobody adduser.cgi; chmod u+s,o-rwx adduser.cgi
but it does not run as root. What can I do?
I need this ASAP, please!

Thanks
Amir

Here is the script:

#!/usr/bin/perl

print "Content-Type: text/plain\n\n";

$buffer = $ENV{'QUERY_STRING'};

@nvpairs = split(/&/,$buffer);
foreach $pair (@nvpairs)
{
        ($namebuffer, $valuebuffer) = split(/=/, $pair);
        $valuebuffer =~ tr/+/ /;
        $valuebuffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex
($1))/eg;
        $in{$namebuffer}=$valuebuffer;
}

$username = $in{'username'};
$password = $in{'password'};
$nexturl = $in{'nexturl'};

print "$username\n$password\n";

        # Step 1: Create the user
        system("/usr/sbin/useradd -m -c $username -d /home/$username -
s '/bin/fa
lse' -G '' -g 100 -e '' $username");
        # Step 2: Set the password age
        system("/usr/bin/chage -m -1 -M 99999 -W -1 $username");
        # Step 3: Set the password
        system("/bin/echo -e $username:$password | /usr/sbin/chpasswd");

        # we are done creating the user
        print "\nDone!";
exit(1);


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


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

Date: Tue, 09 Nov 1999 05:50:20 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: PERL/CGI Programmer Wanted for Contract Job and Possible Continuing Employment
Message-Id: <s2fdgs766i764@corp.supernews.com>

William (bivey@teamdev.com) wrote:
: > Wow, I'm impressed ! What does that mean ?
: > Sounds like Dilbert got lost in c.l.p.m :-)
: 
: "great upside potential"
: Translation: "We're currently in the crapper,
: but the lid's up." -Wm

Or as one of my favorite geekisms puts it, "It's easy to optimize from a
global minimum."

-- 
   |   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: 8 Nov 1999 23:36:00 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Running a program in background.
Message-Id: <slrn82fcsq.6es.abigail@alexandra.delanet.com>

joneill (joneill@pgicompanies.com) wrote on MMCCLX September MCMXCIII in
<URL:news:anJV3.6218$L5.68519@c01read02-admin.service.talkway.com>:
?? There is an FTP site that I want to check periodically for new files.
?? What is the best way for a program to run efficiently/effectively in
?? the background -- becoming active only to check for files, performing
?? certain jobs when new files are present, then going back into
?? hibernation?

I wouldn't do it that way, I'd use cron.

If you really, really want to run in the background all the time,
fork twice such that the grandchild can be orphaned to init, and
use a block like:

    { ... check stuff ....
      sleep $some_time;
      redo
    }

Of course, if you're on Windows, you don't have fork(), and I guess
you don't have cron either.


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


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


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

Date: 08 Nov 1999 23:05:36 -0600
From: mejarrell@worldnet.att.net (Maurice E. Jarrell)
Subject: Re: setting environment variables
Message-Id: <ogd46yqn.fsf@localhost.localdomain>

Balaji Krishnamurthy <bakrishn@cisco.com> writes:


>    how do i set environment variables in perl. i need to write a script

try 'perldoc perlvar' at the command line and search for ENV

HTH,

--Mo


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

Date: 09 Nov 1999 01:09:42 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: setting environment variables
Message-Id: <kusvh7cmc0p.fsf@bottom.bu.edu>

Balaji Krishnamurthy <bakrishn@cisco.com> writes:
>    how do i set environment variables in perl. i need to write
> a script which would set some environment variables for both
> unix and win-nt. 

The hash %ENV contains the environment variables. By assigning
to members of this hash, you can set environment variables.
For instance,

    $ENV{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:.'

There's also an "Env" module in the standard library, but I'm
not sure why one would ever use it.

-- 
"It showed a lady, with a fur cap on and a fur stole, sitting upright
and holding out to the spectator a huge fur muff into which the whole
of her forearm had vanished!" --From Franz Kafka's Metamorphosis


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

Date: Mon, 8 Nov 1999 20:35:01 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: setting environment variables
Message-Id: <slrn82eui5.n9a.tadmc@magna.metronet.com>

On Tue, 09 Nov 1999 10:04:02, Balaji Krishnamurthy <bakrishn@cisco.com> wrote:

>   how do i set environment variables in perl.


   $ENV{EDITOR} = 'vi';   # :-)


   see the entry for %ENV in perlvar.pod.


>   i presume the setenv does not reflect the settings to the parent
>shell.


   You presume correctly.


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


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

Date: Tue, 09 Nov 1999 06:11:47 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: splitting, without losing the thing you split with
Message-Id: <s2fep3bf6i756@corp.supernews.com>

Eric Smith (eric@fruitcom.com) wrote:
: I want to specify the object to split with.
: say /^\.\w\w\s/
: viz. a full-stop at the beginning of the line followed by two word characters,
: followed by a space.
: 
: Now I would like the elements of the array resulting from this split to
: _include_ the \w\w, I do not waht to lose these.   On the other hand I do
: not just want to match any full-stop at the start of a line, only those
: succeeded by \w\w.
: 
: Is there a way?

Lookahead assertion, like zo:

  split /^.(?=\w{2} )/m

Notice that you need to use the /m modifier to match internal
line-beginnings, which is required to match more than one item
with your pattern.  Observe:

#!/usr/bin/perl -w
# splitm - see if split regex respects /m modifier
# Craig Berry (19991108)

use strict;

my $text = <<EOS;
Here is some
text and
 .xx a new line
but not this one .yy
 .zz another new
one
EOS

my @no_m   = split /^\.(?=\w{2} )/,  $text;
my @with_m = split /^\.(?=\w{2} )/m, $text;

print "No m:\n",   join(':', @no_m), "\n\n",
      "With m:\n", join(':', @with_m), "\n";

__END__

Output...

No m:
Here is some
text and
 .xx a new line
but not this one .yy
 .zz another new
one


With m:
Here is some
text and
:xx a new line
but not this one .yy
:zz another new
one

-- 
   |   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: 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 1325
**************************************


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