[25213] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7458 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 28 18:06:08 2004

Date: Sun, 28 Nov 2004 15:05:06 -0800 (PST)
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, 28 Nov 2004     Volume: 10 Number: 7458

Today's topics:
        ©Ê«½«½¼ö½u <pepe_0816@yahoo.com.tw>
    Re: anyone tried http-proxy on windows? (harris)
        Beginners question. $_ Variable. (Mitchell Hulscher)
    Re: Beginners question. $_ Variable. <momichan@yahoo.com>
    Re: DEFINEs in Perl? <dformosa@zeta.org.au>
    Re: export to excel <eon@hotmail.com>
        FAQ 4.25: How do I expand tabs in a string? <comdog@panix.com>
        FAQ 8.8: How do I get the screen size? <comdog@panix.com>
        hashing function <usenet@riddlemaster.org>
    Re: hashing function <Juha.Laiho@iki.fi>
    Re: hashing function <fxn@hashref.com>
    Re: hashing function <fxn@hashref.com>
    Re: hashing function xhoster@gmail.com
    Re: hashing function <junk@blackwater-pacific.com>
    Re: hashing function <mikedeskevich@gmail.com>
    Re: help for exec with command lines with spaces (PilotMI80)
    Re: newbie question. Please help! <jurgenex@hotmail.com>
    Re: newbie question. Please help! <eon@hotmail.com>
    Re: no acceptable C compiler (Marcus)
        Reaping dead children <mike53@moocow.tu-bs.de>
    Re: Transiting from Perl: Learn Python or Ruby? <karlUNDERSCOREkramsch@yahooPERIODcom.invalid>
        Trip to Disney (mickey)
        Unix commands and perl (AS)
    Re: What is 1; <nospam@nospam.com>
        Win32API::Registry, RegOpenKeyEx fails [The parameter i (Rene Nyffenegger)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Nov 2004 12:04:31 GMT
From: "½âºë" <pepe_0816@yahoo.com.tw>
Subject: ©Ê«½«½¼ö½u
Message-Id: <cocesf$r911688@imsp212.netvigator.com>

¤ß«ä«ä¸ÕÅ¥ +86 13180152666



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

Date: 28 Nov 2004 12:37:21 -0800
From: harris_m@yahoo.com (harris)
Subject: Re: anyone tried http-proxy on windows?
Message-Id: <af968c64.0411281237.705ff602@posting.google.com>

harris_m@yahoo.com (harris) wrote in message news:<af968c64.0411161842.2113421a@posting.google.com>...
> Hello,
> Anyone tried to install and run http-proxy module on windows 2000 or
> win-xp?
> 
> I gave it a try. The program hangs up. Any one had luck to get this
> working on windows?
> Harris M.

if any one interested, i found the problem. It is a call "fork" used
in the implementation of this module. On windows "fork" is implemented
with warning message "experimental". this module fails (hangs up) on
"fork" call.


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

Date: 28 Nov 2004 19:04:14 GMT
From: unacceptable@gmail.com (Mitchell Hulscher)
Subject: Beginners question. $_ Variable.
Message-Id: <41aa212e$0$10243$ba620dc5@nova.planet.nl>

Hello everyone,

Since a few weeks I've been trying to learn Perl and so far it's 
been going quite good. 
My only problem is that I can't really figure out what the $_ 
variable does or is. 
I know this might sound as a very stupid question, 
but whether I am dumb or all tutorials I read are written silly, 
I just can't seem to figure it out.

I thought of a theory that the $_ variable gets assigned to the 
latest scalar assigned.
But of course, no results.

If someone could please help me, I'd really appreciate it.

Mitch. :-)

----------------------------------------------
Posted with NewsLeecher v2.0 Beta 5
 * Binary Usenet Leeching Made Easy
 * http://www.newsleecher.com/?usenet
----------------------------------------------



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

Date: Sun, 28 Nov 2004 11:31:58 -0800
From: momichan <momichan@yahoo.com>
Subject: Re: Beginners question. $_ Variable.
Message-Id: <7s9kq01gvafjqslhsqe6makpf1qm0d28nl@4ax.com>

On 28 Nov 2004 19:04:14 GMT, unacceptable@gmail.com (Mitchell
Hulscher) wrote:

>Hello everyone,
>
>Since a few weeks I've been trying to learn Perl and so far it's 
>been going quite good. 
>My only problem is that I can't really figure out what the $_ 
>variable does or is. 
>I know this might sound as a very stupid question, 
>but whether I am dumb or all tutorials I read are written silly, 
>I just can't seem to figure it out.
>
>I thought of a theory that the $_ variable gets assigned to the 
>latest scalar assigned.
>But of course, no results.
>
>If someone could please help me, I'd really appreciate it.
>
>Mitch. :-)
>
>----------------------------------------------
>Posted with NewsLeecher v2.0 Beta 5
> * Binary Usenet Leeching Made Easy
> * http://www.newsleecher.com/?usenet
>----------------------------------------------


The most common special variable is $_, which contains the default
input and pattern-searching string. For example: 

foreach ('hickory','dickory','doc') {
        print;
}
The first time the loop is executed, "hickory" is printed. The second
time around, "dickory" is printed, and the third time, "doc" is
printed. That's because in each iteration of the loop, the current
string is placed in $_ and is used by default by print. Here are the
places where Perl will assume $_, even if you don't specify it: 

Various unary functions, including functions such as ord and int, as
well as the all file tests (-f, -d), except for -t, which defaults to
STDIN. 

Various list functions such as print and unlink. 

The pattern-matching operations m//, s///, and tr/// when used without
an =~ operator. 

The default iterator variable in a foreach loop if no other variable
is supplied. 

The implicit iterator variable in the grep and map functions. 

The default place to put an input record when a line-input operation's
result is tested by itself as the sole criterion of a while test
(i.e., <filehandle>). Note that outside of a while test, this does not
happen. 


remember to use "perldoc perlvar"


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

Date: 29 Nov 2004 06:42:13 +1100
From: ? the Platypus {aka David Formosa} <dformosa@zeta.org.au>
Subject: Re: DEFINEs in Perl?
Message-Id: <m3llclyd4a.fsf@dformosa.zeta.org.au>

William Ahern <william@wilbur.25thandClement.com> writes:

[...]

> Indeed, AFAIK constants might be just as fast as literals. I seem to
> remember constants being called like subroutines, however perldoc constant
> doesn't leave me that impression at all.

The optimizer inlines the constent's subroutine call so its just like
a literal call.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.


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

Date: Sun, 28 Nov 2004 13:57:00 GMT
From: "Leon" <eon@hotmail.com>
Subject: Re: export to excel
Message-Id: <MOkqd.1374$gw4.826@newsfe6-gui.ntli.net>

"ocap" <ocap8891@yahoo.it> wrote in message
news:c4495e9e.0411280102.3e882960@posting.google.com...
> I would like write to Excel file the result of a query on a db table
> with a CGI Perl. My CGI allows output to HTML table by Template.pm
> module; can you help me?
> With Java it's very easy
>
>       response.setContentType("application/vnd.ms-excel")
>
> But with Perl? In the same script I want allow output in html and
> output in excel file (user choices). Can I do it using Template.pm
> module?
>
> Hi
> ocap
Not sure about the Template.pm as I haven't used it, but you could just
write the results from your query out to a .csv file.  This would be Excel
friendly and very easy to import.




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

Date: Sun, 28 Nov 2004 17:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 4.25: How do I expand tabs in a string?
Message-Id: <cod0c5$t2k$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

4.25: How do I expand tabs in a string?

    You can do it yourself:

        1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;

    Or you can just use the Text::Tabs module (part of the standard Perl
    distribution).

        use Text::Tabs;
        @expanded_lines = expand(@lines_with_tabs);



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: Sun, 28 Nov 2004 23:03:04 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 8.8: How do I get the screen size?
Message-Id: <codlf8$76b$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

8.8: How do I get the screen size?

    If you have Term::ReadKey module installed from CPAN, you can use it to
    fetch the width and height in characters and in pixels:

        use Term::ReadKey;
        ($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize();

    This is more portable than the raw "ioctl", but not as illustrative:

        require 'sys/ioctl.ph';
        die "no TIOCGWINSZ " unless defined &TIOCGWINSZ;
        open(TTY, "+</dev/tty")                     or die "No tty: $!";
        unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
            die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
        }
        ($row, $col, $xpixel, $ypixel) = unpack('S4', $winsize);
        print "(row,col) = ($row,$col)";
        print "  (xpixel,ypixel) = ($xpixel,$ypixel)" if $xpixel || $ypixel;
        print "\n";



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: Sun, 28 Nov 2004 12:56:01 -0500
From: Dan Jones <usenet@riddlemaster.org>
Subject: hashing function
Message-Id: <scCdncuU0M45jDfcRVn-vw@speakeasy.net>

I'm working with some large (several hundred megs) flat database files.  I
need to examine the records for duplicates.  Obviously, I don't want to
store several hundred megs of data in a hash.  What I'd like to do is to
read each record, generate a hash value for the record, store that hash
value and an index key rather than storing the entire record, and look for
collisions in the hash value.  

Perl obviously uses an internal hashing function to create it's hash
variables.  Is it possible to access this function or to get the actual
hash value it produces?  If not, any pointers to a module or information on
writing a hashing function in Perl would be appreciated.  Hashing functions
usually involve low level bit twiddling.  While it's probably possible to
do this directly in Perl (what isn't?), I don't know enough Perl to do it. 
Right now, I'm looking at using a C function, then having to integrate that
with Perl.  I'd really prefer to keep this a pure Perl script if I can.

I've been through the Camel, the Panther, and the Ram without finding
anything relevant.  The Cookbook does mention that using hashes to search
for dupes is memory intensive if you have large records but doesn't provide
any alternatives that I could find.  Searching for information on hashing
functions and Perl on the web has proven to be an exercise in futility due
to the naming collision with the variable type.

Thanks in advance for any assistance.




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

Date: Sun, 28 Nov 2004 18:37:39 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: hashing function
Message-Id: <cod5tj$vrl$1@ichaos.ichaos-int>

Dan Jones <usenet@riddlemaster.org> said:
>I'm working with some large (several hundred megs) flat database files.  I
>need to examine the records for duplicates.  Obviously, I don't want to
>store several hundred megs of data in a hash.
 ...
>If not, any pointers to a module or information on writing a hashing
>function in Perl would be appreciated.

MD5 ans SHA1 are two commonly used hashing functions, and implementations
for both are available as perl modules.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: 28 Nov 2004 12:06:44 -0800
From: "Xavier Noria" <fxn@hashref.com>
Subject: Re: hashing function
Message-Id: <1101672404.193370.127880@z14g2000cwz.googlegroups.com>

Storing the hash code and an index is what the $hash{$record}++ idiom
does, the post seem to assume that the record itself is being stored in
the hash. Just to avoid a misconception, that's not the case.

Did you already try that simple solution and it wasn't suitable?

-- fxn



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

Date: 28 Nov 2004 12:11:46 -0800
From: "Xavier Noria" <fxn@hashref.com>
Subject: Re: hashing function
Message-Id: <1101672706.449519.138890@z14g2000cwz.googlegroups.com>

I don't know what was I thinking about, that's completely wrong. I am
very sorry.

-- fxn



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

Date: 28 Nov 2004 21:23:46 GMT
From: xhoster@gmail.com
Subject: Re: hashing function
Message-Id: <20041128162346.830$Gp@newsreader.com>

Dan Jones <usenet@riddlemaster.org> wrote:
> I'm working with some large (several hundred megs) flat database files.
> I need to examine the records for duplicates.  Obviously, I don't want to
> store several hundred megs of data in a hash.

I don't consider that to be at all obvious.  I often want to and often do
store several hundred meg of data in a hash.

Is there no subset of the record which would be suitable for identifying
duplicates?

> What I'd like to do is to
> read each record, generate a hash value for the record, store that hash
> value and an index key

You would potentially need a list of index keys, not just one index key.
Otherwise what would you do when different records collide on the
same hash values?

> rather than storing the entire record, and look
> for collisions in the hash value.

And then use the index values to go back and look up the whole records
and compare them properly?  Wouldn't it be easier to use system sort
routines or a proper database server?

> Perl obviously uses an internal hashing function to create it's hash
> variables.  Is it possible to access this function or to get the actual
> hash value it produces?

This seems to work.  No gaurantees:

#!/usr/bin/perl -wl

use strict;
use Inline 'C' ;

foreach (1..1_000_000) {
  print calc($_);
};

__DATA__
__C__

size_t calc(SV* sv) {
  char * c;
  size_t size;
  size_t hash;

  c=SvPV(sv,size);
  PERL_HASH(hash,c,size);
  return hash;
};



> If not, any pointers to a module or information
> on writing a hashing function in Perl would be appreciated.  Hashing
> functions usually involve low level bit twiddling.  While it's probably
> possible to do this directly in Perl (what isn't?), I don't know enough
> Perl to do it. Right now, I'm looking at using a C function, then having
> to integrate that with Perl.  I'd really prefer to keep this a pure Perl
> script if I can.

The C code behind PERL_HASH is given in PERLDOC PERLGUTS.  You could easily
translate that into Perl.

Others have mentioned modules for hashing functions which are intended
more for security than efficiency.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Sun, 28 Nov 2004 14:14:33 -0800
From: Steve May <junk@blackwater-pacific.com>
Subject: Re: hashing function
Message-Id: <10qkj7n99rlhr8d@corp.supernews.com>

Dan Jones wrote:

> I'm working with some large (several hundred megs) flat database files.  I
> need to examine the records for duplicates.  Obviously, I don't want to
> store several hundred megs of data in a hash.  What I'd like to do is to
> read each record, generate a hash value for the record, store that hash
> value and an index key rather than storing the entire record, and look for
> collisions in the hash value.  
> 
> Perl obviously uses an internal hashing function to create it's hash
> variables.  Is it possible to access this function or to get the actual
> hash value it produces?  If not, any pointers to a module or information on
> writing a hashing function in Perl would be appreciated.  Hashing functions
> usually involve low level bit twiddling.  While it's probably possible to
> do this directly in Perl (what isn't?), I don't know enough Perl to do it. 
> Right now, I'm looking at using a C function, then having to integrate that
> with Perl.  I'd really prefer to keep this a pure Perl script if I can.
> 
> I've been through the Camel, the Panther, and the Ram without finding
> anything relevant.  The Cookbook does mention that using hashes to search
> for dupes is memory intensive if you have large records but doesn't provide
> any alternatives that I could find.  Searching for information on hashing
> functions and Perl on the web has proven to be an exercise in futility due
> to the naming collision with the variable type.
> 
> Thanks in advance for any assistance.
> 
> 

Hmmm.. well, for what it's worth, I'd think seriously about calcing 
checksums for each record (probably using unpack), recording the line 
numbers or positions for checksums that match, then more closely inspect 
records with matching checksums...

Just a thought, and maybe I'm all wet...

\s


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

Date: 28 Nov 2004 14:40:43 -0800
From: "Mike  Deskevich" <mikedeskevich@gmail.com>
Subject: Re: hashing function
Message-Id: <1101681643.922122.58120@f14g2000cwb.googlegroups.com>

rather than trying to store the data in the hash (which you said you
didn't want to do), why not just use the hash to keep track of how many
records there are of each key.  something like this

%hash={}  #or however you make an empty hash, i don't use them often so
i don't know off the top of my head how to do it.
while (<DATAFILE>)
{
$key=get_key_from_record ($_);  #or however you get the key from the
record just read in
$num=(%hash{$key}++);
if ($num>1)
  {
    #record is a dupe, do what you want with it
  }
}



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

Date: 28 Nov 2004 10:23:32 -0800
From: pilotmi80@hotmail.com (PilotMI80)
Subject: Re: help for exec with command lines with spaces
Message-Id: <9b14a223.0411281023.509c1ad6@posting.google.com>

Finally I managed to do what I wished :
my $ProgramExe = "\"C:\\The path to the\\executable.exe\"";
my $OneArgument = "OneArgumentThatDoesNotContainSpace";
my $SecondArgument = "\"D:\\Another Argt\\that contains spaces\"";

system("start \"\"", $ProgramExe, $OneArgument, $SecondArgument);

Some explanations for the ones who may encounter this concern (and
feel free to correct me if I am wrong or not precise enough) :
- system behaves differently whether it is passed a scalar argument or
a list. I will not repeat the FAQ but it is often useful to force LIST
context to avoid misinterpretation by the shell. (So we meet the form
exec {"FakeName"} @ForcedToBeListCommandLine)

- I use "start" because I'm running on Win32, so it let the system
launch a program as if it was launched from the start menu/Run.
Otherwise, the script waits for the command to end (exec does not work
neither cause it just turns the script process to the one just
launched and there is no point of return)

- \"\" is the FakeName, the name we invoked the program under. (In
this case I don't need to pretend my program was launched under a
particular name so I let it blank)

- $ProgramExe and $SecondArgument were quoted in order to have the
white spaces preserved on the command line issued;
- $OneArgument does not contain any white space so I let it unquoted

- I kept my different arguments in a LIST (and thus separated) not to
have to rebuild my command line for any argument I want to issue but
they could have been grouped together into one argument.

Hope it will help someone


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

Date: Sun, 28 Nov 2004 12:56:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: newbie question. Please help!
Message-Id: <nWjqd.1648$1z5.801@trnddc06>

L. Hao wrote:
> Hello, I am new to Perl. What I am trying to do is to get and parse
> the result of a system function execution.

You should read the documentation for the functions you are using.
The third paragraph of 'perldoc -f system' describes how to get the actual 
exit value of the program executed by system() as well as how to capture the 
output of the program executed by system().

> The system function is the file comparison, cmp, i.e.
> system(" cmp -xl $file1 $file2") && die "failed"
>
> If the file1 and file2 are not identical, cmp returns the detailed
> differences by bytes. What do I need to do to get this results and
> parse them in Perl? To be specific about parsing, I'd like to get the
> index of differences.

You will have to show us the detailed format, then we may be able to show 
you how to parse it.
But chances are that it will involve some form of split() or Text::CSV.

jue 




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

Date: Sun, 28 Nov 2004 13:51:11 GMT
From: "Leon" <eon@hotmail.com>
Subject: Re: newbie question. Please help!
Message-Id: <jJkqd.1346$gw4.221@newsfe6-gui.ntli.net>

"L. Hao" <lhao@NOSPAMcomcast.net> wrote in message
news:SBeqd.108661$5K2.58365@attbi_s03...
> Hello, I am new to Perl. What I am trying to do is to get and parse the
> result of a system function execution. But I am not sure how to do it.
>
> The system function is the file comparison, cmp, i.e.
> system(" cmp -xl $file1 $file2") && die "failed"
>
> If the file1 and file2 are not identical, cmp returns the detailed
> differences by bytes. What do I need to do to get this results and parse
> them in Perl? To be specific about parsing, I'd like to get the index of
> differences.
>
> Thanks a lot.
>
> Li
>
>

Try ...

@Result = `cmp -xl $file1 $file2`;

 ...then just treat as normal array.




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

Date: 28 Nov 2004 11:05:21 -0800
From: mygooglegroupsaccount@yahoo.com (Marcus)
Subject: Re: no acceptable C compiler
Message-Id: <6fc26ca7.0411281105.1d4eb31d@posting.google.com>

Thanks! Sorted.

burlo_sumproot@yahoo.se wrote in message news:<uact6yzjp.fsf@notvalid.se>...
> mygooglegroupsaccount@yahoo.com (Marcus) writes:
> 
> Please dont top post. (text moved below where it belongs)
> 
> > Tony Curtis <tony_curtis32@yahoo.com> wrote in message news:<87653udbag.fsf@limey.hpcc.uh.edu>...
> > > >> On 24 Nov 2004 16:24:33 -0800,
> > > >> mygooglegroupsaccount@yahoo.com (Marcus) said:
>  
> > > > hi when trying to install image::magick perl module I get
> > > > the following:
>  
> > > > error: no acceptable C compiler found in $PATH
>  
> > > > what c compiler should I install on my server? is there a
> > > > module?
> > > 
> > > You need to ask this question in a group related to your OS.
> >
> > Im running a Unix server
> 
> 
> Assuming "Unix server" means Solaris go to http://www.sunfreeware.com/ and install gcc.
> 
> If not follow Tonys advice.


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

Date: 28 Nov 2004 11:19:29 GMT
From: Mike Dowling <mike53@moocow.tu-bs.de>
Subject: Reaping dead children
Message-Id: <slrncqjd21.j3.mike53@moocow.localhost>

I'm having problems reaping my dead children.

I have written a perl script that starts a monster program that
determines optimal schedules for my companies power plants.  It can
happen that the optimisation software takes hours, months, or years.
Obviously, we would like to interrupt the program when that happens, but
my perl script is blocked until the monster finishes, or until it's
interrupted.  So I start a second process with "fork" that writes info
from the log file that the monster is continually writing.  I don't want
that second process to become a zombie, so I reap dead children ising:

use POSIX ":sys_wait_h";

$SIG{CHLD} = \&REAPER;

sub REAPER {    # reap my dead children to avoid zombies
  my $stiff;
  while (($stiff = waitpid(-1, WNOHANG)) > 0) { }
  $SIG{CHLD} = \&REAPER;
}

Now my child can rest in peace.

But, and here's the problem, if monster terminates with an error
message, I want to cath that, and analyse why.  With any kind of
reaping,  including

$SIG{CHLD} = 'IGNORE'

(I am really not interested in why my child dies), the status code
returned by monster is changed.  I don't care that happens to dead
children started by "fork", but it is vital to check why a child dies
that is started with "system".  What can be done?

Cheers,
Mike Dowling

-- 
Sorry, after years of fighting spam, I've given in.  I changed
my email address, and don't want to reveal it to spammers.  I
understand any wrath therby incurred, but I'm no longer in any
position to continue the fight.


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

Date: Sun, 28 Nov 2004 15:33:29 +0000 (UTC)
From: KKramsch <karlUNDERSCOREkramsch@yahooPERIODcom.invalid>
Subject: Re: Transiting from Perl: Learn Python or Ruby?
Message-Id: <cocr49$ree$1@reader1.panix.com>

In <slrncqj3p5.2r7.tassilo.von.parseval@localhost.localdomain> "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> writes:

>As it happens, the Pythonic flaws
>can be a real spoiler when it comes to large projects in particular.
>...
>[Ruby] avoids most of Python's serious shortcomings for
>programming-in-the-large.

What are those shortcomings, in your opinion?

	Karl
-- 
Sent from a spam-bucket account; I check it once in a blue moon.  If
you still want to e-mail me, cut out the extension from my address,
and make the obvious substitutions on what's left.


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

Date: Sun, 28 Nov 04 16:27:27 GMT
From: mickey@travelexpert2004.biz(mickey)
Subject: Trip to Disney
Message-Id: <04112816272747853@newshost.allthenewsgroups.com>

GET YOUR TRIP
TRIPS TO DESNEY
TRIPS TO HAWAII


http://travelexpert2004.us

http://travelexpert2004.biz

http://gotraveling85.us




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

Date: 28 Nov 2004 14:45:58 -0800
From: solanki1961@yahoo.com (AS)
Subject: Unix commands and perl
Message-Id: <5d085a51.0411281445.34c019fb@posting.google.com>

Hi,

I tried to run a set of Unix commands (separated by |) using the
'system' command from a perl script, but only a single command works. 
What is a good way to do this?

I need to take the output of one command put it into the next one use
that ooutput in a third command. e.g.,
system ('id | awk '{print $2}' |  cut -d\( -f2 | cut -d\) -f1');

This command in itself gives me the current user's set primary group
in Unix (Solaris)


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

Date: Sun, 28 Nov 2004 17:52:05 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: What is 1;
Message-Id: <1101682407.386908@nntp.acecape.com>

"Ian Pellew" <ipellew@pipemedia.co.uk> wrote in message
news:30875970.0411250714.30fb8502@posting.google.com...
> Hi all;
>
> What does the
> 1;
> line of a perl script do?

nothing....it generates code, but serves no purpose....it is the smallest
and simplest progrma you could write....

not sure under what context you came across that line of code, but other
that the use below, i know of no other purpose it would be used for...."as
you typed it"

***testing to see if you have a specific perl module installed****

so let's say you want to see if you have a certain module installed....let's
say Net::POP3....from the command line you could type


perl -MNet::POP3 -e 1

perl

-e                       (execute this line of code)
1                        (the simplest line of code possible)
-M                     (execute a "use" of the folowing module)
Net::POP3         (you could use any module here in it's place)
if you have the module intalled, you would just get a command prompt upon
hitting "enter"  meanign perl ran your line of code and found that
module....if you did not have that module installed, you would get back an
error saying it could not locate that module.....

of course you could subsitite a print "hello world";  for the 1, but what's
the point?







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

Date: 28 Nov 2004 13:10:34 -0800
From: rene.nyffenegger@gmx.ch (Rene Nyffenegger)
Subject: Win32API::Registry, RegOpenKeyEx fails [The parameter is incorrect]
Message-Id: <a6d06107.0411281310.7f1d0668@posting.google.com>

Hello

When I run the code appended further down, the call
to RegOpenKeyEx fails and regLastError() returns 
"The parameter is incorrect".

As far as I can see, all is correct, but obviously, it isn't.
If someone gave me a helpful tip, I'd be very grateful.

Rene Nyffenegger

---------------->8----------->8---------->8------------

use warnings;
use strict;

use Win32API::Registry qw(:ALL);

my $handleSubKey=0;
my $handleSw    =0;

my $company = "FooBar";

my $disp=0;

if ( ! RegOpenKeyEx(
         HKEY_CURRENT_USER, 
         "Software", 
         0,      # should be zero
         KEY_ALL_ACCESS,
         $handleSw) ) {

  print regLastError();
}

print "handleSw: $handleSw\n";


if ( RegCreateKeyExW (
        $handleSw,
        $company,
        0,
        "", 
        REG_OPTION_NON_VOLATILE ,
        KEY_ALL_ACCESS,
        0, 
        $handleSubKey,
        $disp)) {

  print "$company existed already\n"           
    if $disp == REG_OPENED_EXISTING_KEY;
  print "$company didn't exist, now created\n" 
    if $disp == REG_CREATED_NEW_KEY;
}
else {
  print regLastError();
}


-- 
Rene Nyffenegger
http://www.adp-gmbh.ch


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V10 Issue 7458
***************************************


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