[17180] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4592 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 12 03:10:28 2000

Date: Thu, 12 Oct 2000 00:10:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971334616-v9-i4592@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 12 Oct 2000     Volume: 9 Number: 4592

Today's topics:
        is there a better way to do this? <no@spam.org>
    Re: is there a better way to do this? <godzilla@stomp.stomp.tokyo>
    Re: is there a better way to do this? <uri@sysarch.com>
    Re: is there a better way to do this? (Martien Verbruggen)
    Re: is there a better way to do this? <no@spam.org>
    Re: is there a better way to do this? <godzilla@stomp.stomp.tokyo>
    Re: mod_perl variables (Tim Hammerquist)
    Re: mod_perl variables (Randal L. Schwartz)
    Re: mod_perl variables apacheproblems@my-deja.com
    Re: Newbie Pattern Match Question <markmccarthy1@home.com>
    Re: passing and returning hashes <elephant@squirrelgroup.com>
    Re: passing info with POST <uri@sysarch.com>
        possible pragma: 'string' - a C-style scalar character  <jdb@wcoil.com>
    Re: running a program in the background <rick.delaney@home.com>
        Silly newbie question (Net::POP3) ambidexter@my-deja.com
    Re: simulate keyboard activity <elephant@squirrelgroup.com>
    Re: Solved: Don't ignore a SIGCHLD! (Charles DeRykus)
    Re: will perl 5 work w/o server on my PC <ericio@pd.jaring.my>
    Re: will perl 5 work w/o server on my PC <ericio@pd.jaring.my>
    Re: will perl 5 work w/o server on my PC <ericio@pd.jaring.my>
    Re: Will perl help me to create directory in writing fi <carfield@my-deja.com>
        Works on Win2000 but not on Win98!? Why? Help! <idk@teleport.com>
    Re: Works on Win2000 but not on Win98!? Why? Help! <kmsproule@worldnet.att.net>
    Re: Works on Win2000 but not on Win98!? Why? Help! <wyzelli@yahoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 11 Oct 2000 19:50:43 -0700
From: David <no@spam.org>
Subject: is there a better way to do this?
Message-Id: <1o9auso55pg1ocoudbm4vq4vcp1vs2pjsq@4ax.com>

Hi

This script goes through a directory and removes three characters
before the underscore of all .jpg's.  Before doing so, it checks if
this would create a duplicate file name and copies such files to a
"dups" dir.

There are no performance isues with this script, the second loop just
contains some code that looks redundant.  (for that matter, I have a
hunch the second loop is redundant to some extent).  I'm new to Perl.
Any suggestions?


#! usr/bin/perl-w

chomp(@list=(glob("*.jpg")));
foreach $file(@list){
	$file_temp = $file;
	$file_temp =~ s/..._/_/;
	$index{$file_temp}++;
}

foreach $fileold(@list){
	$filenew=$fileold;
	$filenew=~s/..._/_/;
	if($index{$filenew} >1) {
		rename ("$fileold" , ".\\dups\\$fileold")
			|| die "Can't rename $fileold to
\\dups\\$fileold: $!\n";
	}else{
		rename ($fileold , $filenew);
	}
}


Thanx

David


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

Date: Wed, 11 Oct 2000 20:24:38 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: is there a better way to do this?
Message-Id: <39E52EF6.8592495F@stomp.stomp.tokyo>

David wrote:

> This script goes through a directory and removes three characters
> before the underscore of all .jpg's.  Before doing so, it checks if
> this would create a duplicate file name and copies such files to a
> "dups" dir.
 
> There are no performance isues with this script, the second loop just
> contains some code that looks redundant.  (for that matter, I have a
> hunch the second loop is redundant to some extent).  I'm new to Perl.


> Any suggestions?


A suggestion. If you are looking for help of a sort,
you need to ask a question. You have asked no question
nor have you described anything with which you need help.
Do you have a question? Do you need help?

In lieu of any question from you, my suggestion would
be to plant your corn early next year. We will have a
warm wet spring. I hope this satisfies your need for
suggestions.



Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Thu, 12 Oct 2000 03:51:19 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: is there a better way to do this?
Message-Id: <x7u2aiyax7.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  >> There are no performance isues with this script, the second loop just
  >> contains some code that looks redundant.  (for that matter, I have a
  >> hunch the second loop is redundant to some extent).  I'm new to Perl.

  >> Any suggestions?

  G> A suggestion. If you are looking for help of a sort,
  G> you need to ask a question. You have asked no question
  G> nor have you described anything with which you need help.
  G> Do you have a question? Do you need help?

he asked for suggestions on dealing with redundant code, you
dunderhead. what could be clearer? sorry, i forgot i am addressing
moronzilla, the champeen of english miscomprehension. i will do better
next time and read the headers and know what idiot i am addressing.

  G> In lieu of any question from you, my suggestion would
  G> be to plant your corn early next year. We will have a
  G> warm wet spring. I hope this satisfies your need for
  G> suggestions.

go back to grade school english and ask you teacher for the definition
of what a question is. study the answer. then go away from this group.

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: Thu, 12 Oct 2000 04:14:00 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: is there a better way to do this?
Message-Id: <slrn8uaeju.a0g.mgjv@verbruggen.comdyn.com.au>

On Wed, 11 Oct 2000 19:50:43 -0700,
	David <no@spam.org> wrote:
> Hi
> 
> This script goes through a directory and removes three characters
> before the underscore of all .jpg's.  Before doing so, it checks if
> this would create a duplicate file name and copies such files to a
> "dups" dir.
> 
> There are no performance isues with this script, the second loop just
> contains some code that looks redundant.  (for that matter, I have a
> hunch the second loop is redundant to some extent).  I'm new to Perl.
> Any suggestions?

[snip]

I've taken the liberty to rewrite your program in a slightly more
portable way, including the removal of that redundant code. I believe
that my example is clearer than the code you submitted. I found the
use of the hash in yours especially confusing. Also, I tend to avoid
the use of glob, since it makes your program unportable. Different
systems, and different versions of Perl can give different results.
Use opendir/readdir instead.

Remarks:

The pattern needs to be anchored at the start. Otherwise you could
have problems with files like 'abcd_ghe.jpg' and on repeated runs
with 'abcd_efgh_ijkl.jpg'.

This code also works on files that begin with a '.'. I don't think
yours did, but I'm not sure how glob on Windows works. That's why I
called your code less portable (the glob differences, and the use of
backslashes in directories. Normal slashes work just fine. For even
more portability, use File::Spec)

Your program had to be run from the directory in which the files live.
This program can be run from anywhere, and requires the directory as
argument. Instead, you could default to '.', if you like that better.

This program, like yours, does not make sure that $dir/dups exists.
It is trivial to add that check.

#!/usr/local/bin/perl -w
use strict;

my $dir = shift or die "Usage: $0 directory-name\n";

opendir(DIR, $dir) or die "Cannot opendir $dir: $!";
while (my $file = readdir DIR)
{
    next unless $file =~ /.*\.jpg$/;
    my ($new_file) = $file =~ /^...(_.*)/ or next;

    if (-f "$dir/$new_file")
    {
        # print "moving $dir/$file\n";
        rename "$dir/$file", "$dir/dups/$file"
            or die "Cannot move $dir/$file to $dir/dups/$file: $!";
    }
    else
    {
        # print "renaming $dir/$file to $dir/$new_file\n";
        rename "$dir/$file", "$dir/$new_file"
            or die "Cannot rename $dir/$file: $!";
    }
}
closedir DIR;

Invoke it as

# ./proggie /tmp/foo/bar/canary
# ./proggie .
# ./proggie foo/bar

HTH,
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: Thu, 12 Oct 2000 06:08:49 GMT
From: David <no@spam.org>
Subject: Re: is there a better way to do this?
Message-Id: <6vjaus8g2lh4mbo371faihnkhfqlukpp6m@4ax.com>

My apologies if my original post confused anyone.  The question was, er, is there a better way to do
this?

Thanks for the reply Martien. As some of the functions you've used are beyond me at the moment (just
finished chapt 5 - Learning Perl), I will hang on to your example for future reference.  There are
several features I'll implement to this and other simple scripts I've written (such as checking for,
or creating a directory as you pointed out) as I gain a better understanding of Perl.  Meantime,
I'll continue to follow this ng and this thread to see how others approached this problem.

D.


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

Date: Wed, 11 Oct 2000 23:39:39 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: is there a better way to do this?
Message-Id: <39E55CAB.115206E@stomp.stomp.tokyo>

David wrote:

(snippage)
 
> My apologies if my original post confused anyone.  
> The question was, er, is there a better way to do this?


A better way to do what? A better way to pick your
toes? A better way to flick sticky boogers?

So what is your question? Are you making reference to
a specific section of your script? You have indicated
satisfaction with this script, have indicated there 
are no performance issues. You make a vague reference
to something being redundant. Specifically what do you
consider to redundant? So what is your question?


Godzilla!


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

Date: Thu, 12 Oct 2000 01:01:00 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: mod_perl variables
Message-Id: <slrn8ua464.mg.tim@degree.ath.cx>

nobull@mail.com <nobull@mail.com> wrote:
> [1] By here I mean comp.lang.perl.misc.  There is no such group as
> comp.lang.perl.

Um.  By "no such group" you mean "the group that Tim read this post in
does not exist?"  Or that it doesn't exist in that it's not widely
endorsed nor propogated by news servers?

-- 
-Tim Hammerquist <timmy@cpan.org>
Nearly all men can stand adversity, but if you
want to test a man's character, give him power.
	-- Abraham Lincoln


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

Date: 11 Oct 2000 18:46:32 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: mod_perl variables
Message-Id: <m1zokahlvr.fsf@halfdome.holdit.com>

>>>>> "Tim" == Tim Hammerquist <tim@degree.ath.cx> writes:

Tim> Um.  By "no such group" you mean "the group that Tim read this post in
Tim> does not exist?"  Or that it doesn't exist in that it's not widely
Tim> endorsed nor propogated by news servers?

The latter, which means the former. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 12 Oct 2000 06:00:22 GMT
From: apacheproblems@my-deja.com
Subject: Re: mod_perl variables
Message-Id: <8s3k1k$ntp$1@nnrp1.deja.com>

Would you mind directing me to the FAQ please. I was not able to find
there....

thank you,

a


In article <x7vguziesb.fsf@onceler.kciLink.com>,
  Vivek Khera <khera@kciLink.com> wrote:
> >>>>> "a" == apacheproblems  <apacheproblems@my-deja.com> writes:
>
> a> I notice when using %ARRAYS in mod_perl that for new requests
previous
> a> data stored in the %ARRAY are still present. I have declared the
> a> veriables with my(%ARRAY) = () and still causing problems.Any
ideas?
> a> -a
>
> Yes; this is a mod_perl FAQ even.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Vivek Khera, Ph.D.                Khera Communications, Inc.
> Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
> GPG & MIME spoken here            http://www.khera.org/~vivek/
>


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


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

Date: Thu, 12 Oct 2000 02:47:47 GMT
From: "Mark McCarthy" <markmccarthy1@home.com>
Subject: Re: Newbie Pattern Match Question
Message-Id: <nD9F5.29231$3_4.347700@news1.rdc1.sdca.home.com>


<andreas_berg_genient@my-deja.com> wrote in message
news:8s2cgo$nht$1@nnrp1.deja.com...
>
>
> Hi,
>
> I somehow cannot get the right pattern to match
> the following text. Suppose I have an HTML file:
>
> <table width="100">
>
> <table width="50">
> <tr><td>Some unknown text</td></tr>
> <tr><td>Some unknown text</td></tr>
> </table>
>
> <table width="50">
> <tr><td>Some unknown text</td></tr>
> <tr><td>Some specific text</td></tr>
> <tr><td>Some unknown text</td></tr>
> </table>
>
> <table width="50">
> <tr><td>Some unknown text</td></tr>
> <tr><td>Some unknown text</td></tr>
> <tr><td>Some unknown text</td></tr>
> </table>
>
> </table>
>
> Now I want to match the part:
>
> <table width="50">
> <tr><td>Some unknown text</td></tr>
> <tr><td>Some specific text</td></tr>
> <tr><td>Some unknown text</td></tr>
> </table>
>
> I tried the pattern
>
> <table(?:[\d\D]*?)Some specific text(?:[\d\D]*?)
> </table>

Here is some insight. Im not much more than a newbie myself but
noone has taken this on, so here goes.

The heavyweights can correct my misconceptions if they care to help out ...

[\d\D] is the same as . so use that instead
You need the s modifier ie m//s because youre traversing many lines.
What youre needing is:

As much text as possible
followed minimally by text which has been preceeded by < table
followed by "Some specific text"
followed minimally by text which has </table after it
followed greedily by all else that is left.

if (m#(.*)((?<=<table)(.*?)Some specific text(.*?)(?=</table>))(.*)#s)
{print $2};

Look up zero-width assertions in perlre. Notice I used a lookbehind and a
lookahead here.

Took me a long session to discover all this so hope it helps.

Mark McCarthy






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

Date: Thu, 12 Oct 2000 12:40:20 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: passing and returning hashes
Message-Id: <MPG.144fcfa25e548bbf989817@localhost>

Dale Emmons wrote ..
>I'd like to create a subroutine that takes a hash of values as its arguments
>and returns a hash as its value, something like:
>
>%fbsubs_returned_hash = fbsub( foo => 'fooit', bar => 'barit' );
>
>print $fbsubs_returned_hash{foobar};
>
>sub fbsub {
>
>    my ($fb, $bf);
>
>    ### do something... to give $fb & $bf values from $_{foo} and $_{bar}
>
>    return ( foobar => $fb, barfoo => $bf );
>}
>
>I know that this probably isn't close to what would work, but I hope you
>understand what I'm getting at?

sometimes it pays to give things a go .. as far as Perl is concerned - 
(foo => 'fooit', bar => 'barit') is just a LIST .. and it will pass 
straight in to a sub - in order .. and obviously you can assign a 
LIST to a hash .. so it's as simple as

  sub fbsub
  {
    my %hash = @_;

    return foo => $hash{bar}, bar => $hash{foo};
  }

  %swap = fbsub( foo => 'fooit', bar => 'barit' );

the only real trick is that if you have any other parameters then they 
have to be scalars and they have to come be shifted (or -shudder- 
popped) from @_ before the my %hash assignment

ie. you can't pass to naked hashes in - because Perl has no idea where 
one begins and where the other ends

all that having been said .. keep in mind that hashes can easily have a 
very large number of elements - and so it is often significantly better 
to pass in a hashref

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 12 Oct 2000 01:17:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: passing info with POST
Message-Id: <x71yxmzwmb.fsf@home.sysarch.com>

>>>>> "MD" == Mark-Jason Dominus <mjd@plover.com> writes:

  MD> if the browser is behaving according to spec, then the programmer
  MD> can retrieve the query-string information on the server side using
  MD> the -> query_string method, and I showed an example of this.  The
  MD> code that Brian pointed to in CGI.pm is only for conveneience, so
  MD> that the programmer gets the query string *as if* it had been
  MD> passed as part of the POST content.

i wrote a test system for a fastcgi web server setup and i generated
requests which had any combination of post and get info. the cgi script
(specialized so it didn't use CGI.pm) always echoed either kind of data
if it was set. so i had control over the agent and cgi and the server
always passed both. there should be no reason why that is not supported
as the server can pass both to the cgi. but as you all have pointed out
browsers (not custom written agents) can break that. i don't know if any
servers break it too.

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: 12 Oct 2000 07:04:53 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: possible pragma: 'string' - a C-style scalar character arrays
Message-Id: <8s3nql$cus$0@206.230.71.80>

Greets Perlfolk,

After dreaming a little on my own about the beauties of C strings, and after
reading the "Convert array to string?" and "Defining new Operator (not
overload)" threads, I came up with a small module that does a little of all
three things, with the emphasis on the C strings. I am looking for any
comments: good/bad/like the name/needs a different name/pros/cons of
module/etc...anything.

Well, since code speaks louder than words, here is a small synopsis: (56
lines)

#== BEGIN SYNOPSIS

    use string;
    use strict;

    # uncomment to see actual code produced
    #mode $__FILTER__,verbose;

    # create two lexically-scopped
    # "character-array scalars." ("my" variables)
    str $var,$var2;

    # $var is a standard scalar, it can be used wherever (approx.)
    # you would use any other scalar.
    $var = 'just another perl hackerf';

    # array operators on a scalar?? yep!
    my $f = pop $var;

    # simple fetching from string via indices
    print $var[18..$#var], " $var[7]$f ", $var[13..16],":\n";
    # prints 'hacker of perl:';

    # overwrite strings at positions specified
    $var[0] = 'J';
    $var[13] = 'Perl H';
    print "$var\n";

    # use mode function to modify 'str' scalar's behavior
    mode $var, 'insert';

    # now assigning to a location inserts a string instead of
    # overwriting current string
    $var[13] = '(yes, *another*) ';
    print "$var\n";

    # standard scalar operators work on 'str' variables, as
    # well as array operators such as push,pop,shift, & unshift
    $var = lc $var;
    push $var, '!?!';

    # demos the "null-join" operator added by 'use' of 'string;'
    # the operator is "=, (double-quote-then-equal-sign). Just inserts:
    # q/join'',/ inplace of of q/"=/.
    $var="=$var[6..$#var];

    # modify the string again
    unshift $var, 'A';
    print "$var\n";

    # show that fancy null-join op again
    shift $var;
    $var="=$var[0..$#var-3];

    # demonstrate the '= (single-quote-then-equal-sign) operator.
    # Replaces "$a'=$b;" with "$a=$b.$a;"
    $var'='Just a';
    print "$var.\n";

#==END SYNOPSIS==


As you can see, it combines array-like operators and operations on scalars.
Actually, the 'str' just ties an list by the same name to the
'string::TIEARRAY' package, and the array is what you are calling when you
call all the array slices and all that good stuff.

If this sounds like a good idea to anybody, please let me know. I'll get the
code cleaned up and put together a beta package for the CPAN.

As always, looking for tons of feedback on the possible uses/pros/cons of
this possibly-new pragmatic modue.

Cheers!


Josiah Bryan  <jdb@wcoil.com>
--
    Yes, Boss! (sorry, Boss!)
        - Oscar, cc.1932




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

Date: Thu, 12 Oct 2000 03:22:23 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: running a program in the background
Message-Id: <39E53140.BC5514F3@home.com>

[posted & mailed]

rbeau@my-deja.com wrote:
> 
> I have a program that I need to run in the
> background while my computer goes about its normal
> business.  How might I be able to accomplish this?

    perldoc -q background

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 12 Oct 2000 06:07:51 GMT
From: ambidexter@my-deja.com
Subject: Silly newbie question (Net::POP3)
Message-Id: <8s3kfl$o96$1@nnrp1.deja.com>

I'm having a go at Net::POP3, and seem to be hitting a stumbling block.
I'm trying to write the contents of a message to a temporary file, and
while the file does get created, nothing ever seems to get written to
it. Here's a quick example:

#!/usr/local/bin/perl
use Net::POP3;

$pop = Net::POP3->new("pop.mydomain.net", Debug => 1);

$pop->user("myuser");
$total_msgs = $pop->pass('mypass');
print $total_msgs . "\n";
open(TEMPMSG,">temp");
$pop->get(($total_msgs-1),<TEMPMSG>);
$pop->quit();

And here's what I see in stdout:

Net::POP3: Net::POP3(2.21)
Net::POP3:   Net::Cmd(2.18)
Net::POP3:     Exporter(5.562)
Net::POP3:   IO::Socket::INET(1.25)
Net::POP3:     IO::Socket(1.26)
Net::POP3:       IO::Handle(1.21)

Net::POP3=GLOB(0x1a629a4)<<< +OK <13235.971330644@mydomain.net>
Net::POP3=GLOB(0x1a629a4)>>> USER myuser
Net::POP3=GLOB(0x1a629a4)<<< +OK
Net::POP3=GLOB(0x1a629a4)>>> PASS ....
Net::POP3=GLOB(0x1a629a4)<<< +OK
Net::POP3=GLOB(0x1a629a4)>>> STAT
Net::POP3=GLOB(0x1a629a4)<<< +OK 3 4341
3
Net::POP3=GLOB(0x1a629a4)>>> RETR 2
Net::POP3=GLOB(0x1a629a4)<<< +OK
Net::POP3=GLOB(0x1a629a4)>>> QUIT
Net::POP3=GLOB(0x1a629a4)<<< +OK


When all this is done, I've got a 0 byte file called temp and nuthin
else. What am I not doing? Thanks!


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


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

Date: Thu, 12 Oct 2000 12:17:58 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: simulate keyboard activity
Message-Id: <MPG.144fca6548c66ec4989816@localhost>

bhaskaracharya@my-deja.com wrote ..
>how can i simulate a keyboard entry? is this possible with perl?

in what context ? .. do you mean that you're interacting with some other 
program and you want to send it a key ? .. or do you want the Perl 
program to pretend to be a shell and receive keys as they are typed ?

more details - or have a look at Term::ReadKey if you're asking the 
latter question

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 12 Oct 2000 04:08:59 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Solved: Don't ignore a SIGCHLD!
Message-Id: <G2Au70.Dn@news.boeing.com>

In article <39E48929.A7816F33@avaya.com>,
David Haertig  <haertig@avaya.com> wrote:
>Hi -
>
>Figured it out.  The program in question was setting SIGCHLD
>to IGNORE prior to the system call.  Don't know why anyone would
>want to do this, but the person who originally wrote the program
>felt a need to, I guess.
>
>I would have thought that an ignored SIGCHLD would cause a system()
>call to hang, not return -1, but real life tests prove otherwise.
>Maybe someday I'll analyze what's happening and increase my knowledge
>in the process.
>

No, Perl's system call will use wait(2) under the covers 
which means blocking if the child's reapable or -1 if the 
child's already gone.

See perldoc -f wait

hth,
--
Charles DeRykus   


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

Date: Thu, 12 Oct 2000 13:11:23 +0800
From: "ericio" <ericio@pd.jaring.my>
Subject: Re: will perl 5 work w/o server on my PC
Message-Id: <8s3gp2$rse$1@news6.jaring.my>

im really glad to receive all this great responses by u guy...it is so
beautiful to have this kind of feeling..now i will concentrate learning this
new things in 3 years time in order to master it...tq so much
"Craig Berry" <cberry@cinenet.net> wrote in message
news:su9s04mqr5774f@corp.supernews.com...
> Cameron Dorey (camerond@mail.uca.edu) wrote:
> : Craig Berry wrote:
> : > ericio (ericio@pd.jaring.my) wrote:
> : > : im using WinME...i manage to install the activeperl 5.005
> : > : can i ask whether i can develop the CGI using perl without any web
server on
> : > : my terminal???
> : >
> : > You have my permission.  If anyone challenges you, have them come talk
to
> : > me.
> :
> : From Webster's Revised Unabridged Dictionary (1913) :
>
> I *did* go on to answer the question, you may have noticed.  It just
> struck me as a humorously misdirected question.
>
> --
>    |   Craig Berry - http://www.cinenet.net/~cberry/
>  --*--  "Quidquid latine dictum sit, altum viditur."
>    |




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

Date: Thu, 12 Oct 2000 13:12:26 +0800
From: "ericio" <ericio@pd.jaring.my>
Subject: Re: will perl 5 work w/o server on my PC
Message-Id: <8s3gr1$rso$1@news6.jaring.my>

tq so much Mr Jeff Zucker...im so glad to have u in my way to learning this
new language...thnax a lot
"Jeff Zucker" <jeff@vpservices.com> wrote in message
news:39E494B4.EA04AE73@vpservices.com...
> ericio wrote:
> >
> > im using WinME...i manage to install the activeperl 5.005
> > can i ask whether i can develop the CGI using perl without any web
server on
> > my terminal???
>
> Sure, as long as you don't mind viewing the output of the CGI in a DOS
> box, rather than in a browser. (or jump through various hoops to save
> the output to a file before viewing or using CGI.pm's debug mode, etc.)
>
> > can i learn the perl with just in client way(using PC alone)?
>
> Yes, Perl itself is fine with just the client.  But that is Perl, not
> CGI, there is a big difference between the two.  If CGI is your main
> reason for learning Perl, then you are probably much better off just
> biting the bullet and installing a web server. Apache and many other web
> servers are free, avaialable for the PC, and easily installable.
>
> --
> Jeff




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

Date: Thu, 12 Oct 2000 14:01:53 +0800
From: "ericio" <ericio@pd.jaring.my>
Subject: Re: will perl 5 work w/o server on my PC
Message-Id: <8s3jnn$2gd$1@news5.jaring.my>

i have decided to download apache server from www.apache.org but i noticed
that it have several option like Java apache, mod_perl, Php. Should i choose
the mod perl or just download the apache server for Win32???my main purpose
is to learn CGI using perl script

"Jeff Zucker" <jeff@vpservices.com> wrote in message
news:39E494B4.EA04AE73@vpservices.com...
> ericio wrote:
> >
> > im using WinME...i manage to install the activeperl 5.005
> > can i ask whether i can develop the CGI using perl without any web
server on
> > my terminal???
>
> Sure, as long as you don't mind viewing the output of the CGI in a DOS
> box, rather than in a browser. (or jump through various hoops to save
> the output to a file before viewing or using CGI.pm's debug mode, etc.)
>
> > can i learn the perl with just in client way(using PC alone)?
>
> Yes, Perl itself is fine with just the client.  But that is Perl, not
> CGI, there is a big difference between the two.  If CGI is your main
> reason for learning Perl, then you are probably much better off just
> biting the bullet and installing a web server. Apache and many other web
> servers are free, avaialable for the PC, and easily installable.
>
> --
> Jeff




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

Date: Thu, 12 Oct 2000 04:17:35 GMT
From: Carfield Yim <carfield@my-deja.com>
Subject: Re: Will perl help me to create directory in writing file?
Message-Id: <8s3e0r$jhf$1@nnrp1.deja.com>

In article <MPG.144e7d9df1c289f98ae2a@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
> In article <slrn8u8k7u.ios.rgarciasuarez@rafael.kazibao.net> on Wed,
11
> Oct 2000 11:30:37 GMT, Rafael Garcia-Suarez <rgarciasuarez@free.fr>
> says...
> > Carfield Yim wrote in comp.lang.perl.misc:
> > >I would like to write something to a file:
> > >
> > >open(FILE, ">>file_with_fullpath");
> > >
> > >if the file and the the directory don't exist yet, will perl make
the
> > >directory for me? assume that the user run the perl program have
the
> > >right the create directory and write file.
> >
> > No. (You could have tried it yourself.)
> >
> > Some hints :
> >   -d tests the existence of a directory
> >   mkdir creates a directory
>
> Another (perhaps more useful) hint:
>
>   See the function mkpath() in the standard modules File::Path .
>
Thx for all your information.


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


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

Date: Wed, 11 Oct 2000 22:20:28 -0700
From: "mark" <idk@teleport.com>
Subject: Works on Win2000 but not on Win98!? Why? Help!
Message-Id: <%LbF5.33136$F65.1953513@nntp2.onemain.com>

The following script works fine on my Windows2000 box, but prints nothing on
my Windows98 box.  (Yes the file is in the right place on both boxes.)  I'm
running version 5.6.0 build 613 on W2K and 5.6.0 build 618 on the 98 box.

@lines = `"type c:\\testfile.txt"`;
print @lines;

What am I missing?





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

Date: Thu, 12 Oct 2000 05:42:07 GMT
From: "Kevin M. Sproule" <kmsproule@worldnet.att.net>
Subject: Re: Works on Win2000 but not on Win98!? Why? Help!
Message-Id: <PacF5.622$Ef1.35619@bgtnsc06-news.ops.worldnet.att.net>


"mark" <idk@teleport.com> wrote in message
news:%LbF5.33136$F65.1953513@nntp2.onemain.com...
> The following script works fine on my Windows2000 box, but prints nothing
on
> my Windows98 box.  (Yes the file is in the right place on both boxes.)
I'm
> running version 5.6.0 build 613 on W2K and 5.6.0 build 618 on the 98 box.
>
> @lines = `"type c:\\testfile.txt"`;
> print @lines;
>
> What am I missing?
>
>
>

Mark,

If I get rid of the double quotes it works fine on my 98 machine.  The W-98
DOS shell cannot figure out what to do with a quoted command.  It takes the
quoted command as a file name.

From the command prompt:
type "c:\testfile.txt"    << Works
"type c:\testfile.txt"    << Fails

Kevin




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

Date: Thu, 12 Oct 2000 15:18:18 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Works on Win2000 but not on Win98!? Why? Help!
Message-Id: <xdcF5.11$dy4.4404@vic.nntp.telstra.net>

"mark" <idk@teleport.com> wrote in message
news:%LbF5.33136$F65.1953513@nntp2.onemain.com...
> The following script works fine on my Windows2000 box, but prints
nothing on
> my Windows98 box.  (Yes the file is in the right place on both boxes.)
I'm
> running version 5.6.0 build 613 on W2K and 5.6.0 build 618 on the 98
box.
>
> @lines = `"type c:\\testfile.txt"`;
> print @lines;
>

Well, I get the same results as you (works on Win2k but not 98) but I
have to ask the question "Why do it that way?"

It spawns an uneccesary extra process and is obviously very
non-portable.

It would be better to do:

open (IN, 'c:/testfile.txt') or die "Unable to open $!";
@lines = <IN>;
close IN;
print @lines;

This would be more portable, avoids backwacking the backslash, reports
any error with failing to open the file, and reads and prints all lines
within the single Perl script.

It is also guaranteed to work on both Win2k and 98, as well as NT and
95, and with the exception of the 'c:' bit would also work on all *nix.

That last thing could be fixed real easily too.

Beware of reading all lines into an array if your file can be
large...you can gobble memory real quickly.  It is perfectly OK for
small files though (the definition of small may be somewhat system
dependent).

Wyzelli

--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

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


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