[26280] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8462 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 27 14:05:35 2005

Date: Tue, 27 Sep 2005 11:05:05 -0700 (PDT)
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, 27 Sep 2005     Volume: 10 Number: 8462

Today's topics:
    Re: Checking to see if PID is running <josef.moellers@fujitsu-siemens.com>
    Re: FAQ . <zeno@lastone.com>
    Re: FAQ . xhoster@gmail.com
        Help - How do I install Perl (CPAN) on Windows ? <zeno@lastone.com>
        How to control version of OS <maki@system.net.cro>
        input validation <""alexjaquet\"@[no spam]msn.com">
        Newbie: Testing for Null <info2005@remove-this-including-dot.bigbunker.com>
        Using perl with Inetd <ben@427.org.uk>
    Re: Using perl with Inetd (Anno Siegel)
    Re: Using perl with Inetd <vek@station02.ohout.pharmapartners.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Sep 2005 12:41:27 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Checking to see if PID is running
Message-Id: <dhb7ea$v$3@nntp.fujitsu-siemens.com>

H. Wade Minter wrote:
> Is there a preferred module, under Linux, to verify whether a given pro=
cess
> ID number is still running?  Nothing looked promising via a CPAN search=
, and
> I didn't get anywhere with "perldoc -q process" or "perldoc -q pid".
>=20
> There were a few modules dealing with pid files, but nothing obvious if=

> you just had the pid number in a scalar and needed to check it.

Besides the "kill 0" mentioned, you might look at /proc, if you restrain =

yourself to Linux.
If /proc/<pid> exists, you could also check /proc/<pid>/cmdline to=20
verify that the process is (still) running the program you expect it to=20
run. Note that /proc/<pid>/cmdline has NUL bytes separating command line =

arguments, so you might also want to use split /\0/.

Btdt,

Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Tue, 27 Sep 2005 15:49:33 GMT
From: Zeno <zeno@lastone.com>
Subject: Re: FAQ .
Message-Id: <s4qij15n4ecehkhg7k43rbtopm2l37sa3k@4ax.com>

On Sun, 27 Mar 2005 17:03:01 +0000 (UTC), PerlFAQ Server
<comdog@panix.com> wrote:

>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.
>
>--------------------------------------------------------------------
>
>.: 
>
>
>
>--------------------------------------------------------------------
>
>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.

It would be far more useful for me to get 1 large FAQ - rather
than countless small ones.



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

Date: 27 Sep 2005 16:20:49 GMT
From: xhoster@gmail.com
Subject: Re: FAQ .
Message-Id: <20050927122049.380$rk@newsreader.com>

Zeno <zeno@lastone.com> wrote:
>
> It would be far more useful for me to get 1 large FAQ - rather
> than countless small ones.

Then go get 1 large FAQ.  What is stopping you?

Xho

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


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

Date: Tue, 27 Sep 2005 17:52:30 GMT
From: Zeno <zeno@lastone.com>
Subject: Help - How do I install Perl (CPAN) on Windows ?
Message-Id: <eg0jj1l5b08s52mo0heta9fnmfik44fhcs@4ax.com>

I downloaded the ActiveState perl msi from: ActiveState (ver.
5.8.7). It installed. But now I find that I am, naturally,
missing a load of CPAN modules.

I can find these things quite easily but how do I install them?

The instructions are simple, but unfortunately these
instructions involve running either of these 2 command line
options:

	Perl -MCPAN -e shell
or
	cpanp

Running  cpanp  is no good because the system doesn't know what
cpanp  is.

Running:
	Perl -MCPAN -e shell

begins an incomprehensible dialog. For instance, the program
wants to know where my gzip, tar, make, lynx, wget, ncftpget,
ncftp, gpg programs are, etc.  I don't even know what these
things are let alone where they are.

Is there a simple set of instuctions for configuring Perl to
install CPAN modules quickly and simply. Or is there a
configuration file for this (with some meaningful documentation
explaining what the options in the cofigurations file are for).



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

Date: Tue, 27 Sep 2005 13:52:31 +0200
From: "Maki" <maki@system.net.cro>
Subject: How to control version of OS
Message-Id: <dhbc1q$ifi$1@ss405.t-com.hr>

How to control version of OS E.g., if  is Perl script run  on Windows XP ,
Windows 98 etc.?

Thanks






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

Date: Tue, 27 Sep 2005 15:34:05 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: input validation
Message-Id: <mTb_e.37906$hV3.17285@nntpserver.swip.net>

Hi,

I've a trouble when I parse web page input, I want to accept only
alphanumeric char (with accent) and ignore it when the datas is equal
is to "Toutes les catégories"

I do the following :

local our $category = $query->param("categories");
$category =~ s/[^\w]//g;

local our $test = $SERVER{'all_categories'};
if ($category ne $test) {
$add .= " AND ref_categorie = id_categorie AND categorie_$lang.nom = 
'$category'";
$from .= "article, categorie_$lang,statut_$lang";
}else {
$add .= "AND article.ref_statut = id_statut AND ref_statut = '3' AND 
ref_categorie = id_categorie ";
$from .= "article,statut_$lang,categorie_$lang"
    }
but I the following part "$add .= " AND ref_categorie = id_categorie AND 
categorie_$lang.nom = " is still executed

any help

many thanks



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

Date: Tue, 27 Sep 2005 17:01:40 GMT
From: "Pritchie" <info2005@remove-this-including-dot.bigbunker.com>
Subject: Newbie: Testing for Null
Message-Id: <UVe_e.957$DO.428@newsfe3-gui.ntli.net>

How do I test for null values?

eg.

my $MyVal;
print "MyVal:".$MyVal;

gives me...

Use of uninitialized value in concatenation (.) or string at
        ./process-images.pl line 80 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a
mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl tells you what
operation
    you used the undefined value in.  Note, however, that perl optimizes
your
    program and the operation displayed in the warning may not necessarily
    appear literally in your program.  For example, "that $foo" is
    usually optimized into "that " . $foo, and the warning will refer to
    the concatenation (.) operator, even though there is no . in your
    program.

apart from commenting out "use warnings" etc and assign a defined value.
How can I test for null or undef?

so if I did something like
my $MyVal = $ARGV[0]
but didn't pass an argument to the script, I could catch and handle the
problem.

Thanks all





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

Date: Tue, 27 Sep 2005 11:16:34 +0100
From: Ben Brown <ben@427.org.uk>
Subject: Using perl with Inetd
Message-Id: <43391c02$0$15056$ed2619ec@ptn-nntp-reader02.plus.net>

I have a perl script I want to run on port 23, my evential goal is to
have a script anonymous users can telnet to so they can sign up an
account on a server.

Before anyone worries about security, this is a NetBSD box that's on a
local network at my place of work, it's not publically accessable.

So far I've just written a very simple test script, a proof of concept
of you will, I don't like running before I can walk :)

I've called my script telnet.pl and have put the following in
/etc/inetd.conf:

telnet          stream  tcp     nowait  root    /root/bin/telnet.pl
telnet.pl

Here is the script itself:

#!/usr/pkg/bin/perl

$|=1;
print ("Y/n: ");
my $choice = <STDIN>;
chomp($choice);
if ($choice =~ /\r$/) { chop $choice; }
if ($choice eq "y") {
         print ("OK");
} else {
         print ("No match");
}
print("\n");
print("Debugging: \$choice = \"$choice\"\n");
exit(0);

If I run it from the command line, it does what you'd expect it to:

Y/n: y
OK
Debugging: $choice = "y"

However, when run from telnet, you get this:

Y/n: y
No match
Debugging: $choice = "y"

Any assistance will be greatfully recieved!

Ben


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

Date: 27 Sep 2005 10:36:59 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Using perl with Inetd
Message-Id: <dhb7cb$3q6$2@mamenchi.zrz.TU-Berlin.DE>

Ben Brown  <ben@427.org.uk> wrote in comp.lang.perl.misc:
> I have a perl script I want to run on port 23, my evential goal is to
> have a script anonymous users can telnet to so they can sign up an
> account on a server.
> 
> Before anyone worries about security, this is a NetBSD box that's on a
> local network at my place of work, it's not publically accessable.
> 
> So far I've just written a very simple test script, a proof of concept
> of you will, I don't like running before I can walk :)
> 
> I've called my script telnet.pl and have put the following in
> /etc/inetd.conf:
> 
> telnet          stream  tcp     nowait  root    /root/bin/telnet.pl
> telnet.pl
> 
> Here is the script itself:
> 
> #!/usr/pkg/bin/perl
> 
> $|=1;
> print ("Y/n: ");
> my $choice = <STDIN>;
> chomp($choice);
> if ($choice =~ /\r$/) { chop $choice; }
> if ($choice eq "y") {
>          print ("OK");
> } else {
>          print ("No match");
> }
> print("\n");
> print("Debugging: \$choice = \"$choice\"\n");
> exit(0);
> 
> If I run it from the command line, it does what you'd expect it to:
> 
> Y/n: y
> OK
> Debugging: $choice = "y"
> 
> However, when run from telnet, you get this:
> 
> Y/n: y
> No match
> Debugging: $choice = "y"

You probably get different line feeds from what you expect.  Try (untested)

    $choice =~ s/\s+$//;

to verify.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: 27 Sep 2005 10:37:07 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: Using perl with Inetd
Message-Id: <slrndji86j.1oo.vek@station02.ohout.pharmapartners.nl>

On Tue, 27 Sep 2005 11:16:34 +0100,
    Ben Brown <ben@427.org.uk> wrote:


>
> However, when run from telnet, you get this:
>
> Y/n: y
> No match
> Debugging: $choice = "y"
>
> Any assistance will be greatfully recieved!
>

You sure $choice doesn't contain invisible characters?  These characters
could come from the telnet client doing protocol negotiation.

Villy


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

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


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