Perl cgi for WAP / WAP Push

2006-02-14 Thread cool planet
Hi , 
   
  I'm trying to develop a bit advance WAP Push SI and SL intewrface for wap 
push contents , my wap push proxy gateway is kannel. As i read the 
documentations and after i did some google , there is two xml files has to 
generate. for SI and SL. But this is bit confused . How can i get a help from 
you guys ?
   
  It is not a proper way to ask from you about the perl cgi code directly . not 
a good manner. But how can i get it use with perl cgi ? 
   
  How can i start to develop ? can you guys help me .please 
   
  and is there any proper tutorial or text books for how to develop WAP site 
via perl - cgi  ?
   
  Thanx in advance,
  Kane.


-
 Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews,  more on new 
and used cars.

compile fails at/during the use DB_File; line

2006-02-14 Thread Alan C
Hi,

Perl 5.8.8  on Slackware 10.2

As to the libdb's: (the default for Slack 10.2) appears to be onboard 3
different versions of libdb (Sleepycat)

Ideas, suggestions to get it working?

How to tell if it's a Perl or a C init thing?

/usr/lib/perl5/5.8.8/i486-linux/auto/DB_File/DB_File.so  does exist.

Next, in order, (a) line # 5 from rss4, (b) the error perl returned, (c)
onboard/installed Slack pkgs of libdb, and (d) libdb's

(a)
use DB_File;

(b)
[EMAIL PROTECTED]:~$ rss4
Can't load '/usr/lib/perl5/5.8.8/i486-linux/auto/DB_File/DB_File.so' for
module DB_File: libdb-4.4.so: cannot open shared object file: No such file
or directory at /usr/lib/perl5/5.8.8/i486-linux/XSLoader.pm line 70.
 at /usr/lib/perl5/5.8.8/i486-linux/DB_File.pm line 251
Compilation failed in require at /home/al/bin/rss4 line 5.
BEGIN failed--compilation aborted at /home/al/bin/rss4 line 5.

(c)
[EMAIL PROTECTED]:~$ cd /var/log/packages
[EMAIL PROTECTED]:/var/log/packages$ lsag db
-rw-r--r--   1 root root   1164 2005-09-27 18:23 db3-3.3.11-i486-4
-rw-r--r--   1 root root803 2005-09-27 18:23 db31-3.1.17-i486-1
-rw-r--r--   1 root root   1117 2005-09-27 18:23 db4-4.2.52-i486-2
-rw-r--r--   1 root root   1174 2005-09-27 18:22 gdb-6.3-i486-1
-rw-r--r--   1 root root762 2005-09-27 18:23 gdbm-1.8.3-i486-3
-rw-r--r--   1 root root   1031 2005-09-27 18:31 xxgdb-1.12-i386-1

(d)
[EMAIL PROTECTED]:/var/log/packages$ cd /usr/lib
[EMAIL PROTECTED]:/usr/lib$ lsag libdb
-rw-r--r--1 root root   723168 2004-05-11 18:09 libdb-3.1.a
-rw-r--r--1 root root  629 2004-05-11 18:09 libdb-3.1.la
lrwxrwxrwx1 root root   17 2005-09-27 18:23 libdb-3.1.so -
/lib/libdb-3.1.so*
-rw-r--r--1 root root   842506 2004-05-11 18:30 libdb-3.3.a
-r--r--r--1 root root  696 2004-05-11 18:30 libdb-3.3.la
lrwxrwxrwx1 root root   17 2005-09-27 18:23 libdb-3.3.so -
/lib/libdb-3.3.so*
lrwxrwxrwx1 root root   11 2005-09-27 18:23 libdb-3.a - libdb-3.3.a
lrwxrwxrwx1 root root   12 2005-09-27 18:23 libdb-3.so -
libdb-3.3.so*
-rw-r--r--1 root root  1170632 2004-05-29 23:03 libdb-4.2.a
-rw-r--r--1 root root  781 2004-05-29 23:03 libdb-4.2.la
lrwxrwxrwx1 root root   17 2005-09-27 18:23 libdb-4.2.so -
/lib/libdb-4.2.so*
lrwxrwxrwx1 root root   11 2005-09-27 18:23 libdb-4.a - libdb-4.2.a
lrwxrwxrwx1 root root   12 2005-09-27 18:23 libdb-4.so -
libdb-4.2.so*
lrwxrwxrwx1 root root   11 2005-09-27 18:23 libdb.a - libdb-3.3.a
lrwxrwxrwx1 root root   12 2005-09-27 18:23 libdb.so -
libdb-3.3.so*
lrwxrwxrwx1 root root9 2005-09-27 18:23 libdb4.a - libdb-4.a
lrwxrwxrwx1 root root   10 2005-09-27 18:23 libdb4.so - libdb-4.so*
lrwxrwxrwx1 root root   19 2005-09-27 18:31 libdbh-1.0.so.1 -
libdbh-1.0.so.1.0.0*
-rwxr-xr-x1 root root23172 2005-05-17 17:03 libdbh-1.0.so.1.0.0*
-rwxr-xr-x1 root root  783 2005-05-17 16:48 libdbh.la*
lrwxrwxrwx1 root root   19 2005-09-27 18:31 libdbh.so -
libdbh-1.0.so.1.0.0*
[EMAIL PROTECTED]:/usr/lib$


Oh, BTW:  alias lsag='ls -la | grep'

--
Alan.


How to copy a string variable to a file ?????

2006-02-14 Thread Madhu Kumar


 I have a question related to copying a string variable in perl.

 Actually in my program iam splitting the entries of /etc/shadow file,
and 

storing the first two fields i.e username and password in a variable,
and 

 i want to write this variable to /usr/local/cvsn/CVSROOT/passwd file
, inorder to give priveleges  to users to access cvs.

 I used the syswrite function but didn't work, can u plz help me
regarding this.

 This is how i tried the above said statements :

 The first part includes opening the /etc/shadow file and read the
last entry of the /etc/password file and storing it in default
variable, and splitting the password entry

 my @fields = split(/:/, $_);

#print ($fields[0]\n);

#print ($fields[1]\n);

$pass = join(':', $fields[0],$fields[1]);

print ($pass\n); # It prints the username and password with :
between them

#my $MYFILE = '/usr/local/cvsnt/CVSROOT/passwd';

syswrite ('/usr/local/cvsnt/CVSROOT/passwd', $pass, 60);

and also i tried this way 

my $MYFILE = '/usr/local/cvsnt/CVSROOT/passwd';

syswrite ($MYFILE, $pass, 60);


How should i go about it , plz let me kno.

 Thanks in advance

 
  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: How to copy a string variable to a file ?????

2006-02-14 Thread Jeff Pang


Hello,

 my @fields = split(/:/, $_);
$pass = join(':', $fields[0],$fields[1]);

Yes,you are right here.for more briefness,I would write it as below instead,

my $pass = join ':',((split /:/,$_)[0,1]);


#my $MYFILE = '/usr/local/cvsnt/CVSROOT/passwd';
syswrite ('/usr/local/cvsnt/CVSROOT/passwd', $pass, 60);

here you don't need the 'syswrite',you can simply open a file and obtain its 
file handle,then 'print' to this handle.
The code should be like:

open (FILEHD,,$myfile) or die $!;
print FILEHD $pass,\n;
close FILEHD;

by the way,for good program practice,you should be careful to use the varible 
whose name is all spelled in capital letter.For example,I would write $myFile 
instead of $MYFILE,the latter have other special meanings (for example,it means 
a global varible) usually.

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




help with adding strings that are floating point numbers

2006-02-14 Thread Ravi Malghan
Hi: I think this is very trivial, but just can't seem
to figure it out. I have two strings $var1 = 0.12
and $var2 = 0.3. I want to add these two and have
0.42 in $result, but $result = int($var1) + int($var2)
always results to 0?

What am I doing wrong.
Thanks
Ray



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




[RESOLVED]Re: help with adding strings that are floating point numbers

2006-02-14 Thread Ravi Malghan
Thanks

--- JeeBee [EMAIL PROTECTED] wrote:

 
 Just do $result = $var1 + $var2;
 int returns the integer part of a number,
 see: perldoc -f int
 
 JeeBee
 
 On Tue, 14 Feb 2006 07:04:18 -0800, Ravi Malghan
 wrote:
 
  Hi: I think this is very trivial, but just can't
 seem to figure it out. I
  have two strings $var1 = 0.12 and $var2 = 0.3.
 I want to add these two
  and have 0.42 in $result, but $result = int($var1)
 + int($var2) always
  results to 0?
  
  What am I doing wrong.
  Thanks
  Ray
  
  
  
  __
 Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam
 protection around
  http://mail.yahoo.com
 
 
 
 -- 
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 http://learn.perl.org/
 http://learn.perl.org/first-response
 
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Strange Can't locate Module.pm in @INC error after chaning from 'use lib' to PERL5LIB

2006-02-14 Thread Hans Meier (John Doe)
Dear list

It's very strange:

My apache doesn't start with

[error] Can't locate SMF/Config.pm in @INC (@INC contains: /opt/smf/lib [...]) 
at /opt/smf/apconf/backend/httpd_startup_smf.pl line 228.

But why? The file is there:

# ls /opt/smf/lib/SMF/Config.pm
/opt/smf/lib/SMF/Config.pm

and the path is obviously in @INC. 

The error appears after replacing  use lib '/opt/smf/lib';
in the httpd_startup.pl with  PERL5LIB=/opt/smf/lib
in the init.d script. Before, everything went well, and I changed nothing 
else. 

I checked permissions, copiedpasted around to avoid typos, tried to find 
someting with strace, etc., but to no avail.

Could anybody please give me a hint what could be the reason? It must be 
something very stupid, but I can't see it. 


Thanks a lot!

Hans

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




regexpressions help

2006-02-14 Thread Gerald Wheeler
I am trying to allow input of a person's first and last name in one form
field, nothing more, nothing less

There should be only one uppercase A-Z character followed by one or
more lowercase a-z characters followed by one space followed by one
uppercase A-Z character followed by one or more lowercase a-z
characters, nothing more.

have tried this which does not work:  /^[A-Z a-z]\s+[A-Z a-z]{1,15}$/

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: still confused on how to locally install perl modules without administrative privileges on windows (activestate 5.6.1 build 630)

2006-02-14 Thread Wolcott, Kenneth A
Hi;

  What is the correct path separator for use lib in a Perl program on
Windoze when I have multiple paths?

  What is the correct path separator when using PERL5LIB on Windoze?

  Apparently a colon is not a good choice as that is the Windoze
separator between drive/partition names and the path(s)...

  Use a semi-colon like in the Windoze PATH environment variable?

  I have installed ActiveState Perl in C:\Documents and
Settings\login_name\My Documents\ActivePerl_5.8.7.815.  I have a DOS
batch file with my modified PATH variable and PATHEXT variables in it
representing this location of Perl.  I'd like to add PERL5LIB variable
to this batch file so that XML::Simple (and many other modules I'd like
to use) is/are present.

Thanks,
Ken

-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 20, 2006 10:17 AM
To: Wolcott, Kenneth A
Cc: beginners@perl.org
Subject: Re: still confused on how to locally install perl modules
without administrative privileges on windows (activestate 5.6.1 build
630)


On 1/20/06, Wolcott, Kenneth A [EMAIL PROTECTED] wrote:
 Hi;

   It would be really nice if there was a clear, precise, concise,
 accurate and simple instruction of how to install Perl modules locally
 (non-privileged accounts) on Windows systems.

snip
   I really can't use ppm from activestate (can't seem to control
install
 location).
snip

It looks like you can use ppm.  Here is how I did it.

1. run cmd
2. create a directory named perl in your profile's directory
(C:\documents and settings\user)
3. run ppm
4. at the prompt type target set root DIR where DIR is the perl
directory you just created (example: target set root
C:\DOCUME~1\COWENS~1.ISP\perl)
5. type install PACKAGE where PACKAGE is the name of the module
you want installed
6. type quit
7. enjoy the moduley goodness

You will probably need to set PERLLIB environmental variable to the
newly create path or hard code the path in with 'use lib' in the
scripts.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




force requiring a file

2006-02-14 Thread Adriano Allora

Hi all,

I need to execute the code found in a separate file (that file is 
written by another script).

I wrote:

my $nf = shift();
chomp($nf);
require(./ricerche/$nf.pl);

see what happens:

Can't locate ./ricerche/VALICO672.pl in @INC (@INC contains: 
/System/Library/Perl/5.8.1/darwin-thread-multi-2level 
/System/Library/Perl/5.8.1 
/Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 
/Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level 
/Network/Library/Perl/5.8.1 /Network/Library/Perl .) at 
./4-interroga.pl line 13.


the pathname is correct (the code in the separate file too), alla 
permissions are ok, but I cannot include it.


Any help is appreciated,

alladr


|^|_|^|_|^|  |^|_|^|_|^|
 || ||
 || ||
 ||*\_/*\_/*\_/*\_/*\_/* ||
 |   |
 |   |
 |   |
 | http://www.e-allora.net|
 |   |
 |   |
**


RE: regexpressions help

2006-02-14 Thread Wolcott, Kenneth A
What about (untested)

/^[A-Z][a-z]+\s[A-Z][a-z]+$/

This forces one uppercase letter followed by one or more lowercase
letters, followed by a space, followed by one uppercase letters and
terminated by one or more lowercase letters.  This does not force a
limit on the total number of characters.

HTH,
Ken Wolcott

-Original Message-
From: Gerald Wheeler [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 2:04 PM
To: beginners@perl.org
Subject: regexpressions help


I am trying to allow input of a person's first and last name in one form
field, nothing more, nothing less

There should be only one uppercase A-Z character followed by one or
more lowercase a-z characters followed by one space followed by one
uppercase A-Z character followed by one or more lowercase a-z
characters, nothing more.

have tried this which does not work:  /^[A-Z a-z]\s+[A-Z a-z]{1,15}$/

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




[RESOLVED (workaround?)] Re: Strange Can't locate Module.pm in @INC error after chaning from 'use lib' to PERL5LIB

2006-02-14 Thread Hans Meier (John Doe)
Hans Meier (John Doe) am Dienstag, 14. Februar 2006 19.08:

 It's very strange:

 My apache doesn't start with

 [error] Can't locate SMF/Config.pm in @INC (@INC contains: /opt/smf/lib
 [...]) at /opt/smf/apconf/backend/httpd_startup_smf.pl line 228.

 But why? The file is there:

 # ls /opt/smf/lib/SMF/Config.pm
 /opt/smf/lib/SMF/Config.pm

 and the path is obviously in @INC.

 The error appears after replacing  use lib '/opt/smf/lib';
 in the httpd_startup.pl with  PERL5LIB=/opt/smf/lib
 in the init.d script. Before, everything went well, and I changed nothing
 else.
[...]

Ok, finally a 

Perl
   use lib qw(/opt/smf/lib);
/Perl

in the httpd.conf did the trick, while a PerlSetEnv PERL5LIB also didn't.

I'm fine with that, but still don't understand how a path present in @INC is 
ignored.

Hans

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: still confused on how to locally install perl modules without administrative privileges on windows (activestate 5.6.1 build 630)

2006-02-14 Thread Chas Owens
On 2/14/06, Wolcott, Kenneth A [EMAIL PROTECTED] wrote:
 Hi;

   What is the correct path separator for use lib in a Perl program on
 Windoze when I have multiple paths?

Multiple use lib statements:

use lib /usr/local/perl;
use lib /opt/perl;
use lib ~/perl;


   What is the correct path separator when using PERL5LIB on Windoze?

   Apparently a colon is not a good choice as that is the Windoze
 separator between drive/partition names and the path(s)...
snip

from perldoc perlrun
PERL5LIB

A list of directories in which to look for Perl library files
before looking in the standard library and the current directory. Any
architecture-specific directories under the specified locations are
automatically included if they exist. If PERL5LIB is not defined,
PERLLIB is used. Directories are separated (like in PATH) by a colon
on unixish platforms and by a semicolon on Windows (the proper path
separator being given by the command perl -V:path_sep).

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Stopping a Service with cgi

2006-02-14 Thread nishanth ev
hello Friends,

Have anyone tried stopping a service say httpd usng a
cgi script ?
I have set a setuid for the cgi script and the script
is in the root cgi-bin directory namely
/var/www/cgi-bin/ with ownership root and have the
following contents in the file

#!/usr/bin/perl
$ENV{'PATH'} = '/bin:/usr/bin';
printContent-type:text/html\n\n;
`/etc/rc.d/init.d/httpd stop`;

./file-name.cgi will stop the httpd but i want to stop
the httpd when i access this cgi through the browser.

Please help

regards
Nishanth

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread Hans Meier (John Doe)
Gerald Wheeler am Dienstag, 14. Februar 2006 21.03:
 I am trying to allow input of a person's first and last name in one form
 field, nothing more, nothing less

 There should be only one uppercase A-Z character followed by one or
 more lowercase a-z characters followed by one space followed by one
 uppercase A-Z character followed by one or more lowercase a-z
 characters, nothing more.

 have tried this which does not work:  /^[A-Z a-z]\s+[A-Z a-z]{1,15}$/

It's not enough restrictive. According to your exact description, it should be 
(untested):

/^[A-Z][a-z]+ [A-Z][a-z]+$/

Of course, you can replace the '+' by {min,max}.

Further, for userfriendliness, you could allow other whitespace, and more 
between the words, and additonally around them, and trim them away 
*afterwards*:

my $userinput=get_from_request();

if (/^\s*([A-Z][a-z])+\s*([A-Z][a-z])+\s*$/) { 
  # input is ok, so now we format:
  my $formatted=$1 $2;
  do_something_with($formatted);
}

hth,
Hans

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread Chas Owens
On 2/14/06, Gerald Wheeler [EMAIL PROTECTED] wrote:
 I am trying to allow input of a person's first and last name in one form
 field, nothing more, nothing less

 There should be only one uppercase A-Z character followed by one or
 more lowercase a-z characters followed by one space followed by one
 uppercase A-Z character followed by one or more lowercase a-z
 characters, nothing more.

 have tried this which does not work:  /^[A-Z a-z]\s+[A-Z a-z]{1,15}$/

 Thanks.

[A-Z a-z] says match one or more of the characters A through Z,
space, or a through z.  What you want is [A-Z][a-z]+ which says
match a character A through Z followed by one or more characters a
through z.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: hi please clarify my doubts

2006-02-14 Thread Tom Phoenix
On 2/13/06, DEVARAJA AP [EMAIL PROTECTED] wrote:

i wrote a perlscript to generate a verilog code with instantiations .in 
 this
  after instantiation, the ports getting as eg
   module_name  name(.a(a),.b(b),...)

   but for connection sakeif want to connect a to some k and b to some
 p (say).here we wanted to change those names manually. is ther any way
 to do trhis automatically in the instantiation part of the perl script itself.

Almost certainly, what you want is possible. Perl is very versatile.

Unfortunately, I cannot understand what you are asking about. It may
help if you include the Perl code that you're talking about. If
another language is better for you than English, feel free to try that
one.

At a guess, maybe you want something like this code. Or maybe not...

if ($alternate_site) {
$port = 'k';
} else {
$port = 'a';
}

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: regexpressions help

2006-02-14 Thread Timothy Johnson


Someone has already given you a Regex that will work, but I wanted to
show you what happened with the regex you provided.

What I see in your regex is:

/^
Start of the line

[A-Z a-z]
One uppercase letter, space, or lowercase letter.
It looks like you're trying to include two character classes in one set
of brackets.  You have to separate the character classes to get what you
want: [A-Z][a-z]+ would work.

\s+
One or more spaces

[A-Z a-z]{1,15}
One to fifteen uppercase letters, spaces, or lowercase letters

$/
And then the end of the line, possibly including a \n character






You might want to look at the YAPE::Regex::Explain module.  If you're
not sure what a regex is doing, it will break it down for you.


Here's what YAPE::Regex::Explain had to say about your Regex.


(?-imsx:/^[A-Z a-z]\s+[A-Z a-z]{1,15}$/)

matches as follows:

NODE EXPLANATION
--
(?-imsx: group, but do not capture (case-sensitive)
 (with ^ and $ matching normally) (with . not
 matching \n) (matching whitespace and #
 normally):
--
  /'/'
--
  ^the beginning of the string
--
  [A-Z a-z]any character of: 'A' to 'Z', ' ', 'a' to
   'z'
--
  \s+  whitespace (\n, \r, \t, \f, and  ) (1 or
   more times (matching the most amount
   possible))
--
  [A-Z a-z]{1,15}  any character of: 'A' to 'Z', ' ', 'a' to
   'z' (between 1 and 15 times (matching the
   most amount possible))
--
  $before an optional \n, and the end of the
   string
--
  /'/'
--
)end of grouping
--




-Original Message-
From: Gerald Wheeler [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 12:04 PM
To: beginners@perl.org
Subject: regexpressions help

I am trying to allow input of a person's first and last name in one form
field, nothing more, nothing less

There should be only one uppercase A-Z character followed by one or
more lowercase a-z characters followed by one space followed by one
uppercase A-Z character followed by one or more lowercase a-z
characters, nothing more.

have tried this which does not work:  /^[A-Z a-z]\s+[A-Z a-z]{1,15}$/

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread Hans Meier (John Doe)
Hans Meier (John Doe) am Dienstag, 14. Februar 2006 21.35:

 if (/^\s*([A-Z][a-z])+\s*([A-Z][a-z])+\s*$/) {
   # input is ok, so now we format:
   my $formatted=$1 $2;
   do_something_with($formatted);
 }

Sorry, this is completely bullshit, shuld have tested before hitting send.



my $userinput=   Hans \n  Meier ;

if ($userinput=~/^\s*([A-Z][a-z]+)\s+([A-Z][a-z]+)\s*$/) {
  # input is ok, so now we format:
  my $formatted=$1 $2;
  print $formatted;
}
print $userinput;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: regexpressions help

2006-02-14 Thread Wolcott, Kenneth A
Glad I was able to help.

Ken Wolcott

-Original Message-
From: Gerald Wheeler [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 2:31 PM
To: Wolcott, Kenneth A
Subject: RE: regexpressions help


Kenneth,
   works for me

much appreciated..

Jerry

 Wolcott, Kenneth A [EMAIL PROTECTED] 2/14/2006 1:20:47 PM 
What about (untested)

/^[A-Z][a-z]+\s[A-Z][a-z]+$/

This forces one uppercase letter followed by one or more lowercase
letters, followed by a space, followed by one uppercase letters and
terminated by one or more lowercase letters.  This does not force a
limit on the total number of characters.

HTH,
Ken Wolcott

-Original Message-
From: Gerald Wheeler [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 2:04 PM
To: beginners@perl.org 
Subject: regexpressions help


I am trying to allow input of a person's first and last name in one
form
field, nothing more, nothing less

There should be only one uppercase A-Z character followed by one or
more lowercase a-z characters followed by one space followed by one
uppercase A-Z character followed by one or more lowercase a-z
characters, nothing more.

have tried this which does not work:  /^[A-Z a-z]\s+[A-Z a-z]{1,15}$/

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response

--
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: force requiring a file

2006-02-14 Thread Tom Phoenix
On 2/14/06, Adriano Allora [EMAIL PROTECTED] wrote:

 Can't locate ./ricerche/VALICO672.pl in @INC (@INC contains:

 the pathname is correct (the code in the separate file too), alla
 permissions are ok, but I cannot include it.

The dot at the start of the pathname means that the pathname is
relative to the current working directory. If you think the pathname
is correct, double-check that you're working in the right directory
when you reach the require.

Better yet, use absolute pathnames, not relative ones, to locate code.
That's for security reasons. You don't really want to ask for whatever
file of that name is available relative to the current directory; you
want to ask for a particular library file which doesn't depend upon
whichever is the current directory at the moment.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: hi please clarify my doubts

2006-02-14 Thread Marilyn Sander
Devaraja,

Is this a question about vperl?

You speak of generating verilog code.  Is the instantiation you speak
of the instantiation of your block that is defined in verilog?
What do you mean by the instantiation part of the perl script?

--Marilyn

Tom Phoenix wrote On 02/14/06 09:49,:
 On 2/13/06, DEVARAJA AP [EMAIL PROTECTED] wrote:
 
 
   i wrote a perlscript to generate a verilog code with instantiations .in 
 this
 after instantiation, the ports getting as eg
  module_name  name(.a(a),.b(b),...)

  but for connection sakeif want to connect a to some k and b to some
p (say).here we wanted to change those names manually. is ther any way
to do trhis automatically in the instantiation part of the perl script itself.
 
 
 Almost certainly, what you want is possible. Perl is very versatile.
 
 Unfortunately, I cannot understand what you are asking about. It may
 help if you include the Perl code that you're talking about. If
 another language is better for you than English, feel free to try that
 one.
 
 At a guess, maybe you want something like this code. Or maybe not...
 
 if ($alternate_site) {
 $port = 'k';
 } else {
 $port = 'a';
 }
 
 Good luck with it!
 
 --Tom Phoenix
 Stonehenge Perl Training
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response
 
 

-- 

Marilyn E. Sander[EMAIL PROTECTED]
Database (CM) Engineer   Phone  (408)616-5651
 internal 45651

 ~
 NOTICE: This email message is for the sole use of the intended
 recipient(s) and may contain confidential and privileged
 information. Any unauthorized review, use, disclosure or
 distribution is prohibited. If you are not the intended recipient,
 please contact the sender by reply email and destroy all copies
 of the original message.
 ~


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: regexpressions help

2006-02-14 Thread Timothy Johnson

I had the same thought.  Is there a reason why the OP doesn't want to
give the user two prompts?  It seems like the most stable way of getting
the information.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Tom Phoenix
Sent: Tuesday, February 14, 2006 1:47 PM
To: Gerald Wheeler
Cc: beginners@perl.org
Subject: Re: regexpressions help

On 2/14/06, Gerald Wheeler [EMAIL PROTECTED] wrote:

 I am trying to allow input of a person's first and last name in one
form
 field, nothing more, nothing less

Robert de Niro?
Mary Kay Place?
Arthur Conan Doyle?
Harry S Truman?
Kim Jong-il?
brian d foy?
Sting?
John Paul II?
George W. Bush?
Prince Charles?

snip



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread Tom Phoenix
On 2/14/06, Gerald Wheeler [EMAIL PROTECTED] wrote:

 I am trying to allow input of a person's first and last name in one form
 field, nothing more, nothing less

Robert de Niro?
Mary Kay Place?
Arthur Conan Doyle?
Harry S Truman?
Kim Jong-il?
brian d foy?
Sting?
John Paul II?
George W. Bush?
Prince Charles?

I'm sure you're doing what you need to do for your application. You
probably already know that not everybody easily fits a simple pattern,
and that you can't algorithmically be certain what's a first name
and what's a last name in a given string. I'm just thinking of a few
people who won't be using your software. :-)

Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Perl/Syslog: how to control the hostname in the syslog file?

2006-02-14 Thread Ravi Malghan
Hi: I have created a simple script to log syslog
messages with the following lines

openlog('lab-sensor', 'cons,ndelay,nowait','local7');
syslog('debug', 'this is a test message');

When I run this locally (local hostname: nms02), the
following message shows up in the syslog file.

Feb 14 16:50:37 nms02 lab-sensor: this is a test
message

Is there any way I can configure so that lab-sensor
shows up instead of nms02 after the date field?

Thanks in Advance.
Ray

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Stopping a Service with cgi

2006-02-14 Thread Tom Phoenix
On 2/14/06, nishanth ev [EMAIL PROTECTED] wrote:

 I have set a setuid for the cgi script

You webserver may not be running this program set-id, even if you use
the setuid bit, for security reasons. You can find out the user id
it's running under with the $ and $ variables. See perlvar.

 Have anyone tried stopping a service say httpd usng a
 cgi script ?

You mean, stopping a second web server, not the one that's running
your CGI program, right? If your program stops running the program
that's running your program, that's the end of execution, ready or
not. (But if that's the issue, you could set up a delayed shutdown, to
shut down the server several seconds after the CGI program finishes.)

Stopping another server should be possible, although you may need to
have a non-privileged CGI program start a second set-id program to do
the work.

 `/etc/rc.d/init.d/httpd stop`;

Any error messages that this command produces may cause the webserver
to stop the CGI program early. Also, since the backquotes are in a
void context, any normal output is discarded. You could make that
explicit:

system('/etc/rc.d/init.d/httpd stop /dev/null 2/dev/null');

But capturing the output (and maybe saving it or displaying it for the
benefit of the user) is probably a better way:

my $results = `/etc/rc.d/init.d/httpd stop 21`;

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Stopping a Service with cgi

2006-02-14 Thread Hans Meier (John Doe)
nishanth ev am Dienstag, 14. Februar 2006 17.56:
 hello Friends,

 Have anyone tried stopping a service say httpd usng a
 cgi script ?
 I have set a setuid for the cgi script and the script
 is in the root cgi-bin directory namely
 /var/www/cgi-bin/ with ownership root and have the
 following contents in the file

 #!/usr/bin/perl
 $ENV{'PATH'} = '/bin:/usr/bin';
 printContent-type:text/html\n\n;
 `/etc/rc.d/init.d/httpd stop`;

 ./file-name.cgi will stop the httpd but i want to stop
 the httpd when i access this cgi through the browser.

As Tom alredy pointed out, there are some security implications by enabling 
service starting and stopping through a web interface. 

In my persopnal opinion, it's better not to call a (set-id) program but just 
touch or modify a file if possible.

You could set up a cron job to test modification time of the touched file and 
stopping/restarting the service accordingly 
(and, e.g., let it send a notification mail to you or any other recipient not 
provided by the webinterface user).

In any case, be careful not to enable DOS-attacks.

hth,
Hans

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread David Kaufman
Hans Meier (John Doe) [EMAIL PROTECTED] wrote:

 Gerald Wheeler wrote:
 I am trying to allow input of a person's first and last name in one
 form field, nothing more, nothing less

 There should be only one uppercase A-Z character followed by one or
 more lowercase a-z characters followed by one space followed by one
 uppercase A-Z character followed by one or more lowercase a-z
 characters, nothing more.

 Further, for userfriendliness, you could allow other whitespace, and
 more between the words, and additonally around them, and trim them
 away *afterwards*:

Also for user-friendliness...

Keep in mind that lots of people have two-word last names (Dick Van 
Dyke), intersticial caps in their names (Matt LeBlanc and LaToya 
Jackson), apostrophes crammed in there (Conan O'Brien) and/or 
non-English letters in their names ...and boy, do people tend to get 
attached to these particular strings of characters, insisting on their 
names being spelled the way they like!

-dave 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: regexpressions help

2006-02-14 Thread Timothy Johnson


-Original Message-
From: David Kaufman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 1:23 PM
To: beginners@perl.org
Subject: Re: regexpressions help

Hans Meier (John Doe) [EMAIL PROTECTED] wrote:

 Gerald Wheeler wrote:
 I am trying to allow input of a person's first and last name in one
 form field, nothing more, nothing less

 There should be only one uppercase A-Z character followed by one or
 more lowercase a-z characters followed by one space followed by one
 uppercase A-Z character followed by one or more lowercase a-z
 characters, nothing more.

 Further, for userfriendliness, you could allow other whitespace, and
 more between the words, and additonally around them, and trim them
 away *afterwards*:

Also for user-friendliness...

Keep in mind that lots of people have two-word last names (Dick Van
Dyke),
intersticial caps in their names (Matt LeBlanc and LaToya Jackson),
apostrophes crammed in there (Conan O'Brien) and/or non-English letters
in
their names ...and boy, do people tend to get attached to these
particular
strings of characters, insisting on their names being spelled the way
they
like!

-dave


Oh, and don't forget that some people have only one name.  It's rare,
but it can really throw things for a loop if you don't plan for it.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: [RESOLVED (workaround?)] Re: Strange Can't locate Module.pm in @INC error after chaning from 'use lib' to PERL5LIB

2006-02-14 Thread Tom Phoenix
On 2/14/06, Hans Meier (John Doe) [EMAIL PROTECTED] wrote:

 I'm fine with that, but still don't understand how a path present in @INC is
 ignored.

It sure looks like it's in @INC, from the message. (You may know that
PERL5LIB is sometimes ignored for security reasons, but it's not
ignored if it's in the message.) Could there be a hidden (control or
whitespace) character or something else in there? See whether you can
compare the @INC that works with the one that doesn't, because that
sounds like the culprit. Good luck!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread Chris Devers
On Tue, 14 Feb 2006, Tom Phoenix wrote:

 On 2/14/06, Gerald Wheeler [EMAIL PROTECTED] wrote:
 
  I am trying to allow input of a person's first and last name in one 
  form field, nothing more, nothing less
 
 Robert de Niro?
 Mary Kay Place?
 Arthur Conan Doyle?
 Harry S Truman?
 Kim Jong-il?
 brian d foy?
 Sting?
 John Paul II?
 George W. Bush?
 Prince Charles?

Or, my favorite, Jennifer 8 Lee:

http://en.wikipedia.org/wiki/Jennifer_8._Lee

So, as others have asked, is it really pragmatic to come up with a regex 
that will properly recognize any of these eccentric-but-real surnames, 
while rejecting non-surnames like, say...

Time And Place
Bee Sting
Rose Bush

...which presumably are not names.

Put another way, if someone says their name is 8, what business does 
your software have in trying to convince them otherwise? You have a slim 
chance of catching a typo -- though if you think about it most people 
that can type at all well have probably long-since committed their own 
name to finger memory, so typoes are unlikely -- but most likely you're 
just going to get someone frustrated with you. 
 


-- 
Chris Devers
DO NOT LEAVE IT IS NOT REAL

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regexpressions help

2006-02-14 Thread Chas Owens
On 2/14/06, Chris Devers [EMAIL PROTECTED] wrote:
snip
 So, as others have asked, is it really pragmatic to come up with a regex
 that will properly recognize any of these eccentric-but-real surnames,
 while rejecting non-surnames like, say...

 Time And Place
 Bee Sting
 Rose Bush

 ...which presumably are not names.
snip

I actually knew a Rose Bush (cruel parents).

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




get rid of IO::Handle::DESTROY

2006-02-14 Thread Ken Perl
I am using Apache::DB as interactive debugger to debug my modperl2 program.

No breakpoints are defined, I input many 'r' while requesting the home
page,  and the return is always like below, and the home page can't be
displayed in the debug mode.
However, if turning off the debug mode, the home page can be rendered normally.

 DB1 r
void context return from IO::Handle::DESTROY
IO::Handle::DESTROY(/usr/lib/perl/5.8/IO/Handle.pm:75):
75: sub DESTROY {}
 DB1 r
void context return from IO::Handle::DESTROY
Apache2::SizeLimit::handler(/usr/lib/perl5/Apache2/SizeLimit.pm:248):
248:my $r = shift;

Any comments about why I got so many  IO::Handle::DESTROY messages
again and again? How to remove them and let the debugging go smoothly?
--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Unicode character definition

2006-02-14 Thread Kenneth Moeng
Hello team,
 
Please help me on the following code. The code is supposed to receive to
words cool and cash plus a number from 0 to 10, with optional spaces
between the words.
 
When I run the program it gives me this error  Can't find unicode
character property definition via main-a or a.pl at Unicode
 
 
Use dbi;
 
$dsn= dbi:mysql:db_coolcash:localhost;
my $user= mysql;
my $password = mysql123;
$dbh = DBI-connect($dsn,$user,$password);
 
##GET ARGS ##
$msg = $ARGV[1];
$source = $ARGV[0];
 
if (($msg =~ /cool\s\cash\s*1/i)  ($msg !~ /cool\s\cash\s*1\d/i))
{
 $vote = cool cash 1';
 $found = 1;
}
 
 
Kind Regards,
 
 


regex problem

2006-02-14 Thread anand kumar
Hi all,
   
   I have the following problem in the following regex replace. 
   
  $line=~s!\b($name)\b!au$1!g;
   
  here this regex finds the exact matching of the content in $name and does the 
needed but in some examples the variable $name may contain backslash characters 
like 'gene\l=s\' , in this type of cases the replace string does not work so i 
have removed '\b' on either side and used the following
   
  $line=~s!(\Q$name\E)!au$1!g;
   
  This works fine but the problem is that the replacement is not done on the 
exact word but also on substrings which is unnecessary.
   
  if i use both \b\b and \Q\E then the code fails to replace.
   
  please send suggestions in this regard
   
  Thanks in advance for the help
   
  Regards
  Anand
   


-
 Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.

Re: Stopping a Service with cgi

2006-02-14 Thread nishanth ev
Hello folks,
Thanks a lot for the reply.
I dont mean exactly httpd.
Any Service will do.
I want to start and stop a serviec using cgi script.
Say mysql service will do,

#!/usr/bin/perl
`/etc/rc.d/init.d/mysqld restart`;
printContent-type:text/html\n\n;
printRESTARTED;

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regex problem

2006-02-14 Thread John W. Krahn
anand kumar wrote:
 Hi all,

Hello,

 I have the following problem in the following regex replace.
 
 $line=~s!\b($name)\b!au$1!g;
 
 here this regex finds the exact matching of the content in $name and does
 the needed but in some examples the variable $name may contain backslash
 characters like 'gene\l=s\' , in this type of cases the replace string does
 not work so i have removed '\b' on either side and used the following
 
 $line=~s!(\Q$name\E)!au$1!g;
 
 This works fine but the problem is that the replacement is not done on the
 exact word but also on substrings which is unnecessary.
 
 if i use both \b\b and \Q\E then the code fails to replace.
 
 please send suggestions in this regard

$line=~s!\b(\Q$name\E)\b!au$1!g;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response