[10936] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4537 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 3 13:07:17 1999

Date: Sun, 3 Jan 99 10:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 3 Jan 1999     Volume: 8 Number: 4537

Today's topics:
    Re: "Malform Multipart Post" <eugene@verticalnet.com>
    Re: a server being able to dintinguish multiple instanc <rra@stanford.edu>
    Re: Adding a path to the @INC variable <tchrist@mox.perl.com>
        binary conversion <thirdwaver@inxpress.net>
    Re: Bug in Modulo Operator? <rgoeggel@atos-group.com>
    Re: Dynamic Image Generation (Clay Irving)
        Editor <gigs@ici.net>
    Re: Finding elements between 2 arrays <jdf@pobox.com>
    Re: Finding elements between 2 arrays (Tad McClellan)
    Re: Finding elements between 2 arrays (Tad McClellan)
    Re: Is interpolation/parsing in s/// possible? <jdf@pobox.com>
    Re: Is interpolation/parsing in s/// possible? (Tad McClellan)
    Re: Is interpolation/parsing in s/// possible? (Mark Badolato)
    Re: Is mod_perl an option? (Randy Kobes)
    Re: Lockfile in CPAN (Randy Kobes)
    Re: Lockfile in CPAN <webmaster@mcomn.com>
    Re: need short delay (Clay Irving)
    Re: need short delay (Jeffrey Drumm)
    Re: need short delay (Tad McClellan)
        new to PERL..need help <selbig@worldnet.att.net>
    Re: Newbie - OPEN() gives sh error - why? (Tad McClellan)
    Re: noop (Tad McClellan)
    Re: noop (Bart Lateur)
    Re: Official Perl Movie (Tad McClellan)
    Re: Path under windows <eugene@verticalnet.com>
    Re: PERL OO: Function overloading (Tad McClellan)
        Quick operator question <aidan@salvador.blackstar.co.uk>
    Re: Quick operator question <rra@stanford.edu>
    Re: Syntactical weirdness? Or is it just me? (Tad McClellan)
        use of 'system' <clerke@emirates.net.ae>
    Re: use of 'system' <gellyfish@btinternet.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 03 Jan 1999 10:47:11 -0500
From: Eugene Sotirescu <eugene@verticalnet.com>
To: walter <tavi@earthling.net>
Subject: Re: "Malform Multipart Post"
Message-Id: <368F90FF.206AA126@verticalnet.com>

Here's an idea: there are 3 places in CGI.pm that give the "Malformed Multipart
POST" error message. Open CGI.pm and modify a little each of the 3 messages to
know which one it is that you get. When you know that go back to CGI.pm and see
what triggers that error.

walter wrote:

> Tony Curtis wrote in message <83vhiqrffe.fsf@vcpc.univie.ac.at>...
> >Re: "Malform Multipart Post", tavi <tavi367@ibm.net>
> >said:
> >
> >tavi> I created a script on NT p5 iis4.  It seems to
> >tavi> work fine but I get this error every 6 to 8
> >tavi> uploads.
> >tavi> Even if the file is the same or different.
> >tavi> I used CGI.pm in my script.
> >tavi> Any ideas?
> >
> >Provide some information that would help to identify
> >the problem?
> >
>
> Well, I'd love to, but I don't have any more info.
>
> My script works 80% of the time, then it fails for a time or 2 and works
> again.
>
> Even if I use the same file to send, or change files, makes no difference.
>
> I just get this error, and I have no idea why or how to replicate it without
> running the scripts several times.
>
> Walter



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

Date: 03 Jan 1999 09:31:01 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: a server being able to dintinguish multiple instances of the same process
Message-Id: <yllnjkclgq.fsf@windlord.stanford.edu>

howhow <howhow@dbworld.net.au> writes:

> Suppose there is a server process running on host1, listening to a
> particular port, say port 1234, then forks out child processes to handle
> requests.

> This server is used to handle the requests from an application on
> PC. Since each PC has different IP address in a LAN, each PC can has its
> own socket to talk to the server.

> I tried to write a Perl script to simulate multiple instances of a PC
> application talking to the server. I will run these Perl script serveral
> times on the *SAME* host concurrently. I found out that while the first
> process is running, if a second process is started, the first process
> will get "broken pipe".

Sounds like the server is closing the first connection when it gets a
second connection from the same host.  Unless you're doing something very
strange, I don't see how this could be a client-side problem.

BTW, your networking code is quite old; as of 5.002, use Socket will
predefine a lot of that nonsense and export some simple subs that clean up
networking code considerably.  Do a perldoc Socket and look it over, and
also take a look at the perlipc man page.  You don't need semi-magical
pack statements any more.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 3 Jan 1999 15:03:32 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Adding a path to the @INC variable
Message-Id: <76o0s4$osu$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Daniel Grisinger <dgris@moiraine.dimensional.com> writes:
:> BEGIN {
:>       push(@INC,"/some/path/some/where");
:> }
:> 
:  use lib '/some/path/some/where';
:is almost exactly equivalent to the begin block you posted above.

It's rather more elaborate than that.  See the arrows below.

    package lib;

    use vars qw(@ORIG_INC);
    use Config;

    my $archname = $Config{'archname'};

    @ORIG_INC = @INC;   # take a handy copy of 'original' value


    sub import {
        shift;
        foreach (reverse @_) {
            ## Ignore this if not defined.
            next unless defined($_);
            if ($_ eq '') {
                require Carp;
                Carp::carp("Empty compile time value given to use lib");
                                                            # at foo.pl line ...
            }
            if (-e && ! -d _) {
                require Carp;
                Carp::carp("Parameter to use lib must be directory, not file");
            }
            unshift(@INC, $_);
            # Put a corresponding archlib directory infront of $_ if it
            # looks like $_ has an archlib directory below it.
            if (-d "$_/$archname") {
==>             unshift(@INC, "$_/$archname")    if -d "$_/$archname/auto";
==>             unshift(@INC, "$_/$archname/$]") if -d "$_/$archname/$]/auto";
            }
        }
    }


    sub unimport {
        shift;
        my $mode = shift if $_[0] =~ m/^:[A-Z]+/;

        my %names;
        foreach(@_) {
            ++$names{$_};
            ++$names{"$_/$archname"} if -d "$_/$archname/auto";
        }

        if ($mode and $mode eq ':ALL') {
            # Remove ALL instances of each named directory.
            @INC = grep { !exists $names{$_} } @INC;
        } else {
            # Remove INITIAL instance(s) of each named directory.
            @INC = grep { --$names{$_} < 0   } @INC;
        }
    }

    1;

Maybe now people will stop saying that use lib and unshifting one
thing on @INC even at compile time are the same.

--tom
-- 
    "Since nobody ever compared Hitler to Hitler, being compared with Hitler
    immediately disqualifies you for Hitlerhood."
    	--Larry Wall


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

Date: Sun, 3 Jan 1999 11:16:10 -0600
From: "todda" <thirdwaver@inxpress.net>
Subject: binary conversion
Message-Id: <76o8mo$qb4@news2.tds.net>

I am very new to perl and made a simple addition calculator.
I have found printf function which can convert the $result to hex %x, octal
%o and decimal is %d.

ex: printf "The result in hex is %x\n", $result;

I would like to create a decimal to binary converter is there a built in
function of some sort to do this?





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

Date: Sun, 03 Jan 1999 16:15:13 +0100
From: "Ronald Gvggel" <rgoeggel@atos-group.com>
Subject: Re: Bug in Modulo Operator?
Message-Id: <76o21n$l40$1@news.pop-stuttgart.de>

Samuel Kilchenmann schrieb:
> 
> Can somebody please check, what he/she gets as the result of the following:
> 
> $a = 32_730_968_896_115;
> print $a % 36, "\n";
> print $a - int($a / 36) * 36, "\n";
> 
> On my ActivePerl Build 507 on a W95 notebook it prints:
> 35
> 23
> but it should print:
> 23
> 23
> 

I got:
3
23

But anyway:
If you want to calculate such big numbers, add a
   require "bigint.pl";
to your script.
Then you can make a 
print bmod($a, 36),"\n"; 
and it will result in a
23
 .

HTH
Ronald


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

Date: 3 Jan 1999 10:02:08 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Dynamic Image Generation
Message-Id: <76o0pg$sia@panix.com>

In <76n1g6$mu2$1@winter.news.rcn.net> "Alex Blyumenkrants" <alexb@ipwiz.com> writes:

>I have the following problem:

>i need to create a page that dynamically generates images, like
>LinkExchange,
>when i put in the page
><IMG SRC="http://www.foo.com/foo.cgi?foo" > i need it to produce an image
>chosen from the database based on what the query string is.
>Can anyone tell me what foo.cgi should look like, can it simply print out
>the name of the image?

This program:
    
    #!/usr/local/bin/perl
    
    use CGI qw(:standard);
    
    my $image = param('image');
    
    print header,
        start_html(-title=>'Image', -author=>'clay@panix.com'),
        "The image name is $image.\n",
        end_html();
     
used like this: 

    http://www.foo.com/foo.cgi?image=foo

prints this:

    Content-Type: text/html
    
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    <HTML><HEAD><TITLE>Image</TITLE>
    <LINK REV=MADE HREF="mailto:clay%40panix.com">
    </HEAD><BODY>The image name is foo.
    </BODY></HTML>

-- 
Clay Irving
clay@panix.com


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

Date: Sun, 03 Jan 1999 12:49:36 -0500
From: Bob Nugent <gigs@ici.net>
Subject: Editor
Message-Id: <368FADB0.77B2@ici.net>

Would somebody suggest a proper language/script editor
for Win95? I was trying to get a bbs working when my 
sysad said that all the perl files have 2 returns " ^M "
after #!/usr/bin/perl. All I have is Wordpad, Notepad
and Fusion. None of which show those characters. I need
to edit a bunch of files before sending to the server.

If so, TIA.
Bob

-- 
                 http://www.constructiongigs.com/
Email: bob@constructiongigs.com       Voice/Fax: 781-383-0054

PGP public key (RSA): email with "send key" in subject.
0x8f62a9b * 1024 * 11/29/97
399A 5D4F D791 89F7 2411 168A 1568
http://www.constructiongigs.com/assets/RSAkey.txt

PGP public key(DH-DSS): email with "send key" in subject.
0xCAD666B7 * 2048/1024 * 3/3/98
3C4D A63F 3C88 2D7B 7E1A FFE8 9A2E 4D78 CAD6 66B7
http://www.constructiongigs.com/assets/DH-DSSkey.txt


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

Date: 03 Jan 1999 16:37:38 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Finding elements between 2 arrays
Message-Id: <m3sodsmkot.fsf@joshua.panix.com>

"Charles R. Thompson" <design@raincloud-studios.com> writes:

>            if (@db_user_definable_field_order[$j] eq $index){

I also forgot to mention that the above line of code is nonsensical,
(though legal) as it uses the eq operator to compare an array slice
with a scalar.

   $ perldoc perldata

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Sun, 3 Jan 1999 09:34:37 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Finding elements between 2 arrays
Message-Id: <dm2o67.qml.ln@magna.metronet.com>

Charles R. Thompson (design@raincloud-studios.com) wrote:


:            if (@db_user_definable_field_order[$j] eq $index){
                 ^
                 ^ you should be using a $ instead of an @


You should use the -w switch on *all* of your perl programs.

It would have pointed out that you are using an array slice
there instead of a scalar.


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


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

Date: Sun, 3 Jan 1999 09:37:33 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Finding elements between 2 arrays
Message-Id: <tr2o67.qml.ln@magna.metronet.com>

Charles R. Thompson (design@raincloud-studios.com) wrote:

: >To answer your main question,
: >   $ perldoc -f grep

: >If, under other circumstances, you need to iterate over the elements
: >of a list,

: >   foreach my $field (@fields) {
: >      # do something with $field
: >   }
: >   $ perldoc perlsyn

: Thanks... will take a look at them in the AM. Lots to do!


   Here's one more "to do" for your list  ;-)

   See Perl FAQ, part 4:

      "How can I tell whether a list or array contains a certain element?"


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


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

Date: 03 Jan 1999 16:44:53 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Is interpolation/parsing in s/// possible?
Message-Id: <m3ogogmkcq.fsf@joshua.panix.com>

Jonathan Stowe <gellyfish@btinternet.com> writes:

> On Sun, 03 Jan 1999 12:50:32 GMT Mark Badolato wrote:
> > 
> > Is it possible to interpolate variables in a regex substitution,
> > but use the variable contents as the regex for substitution instead
> > of as a literal?

> $regex = 'ucfirst(lc($1))';
> 
> $name =~ s/(.*)/eval($regex)/e;

Ooh, Gellyfish.  You missed

  s/(.*)/$regex/ee;

Although, of course, in this case a simple

  s/(.*)/\u\L$1/;   # would suffice

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Sun, 3 Jan 1999 10:32:30 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Is interpolation/parsing in s/// possible?
Message-Id: <u26o67.v5m.ln@magna.metronet.com>

Mark Badolato (bady@primenet.com) wrote:
: This may be a dumb question, but its 5:30am and I've pulled an all-nighter =)


: $name = "MARK";
: $regex = '\u\L$1';
: $name =~ s/(.*)/$regex/;


   That is a very misleading choice of name for your variable.

   $regex does not contain a Regular Expression!

   It contains a replacement string.


   You don't use $1 in a regex, you use \1 instead...


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


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

Date: Sun, 03 Jan 1999 17:49:20 GMT
From: bady@primenet.com (Mark Badolato)
Subject: Re: Is interpolation/parsing in s/// possible?
Message-Id: <76oant$dft$1@nnrp03.primenet.com>

Previously, tadmc@metronet.com (Tad McClellan) wrote:
>Mark Badolato (bady@primenet.com) wrote:
>: This may be a dumb question, but its 5:30am and I've pulled an all-nighter =)
>
>
>: $name = "MARK";
>: $regex = '\u\L$1';
>: $name =~ s/(.*)/$regex/;
>
>
>   That is a very misleading choice of name for your variable.
>
>   $regex does not contain a Regular Expression!
>
>   It contains a replacement string.
>
>
>   You don't use $1 in a regex, you use \1 instead...
>

Even in a substitution as being used above?

I'm looking at The Llama, page 88, at the bottom, and this example is used:

$_ = "this is a test";
s/(\w+)/<$1>/g; # $_ is now "<this> <is> <a> <test>"

Which is used when? (sorry, im still just getting the hang regex stuff)

--Mark


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

Date: 3 Jan 1999 15:42:35 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: Is mod_perl an option?
Message-Id: <slrn78v4h7.b95.randy@theory.uwinnipeg.ca>

On Sun, 3 Jan 1999 00:25:58 -0500, The Smiths <smiths@erols.com> wrote:
>I am running ActivePerl build 508 and Apache 1.3.3 on Win95.  Is mod_perl an
>option in this configuration?  I didn't see it available as a module for
>this flavor of Perl but wasn't sure.

Hi,
   There is a binary distribution of mod_perl, built under NT,
available at
	http://www.perl.com/CPAN/authors/id/JBAKER/
However, the readme says it's not guaranteed to work under
Windows 95/98. I'm not sure, too, if it would be compatable
with the ActiveState build - the INSTALL.win32 file in mod_perl
says mod_perl will not work with ActiveState's port, but this might
be an old comment referring to earlier builds not based on
the present 5.005_02 sources.
   If you're feeling adventuresome, you could try it doing it
yourself (if you have a C compiler, preferably VC++). I've done
it (using a native perl build) following the instructions in
the INSTALL.win32 mod_perl file, and it was straightforward -
the only additional hints I used were to change all relative
paths in ApacheModulePerl.dsp to absolute ones, especially those
referrring to the perl and apache libs. Also, it helps to be
working in directories that do not contain spaces in their names.

-- 
		Best regards,
		Randy Kobes

Physics Department		Phone: 	   (204) 786-9399
University of Winnipeg		Fax: 	   (204) 774-4134
Winnipeg, Manitoba R3B 2E9	e-mail:	   randy@theory.uwinnipeg.ca
Canada				http://theory.uwinnipeg.ca/


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

Date: 3 Jan 1999 15:24:59 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: Lockfile in CPAN
Message-Id: <slrn78v3g8.b95.randy@theory.uwinnipeg.ca>

On Sun, 03 Jan 1999 09:12:04 -0800, Greg Petranek <webmaster@mcomn.com> wrote:
>While running in the CPAN shell from MS-DOS(WIN95) a CPAN install
>program was inadvertently terminated causing a ".locklfile" to be
>written to my .cpan directory. I can no longer access the remote CPAN
>shell with the lockfile installed (error message that CPAN process is
>still running).

Hello,
   Just delete the file ....

-- 
		Best regards,
		Randy Kobes

Physics Department		Phone: 	   (204) 786-9399
University of Winnipeg		Fax: 	   (204) 774-4134
Winnipeg, Manitoba R3B 2E9	e-mail:	   randy@theory.uwinnipeg.ca
Canada				http://theory.uwinnipeg.ca/


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

Date: Sun, 03 Jan 1999 10:36:07 -0800
From: Greg Petranek <webmaster@mcomn.com>
Subject: Re: Lockfile in CPAN
Message-Id: <368FB897.3EFE@mcomn.com>

Randy Kobes wrote:
> 
> On Sun, 03 Jan 1999 09:12:04 -0800, Greg Petranek <webmaster@mcomn.com> wrote:
> >While running in the CPAN shell from MS-DOS(WIN95) a CPAN install
> >program was inadvertently terminated causing a ".locklfile" to be
> >written to my .cpan directory. I can no longer access the remote CPAN
> >shell with the lockfile installed (error message that CPAN process is
> >still running).
> 
> Hello,
>    Just delete the file ....
> 
> --
>                 Best regards,
>                 Randy Kobes
> 
> Physics Department              Phone:     (204) 786-9399
> University of Winnipeg          Fax:       (204) 774-4134
> Winnipeg, Manitoba R3B 2E9      e-mail:    randy@theory.uwinnipeg.ca
> Canada                          http://theory.uwinnipeg.ca/

Thanks Randy.



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

Date: 3 Jan 1999 10:05:21 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: need short delay
Message-Id: <76o0vh$sl6@panix.com>

In <01be36fa$a8c41820$b7eb63c1@dietmar> "jupp" <jupp@media-point.de> writes:

>Hi, does anybody know a short delay, so around 200-500 ms instead of the
>unprecise Sleep 1 ?
>Or has anybody a better idea how to deal with the fast networks ?

    Time::HiRes

    http://www.perl.com/CPAN/modules/by-module/Time

    Finer granularity time, sleep, and alarm: implements usleep(), 
    ularam(), and gettimeofday() in Perl. 

-- 
Clay Irving
clay@panix.com


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

Date: Sun, 03 Jan 1999 15:38:53 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: need short delay
Message-Id: <368f8ce5.265113378@news.mmc.org>

On 3 Jan 1999 09:24:15 GMT, "jupp" <jupp@media-point.de> wrote:

>Hi, does anybody know a short delay, so around 200-500 ms instead of the
>unprecise Sleep 1 ?
>Or has anybody a better idea how to deal with the fast networks ?
>
>Thanks Dietmar

See perlfaq8: "How can I sleep() or alarm() for under a second?"

$ perldoc perlfaq8

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: Sun, 3 Jan 1999 09:48:46 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: need short delay
Message-Id: <ug3o67.qml.ln@magna.metronet.com>

jupp (jupp@media-point.de) wrote:
: Hi, does anybody know a short delay, so around 200-500 ms instead of the
: unprecise Sleep 1 ?
: Or has anybody a better idea how to deal with the fast networks ?


   Perl FAQ, part 8:

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


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


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

Date: 3 Jan 1999 17:25:57 GMT
From: "William Selbig" <selbig@worldnet.att.net>
Subject: new to PERL..need help
Message-Id: <76o975$59j@bgtnsc01.worldnet.att.net>

I'm trying to install a simple form on my web site so people can send info
to me without going through email (even though that's how the script sends
it to me).

I use ATT Worldnet as an ISP. They don't have a cgi-bin. Can I still use a
PERL script?

Also, I copied the script from another source. I don't have PERL on my
machine and I don't know if ATT does either. Do you need it to run the
script?

reply to: selbig@worldnet.att.net




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

Date: Sun, 3 Jan 1999 10:20:38 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie - OPEN() gives sh error - why?
Message-Id: <mc5o67.v5m.ln@magna.metronet.com>

Jonathan Stowe (gellyfish@btinternet.com) wrote:
: On Thu, 31 Dec 1998 17:23:38 GMT Philip de Lisle wrote:

: > I have to open a pipe to a program and pass it some parameters which could
: > contain spaces so they need to be in quote marks. My code looks like
: > 
: >  $Name = "Philip de Lisle";
: >  $user = "pdelisle";
: >  $password = "dsfas/wrh431";
: >  open(UA, "| /usr/sbin/useradd -M -c '$Name' -p $password $user") || die
: > "open: $!";
: >  close(UA);


: You would also have a problem with the *single* quotes around $Name which
: would prevent its interpolation by Perl and thus the literal '$Name' will
        ^^^^^^^^^^^^^^^^^^^^^^^^^
: get passed to the shell for interpolation and almost certainly there isnt
: one so thus you error.  When you have to mix quotes like this it is better
: to use the generalized quoting methods (see perlsyn).


   Eh?


-------------------------
#!/usr/bin/perl -w

$Name = 'Philip de Lisle';
$user = 'pdelisle';
$password = 'dsfas/wrh431';

print "| /usr/sbin/useradd -M -c '$Name' -p $password $user", "\n";
-------------------------

prints:

| /usr/sbin/useradd -M -c 'Philip de Lisle' -p dsfas/wrh431 pdelisle



Single quotes inside of double quotes are just plain characters,
they don't suppress interpolation...


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


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

Date: Sun, 3 Jan 1999 09:41:32 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: noop
Message-Id: <c33o67.qml.ln@magna.metronet.com>

David Formosa (dformosa@zeta.org.au) wrote:
: In article <8r6n67.9vj.ln@magna.metronet.com>, Tad McClellan wrote:
: >EVILjosh (engineer@noorg.org) wrote:
: >
: >: Is there any kind of a noop keyword in Perl?
: >
: >
: >   Perl is a high level language, I cannot imagine why you need
: >   a do-nothing placeholder like NOOP is in assembler.

: Sometimes noop is usefull to say "I'm going to code this but not yet."
: when testing stubbly code.


   A comment or "empty statement" (bare semicolon) isn't enough?


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


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

Date: Sun, 03 Jan 1999 15:55:20 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: noop
Message-Id: <3690922a.15423104@news.skynet.be>

David Formosa wrote:

>Its an easy to type 4 chars sequence.  Faster then thinking up a comment to put
>in that place.

Yes. But at that moment, you have some idea what the code you don't
write just yet, should do. If you have to figure it out again later,
that's more work. Typing is easier than thinking. ;-)

Besides, you  could do a warn or a die instead:

	warn "subroutine not implemented";

Ooh, too much to type. ;-)

	Bart.


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

Date: Sun, 3 Jan 1999 09:44:28 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Official Perl Movie
Message-Id: <s83o67.qml.ln@magna.metronet.com>

beable@my-dejanews.com wrote:

: REMEMBER TO WATER YOUR CAMEL AT
: LEAST EVERY THREE WEEKS OR IT WILL DIE!!!


   The -w switch will warn you of this common mistake.

   You should use the -w switch on *all* of your perl programs.

   ;-)


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


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

Date: Sun, 03 Jan 1999 12:09:54 -0500
From: Eugene Sotirescu <eugene@verticalnet.com>
Subject: Re: Path under windows
Message-Id: <368FA462.BCC37116@verticalnet.com>

1. Sounds like you are blessed to work in a place that allows you the luxury to
rewrite stuff your own way.

2. I would challenge you to show that loading CGI::Standard results in
significant slowdowns.

Ethan H. Poole wrote:

> As for my own avoidance of CGI.pm, the bloating is reason #1.  I used the
> CGI.pm module back in my earlier days of learning Perl and found that
> virtually all my scripts spent more time loading and compiling just the
> CGI.pm module than they did compiling and executing my code, the performance
> hit just wasn't acceptable to me.
>



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

Date: Sun, 3 Jan 1999 09:18:08 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: PERL OO: Function overloading
Message-Id: <gn1o67.qml.ln@magna.metronet.com>

Tony Cook (tony@ns.cook.ml.org) wrote:
: Zenin (zenin@bawdycaste.org) wrote:
: : hoangngo@usa.net wrote:
: : : Can anyone out here tell me if PERL offers function overloading?

: :         No.  There is no need for it in Perl (and it's not "PERL" btw, it's
: :         not an acronym.  Would you call it "JAVA" too?).

: Hmm, I though it was an acronym...

: bash$ perldoc -t perl | head -2
: NAME
:     perl - Practical Extraction and Report Language


   radar - RAdio Detection And Ranging


   In its early history radar was known as RADAR. 

   It is in such common use nowadays that it has become 
   a word in its own right.


   It is now known as "radar" rather than "RADAR".

   [ or "Radar" if used with "O'Reilly".

     (what animal would be used on the cover of a Radar O'Reilly
      book?  Bunny rabbit? Teddy Bear?)

     ;-)

   ]




   Insights into even this esoteric issue can (perhaps) be 
   gained by consulting the docs that ship with perl:


-------------------
#!/usr/bin/perl -w
# name_of_perl - count usages of various forms of the word "perl"

while (<>) {
   $perl ++ while /\bperl\b/g;
   $Perl ++ while /\bPerl\b/g;
   $PERL ++ while /\bPERL\b/g;
}

print "perl: $perl\n";
print "Perl: $Perl\n";
print "PERL: $PERL\n";
-------------------

name_of_perl *.pod

output:
perl: 810
Perl: 2111
PERL: 10



   Lets see those ten:


perl -ne 'print "$ARGV: $_" if /\bPERL\b/' *.pod 

output:
perlembed.pod: THE SAME WAY THAT YOUR PERL WAS COMPILED.  (Sorry for yelling.)
perlfaq2.pod:   http://www.cs.ruu.nl/pub/PERL/CPAN/
perlmodlib.pod: =head1 THE PERL MODULE LIBRARY
perlmodlib.pod:                     ftp://ftp.wownet.net/pub2/PERL/
perlmodlib.pod:     the Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
perlport.pod: A free perl5-based PERL.NLM for Novell Netware is available from
perltoc.pod: =item THE PERL MODULE LIBRARY
perltoc.pod: =item MAKING PERL ERRORS APPEAR IN THE BROWSER WINDOW
perltoc.pod: =item WRITING FASTCGI PERL SCRIPTS
perltoc.pod: NEEDS_LINKING, NOECHO, NORECURS, OBJECT, OPTIMIZE, PERL, PERLMAINCC


   "PERL" appears only as dir names and part of an entirely
   uc()ed phrase in the docs.






   And of course there is this FAQ, which makes no mention of PERL:

      What's the difference between "perl" and "Perl"?


   Hmmm...

   So I guess a use of "PERL" causes it to spring into existence
   with a value of undef?   ;-)


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


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

Date: 3 Jan 1999 15:52:20 GMT
From: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Quick operator question
Message-Id: <76o3nk$79k$1@nclient3-gui.server.ntli.net>

Is there a quicker way to do the following?

$foo = 50 if $foo > 50;

Thanks in advance,

Aidan


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

Date: 03 Jan 1999 09:32:40 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Quick operator question
Message-Id: <yliueocldz.fsf@windlord.stanford.edu>

Aidan Rogers <aidan@salvador.blackstar.co.uk> writes:

> Is there a quicker way to do the following?
> $foo = 50 if $foo > 50;

No, not really.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sun, 3 Jan 1999 09:25:19 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <v42o67.qml.ln@magna.metronet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote:
: In comp.lang.perl.misc, tadmc@metronet.com (Tad McClellan) writes:
: :   The lesson is to understand the difference between 
: :   scalar and list context.
: :      print scalar reverse($string);

: In this case, you're ok.  


   Because I remembered the referenced quiz question when writing
   the above. 

   So I went and looked it up before posting, to make sure I wasn't
   messing up  ;-)

   I hate looking foolish in front of hundreds of people, though
   I still manage to do it with distressing frequency...



: But there's still more to learn.
: I present this from the perl quiz.

: --tom

: Question:   How do you print out the next line from a filehandle
: 	    with all its bytes reversed?


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


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

Date: Sun, 3 Jan 1999 19:24:14 +0400
From: "wayne clerke" <clerke@emirates.net.ae>
Subject: use of 'system'
Message-Id: <76o2el$pbv$1@nntp.or.nw.verio.net>

Hi,

I looked at this simple thing for 5-10 minutes and didn't seem to be going
anywhere! Apologies if it's just stupid.
On an NT4 system with Activestate perl.

Why does the following sort of thing not work:
system("dir /w test");

while the following does work:
system("dir/w test");

It's the same with rmdir /s etc. etc.
I'm sure it's completely obvious ... but ???

regards,
Mail: wayne clerke <clerke@emirates.net.ae>    Voice: +971 506 43 4853
PGP key id: AEB2546D  F/P: D663D11EDA19D74F5032DC7EE001B702
PGP key id: 57AA1C10  F/P: 9926BF8918B7EB3623A7 AFA46572C5B857AA1C10
If you're not living on the edge, you're taking up too much space.




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

Date: 3 Jan 1999 16:15:08 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: use of 'system'
Message-Id: <76o52c$16s$1@gellyfish.btinternet.com>

On Sun, 3 Jan 1999 19:24:14 +0400 wayne clerke wrote:
> Hi,
> 
> I looked at this simple thing for 5-10 minutes and didn't seem to be going
> anywhere! Apologies if it's just stupid.
> On an NT4 system with Activestate perl.
> 
> Why does the following sort of thing not work:
> system("dir /w test");
> 
> while the following does work:
> system("dir/w test");
> 
> It's the same with rmdir /s etc. etc.
> I'm sure it's completely obvious ... but ???
> 

At a guess I would say that its a "feature" of the Microsoft command
interpreter - I say guess because I cant test it right now.  I think that
what is happening that in the first instance Perl is directly attempting
to run an external command (dir.exe dir.com dir.bat or whatecver)
which doesnt exist as 'dir' is builtin to the command interpreter.
However in the second case the command line is being handed off to the
command interpreter for execution.

I think that you'll find that:

system("command /c dir /w test");

will work as well.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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