[22016] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4238 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 10 03:06:07 2002

Date: Tue, 10 Dec 2002 00:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 10 Dec 2002     Volume: 10 Number: 4238

Today's topics:
    Re: [FTP] Downloading a file by matching part of its na <bstutes@eskimo.com>
    Re: Cache the execution of a Perl CGI? <bstutes@eskimo.com>
    Re: can't display HTML file in browser <jurgenex@hotmail.com>
    Re: cgi and perl on windows 98 ? <os7man@attbi.com>
    Re: Currency Regular expression (Elf)
    Re: Currency Regular expression (Tad McClellan)
    Re: Determining If a Socket is Open... <smackdab1@hotmail.com>
    Re: Determining If a Socket is Open... <eric@spamnotcfm-consulting.com>
    Re: Filenames on Win32: the bane of my existence.... <pkent77tea@yahoo.com.tea>
    Re: help with Can't modify constant item in scalar assi <bstutes@eskimo.com>
    Re: HELP! Looking for a cgi <bstutes@eskimo.com>
        Invalid Base64 data msg when sending email (bpaluch)
    Re: Invalid Base64 data msg when sending email <mgjv@tradingpost.com.au>
    Re: io::socket::inet / tcp question <goldbb2@earthlink.net>
    Re: Is there a better way of doing this? <goldbb2@earthlink.net>
        log file monitor <ricardo@nospam.pt>
        Max fork'd proc limit...? (Spammay Blockay)
    Re: Max fork'd proc limit...? (Walter Roberson)
    Re: Max fork'd proc limit...? <eric@spamnotcfm-consulting.com>
    Re: Max fork'd proc limit...? (Spammay Blockay)
    Re: nother <goldbb2@earthlink.net>
    Re: Output Lines of 70 Characters <mgjv@tradingpost.com.au>
        perl speed comparisom on windows and linux (eddie wang)
    Re: perl speed comparisom on windows and linux (Malcolm Dew-Jones)
    Re: perl speed comparisom on windows and linux (Walter Roberson)
    Re: perl speed comparisom on windows and linux <SendNoSpam>
        Question about sockets <extendedpartition@NOSPAM.yahoo.com>
    Re: Question about sockets (Walter Roberson)
        read return value from a sql script using piped open <sunil_franklin@hotmail.com>
        The black list: websites banned on Google <vincentg@datashaping.com>
    Re: Trouble with macintosh file access <pkent77tea@yahoo.com.tea>
        variable/module scope in child packages <leinfidel AT netscape DOT net>
    Re: which UI for Perl? <smackdab1@hotmail.com>
    Re: which UI for Perl? <pkent77tea@yahoo.com.tea>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 10 Dec 2002 01:18:33 -0600
From: Bob Stutes <bstutes@eskimo.com>
Subject: Re: [FTP] Downloading a file by matching part of its name (code incl.)
Message-Id: <at44h1$gis$1@eskinews.eskimo.com>

Try the changes I added below.

HTH.


Bob wrote:
> # This Perl script will go out and get the latest NAV(CE)
> # definitions.
> 
> # file name ex:  20021202-05-x86.exe
> 
> # pragmas
> use strict;
> use warnings;
> 
> # modules
> use Net::FTP;
> 
> # my declares
> my $ftp;
> my $hostname = 'symantec.com';
> my $navhome = '/public/path_to/norton_antivirus/';
> my $username = 'anonymous';
> my $password = 'nobody\@spammer.com';
> my $local_dir = 'c:\\temp';
> my $net_dir = 'p:\\public\\navtemp';
> my $filename;
my $filere;
my $filelsit;
> 
> # format the first part of the file
> sub filename {
>     my($day, $month, $year) = (localtime)[3, 4, 5];
>     $month++;
>     $year += 1900;
>     $day--;  # subtract a day
>     
>     my $file = sprintf '%04d%02d%02d', $year, $month, $day;
> }
> 
> # connect to the ftp site
> $ftp = Net::FTP->new($hostname);
> $ftp->login($username, $password);
> $ftp->cwd($navhome);
$filere = filename () . '-\d+-x86\.exe';
@filelist = $ftp->ls;
for (@filelist) {
     if (/($filere)/) {
         $filename = $1;
         last;
     }
}
> 
> # now get the file
if (defined $filename) {
> $ftp->type("binary");
> $ftp->get($filename);
} else {
   print "No new udpates today.\n";
}
> $ftp->quit;
> 
> The NAV file has a particular format of 20021202-05-x86.exe and I want
> to match the date in the first part (20021202) and make sure I get the
> EXE file and not the ZIP. I have muddled through the above (I am
> learning!) but now I need to match the the sprintf from the sub to the
> file name and make sure it is the EXE, and that is where I am stuck.
> 
> Help?
> 
> Bob
> 
> P.S. I read c.l.p.misc quite frequently so post here please.  : )

-- 
Bob Stutes - St. Louis, Mo.
Unix Administrator and General Geek Wanna-Be
e-mail: bstutes@eskimo.com

The Wisdom of the ages may be found ... if you will only look up.
                                           Unknown.



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

Date: Tue, 10 Dec 2002 00:46:00 -0600
From: Bob Stutes <bstutes@eskimo.com>
Subject: Re: Cache the execution of a Perl CGI?
Message-Id: <at42j9$fsm$1@eskinews.eskimo.com>

Check out FastCGI at 
http://www.cpan.org/author/JHI/perl-5.8.0/lib/CGI/Fast.pm

HTH

Peter Wu wrote:
> I'm doing CGI programming in Perl.
> 
> I understand that an CGI script is interpreted when requested instead of
> being compiled into native code before executed.
> 
> I wonder if there is anything that can *cache* the native code generated by
> the 1st execution of that particular CGI. Say, I have a test.cgi. When a
> request for the test.cgi arrives, the cgi script gets interpreted and
> executed. Afterwards, it will get interpreted for the 2nd time when a 2nd
> request arrives.
> 
> Thanks for any input.
> 
> --
> This message is provided "AS IS" with no warranties, and confers no rights.
> 
> 

-- 
Bob Stutes - St. Louis, Mo.
Unix Administrator and General Geek Wanna-Be
e-mail: bstutes@eskimo.com

The Wisdom of the ages may be found ... if you will only look up.
                                           Unknown.



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

Date: Mon, 09 Dec 2002 23:41:02 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: can't display HTML file in browser
Message-Id: <iS9J9.2195$cn2.1160@nwrddc02.gnilink.net>

PERLProgrammer@nowhere.com wrote:
> My PERL script creates several HTML files (in the same directory),
> but when I try to display any of them in a browser, I get an 'HTTP
> 500 Internal server error' message. Any ideas as to why this is
> happening?

Did you try the FAQ? Please see "perldoc -q 500"?

jue




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

Date: Tue, 10 Dec 2002 03:57:23 GMT
From: Eric Osman <os7man@attbi.com>
Subject: Re: cgi and perl on windows 98 ?
Message-Id: <3DF56692.332D78F8@attbi.com>


> > o        What I'm really trying to implement is to have
> >          a filled-out-form on an html page be sent
> >          through email when SUBMIT button is pressed.
> 
> Have you thought this through?  What are you really trying to achieve?
> Lots of people messing around like that have found themselves creating
> spam-relays, and getting their server blacklisted, so be sure you know
> what you're getting into.
> 


These are pretty strong words.  Please explain what
you're referring to.

Also, this comment:

>>          be left in their email client and they have
>>          to click the send button themselves
>
>I should bloody-well hope so.  Who wants to be sending 
>inadvertent emails?  You trying to write a virus or 
> something?

Whether a design manages to use "mailto:" to send
the email automatically, or the design features
a "submit" button that talks to cgi and perl to
send the email, both are doing the same result, mainly
sending the form info off to someone in an email.

So what's your point ?  Why would one of these be
bad and the other good ?

Or are you saying both are bad ?  If you're saying
both are bad, what would you suggest happen when
the "SUBMIT" button is clicked on a form.

I mean, if the cgi/perl sends the form info into
a database, someone still needs to be alerted that
there's a new record in the database, particularly
if the form being filled out is a request for
a product or for information.

/Eric

-- 
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html


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

Date: 9 Dec 2002 15:05:10 -0800
From: smltestau@yahoo.com.au (Elf)
Subject: Re: Currency Regular expression
Message-Id: <6c45ec57.0212091505.e13da99@posting.google.com>

Thanks all for your help.

This expression is only for validating Aus $'s, so I'm not worried
about other currency formats.

I came in this morning and it worked.  Odd, perhaps I was testing
against a dodgy test case (who knows)...  Thanks anyway for the
responses.

My resultant expression for future reference is as follows...

RegExp( /^\$?(?:\d+|\d{1,3}(?:,\d{3})*)(?:\.\d{1,2}){0,1}$/ );

\$?                - Optional $ at the beginning
(?:                - Either
  \d+              - 1 or more digits
|                  - Or
  \d{1,3}          - A group of 1-3 digits
  (?:,\d{3})*      - 0 or more groups of a comma followed by 3 digits
)                  - End options
(?:\.\d{1,2}){0,1} - Optional group of full stop followed by 1-2
digits

On the last bit, can I potentialy do (?:\.\d{1,2})? .  The reason I
ask is that the docko says says that the ? following a ) makes the
pattern a non-greedy pattern match.  So I assume I need to use the
explicit {0,1}.  Any comments (again this is for JavaScript)?

Regards
Elf


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

Date: Mon, 9 Dec 2002 20:15:51 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Currency Regular expression
Message-Id: <slrnavajin.2qt.tadmc@magna.augustmail.com>

Elf <smltestau@yahoo.com.au> wrote:

> (?:\.\d{1,2}){0,1} - Optional group of full stop followed by 1-2

> On the last bit, can I potentialy do (?:\.\d{1,2})? .  


Yes.


> The reason I
> ask is that the docko says says that the ? following a ) makes the
> pattern a non-greedy pattern match.  


Then the docko is wrong. What doc are you referring to?

A ? following a _quantifier_ makes it non-greedy:

   +?
   *?
   ??
   {0,1}?


> Any comments (again this is for JavaScript)?


Ask in the Perl newsgroup, get the Perl answer.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 09 Dec 2002 23:35:45 GMT
From: "smackdab" <smackdab1@hotmail.com>
Subject: Re: Determining If a Socket is Open...
Message-Id: <lN9J9.23399$jf7.1510719@news2.west.cox.net>


"Brad W. Galiette" <brad.galiette@snet.net> wrote in message
news:or7J9.3229$p26.853593109@newssvr10.news.prodigy.com...
> How would one go about determining if a client is still active on a
> server-based socket? (i.e., does the socket remain open and is there a
> computer at the other end? :-)

My understanding is that you can't w/o sending it some data.  You could
send it your own "are you alive?" message and see if it replies in a timely
manner, but the other
side could be blocked, so it is hard to tell the differrence...this also
assumes that you wrote
the other side or know how it works...





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

Date: Tue, 10 Dec 2002 03:59:23 GMT
From: "Eric" <eric@spamnotcfm-consulting.com>
Subject: Re: Determining If a Socket is Open...
Message-Id: <vEdJ9.307476$P31.118070@rwcrnsc53>

Hi Brad,

You probably need the IO::Select package...

This is completly untested code, but in principle that should give you the
general idea:

use IO::Select ;
use IO::Socket;

$server = IO::Socket::INET->new(@usual_drill) or die "dead because $@\n" ;
$select = IO::Select->new($server) ;

while (1 ) {
    $client = $server->accept() ) ;
    $select->add($client) ;
    @can_read = $select->can_read(1) ;
    foreach $reader (@can_read) {
        if ($reader == $client) {
            #   There is stuff coming out from the client
                $handle = $server ;
        } else {
            #stuff coming out from the server
            $handle = $client ;
        }
        $rv = $reader->recv($buffer, POSIX::BUFSIZ, 0) ;
        print $handle $buffer ;
    }
}

As I said, untested... The idea is to check with can_read whether any handle
have stuff in it,  and if so, read it, and pass it on
to the other $handle, assume it can write.

I hope that helps,
    Eric


> How would one go about determining if a client is still active on a
> server-based socket? (i.e., does the socket remain open and is there a
> computer at the other end? :-)
>
> Brad




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

Date: Tue, 10 Dec 2002 01:10:17 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Filenames on Win32: the bane of my existence....
Message-Id: <pkent77tea-87D383.01101710122002@news-text.blueyonder.co.uk>

In article <c7c208d1.0212091255.6b0849cb@posting.google.com>,
 drsmithhm@hotmail.com (drsmith) wrote:

> The problem is that many of the filenames contain dates, spaces, and
> other special characters like umlat's.  Perl's readdir function is
> returning '?' characters in place of the special characters which
> later on causes unlink() to fail.

Is the filesystem where these files are stored a native windows local 
volume? I only ask because we use sharity, I think, on some linux 
machines to mount windows SMB shares and we get '?' is filenames in 
place of, say, Unicode characters. It might be the same thing, or maybe 
not.

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: Tue, 10 Dec 2002 01:31:45 -0600
From: Bob Stutes <bstutes@eskimo.com>
Subject: Re: help with Can't modify constant item in scalar assignment but it does not tell me why?
Message-Id: <at4592$gis$2@eskinews.eskimo.com>

Your line shuld read "$data =\%params,".  Note the missing "$" in your code.

Perl won't ket you assign to a "bareword".

Mothra wrote:
> Hi All,
> I am in the process of writing a Perl script that will run under mod_perl.
> the script uses the text template system for generating the HTML and I
> am receiving an error ( in the apache log file) that I cannot fix. So I
> added the use diagnostics to the program and ran from teh command line
> this was the result:
> -----------------result----------------
> /app/perl5.8.0/bin/perl -c new_uga.pl
> Can't modify constant item in scalar assignment at new_uga.pl line 314, near
> "%params,"
> new_uga.pl had compilation errors (#1)
>     (F) You aren't allowed to assign to the item indicated, or otherwise try
>     to change it, such as with an auto-increment.
> 
> Uncaught exception from user code:
>         Can't modify constant item in scalar assignment at new_uga.pl line
> 314, near "%params,"
> new_uga.pl had compilation errors.
> ------------end result----------------
> 
> line 314 is part of a sub
> 
> sub reassemble_uga_file   {
> 
> my %params = $query->Vars;
> my $file_template = 'draft.tpl';
> my $file_string = '';
> 
> my $template = Template->new({
>                INCLUDE_PATH =>$config_dirs->value("template"),});
> 
> my $vars = {
>    data =\%params,# this is line 314 in my script that the error is refering
> to
>    };
> 
> 
>  $template->process($file_template, $vars,\$file_string)
>   || die "Template process failed: ", $template->error(), "\n";
> 
> return $file_string;
> 
> My questions is why am I not allowed to assign the item indicated? The error
> does not tell me why. All I am trying to do is take the params from the form
> and  generate a string based on a template (kinda like using a format)
> I don't want to modify anything.
> 
> 

-- 
Bob Stutes - St. Louis, Mo.
Unix Administrator and General Geek Wanna-Be
e-mail: bstutes@eskimo.com

The Wisdom of the ages may be found ... if you will only look up.
                                           Unknown.



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

Date: Tue, 10 Dec 2002 00:13:41 -0600
From: Bob Stutes <bstutes@eskimo.com>
Subject: Re: HELP! Looking for a cgi
Message-Id: <at40n2$f9k$1@eskinews.eskimo.com>

Jorge Mesa wrote:
> I want to thank to everyone, for your posts and for your support,
> This my cgi resulted:
> =================
> #!/usr/bin/perl
> #redirect.pl
> 
> use CGI qw/:standard/;
> 
> print header(1,'301 Moved Permanently'),
> print redirect('http://www.terra.es/');
> ==================
> 
> When I check it on: http://www.searchengineworld.com/cgi-bin/servercheck.cgi
> 
> The results:
> Status: HTTP/1.1 302 Object Moved  
> Location: http://www.terra.es/  
> Server: Microsoft-IIS/5.0  
> Content-Type: text/html  
> Connection: close  
> Content-Length: 153  
> 
> But if I cut the last line: print redirect('http://www.terra.es/');
> The results:
> Status: HTTP/1.1 301 Moved Permanently  
> Server: Microsoft-IIS/5.0  
> Date: Tue, 03 Dec 2002 01:22:06 GMT  
> Connection: close  
> HTTP/1.0 301 Moved Permanently  
> Content-type: 1  
> 
> Why my cgi can not send the header and redirect???
> 
> Thank you again, and no, it is not a student exercise, it's for the
> real life
> ;-))), my server is remote, and the administrators of my ISP, don't
> want to make a server redirection, this way it will be too easy.
> 
> Best regards, and sorry for my english.
> 
> Jorge Mesa

It appears to be a limitation of the CGI implementation.

According to the CGI Perldoc:

The redirect() function redirects the browser to a different URL.  If 
you use redirection like this, you should not print out a header as well.

-- 
Bob Stutes - St. Louis, Mo.
Unix Administrator and General Geek Wanna-Be
e-mail: bstutes@eskimo.com

The Wisdom of the ages may be found ... if you will only look up.
                                           Unknown.



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

Date: 9 Dec 2002 19:43:36 -0800
From: beilyp@hotmail.com (bpaluch)
Subject: Invalid Base64 data msg when sending email
Message-Id: <1ee72a94.0212091943.138225ab@posting.google.com>

I am trying to use perl to send email through a server which requires
authentication. (This is my own account, this is not spam).

The code is below.

	$smtp->command("AUTH", "LOGIN");
	$smtp->command(MIME::Base64::encode_base64("username@myserver.com"));
	$smtp->command(MIME::Base64::encode_base64("mypass"));

	$smtp->mail($from);
	$smtp->to($to);
	$smtp->data();

When I turn on the debug, I get the following:
Why am I getting the 501 error - Invalid base64 data?

250-ozone.hostnoc.net Hello mail.chedvamusic.com [66.96.227.2] 
Net::SMTP=GLOB(0x2d7353c)<<< 
250-SIZE Net::SMTP=GLOB(0x2d7353c)<<< 
250-PIPELINING Net::SMTP=GLOB(0x2d7353c)<<< 
250-AUTH PLAIN LOGIN 
Net::SMTP=GLOB(0x2d7353c)<<< 
250-STARTTLS 
Net::SMTP=GLOB(0x2d7353c)<<< 
250 HELP 
Net::SMTP=GLOB(0x2d7353c)>>> AUTH LOGIN 
Net::SMTP=GLOB(0x2d7353c)>>> [base64 encoded username] 
Net::SMTP=GLOB(0x2d7353c)>>> [base64 encoded password]
Net::SMTP=GLOB(0x2d7353c)>>> MAIL FROM: 
Net::SMTP=GLOB(0x2d7353c)<<< 334 VXNlcm5hbWU6 
Net::SMTP=GLOB(0x2d7353c)>>> RCPT TO: 
Net::SMTP=GLOB(0x2d7353c)<<< 501 Invalid base64 data 
Net::SMTP=GLOB(0x2d7353c)>>> DATA Net::SMTP=GLOB(0x2d7353c)<<< 500
Unrecognized command
Net::SMTP=GLOB(0x2d7353c)>>> To: me@myemail.com 
Net::SMTP=GLOB(0x2d7353c)>>> From: username@myserver.com 
Net::SMTP=GLOB(0x2d7353c)>>> Subject: HELLO 
Net::SMTP=GLOB(0x2d7353c)>>> Net::SMTP=GLOB(0x2d7353c)>>> testing,
testing Net::SMTP=GLOB(0x2d7353c)>>> .
Net::SMTP=GLOB(0x2d7353c)<<< 250 is syntactically correct 
Net::SMTP=GLOB(0x2d7353c)>>> QUIT 
Net::SMTP=GLOB(0x2d7353c)<<< 250 is syntactically correct 

Any assistance will be greatly appreciated.  
Thank you.


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

Date: Tue, 10 Dec 2002 04:03:12 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Invalid Base64 data msg when sending email
Message-Id: <slrnavapvf.865.mgjv@verbruggen.comdyn.com.au>

On 9 Dec 2002 19:43:36 -0800,
	bpaluch <beilyp@hotmail.com> wrote:
> I am trying to use perl to send email through a server which requires
> authentication. (This is my own account, this is not spam).

For an example using sockets:

http://www.krkeegan.com/smtp_auth/

For a Net::SMTP_auth package, which uses (actually extends) Net::SMTP,
overriding the auth() method, and includes many more modules than it
actually needs. But it will show how you can do this:

http://perlmonks.thepen.com/110334.html

And here is a URL to a search engine:

http://www.google.com

Martien
-- 
                        | 
Martien Verbruggen      | That's not a lie, it's a terminological
Trading Post Australia  | inexactitude.
                        | 


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

Date: Tue, 10 Dec 2002 00:53:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: io::socket::inet / tcp question
Message-Id: <3DF58147.769C43D7@earthlink.net>

Mina Naguib wrote:
[snip]
> The best way would be for you to write small client-server test
> programs and test it out.  Pulling out an ethernet cable might be the
> easiest way to simulate the other end "disappearing".

Or better yet, consider deactivating the network driver.  This has the
advantage of not having any chance of causing physical damage, and also
of not having to remember to plug the cable back (since the driver will
be automatically restarted the next time you reboot).

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 10 Dec 2002 01:00:38 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Is there a better way of doing this?
Message-Id: <3DF58306.2B86B64A@earthlink.net>

Philip Taylor wrote:
[snip]
> Several times I've wanted to do something similar to that, mainly in
> circumstances like:
> 
>     my (@colour[0..2], $x, $y) = unpack C3SS => $data;
> 
> which perl doesn't like ('Can't declare array slice in "my"'), so I
> have to split it into two lines:
> 
>     my (@colour, $x, $y);
>     (@colour[0..2], $x, $y) = unpack C3SS => $data;
> 
> which can get quite messy when there are lots of variables.

This should work:

  my ($x, $y, @colour) = unpack 'x3 SS @0 C3' => $data;

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 10 Dec 2002 06:36:51 +0000
From: Ricardo Mesquita <ricardo@nospam.pt>
Subject: log file monitor
Message-Id: <3df597f3$0$2158$a729d347@news.telepac.pt>

i want to monitor one logfile for changes, and when some change occurs 
some function on my program will be called to take some action.
What is the best way to implemment this logfile checker, without tieing 
  up the processor with one "while (1)" loop cycle?

Is there any function/module i can use to abstract this layer from my 
program, some suggest the use of tail as in tail nix command, is this 
the right approach?

tks for all feedback
ricardo



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

Date: Tue, 10 Dec 2002 02:01:40 GMT
From: SPAMBLOCKER@BLOCKEDTOAVOIDSPAM.com (Spammay Blockay)
Subject: Max fork'd proc limit...?
Message-Id: <at3hu3$53l$1@bolt.sonic.net>

This is probably a well-known topic, but I looked all 'round Deja and Google,
and perused perl.org, perl.com and CPAN, and wasn't able to find an answer.

Running Perl 5.6 and 5.8 on Windows, I found I was only able to fork() 64
times.  Running under Linux, I got 38.

Is this an OS limit?  Or a Perl limit?

Also, when fork() no longer created other processes, the loop I was
forking in appeared to have died (ie. the call to fork() killed the
parent process).

What's the scoop on fork() and processes?  perlfunc/fork doesn't say
anything about fork() dying like that.



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

Date: 10 Dec 2002 03:14:22 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Max fork'd proc limit...?
Message-Id: <at3m6e$oje$1@canopus.cc.umanitoba.ca>

In article <at3hu3$53l$1@bolt.sonic.net>,
Spammay Blockay <SPAMBLOCKER@BLOCKEDTOAVOIDSPAM.com> wrote:
:This is probably a well-known topic, but I looked all 'round Deja and Google,
:and perused perl.org, perl.com and CPAN, and wasn't able to find an answer.

:Running Perl 5.6 and 5.8 on Windows, I found I was only able to fork() 64
:times.  Running under Linux, I got 38.

:Is this an OS limit?  Or a Perl limit?

I believe I've read in this newsgroup that Windows does not have
a unix-style fork that produces a new process, and that on Windows
fork is implimented using threads. 64 sounds like a plausible
"magic number" as to how many threads might be allowed by Windows.

Under Linux, you probably ran out of memory, unless you happen
to have per-user process limits turned on.

--
csh is bad drugs.


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

Date: Tue, 10 Dec 2002 04:13:51 GMT
From: "Eric" <eric@spamnotcfm-consulting.com>
Subject: Re: Max fork'd proc limit...?
Message-Id: <2SdJ9.306493$%m4.103330@rwcrnsc52.ops.asp.att.net>

I could be off, but wouldn't $! tell you what errno you encountered during
your last fork() ? If you're hitting some form of system limit, that should
give you some clues... Maybe a few kernel parameters need to be tweaked ?

Gotta run I'll catch you later

ERic



"Spammay Blockay" <SPAMBLOCKER@BLOCKEDTOAVOIDSPAM.com> wrote in message
news:at3hu3$53l$1@bolt.sonic.net...
> This is probably a well-known topic, but I looked all 'round Deja and
Google,
> and perused perl.org, perl.com and CPAN, and wasn't able to find an
answer.
>
> Running Perl 5.6 and 5.8 on Windows, I found I was only able to fork() 64
> times.  Running under Linux, I got 38.
>
> Is this an OS limit?  Or a Perl limit?
>
> Also, when fork() no longer created other processes, the loop I was
> forking in appeared to have died (ie. the call to fork() killed the
> parent process).
>
> What's the scoop on fork() and processes?  perlfunc/fork doesn't say
> anything about fork() dying like that.
>




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

Date: Tue, 10 Dec 2002 05:00:19 GMT
From: SPAMBLOCKER@BLOCKEDTOAVOIDSPAM.com (Spammay Blockay)
Subject: Re: Max fork'd proc limit...?
Message-Id: <at3sd2$s06$1@bolt.sonic.net>

In article <2SdJ9.306493$%m4.103330@rwcrnsc52.ops.asp.att.net>,
Eric <eric@spamnotcfm-consulting.com> wrote:
>I could be off, but wouldn't $! tell you what errno you encountered during
>your last fork() ? If you're hitting some form of system limit, that should
>give you some clues... Maybe a few kernel parameters need to be tweaked ?
>
>Gotta run I'll catch you later

Under Cygwin, at least, it showed exit code = 0, when I did "echo $?" after
the program ended... which is '$!' from?

Anyway, when ALL I did was fork in my script, the exit code was 5.
In Cygwin that's an IO Error.  Could be...?

- Tim



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

Date: Tue, 10 Dec 2002 01:24:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: nother
Message-Id: <3DF58897.9271A1D0@earthlink.net>

Bart Lateur wrote:
> 
> PerlFAQ Server wrote:
> 
> > Use the four argument form of sysread to continually add to a
> > buffer.  After you add to the buffer, you check if you have a
> > complete line (using your regular expression).
> >
> >           local $_ = "";
> >           while( sysread FH, $_, 8192, length ) {
> >              while( s/^((?s).*?)your_pattern/ ) {
> >                 my $record = $1;
> >                 # do stuff here.
> >              }
> >           }
> 
> The FAQ shouldn't suggest something that can give wrong results , at
> least not without warning about it.
> 
> For example, take this regex, which means "accept any conventional
> line end": /\015\012|[\r\n]/", on a platform that doesn't do any magic
> CRLF -> "\n" conversion. Suppose some file has followed the DOS line
> end convention, CRLF. Suppose the data contains the text:
> 
>         "One line" . "\015\012" . "Another line"
> 
> And by some coincidence, the buufer read splits these lines at an
> unfortunate place: between the CR and the LF. Then the regxes strikes,
> taking the LF at the start of the string to be an empty line,
> resulting in:
> 
>         One line
> 
>         Another line
> 
> And magically, a new, empty line appears in the parsed text.

The the property needed to avoid such wrong results is called being
"prefix-free": No piece of data which matches your pattern should be a
prefix of some *other*, longer, piece of data, which also matches the
pattern.

The pattern /\015\012|[\r\n]/ is not prefix-free, since it can match
both \015 and \015\012, one of which is a prefix of the other.

The pattern /\015\012|[\r\n](?!\z)/ is effectively prefix-free, but has
the disadvantage of not matching the last newline in the file if the
seperator is \r or \n.

I suppose a reasonable solution (assuming that the file won't change the
seperator sequence midway) might be:

   local $_ = "";
   my $re = '\015\012|[\r\n](?!\z)';
   while( sysread FH, $_, 8192, length ) {
      while( s/^((?s).*?)($re)// ) {
         my $record = $1;
         $re = "($2)"; # fixed-length strings are always prefix-free.
         # do stuff here.
      }
   }

Which only has a problem if there's only one line in the file *and* that
line ends with \n or \r.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 10 Dec 2002 02:11:44 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Output Lines of 70 Characters
Message-Id: <slrnavajeg.865.mgjv@verbruggen.comdyn.com.au>

On 8 Dec 2002 22:27:01 -0800,
        David Tian <yuanxi80@hotmail.com> wrote:
> I am writing a Perl program. Given an input of some lines of text as a
> string with no newline chars, where each line contains some
> combination of:
>  alphabetic symbols, either upper case or lower case
>  punctuation symbols: '.' ',' ';' ':' '!' '?'
>  spaces

(I prepared text for this with:

$/ = undef;
my $text = <>;
$text =~ s/\s+/ /mg;
$text =~ s/ $//;
}

And followed it by:

$text =~ s/(.{1,70}) +/$1\n/g;
print "$text\n";

I doubt very much that this is very efficient, or even what is wanted,
but you are the one that specified that the text was all in one
string, with no newlines, and only spaces. I have assumed that a
"word" is anything that is not a space;

If you actually want to read input files, other solutions would be
much better and more efficient.

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

my $char_count = 0;

while (<>)
{
    for my $pseudo_word (split)
    {
        my $len = length($pseudo_word);

        do { print "\n"; $char_count = 0 } if $char_count + $len >= 70;
        do { print " ";  $char_count++   } if $char_count;
        print $pseudo_word;
        $char_count += $len;
    }
}

print "\n" if $char_count;

If this is homework, I doubt your teacher would believe you came up
with these yourself, judging by the attempt I saw. if it isn't
homework, use Text::Wrap.

Martien
-- 
                        | 
Martien Verbruggen      | In the fight between you and the world, back
Trading Post Australia  | the world - Franz Kafka
                        | 


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

Date: 9 Dec 2002 16:14:53 -0800
From: eddiekwang@hotmail.com (eddie wang)
Subject: perl speed comparisom on windows and linux
Message-Id: <879e0e64.0212091614.c7badfc@posting.google.com>

hello, does anyone know if perl would run faster on linux than on
windows, given the same computer? If so, is the difference very
dramatic?

Thank you in advance.
edy


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

Date: 9 Dec 2002 16:48:38 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: perl speed comparisom on windows and linux
Message-Id: <3df539e6@news.victoria.tc.ca>

eddie wang (eddiekwang@hotmail.com) wrote:
: hello, does anyone know if perl would run faster on linux than on
: windows, given the same computer? If so, is the difference very
: dramatic?

I notice that the same script(s) seems to run faster on Linux.

I assume it's because of things like file accesses that may be faster on
linux.

The time to start running seems to be the biggest difference to me.

$0.02


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

Date: 10 Dec 2002 00:54:21 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: perl speed comparisom on windows and linux
Message-Id: <at3dvt$kkj$1@canopus.cc.umanitoba.ca>

In article <879e0e64.0212091614.c7badfc@posting.google.com>,
eddie wang <eddiekwang@hotmail.com> wrote:
:hello, does anyone know if perl would run faster on linux than on
:windows, given the same computer? If so, is the difference very
:dramatic?

Given the same computer. Hmmm. Given the same compiler too?

If the compilers are the same then any speed differences would be
due to differences in available system calls, differences in
available library calls, or to differences in memory management.

If we suppose that there are differences in these factors, then the degree
of drama is going to depend upon the extent to which these factors
are of importance to the program. So it's going to depend on what you run.
--
Visit http://www.ibd.nrc.ca/~gullible for a free gullibility test.


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

Date: Mon, 09 Dec 2002 17:48:30 -0800
From: SendNoSpam <SendNoSpam>
Subject: Re: perl speed comparisom on windows and linux
Message-Id: <31havuctq24qrtbab7uleljds678hqfuid@4ax.com>

On 9 Dec 2002 16:14:53 -0800, eddiekwang@hotmail.com (eddie wang)
wrote:

>hello, does anyone know if perl would run faster on linux than on
>windows, given the same computer? If so, is the difference very
>dramatic?
>
>Thank you in advance.
>edy

I regularly extract data from several hundred .html files at a crack.
Bascially open the file, parse, extract wanted data with  a set of
regexes, and write results into an output file, one file per input
file processed.  I have run jobs on either a desktop 866MHz Dell
running Win2k  (ActiveState  perl 5.6.1) OR a server on a 550MHz Dell
running RedHat 7.1 (perl 5.6.0) .  I haven't done formal measurements,
but I do observe that RH is faster.  The Linux file system is much
faster than Win2k.

Mark



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

Date: Mon, 9 Dec 2002 23:15:14 -0600
From: "Extended Partition" <extendedpartition@NOSPAM.yahoo.com>
Subject: Question about sockets
Message-Id: <3df57901_2@nntp2.nac.net>

Hello Everyone,

I am now to the main portion of my server application and have run into a
small snag that I can't find information on. Thus far I've checked Perl
Monks,  Google, etc and haven't found anything on this. Here is my problem.
Let's say my server forks 4 clients named $client. I know that to print to
the socket all I do is a print $client "blah blah blah";  But what if I want
to print the same message to ALL connected clients? How do I do that?  Code
examples or URL's are very appreciated.

Thanks!

--
Anthony Saffer [Founder and CEO]
Saffer Consulting Services
www.safferconsulting.com
Discount Webhosting Available
SUPPORT ICQ: 17720817
PERSONAL ICQ: 96698595




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

Date: 10 Dec 2002 05:51:48 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Question about sockets
Message-Id: <at3vdk$ssk$1@canopus.cc.umanitoba.ca>

In article <3df57901_2@nntp2.nac.net>,
Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
:Let's say my server forks 4 clients named $client. I know that to print to
:the socket all I do is a print $client "blah blah blah";  But what if I want
:to print the same message to ALL connected clients? How do I do that?

Keep track of the connected clients, and foreach() of them, print
the message.

You can put wrappers around this, but that's what it's going to
come down to.

If your task by definition involves sending the same data to multiple
clients (i.e., not just an occasional thing but rather that that's its
whole purpose) and you have co-operation with the router folk from
startingpoint to endpoint, then you may wish to look into "multicast
groups".
--
   Any sufficiently advanced bug is indistinguishable from a feature.
   -- Rich Kulawiec


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

Date: Tue, 10 Dec 2002 12:43:26 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: read return value from a sql script using piped open
Message-Id: <pxgJ9.20$e14.22@news.oracle.com>

All,
    I need to get the return value from a sql script and redirect the output
to a file. One of the requirements is to avoid showing passwords to 'ps' and
the same code needs to run on win and unix.
    I am now calling the script using code as below.

--------- Start  My Code
open SQLP, "|sqlplus -s /nolog >> $output_file_name "
                                        or die "cannot open sqlplus $ERRNO
\n";
# Connect and execute the script. This is done by writing to the stream we
open for sqlplus.
SQLP "connect $user_name/$password \n" or die "cannot write in doScript";
print SQLP "\@$script_name; \n" or die "cannot write in doScript";
close SQLP or die "cannot close in doScript";

print "Status is :" . ($? >> 8);
--------- End   My Code

The sql script I execute is :-
****** Start  t.sql
select sysdate from dual
/
exit 77
****** End    t.sql


This works if the exit value is 0 but anything else fails.
 ................. Start  Error I see
Uncaught exception from user code:
        cannot close in doScript at sqlutils.pm line 160.
        sqlutils::doSqlScript('t.sql', 'scott', 'tiger@iasdb.local',
'a.log') called at tutils.pl ine 21
 ................. End     Error I see


I had tried using the here document operator
########  Start MyCode Using the here doc
$ret = system << "EOF";
sqlplus -s scott/tiger\@iasdb.local \@t.sql
EOF
print ($ret >> 8);

########  End    MyCode Using the here doc

    This shows the return value properly but I am not able to redirect the
output of the script to the file.


    Your suggestions please.


Thanks & Regards,
Sunil.





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

Date: Tue, 10 Dec 2002 06:17:58 GMT
From: Vincent Granville <vincentg@datashaping.com>
Subject: The black list: websites banned on Google
Message-Id: <3DF58400.3637954F@datashaping.com>

Please help us build this directory of blacklisted websites by sending
your contribution. I've just started the list with a website catering to

mathematicians and selling Perl scripts.

http://www.datashaping.com/google.shtml





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

Date: Tue, 10 Dec 2002 01:19:48 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Trouble with macintosh file access
Message-Id: <pkent77tea-89AA8F.01194810122002@news-text.blueyonder.co.uk>

In article <24fda70e.0212090705.5356c768@posting.google.com>,
 nathantwist@attbi.com (Colin) wrote:

> Hey guys. I've been working on a script that deals with renaming files
> on a macintosh hard drive. I know the filename changing works (you
> guys helped ;-) )

> whether or not this has anything to do with the way macs deal with
> underscores in names ? if you were to click on a mac file on the

MacOS, of either flavour, does not handle underscores at all. TTBOMK the 
only special characters are ':' (on classic) '/' (on OS X)[1] and '\0' 
on both. The _only_ special characters.

> $directory = "Macintosh HD:namechange";

mmm, an absolute path on MacOS classic...

> {  if ((-f "$directory/$filename") && ($filename =~

wth? Spot the incorrect character. Look. There. A character that is 
perfectly valid in file and dir names. I'd just use the File::Spec::Mac 
module.

P

[1] it is slightly more complicated under some circumstances, so I hear, 
but that basically holds.

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: 9 Dec 2002 21:10:57 -0600
From: Kevin <leinfidel AT netscape DOT net>
Subject: variable/module scope in child packages
Message-Id: <56javug6kohefkid93j075nl60rer0ta21@4ax.com>

Hi,

I'm writing an OOP module with many packages in one MyModule.pm file.

I'm not clear on where modules ( use  xxx; ) and globals ( our
$somevar ) from the  first package are accessible from in child
packages.

They appear to be accesible from any child package of the first
package  ( My Module ) without explicitly referencing the first
package.

Is this correct and the normal way to handle this type of situation? 
i.e.  declare things used in each package, in the first package....
versus redeclaring in each child.

# Example

package MyModule;

use SomeRequiredModules.pm
# Exporter stuff etc

use strict;

our @ISA = qw (  Exporter );


package MyModule::BaseClass;


package MyModule::BaseClass::Object1;

@ISA = qw ( BaseClass );


package MyModule::BaseClass::Object2;

# Etc

1;

ps
 if this is in the camel book please point it out to me, i must be
missing it.


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

Date: Mon, 09 Dec 2002 23:38:03 GMT
From: "smackdab" <smackdab1@hotmail.com>
Subject: Re: which UI for Perl?
Message-Id: <vP9J9.23415$jf7.1513886@news2.west.cox.net>


"Erik Braun" <erik@pax07e3.mipool.uni-jena.de> wrote in message
news:slrn4av9deb.76iv.erik@pax07e3.mipool.uni-jena.de...
> I'm looking for a Perl Module, which provides interactive dialogs,
> and some extensions like Radio buttons or file requestors.
>
> I found some Modules (Dialog, Perlmenu, Cdk, Curses), but did not test
> everything, as this is a lot of work. Is someone around here, who
> had the same problem and can me recommend or discourage from one
> of these?
>
> erik

I have had good experiences with Tk, there is a great book on it: mastering
Perl Tk





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

Date: Tue, 10 Dec 2002 01:04:23 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: which UI for Perl?
Message-Id: <pkent77tea-6FEE6A.01042310122002@news-text.blueyonder.co.uk>

In article <slrn4av9deb.76iv.erik@pax07e3.mipool.uni-jena.de>,
 Erik Braun <erik@pax07e3.mipool.uni-jena.de> wrote:

> I'm looking for a Perl Module, which provides interactive dialogs,
> and some extensions like Radio buttons or file requestors.
> 
> I found some Modules (Dialog, Perlmenu, Cdk, Curses), but did not test 
> everything, as this is a lot of work. Is someone around here, who
> had the same problem and can me recommend or discourage from one 
> of these?

Had to say, as it depends on your target operating systems, level of 
portability required and feature set, etc. Try:

Perl/Tk
WxPerl
X11 Window System
Bindings to the MacOS GUI
Bindings to the Win32 GUI
etc

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

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.  

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


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