Re: conecting cgi and mdb? help please:)

2002-04-17 Thread Mo Holkar / UKG

At 13:43 17/04/02, you wrote:
I have install ActivePerl 5.6.1.630 in folder c:\perl
then I have run ppm and do the fallowing:

PPM install dbi
Install package 'dbi?' (y/N): y
Installing package 'dbi'...
Error installing package 'dbi': Could not locate a PPD file for package dbi
PPM

This operation is case-sensitive -- you need to type 'install DBI'.

best,

Mo




Mo Holkar
Undying King Games
[EMAIL PROTECTED]
Free games! at http://www.ukg.co.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Removing the last character from a string

2002-04-17 Thread Nikola Janceski

this worked for me:

use warnings;
use strict;

my $string = qq(one two three four);
$string =~ s/\$//; # replace last  with nothing
print $string\n;

__END__

What did your code look like?
What version of perl are you using?


 -Original Message-
 From: Scot Robnett [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 17, 2002 1:32 PM
 To: [EMAIL PROTECTED]
 Subject: Removing the last character from a string
 
 
 How would I remove only the *last* quote from this string?
 
   my $string = qq(one two three four);
 
 
 The result I am looking for replaces this:
 
   one two three four
 
 
 with this:
 
   one two three four
 
 
 This did not work:
 
   $string =~ s/\$//; # replace last  with nothing
 
 
 -
 Scot Robnett
 inSite Internet Solutions
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.349 / Virus Database: 195 - Release Date: 4/15/2002
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Using smtp

2002-04-17 Thread Bill Lyles

I have a script that I'm trying to edit to use smtp because it only calls
for a mail program.

this is the code

if ($found) {
open (MAILME, |$mailprog -t) or dienice(Can't access $mailprog!\n);
print MAILME To: $email\n;
print MAILME From: $adminmail\n;
print MAILME Subject: Your username and password\n\n;
print MAILME qq~
Below are your username and password.

Username: $user
Password: $pass

Don't lose it next time :o)

Best Regard
$adminname
~;
close (MAILME);
print qq~
$header
Your password and username have been sent to you.
$footer
~;

How can I change this to smtp?

thanks






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Firewall

2002-04-17 Thread Fred Sahakian

Anyone know of a perl script that can determine if a website is actually behind a 
firewall?  

thanks!



Re: Using smtp

2002-04-17 Thread eric-sourceforge

On Wed, 17 Apr 2002, Bill Lyles wrote:
 How can I change this to smtp?

Bill:

Try using Mail::Mailer:

#!/usr/bin/perl -w
use Mail::Mailer;

my $To = $ARGV[0];
my $mailer = Mail::Mailer-new('smtp', 'your.smtp.host');
$mailer-open({
From = [EMAIL PROTECTED],
To   = $To,
Subject = Password reminder for $To,
});
print $mailer $Message;
$mailer-close;

-- 
Eric P.
Los Gatos, CA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Parsing variables and HTML

2002-04-17 Thread John Brooking

P Daniel,
P dir=ltr style=MARGIN-RIGHT: 0pxnbsp;nbsp; I'm
assuming you mean that you want your three crud
parameters passed through, in which case, your
intuition at the end of your message is correct.
Remember that HTTP is by default stateless, meaning
that when the form that was output by first() is
submitted, your script has no memory that is was ever
run before. It only knows what was in the latest
request. So you need to include more hidden fields in
your form in order to preserve them between
invocations of the
script:BRnbsp;nbsp;nbsp;BRlt;input
type=hidden value=$crud1
name=crud1gt;BRlt;input type=hidden
value=$crud2 name=crud2gt;BRlt;input
type=hidden value=$crud3 name=crud3gt;/P
PNote that by default, $variables expand in Here
documents the same as innbsp;double-quoted
literals.nbsp;nbsp; /P
P- JohnBR/P
Pnbsp; BIDaniel Falkenberg
lt;[EMAIL PROTECTED]gt;/I/B wrote: 
BLOCKQUOTE style=PADDING-LEFT: 5px; MARGIN-LEFT:
5px; BORDER-LEFT: #1010ff 2px solidHello
All,BRBRI am having a little bit of trouble with
HTML and perl. I want to beBRable to parse variable
from some HTML code where a user hits a
submitBRbutton and the data they entered from that
from should be parsed to theBRnext sub. At the
moment I am using the following code...BRBR$action
= param(action);BR$crud1 =
param(crud1);BR$crud2 = param(crud2);BR$crud3
= param(crud3);BRBRif ($action =~ /first/)
{first();}BRelsif ($action =~ /second_sub/)
{second_sub();}BRelse{ first();}BRBRsub first
{BRBRprintlt;HTML;BR
FORMBR#User enters data in some text boxes
here...BRINPUT type=hidden value=second_sub
name=actionBRINPUT type=image
src=http://us.f144.mail.yahoo.com/ym/images/submit.gif;BR/FORMBRBRHTMLBRBR}BRBR#
Script is now taken to second_sub();BRBRsub
second_sub {BRBRprint $crud1, $crud2,
$crud3;BRBR}BRBR but for some reason the
the data from first() is not being placedBRinto
second_sub(); Should I be adding some more hidden HTML
tags in theBRfirst(); sub?BRBRAny help on this
would be greatly appricated.BRBRRegards,BRBRDan/BLOCKQUOTE

__
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Counting the number of form fields returned with information

2002-04-17 Thread eric-sourceforge

Hello, All:

What's the simplest way to make sure that all 10 fields have been 
selected? I was hoping that...

  display_error_message() if param()  10;

would work, but it doesn't seem to work correctly.

-- 
Eric P.
Los Gatos, CA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to check installed Modules in perl

2002-04-17 Thread Jeff 'japhy' Pinyan

On Apr 17, Alex Cheung Tin Ka said:

I am new to perl. I would like to know what can I do to check
whether I have installed particular module in perl.

The simplest way is:

  perl -MModule -e0

If that runs without Perl saying Can't find Module.pm in ..., you've got
the module.

Example:

  perl -MCGI -e0

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Module for sending Fax

2002-04-17 Thread Robert Graham

Good day

Does anyone know of a perl module I can use to send a fax with?

Regards
Robert Graham


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to check installed Modules in perl

2002-04-17 Thread Gabby Dizon

You can use the ExtUtils::Installed module to list all the modules installed
in your copy of perl. It's available in CPAN.

Gabby Dizon
Web Developer
Inq7 Interactive, Inc.
http://www.inq7.net
http://you.inq7.net
- Original Message -
From: Alex Cheung Tin Ka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 17, 2002 2:13 PM
Subject: How to check installed Modules in perl


Dear All,
I am new to perl. I would like to know what can I do to check whether I
have installed particular module in perl.

Thanks
Alex



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Parsing variables and HTML

2002-04-17 Thread Daniel Falkenberg

Hello All,

I am having a little bit of trouble with HTML and perl. I want to be
able to parse variable from some HTML code where a user hits a submit
button and the data they entered from that from should be parsed to the
next sub.  At the moment I am using the following code...

$action = param(action);
$crud1 = param(crud1);
$crud2 = param(crud2);
$crud3 = param(crud3);

if ($action =~ /first/)  {first();}
elsif ($action =~ /second_sub/) {second_sub();}
else{ first();}

sub first {

printHTML;
form
#User enters data in some text boxes here...
input type=hidden value=second_sub name=action
input type=image src=./images/submit.gif
/form

HTML

}

# Script is now taken to second_sub();

sub second_sub {

print $crud1, $crud2, $crud3;

}

 but for some reason the the data from first() is not being placed
into second_sub();  Should I be adding some more hidden HTML tags in the
first(); sub?

Any help on this would be greatly appricated.

Regards,

Dan



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regex tester

2002-04-17 Thread John W. Krahn

Clemens Giegerich wrote:
 
 Yesterday I have made regexEvaluater1.0.pl public.
 It's a perl-Tk script for interactive developing of perl regular
 expression. Unlike regexp it hasn't any syntax highlighting but it has
 two text areas one before and after applying the expression and it is
 fully written in perl. Perl's special variables and return values can be
 shown too. It's suitable for incremental script development and can be
 used as a tool for filtering text data stepwise.
 regexEvaluater was developed on Unix SGI but it was reported that it
 will run on Windows 2000 under cygwin too.
 The script and a screen shot is available at
 http://home.arcor.de/clemens.giegerich/ .
 See the online help or the source code for more information.
 
 I would be glad for any comments or suggestions.


It looks pretty good except for:

$ perl -wc regexEvaluater1.0.pl
my variable $frm2 masks earlier declaration in same scope at
regexEvaluater1.0.pl line 709.
my variable $frm2 masks earlier declaration in same scope at
regexEvaluater1.0.pl line 741.
regexEvaluater1.0.pl syntax OK



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Installing Perl Modules / Net::FTP

2002-04-17 Thread OZGUR GENC

Dear All,
I have tried to install Net::FTP module from CPAN. My OS s UNIX. During
the uncompressing module file (example : perl-5.7.3.tar.gz) , the system
prompts invalid compressed data--crc error . I have tried to install
some other Net::FTP module but I have encountered same problem. Does
anyone have any idea ?
Regards,
Ozgur GENC


***

This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient you are hereby notified that any
dissemination, forwarding, copying or use of any of the information is
prohibited.

The opinions expressed in this message belong to sender alone. There is no
implied endorsement by TURKCELL.

This e-mail has been scanned for all known computer viruses.

***

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to check installed Modules in perl

2002-04-17 Thread Greg Matheson

On Wed, 17 Apr 2002, Alex Cheung Tin Ka wrote:

 I would like to know what can I do to check whether I have installed particular 
module in perl.

perldoc perllocal returns a list of modules that have been
installed, but this is different from the modules that you can
use. I am not too sure of how a modules gets included in this list,
because there are modules in the list which I don't believe I
installed myself.


-- 
Greg Matheson   It was said a million monkeys on a million typewriters
Chinmin College would eventually write the works of Shakespeare.
Now, thanks to the Internet, we know this is not so.
http://www.research.att.com/~reeds/monkeys.html
Taiwan Penpals Archive URL: http://netcity.hinet.net/kurage

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: question

2002-04-17 Thread Ramis

Tucker, Ernie wrote:
 
 How can a have one perl script call another perl script ?
May be:

print `somescript.pl`;

 
 
 Ernest P. Tucker II
  Network Technician
  Charter Communications
  Madison Management Area
(608) 373-7625
 

-- 
---!
My blessing!
Ramis. !
---!

http://www.samtan.fromru.com
mailto: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Read file symbol by symbol?

2002-04-17 Thread Ramis

Jonathan E. Paton wrote:
 
 You don't want to, reading one character
 at a time is VERY slow.  At worst, the
 operating system will cut short your
 time slot whilst it waits for the file
 access - perhaps limiting you to a few
 dozen characters per second...
 
 if you care much for that approach,
 have a look at sysopen/sysread.
 
 A better approach is to read a line at
 a time, and split it down into symbols.
 However, it's unlikely you actually need
 to do this in Perl.  This works:
 
 my @chars = split //, $string;
 
 The best approach, is to read fixed sized
 blocks with sysread and then split into
 symbols.
 
 NB: I said you rarely need to split into
 symbols, why?  Because Perl has one of the
 most expressive regular expression engine
 in existance, that does almost all the text
 manipulation you could ever require.
 
 If it's not text manip, I'd like to know
 what happens to these symbols :)
 
 Take care,
 
 Jonathan Paton
I want to translate text files on Russian koi-8r under Linux into
Microsoft Windows-1251 keytables. So why I need read ALL symbols (also
CR and LF). And, anymore, I want to change the lenght of the lines
during this recoding.
I am trying this:

$char=getc TXT;

-- 
---!
My blessing!
Ramis. !
---!

http://www.samtan.fromru.com
mailto: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: localtime help

2002-04-17 Thread Ramis

James Kelty wrote:
 
 Can someone point me to the perldoc's that can help me get the localtime
 equivalent of the shell command /bin/date +'%Y%m%d' ?
 
 Thanks!
 
 -James
 
 James Kelty
 Sr. Unix Systems Administrator
 Everbase Systems
 541.488.0801
 [EMAIL PROTECTED]
 
use Time::localtime;
$today=localtime-mday();
$year=localtime-year()+1900;
$month=localtime-mon()+1;

-- 
---!
My blessing!
Ramis. !
---!

http://www.samtan.fromru.com
mailto: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How to check installed Modules in perl

2002-04-17 Thread Peter_Farrar


in windows:
ppm query




   

Jaimee

Spencer To: 'Alex Cheung Tin Ka' 
[EMAIL PROTECTED], [EMAIL PROTECTED]  
JSpencer@acuc   cc:   

orp.com Subject: RE: How to check installed 
Modules in perl   
   

04/17/2002 

12:24 PM   

   

   





Hello Alex,

You could run the below perl Script.  Hopes this helps.

Regards,
Jaimee


#!/usr/bin/perl
# list all of the perl modules installed
use File::Find ;
for (@INC) { find(\modules,$_) ; }

sub modules
{
if (-d  /^[a-z]/) { $File::Find::prune = 1 ; return }
return unless /\.pm$/ ;
my $fullPath = $File::Find::dir/$_;
$fullPath =~ s!\.pm$!!;
$fullPath =~ s#/(\w+)$#::$1# ;
print $fullPath \n;
}


-Original Message-
From: Alex Cheung Tin Ka [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 11:14 PM
To: [EMAIL PROTECTED]
Subject: How to check installed Modules in perl


Dear All,
I am new to perl. I would like to know what can I do to check whether I
have installed particular module in perl.

Thanks
Alex






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Using smtp

2002-04-17 Thread Chas Owens

On Wed, 2002-04-17 at 12:41, Bill Lyles wrote:
 I have a script that I'm trying to edit to use smtp because it only calls
 for a mail program.
 
 this is the code
 
 if ($found) {
 open (MAILME, |$mailprog -t) or dienice(Can't access $mailprog!\n);
 print MAILME To: $email\n;
 print MAILME From: $adminmail\n;
 print MAILME Subject: Your username and password\n\n;
 print MAILME qq~
 Below are your username and password.
 
 Username: $user
 Password: $pass
 
 Don't lose it next time :o)
 
 Best Regard
 $adminname
 ~;
 close (MAILME);
 print qq~
 $header
 Your password and username have been sent to you.
 $footer
 ~;
 
 How can I change this to smtp?
 
 thanks

Take a look at Mail::Sendmail or Mail::Sender on CPAN (www.cpan.org). 
The author of Mail::Sender is on this list, so you may prefer to go that
route.
 
-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Keep the Lasagna flying!

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: control characters and other entities

2002-04-17 Thread Felix Geerinckx

on Wed, 17 Apr 2002 15:07:58 GMT, Jon Howe wrote:

 I assume this is some sort of char encoding problem can some advise
 on the best way to deal with this. 

The newline sequence \n is encoded differently on Unix and DOS.
See

http://www.perl.com/language/ppt/src/nlcvt/index.html

for conversion programs (in Perl).

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Need help getting started using hashes - SOLUTION

2002-04-17 Thread KEVIN ZEMBOWER

Thank you, David Gray and David K for all your help with understanding
hashes. David Gray, the article you referenced at
http://www.perldoc.com/perl5.6.1/pod/perlreftut.html was very
helpful. Thank you also for the hash of arrays solution which was just
exactly what I was thinking of. Thank you David K for showing me some
excellent SQL techniques, in addition to the program itself.

For those following the thread, and others searching later, here's a
final working program which illustrates the technique. Below it is a
dump of the database used in this example.

—--

www:/cire # cat methodtest4.pl 
#!/usr/local/bin/perl -w

get_method;
our %thehash;

# all dbi stuff is done, show the hash
foreach $key (sort keys %thehash) {
printKey: $key   Method name : $thehash{$key}[0]   Method
short name: $thehash{$key}[1]\n;
}

sub get_method {
   use DBI;
   use DBD::mysql;
   use strict;
   my $dbname = cire; # enter your db name
   my $host = localhost;
   my $dbuser = 'cire';# user may be required
   my $dbpw = 'xx';  # pw may be required
   my $mscs = dbi:mysql:dbname=$dbname;host=$host;;
   my $dbh = DBI-connect($mscs, $dbuser, $dbpw) or die Connect fails
to $dbname\nError = , DBI::errstr;
   my $sql = select methodid, method, sname from method ORDER BY
methodid;
   my $sth = $dbh-prepare($sql) or die Prepare fails for
stmt:\n\t\t$sql\nError = , DBI::errstr;
   my $rv;
   unless ($sth-execute) {
   print\n\tExecute fails for stmt:\n\t\t$sql\nError = ,
DBI::errstr;
   $sth-finish;
   $dbh-disconnect;
   die \n\t\tClean up finished\n;
   }
   print \t\t$rv\n\n if $rv;
   
   our %thehash;
   my @row_ary;
   
   while (@row_ary  = $sth-fetchrow_array) {
   #$key = $row_ary[0];
   #$thehash{$key} = $row_ary[1];
   $thehash{$row_ary[0]} = [$row_ary[1], $row_ary[2]];
   print Key: $row_ary[0]  $thehash{$row_ary[0]}[0]   
$thehash{$row_ary[0]}[0]\n; #for debugging use only
   }
   $sth-finish;
   $dbh-disconnect;
} # sub get_method

—-

mysql select * from method;
+--++-+
| methodid | method | sname   |
+--++-+
|1 | Combined OCs   | COC |
|2 | Progestin-Only OCs | POC |
|3 | DMPA/NET EN| DMPA|
|4 | Norplant Implants  | NI  |
|5 | Female Sterilization   | FS  |
|6 | Vasectomy  | Vas |
|7 | Condoms| Condoms |
|8 | TCu-380A IUD   | TCu |
|9 | Spermicides| Sperm   |
|   10 | Diaphragm Cervical Cap | DCC |
|   11 | Fertility Awareness-based Methods  | FABM|
|   12 | Lacational Amenorrhea Method (LAM) | LAM |
+--++-+
12 rows in set (0.00 sec)

mysql 

—---

Output of program:
www:/cire # ./methodtest4.pl 
Key: 1  Combined OCsCombined OCs
Key: 2  Progestin-Only OCs  Progestin-Only OCs
Key: 3  DMPA/NET EN DMPA/NET EN
Key: 4  Norplant Implants   Norplant Implants
Key: 5  Female SterilizationFemale Sterilization
Key: 6  Vasectomy   Vasectomy
Key: 7  Condoms Condoms
Key: 8  TCu-380A IUDTCu-380A IUD
Key: 9  Spermicides Spermicides
Key: 10 Diaphragm Cervical Cap  Diaphragm Cervical Cap
Key: 11 Fertility Awareness-based Methods   Fertility
Awareness-based Methods
Key: 12 Lacational Amenorrhea Method (LAM)  Lacational Amenorrhea
Method (LAM)
Key: 1   Method name : Combined OCs Method short name: COC
Key: 10   Method name : Diaphragm Cervical Cap  Method short name: DCC
Key: 11   Method name : Fertility Awareness-based Methods   Method
short name: FABM
Key: 12   Method name : Lacational Amenorrhea Method (LAM)  Method
short name: LAM
Key: 2   Method name : Progestin-Only OCs   Method short name: POC
Key: 3   Method name : DMPA/NET EN  Method short name: DMPA
Key: 4   Method name : Norplant ImplantsMethod short name: NI
Key: 5   Method name : Female Sterilization Method short name: FS
Key: 6   Method name : VasectomyMethod short name: Vas
Key: 7   Method name : Condoms  Method short name: Condoms
Key: 8   Method name : TCu-380A IUD Method short name: TCu
Key: 9   Method name : Spermicides  Method short name: Sperm
www:/cire # 

Thanks, again.

-Kevin

-
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310

RE: Counting pairs in a hash.

2002-04-17 Thread Mike Rapuano

$total =  keys %hash;
Mike


-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 12:44 AM
To: 'Glenn Cannon '; '[EMAIL PROTECTED] '
Subject: RE: Counting pairs in a hash.


I'm sure there is a better way, but you could do it this way:

foreach(keys %hash){
   $count++;
}

print $count keys.\n;

-Original Message-
From: Glenn Cannon
To: [EMAIL PROTECTED]
Sent: 4/16/02 7:20 PM
Subject: Counting pairs in a hash.

All,
 
What is the simplest way to find out how many pairs I have in a hash?
 
I am putting a variable number in when reading data from a file, and I
then need to split the file in half for display.
 
Thx,
 
Glenn.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Rounding numbers

2002-04-17 Thread Glenn Cannon

I am dividing a number by 2.  How do I force a round up of the result?
 
Glenn.



Re: Rounding numbers

2002-04-17 Thread Chas Owens

On Wed, 2002-04-17 at 13:01, Glenn Cannon wrote:
 I am dividing a number by 2.  How do I force a round up of the result?
  
 Glenn.

There is undoubtedly a module for this, but here are some off the top of
my head solutions:

Unconditional round-up (ceiling):

$ceiling = int($num+.5) == int($num) ? int($num) : int($num+.5); 

Unconditional round down (floor):

$floor = int($num);

Rounding

$rounded = int($num+.5);

-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Fnord.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




File::Temp for use with mounting remote filesystems

2002-04-17 Thread Dermot Paikkos

Hi Guru's,
SYS stuff: perl 5.005 on tru64 Unix.

I have been playing with the File::Temp module. I wanted to use it to 
create a temporary mount point on a file system then mount a 
remote dir into it and copy the files over.

I tried the following:
use File::Temp qw/ tempdir /;
.
$tempdir = tempdir();
system(mount,-t,nfs,server:/usr1,$tempdir) || die Can't 
mount into $tempdir: $!\n;

I always get the OS error no such file or directory. The dir is made 
so i am not sure if this is an OS problem or a design feature.

Any ideas?
Dp.



~~
Dermot Paikkos * [EMAIL PROTECTED]
Network Administrator @ Science Photo Library
Phone: 0207 432 1100 * Fax: 0207 286 8668


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Rounding numbers

2002-04-17 Thread bob ackerman

for integers:
(add one) divide by 2.
$rndup = ($var+1)/2;

On Wednesday, April 17, 2002, at 10:01  AM, Glenn Cannon wrote:

 I am dividing a number by 2.  How do I force a round up of the result?

 Glenn.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Rounding numbers

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 10:12 , bob ackerman wrote:

 for integers:
 (add one) divide by 2.
 $rndup = ($var+1)/2;

that would give you a float

print half of $_ rounded up is  . ( ($_ + 1) / 2)  . \n
foreach (@ARGV) ;

perl /tmp/drieux/roundup.pl 1 2 3 4 5 6
half of 1 rounded up is 1
half of 2 rounded up is 1.5
half of 3 rounded up is 2
half of 4 rounded up is 2.5
half of 5 rounded up is 3
half of 6 rounded up is 3.5


but:

print half of $_ rounded up is  . int(( $_ / 2) + 0.5 ) . \n
foreach (@ARGV) ;

will give you:

perl /tmp/drieux/roundup.pl 1 2 3 4 5 6
half of 1 rounded up is 1
half of 2 rounded up is 1
half of 3 rounded up is 2
half of 4 rounded up is 2
half of 5 rounded up is 3
half of 6 rounded up is 3

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: setuid ing perl?

2002-04-17 Thread Michael Fowler

Ah, you're talking about running setuid programs.  This can be a tricky
issue, as there are some operating systems that can't securely run setuid
scripts.


On Wed, Apr 17, 2002 at 06:04:49AM +0200, Henk-Jan wrote:
2. Your openwebmail scripts may have wrong owner or mode.
   The permission of
 
   openwebmail.pl, openwebmail-main.pl,
   openwebmail-read.pl, openwebmail-viewatt.pl,
   openwebmail-send.pl, openwebmail-spell.pl,
   openwebmail-prefs.pl, openwebmail-folder.pl and checkmail.pl
 
   should be
 
   mode=4555
   owner=root
   group=mail

Have you checked this?


3. Your perl may be compiled with suid ability disabled.

Did you compile Perl yourself, or install from a vendor-provided package? 
If the latter, does the vendor provide a package for setuid perl?


   c. Or use uty/suidwrap.pl to generate C wrappers for all suid scripts.
  Here are the steps:
  1. cd cgi-bin/openwebmail
  2. perl uty/wrapsuid.pl /fullpath/cgi-bin/openwebmail

You can also try this, avoiding the setuid perl altogether.

 
Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: setuid ing perl?

2002-04-17 Thread Michael Fowler

On Wed, Apr 17, 2002 at 09:50:17AM -0800, Michael Fowler wrote:
 On Wed, Apr 17, 2002 at 06:04:49AM +0200, Henk-Jan wrote:
 3. Your perl may be compiled with suid ability disabled.
 
 Did you compile Perl yourself, or install from a vendor-provided package? 
 If the latter, does the vendor provide a package for setuid perl?

Sorry, I forgot for a moment how you came to this predicament.  Assuming the
permssions on the openwebmail files are correct, you should probably
reinstall the perl provided by your vendor, assuming you have that sort of
OS.  Otherwise, you'll have to recompile perl, or follow 3c.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Rounding numbers

2002-04-17 Thread Michael Fowler

On Wed, Apr 17, 2002 at 01:01:45PM -0400, Glenn Cannon wrote:
 I am dividing a number by 2.  How do I force a round up of the result?

perldoc -q round

or

http://www.perldoc.com/perl5.6.1/pod/perlfaq4.html third question


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Assigning the characters of a variable to an array

2002-04-17 Thread Allison Ogle

Hello,

This is a simple question, I'm sure.  Due to lack of resources however I
have to ask...

I want to store each of the letters and numbers in a variable into an array.

For example, $var=A2B3C4D and I want the elements of my array to be A 2 B 3
C 4 D.  Can anyone help?  Thanks,

Allison


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Assigning the characters of a variable to an array

2002-04-17 Thread Timothy Johnson


split()ing on null will do this for you:

@array = split //,$var;

-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 10:59 AM
To: a a
Subject: Assigning the characters of a variable to an array


Hello,

This is a simple question, I'm sure.  Due to lack of resources however I
have to ask...

I want to store each of the letters and numbers in a variable into an array.

For example, $var=A2B3C4D and I want the elements of my array to be A 2 B 3
C 4 D.  Can anyone help?  Thanks,

Allison


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: PERL Programming Standsrds Help : Urgent

2002-04-17 Thread drieux

Rajnish, et al,

you ask a really tough question one that will not
be that easy to answer as the responses have noted:

On Tuesday, April 16, 2002, at 12:32 , Timothy Johnson wrote:

 Standard #1  TIMTOWTDI :)

'thawak, thwack, thwack' - uh, hold it, that is orthodoxy... 8-)

but think about his problem for a moment - they are trying to do
a 'standards' of a language that is not itself 'strongly typed'
and as such will by its very nature be what is classifiable as
a 'living document' - since as they learn more about this over
that they will have to grow out the document...

 -Original Message-
 From: Felix Geerinckx

 on Tue, 16 Apr 2002 06:39:48 GMT, Rajnish_aggarwal wrote:

 I am preparing a standards document for defining the PERL Coding
 Standards. Any inputs on this will be highly welcome. I will post the
 document on the list for the benefit of other once completed.

 Did you already try

   perldoc perlstyle

Clearly a good starting place!

and then one should of course have the obligatory

perldoc perl

to see the current kvetch of all the current kvetches.

As such, Ranjish needs to think in terms of an 'online'
resource - such as a webPage Section - in which they
can keep updating from the 'lessons learned'.

When even the power house jendra, like myself, has
open concerns about 'unpack' as a function - when
felix did the great job of demonstrating that it is
clearly the CORRECT choice we should:

a) advocate to Ranjish to document that as a
better standard than the bad habits we have used?

b) advocate that 'what we feel safer with' should be
what they adopt

If they start with a webPage of URL's - then they have
the first round of the fight solved - sorta.


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Rounding numbers

2002-04-17 Thread Chas Owens

On Wed, 2002-04-17 at 13:46, drieux wrote:
 
 On Wednesday, April 17, 2002, at 10:12 , bob ackerman wrote:
 
  for integers:
  (add one) divide by 2.
  $rndup = ($var+1)/2;
 
 that would give you a float
 
   print half of $_ rounded up is  . ( ($_ + 1) / 2)  . \n
   foreach (@ARGV) ;
 
   perl /tmp/drieux/roundup.pl 1 2 3 4 5 6
   half of 1 rounded up is 1
   half of 2 rounded up is 1.5
   half of 3 rounded up is 2
   half of 4 rounded up is 2.5
   half of 5 rounded up is 3
   half of 6 rounded up is 3.5
 
 
 but:
 
   print half of $_ rounded up is  . int(( $_ / 2) + 0.5 ) . \n
   foreach (@ARGV) ;
 
 will give you:
 
   perl /tmp/drieux/roundup.pl 1 2 3 4 5 6
   half of 1 rounded up is 1
   half of 2 rounded up is 1
   half of 3 rounded up is 2
   half of 4 rounded up is 2
   half of 5 rounded up is 3
   half of 6 rounded up is 3
   
 ciao
 drieux
 

I think there may have been an implied use integer; pragma in what he
said (for integers:).  Of course, I could be wrong.
 
-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Keep the Lasagna flying!

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Using smtp

2002-04-17 Thread Bill Lyles

I have a script that I'm trying to edit to use smtp because it only calls
for a mail program.

this is the code

if ($found) {
open (MAILME, |$mailprog -t) or dienice(Can't access $mailprog!\n);
print MAILME To: $email\n;
print MAILME From: $adminmail\n;
print MAILME Subject: Your username and password\n\n;
print MAILME qq~
Below are your username and password.

Username: $user
Password: $pass

Don't lose it next time :o)

Best Regard
$adminname
~;
close (MAILME);
print qq~
$header
Your password and username have been sent to you.
$footer
~;

How can I change this to smtp?

thanks






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Variable question

2002-04-17 Thread Helen Dynah


Hi everyone.

 

I was wondering how you would determine whether a variable is a number or not.  I want 
to do an if statement such as

if ($variable is a number) {...

 

Any help is great.  Thanx,

 

Helen



-
Find, Connect, Date! Yahoo! Canada Personals



Re: Automate the running of my script

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 09:13 , Chas Owens wrote:
[..]
 The general way to do this in Unix style OSes is to use cron.  Type man
 crontab for more info, but it should be possible -- but very
 undesirable -- to write something like this:
[..]
 my $last_run = (localtime)[3];
 until ($terminate) {
   my ($hour, $today) = (localtime)[2,3];
   if ($hour = 0 and $last_run  $today) {
   $last_run = $today;
   system('script args args');
   }
 }
[..]

shame on you chas.

that's a run away script - since you have no throttler
in it at all and it will only 'slow down' while actually
executing your system call.

You clearly would want some sort of

use Time::localtime;

#
# so that we can creep on the time
#
sub sleep_and_peek {
 my ( $hour, $min ) = @_;

 my ( $nowHour, $nowMin $nowSec ) = (localtime-hour , localtime-min, 
localtime-sec);

 if ( $nowHour  $hour ) {
 print come back tomorrow\n;

 } elsif ( ($hour - $nowHour )  1 ) {
 print  wait at least  . ( $hour - $nowHour - 1) .  hours\n;
 } else {
 print Inside of an Hour\n;
 my $minOff = 60 - $nowMin ;
 print so sleep at least $minOff minutes \n;
 }
}

to allow you to creep up on the Puppy with a sleep
rather than trying to thrash the system...

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Variable question

2002-04-17 Thread Michael Fowler

On Wed, Apr 17, 2002 at 02:44:32PM -0400, Helen Dynah wrote:
 I was wondering how you would determine whether a variable is a number or
 not.

Use a regex, see perldoc -q 'is a number' or

http://www.perldoc.com/perl5.6.1/pod/perlfaq4.html, second question in the
Data: Misc section.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Automate the running of my script

2002-04-17 Thread Chas Owens

On Wed, 2002-04-17 at 14:45, drieux wrote:
snip /
 
 shame on you chas.
 
 that's a run away script - since you have no throttler
 in it at all and it will only 'slow down' while actually
 executing your system call.
snip /

Oopsy, forgot the sleep call.  That is what I get for just posting code
without testing it first.  Well, I did say something like this grin
/.  Maybe it should look more like this (actually it shouldn't, you
_should use cron or the NT equivalent):

#!/usr/bin/perl
#WARNING UNTESTED CODE
#WARNING UNTESTED CODE
#WARNING UNTESTED CODE

#BIG WARNING -- Has problems with ST vs DT  -- BIG WARNING
#BIG WARNING -- Don't try to use around 2am -- BIG WARNING

use strict;

my $terminate = 0;

$SIG{TERM} = sub { $terminate = 1 };

my $forked = fork;

exit 0 if $forked;

die horrible death unless defined $forked;

my $last_run = (localtime)[3];
until ($terminate) {
my ($sec, $min, $hour, $today) = localtime();
if ($hour = 0 and $last_run  $today) {
$last_run = $today;
system('script args args');
}
($sec, $min, $hour) = localtime();
#(roughly a day) - current time
sleep 86400 - ($sec + $min * 60 + $hour * 60);
}
 
-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Hail Eris, Hack Linux!

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




daemons are not simple or for the feint of heart was - Re: Automate the running of my script

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 11:55 , Chas Owens wrote:
[..]
 Oopsy, forgot the sleep call.  That is what I get for just posting code
 without testing it first.  Well, I did say something like this grin
 /.  Maybe it should look more like this (actually it shouldn't, you
 _should use cron or the NT equivalent):
[..]

Hugs and Kisses - smooch, smooch, love you any way

running them from cron means that in the morning there will be
email about what the job did... great for those 'needs to
run around or after midnightish' types of stock sysAddStuff.

Not good for folks who want to have their automation run more
often than once a day, since the spam mail can get annoying.

So the generalized leap towards a deamon was a practicalish
approach towards a generalized solution...

but the moment that I saw the 'fork' there - I got way
worried, since I did not see any of the classics that
i expect when creating a daemon - such as dealing with
the STDIN/STDOUT/STDERR - setting process group Id, et al.

given that you did not provide a means to 'stop' your
almost like a daemon... nor, for that matter provided
the appropriate 'init scriptology' such that it would
always restart on reboot. and 

These are some of the simpler bits about getting around
to writing a 'daemon' - in perl or any language - and
folks need to think about the costs and consequences...

and there was NO POD

Bad, Bad, Bad Chas No Cookie

{ ok, so I have these strict standards about what can
be installed and run as a daemon }

ciao
drieux

---

ok, so I have this other crisis - namely the bbedit folks,
the other mailing list I am on, pointed out that there were
these cool tricks I could do with it - and I used it as a,

GASP!

Perl IDE - to write, debug, and skank around a bit...

is there an official place to get therapy to help me
deal with the idea of a Perl IDE

Orthodox Perl, this I Grok,
Perl IDE this hurts...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Automate the running of my script

2002-04-17 Thread Gyro


Allison Ogle [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Hi everyone,

 I was wondering if it was possible with Perl to automate my script to be
run
 everyday at midnight.  Does anyone have any suggestions?




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Variable question

2002-04-17 Thread Timothy Johnson


Here's one way:

#\d represents a digit
#this regex checks to see if every character (besides possibly a trailing
\n) is a digit

if($var =~ /^\d+$/){
   do something...
}else{
   don't
}

-Original Message-
From: Helen Dynah [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 11:45 AM
To: [EMAIL PROTECTED]
Subject: Variable question



Hi everyone.

 

I was wondering how you would determine whether a variable is a number or
not.  I want to do an if statement such as

if ($variable is a number) {...

 

Any help is great.  Thanx,

 

Helen



-
Find, Connect, Date! Yahoo! Canada Personals

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Scope of my() declared variables

2002-04-17 Thread drieux


On Wednesday, April 10, 2002, at 04:42 , Elaine -HFB- Ashton wrote:

 I always found the local, my, our mess pretty confusing and the best
 explanation is MJD's Coping with Scoping

 http://perl.plover.com/FAQs/Namespaces.html

 Make good note of the text in red :)

ok, I get the following error message when I use 'local' rather
than a my - in a way old piece of code I found along the way:

vladimir: 66:] perl old_get_ip
Global symbol $hostname requires explicit package name at old_get_ip 
line 8.
Global symbol $hostname requires explicit package name at old_get_ip 
line 10.
Execution of old_get_ip aborted due to compilation errors.
vladimir: 67:]

  see below

I just had the News Flash Coffee Wake Up Moment..

It is whining that in the function it is expecting to use a
local copy of a globally declared variable - which if I try
with the

our $hostname = '';

will work - but not if I did that with the

my $hostname = '';

which hurls furballs with:

vladimir: 75:] perl old_get_ip wetware
Can't localize lexical variable $hostname at old_get_ip line 10.
vladimir: 76:]

So that is how that works

ciao
drieux

---

WARNING: do Not Code Like This: The following is BAD CODE!

### #!/usr/local/bin/perl -w
### use strict;
### #
### # a dumb perl implementation to get an ip_addr for a hostname
### #
our $hostname = '';
### sub do_gethost{
###
### local($hostname) = pop(@_);
###
### my ( $name, $aliases, $addrtype, $length, 
@addr)=gethostbyname($hostname);
###
### if ( defined($name) )
### {
### my ($a, $b, $c, $d) = unpack('C4', $addr[0]);
###
### printf(%s.%s.%s.%s\n, $a, $b, $c, $d);
### }
###
### }
###
### while(my $name = shift(@ARGV) ) {
###
### do_gethost($name);
###
### }
###
### exit(0);
###

that it was in the production release of stuff to provide a
work around because the IT staff was never sure if they were
putting stuff into /etc/hosts or through NIS+ and hence or
and the geeks who whacked in the /bin/sh scripting - 'because we
do not want to learn perl' - had way ancien ugly sed wrappers
on nslookup calls - still remains no good excuse for BAD perl Code.

WARNING: if you code like that after reading stuff from
the perl list - do not blame me because you did not read this
Warning Message and heed it.

did I mention that this is BAD PERL CODE!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: daemons are not simple or for the feint of heart was - Re:Automate the running of my script

2002-04-17 Thread Chas Owens

On Wed, 2002-04-17 at 15:24, drieux wrote:
 
 On Wednesday, April 17, 2002, at 11:55 , Chas Owens wrote:
 [..]
  Oopsy, forgot the sleep call.  That is what I get for just posting code
  without testing it first.  Well, I did say something like this grin
  /.  Maybe it should look more like this (actually it shouldn't, you
  _should use cron or the NT equivalent):
 [..]
 
 Hugs and Kisses - smooch, smooch, love you any way
 
 running them from cron means that in the morning there will be
 email about what the job did... great for those 'needs to
 run around or after midnightish' types of stock sysAddStuff.
 
 Not good for folks who want to have their automation run more
 often than once a day, since the spam mail can get annoying.

So you never heard of redirecting?  A typical crontab entry around here
looks like

#run every minute of everyday
* * * * * /some/misc/script.pl  /some/log/dir/script.log 2
/some/log/dir/script.err

 
 So the generalized leap towards a deamon was a practicalish
 approach towards a generalized solution...

Only if the code is really a daemon.  I have a few daemon scripts that
perform actions on request and then sleep a number of configurable
seconds, but most we want this to run a few times a day requests
should be sent to cron or the equivalent.

 
 but the moment that I saw the 'fork' there - I got way
 worried, since I did not see any of the classics that
 i expect when creating a daemon - such as dealing with
 the STDIN/STDOUT/STDERR - setting process group Id, et al.

If you don't use STDIN/STDOUT/STDERR then you don't need to worry. 
Daemons should only use STDIN/STDOUT/STDERR on failure to start up or
interactive mode.

 
 given that you did not provide a means to 'stop' your
 almost like a daemon... nor, for that matter provided
 the appropriate 'init scriptology' such that it would
 always restart on reboot. and 

Did you miss the $SIG{TERM} = sub { $terminate = 1 };?  Send this
puppy a signal 15 and it falls down nicely.  As for automated starting
up, that depends on your flavor of Unix and is left as an implementation
detail.

 
 These are some of the simpler bits about getting around
 to writing a 'daemon' - in perl or any language - and
 folks need to think about the costs and consequences...

It is definitely a bare bones daemon. 

 
 and there was NO POD
 

Okay, I like docs as much as the next guy, but come on! 31 lines of code
do not deserve POD.  Now if this were a full fledge daemon (ie it
contained the script instead of systeming it) I could see a point to
including some POD.

 Bad, Bad, Bad Chas No Cookie

Yeah, the run away script bit removed my cookie privileges for today. 

 
 { ok, so I have these strict standards about what can
 be installed and run as a daemon }

My standards are a little bit looser (the whole STDIN/STDOUT/STDERR
bit).  

 
 ciao
 drieux
 
 ---
 
 ok, so I have this other crisis - namely the bbedit folks,
 the other mailing list I am on, pointed out that there were
 these cool tricks I could do with it - and I used it as a,
 
   GASP!
 
 Perl IDE - to write, debug, and skank around a bit...
 
 is there an official place to get therapy to help me
 deal with the idea of a Perl IDE

Most people go to alt.sysadmin.recovery for that.

 
 Orthodox Perl, this I Grok,
 Perl IDE this hurts...

You think that is bad?  How about Visual Perl
(http://www.activestate.com/Products/Visual_Perl/).

I actually liked Komodo (incremental compiling is cool), a Perl IDE
based on the Mozilla code base, it was just too slow for my 600 Mhz PC
so I switched back to VIM with syntax highlighting.

-- 
Today is Boomtime the 34th day of Discord in the YOLD 3168
Or not.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regex question

2002-04-17 Thread John W. Krahn

[EMAIL PROTECTED] wrote:
 
 hi,

Hello,

 im pasting some more of the lines i need to parse. i guess
 im just learning regex and just espesially learning how to
 ask the correct questions! heh, dont ask regex without
 showing enuf of the stuff you want to parse :)
 
 theres is these three basic entries (skakkebaek is spelled awfully. only skak 
matches em all :-) :
 
 Hits  Cited Author  Cited WorkVolume  Page  Year
 
__
 
 [_][667] 279   ...Skakkebaek NE  ENVIRON HEALTH PERSP 104   741  
1996
 [_]   1   SKAKKEBAEK NE EARLY DETECTION TEST26  1981
 [_]   3   SKAKKEBAEK NE EARLY DETECTION TEST1981
 
 then there is these freaks:
 this one contains NE in the name and NE in GENE so GENE is truncated if care is not 
taken.
 
 [_][718]  18   ...Skakkebaek NE  GENE CHROMOSOME CANC  20   412  
1997
 
 here the journal name starts with 7
 
 [_]   3   SKAKKEBAEK NE 7 WORLD C FERT STER 1971
 
 here the journal name ends with a digit thus entangling it in the following page 
number 101.
 
 [_]   1   SKAKKEBAEK NE ENV HLTH PERSPECT S2 101 1  1993
 
 here is my mathing routine - works with all but the last freak!:
 
 [snip code]


This works with the data above:

while ( DATA ) {
chomp;
my @field = split /\s{2,}/;

shift @field if $field[0] =~ /]$/;
(my $citations) = (shift @field) =~ /(\d+)$/;

shift @field if $field[0] =~ /skak.*ne$/i;

my $journal = shift @field;
my $year= pop @field || '';
my $page= pop @field || '';
my $volume  = pop @field || '';

print Citation: $citations\nJournal: $journal\nVolume: $volume\nPage: 
$page\nYear: $year\n\n;
}

__DATA__
[_][667] 279   ...Skakkebaek NE  ENVIRON HEALTH PERSP 104   741  
1996
[_]   1   SKAKKEBAEK NE EARLY DETECTION TEST26  1981
[_]   3   SKAKKEBAEK NE EARLY DETECTION TEST1981
[_][718]  18   ...Skakkebaek NE  GENE CHROMOSOME CANC  20   412  
1997
[_]   3   SKAKKEBAEK NE 7 WORLD C FERT STER 1971
[_]   1   SKAKKEBAEK NE ENV HLTH PERSPECT S2 101 1  1993




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Firewall

2002-04-17 Thread Fred Sahakian

Anyone know of a perl script that can determine if a website is actually behind a 
firewall?  

thanks!



Re: Using smtp

2002-04-17 Thread eric-sourceforge

On Wed, 17 Apr 2002, Bill Lyles wrote:
 How can I change this to smtp?

Bill:

Try using Mail::Mailer:

#!/usr/bin/perl -w
use Mail::Mailer;

my $To = $ARGV[0];
my $mailer = Mail::Mailer-new('smtp', 'your.smtp.host');
$mailer-open({
From = [EMAIL PROTECTED],
To   = $To,
Subject = Password reminder for $To,
});
print $mailer $Message;
$mailer-close;

-- 
Eric P.
Los Gatos, CA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Scope of my() declared variables

2002-04-17 Thread A. Arnstein








At 12:47 PM 4/17/2002 -0700, you wrote:

On Wednesday, April 10, 2002, at 04:42 , Elaine -HFB- Ashton wrote:
   ^
is this supposed to be funny?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




how to return an array reference from a subroutine

2002-04-17 Thread richard noel fell


What I am attempting to do is write a perl script that reads the
sub-directories of the current directory, creates a menu bar with the
sub-directories as the titles of cascade widgets and then goes into the
sub-directories, read the files there and creates command widgets with
the file names as titles. For instance, if I have  sub-directories
Algebra1 and Algebra2, each of which contains files Test1 and Test2,
then Algebra1 and Algebra2 appear in the menubar and clicking on them, I
get a drop down(?) menu with Test1 and Test2 command widgets appearing.

But, the script below does not work. I get an error message :
Not an ARRAY reference at
/usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/i686-linux-thread-multi/Tk/Menu.pm
line 69. The cause of this  is the subroutine sub_menu. As I understand
things, the argument to -menuitems must be a reference to an anonymous
array. Am I correct? Is there a way of getting sub_menu to return such a
value or is there another way to do this?

Thanks to all who read this post,
Dick Fell

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w
use strict;
use File::Basename;
use Tk;
use Tk::Dialog;
use Cwd;
our  $MW =MainWindow-new();

create_menu_bar;
MainLoop;


sub create_menu_bar
  {
my $mb = $MW-Menu();
$MW-configure(-menu=$mb);
opendir DIR, ./ or die  cannot open current directory: $!;
my $current_directory = cwd;
   my @directories = grep { !/^\.\.?$/  -d $current_directory/$_ }
readdir DIR;
 map {$mb-cascade(-label = '~'.$_, -menuitems=\sub_menu($_))}
@directories;
sub sub_menu
  {
chdir $_[0] or die Cannot change directory: $!; # change to
Algebra1 sub-directory, then Algebra2, etc.
opendir SUB_DIR, ./ or die  cannot open current directory: $!;
my $current_sub_directory = cwd;
 my @sub_directories = grep { !/^\.\.?$/  -d
$current_sub_directory/$_ } readdir SUB_DIR;
   map {[ 'cascade', '~'.$_]} @sub_directories;
   }
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: control characters and other entities

2002-04-17 Thread John W. Krahn

Jon Howe wrote:
 
 I am currently ripping apart some text files on my
 linux box that where created on windows
 
 I am having a problem with things like  ^M appearing
 where I would expect \n and ~S where there should be a  '  .
 I can remove ^M with :
 
 s/\cM\n/\n/g;
 
 I assume this is some sort of char encoding problem
 can some advise on the best way to deal with this.

Have a look at this program:

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: how to return an array reference from a subroutine

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 02:09 , richard noel fell wrote:
[..]
 sub create_menu_bar
   {
 my $mb = $MW-Menu();
 $MW-configure(-menu=$mb);
 opendir DIR, ./ or die  cannot open current directory: $!;
 my $current_directory = cwd;
my @directories = grep { !/^\.\.?$/  -d $current_directory/$_ }
 readdir DIR;
  map {$mb-cascade(-label = '~'.$_, -menuitems=\sub_menu($_))}
 @directories;
 sub sub_menu
   {
   chdir $_[0] or die Cannot change directory: $!; # change to
 Algebra1 sub-directory, then Algebra2, etc.
   opendir SUB_DIR, ./ or die  cannot open current directory: $!;
   my $current_sub_directory = cwd;
  my @sub_directories = grep { !/^\.\.?$/  -d
 $current_sub_directory/$_ } readdir SUB_DIR;
map {[ 'cascade', '~'.$_]} @sub_directories;
}
 }

creative use of a sub directory

from the perldoc -f map

I normally think of 'map' being used in the form

my %retHash = map {[ 'cascade', '~'.$_]} @sub_directories;

at which point I would simply return the Hash

%retHash ;


my other concern is with

  map {$mb-cascade(-label = '~'.$_, -menuitems=\sub_menu($_))} 
@directories;

wouldn't that be simpler to write as say

$mb-cascade(-label = '~'.$_, -menuitems=\sub_menu($_))
foreach (@directories);

without using the 'map' processeing around it???



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: control characters and other entities

2002-04-17 Thread Timothy Johnson


Isn't there a utility called dos2unix or something like that that comes with
linux?

-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: Re: control characters and other entities


Jon Howe wrote:
 
 I am currently ripping apart some text files on my
 linux box that where created on windows
 
 I am having a problem with things like  ^M appearing
 where I would expect \n and ~S where there should be a  '  .
 I can remove ^M with :
 
 s/\cM\n/\n/g;
 
 I assume this is some sort of char encoding problem
 can some advise on the best way to deal with this.

Have a look at this program:

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: control characters and other entities

2002-04-17 Thread Jaimee Spencer

Hello Timothy,

If you wanted to do it the perl way, which can be more then one way.
Type in the below code.

#!/usr/bin/perl -i
while () {
/\n/g;;
print $_;
}

Regards,
Jaimee

p.s Yes there is a utility called dos2unix you use it in perl also by typing

$cformat = `dos2unix $filename $filename`;

or use it as a standalone at the command line by typing
dos2unix inputfile outputfile

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:56 PM
To: 'John W. Krahn'; [EMAIL PROTECTED]
Subject: RE: control characters and other entities



Isn't there a utility called dos2unix or something like that that comes with
linux?

-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: Re: control characters and other entities


Jon Howe wrote:
 
 I am currently ripping apart some text files on my
 linux box that where created on windows
 
 I am having a problem with things like  ^M appearing
 where I would expect \n and ~S where there should be a  '  .
 I can remove ^M with :
 
 s/\cM\n/\n/g;
 
 I assume this is some sort of char encoding problem
 can some advise on the best way to deal with this.

Have a look at this program:

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: File::Temp for use with mounting remote filesystems

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 10:09 , Dermot Paikkos wrote:

 I tried the following:
 use File::Temp qw/ tempdir /;
 .
 $tempdir = tempdir();
 system(mount,-t,nfs,server:/usr1,$tempdir) || die Can't
 mount into $tempdir: $!\n;

 I always get the OS error no such file or directory. The dir is made
 so i am not sure if this is an OS problem or a design feature.

let's assume that you can run the command

mount -t nfs server:/usr1 /mnt

at the command line.

Why not try

my $mount_msg = mount -t nfs server:/usr1;

system( $mount_msg $tempdir \n ) or die evil beasties:$!;

and check that it's not the comma splicing issue there that
is making it come out on the command line as

mount-tnfsserver:/usr1$tmpdir


comma splices are a bad way to make run on sentences,
since they appear to be subordinant clauses, that never
really graph out quite right 8-)

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: File::Temp for use with mounting remote filesystems

2002-04-17 Thread John W. Krahn

Dermot Paikkos wrote:
 
 I have been playing with the File::Temp module. I wanted to use it to
 create a temporary mount point on a file system then mount a
 remote dir into it and copy the files over.
 
 I tried the following:
 use File::Temp qw/ tempdir /;
 .
 $tempdir = tempdir();
 system(mount,-t,nfs,server:/usr1,$tempdir) || die Can't
 mount into $tempdir: $!\n;
 
 I always get the OS error no such file or directory. The dir is made
 so i am not sure if this is an OS problem or a design feature.

system() returns zero on _success_ and non-zero on _error_ so that
statement will always die and the error is stored in $? not $!

system(mount,-t,nfs,server:/usr1,$tempdir) == 0
or die Can't mount into $tempdir: $?;

perldoc -f system


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How to use variable in SQL statement (ODBC link to Access)

2002-04-17 Thread Rob

I am trying to insert data into a MS Access database using SQL statements in
my perl code.  I have gotten the SQL to execute correctly, but only with
static data.  Does anyone know how I can use variables in the SQL statement
and have it still execute correctly?

Thanks,
Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: setuid ing perl?

2002-04-17 Thread Henk-Jan

I want to go for the recompile option...
The thing is: It was automagically installed by CPAN.

So how can I get perl 5.6.1 using CPAN?
And then I would kow what to do..




 On Wed, Apr 17, 2002 at 09:50:17AM -0800, Michael Fowler wrote:
  On Wed, Apr 17, 2002 at 06:04:49AM +0200, Henk-Jan wrote:
  3. Your perl may be compiled with suid ability disabled.
 
  Did you compile Perl yourself, or install from a vendor-provided
package?
  If the latter, does the vendor provide a package for setuid perl?

 Sorry, I forgot for a moment how you came to this predicament.  Assuming
the
 permssions on the openwebmail files are correct, you should probably
 reinstall the perl provided by your vendor, assuming you have that sort of
 OS.  Otherwise, you'll have to recompile perl, or follow 3c.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Firewall

2002-04-17 Thread Jonathan E. Paton

 Anyone know of a perl script that can determine if
 a website is actually behind a firewall?  

From which side?  There are plenty of scripts for
testing for vunabilities, used by script kiddies
for cracking (wrongly called hackers by the media).

The firewall type/configuration may vary enough that
any script you devise wouldn't be perfect.  I suggest
you try portscanning your website from a remote
location, as firewalls are typically more lenient for
outgoing traffic.

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to use variable in SQL statement (ODBC link to Access)

2002-04-17 Thread Rob

Never Mind...  I figured it out
Rob [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am trying to insert data into a MS Access database using SQL statements
in
 my perl code.  I have gotten the SQL to execute correctly, but only with
 static data.  Does anyone know how I can use variables in the SQL
statement
 and have it still execute correctly?

 Thanks,
 Rob







-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Examples of POD

2002-04-17 Thread Elaine -HFB- Ashton

Kevin Old [[EMAIL PROTECTED]] quoth:
*Hello all,
*
*I was wondering if anyone had a couple of scripts that showed uses of POD 
*among Perl code?  
*
*Any help is appreciated.

Perl includes a little utility called 'podchecker' which you can use to
check your POD for validity once you get it written.

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Firewall

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 03:15 , Jonathan E. Paton wrote:
[..]
 The firewall type/configuration may vary enough that
 any script you devise wouldn't be perfect.  I suggest
 you try portscanning your website from a remote
 location, as firewalls are typically more lenient for
 outgoing traffic.

actually let us not and say that we did

that merely adds more frivilous lines in the loggers
for various firewalls as they do what they do

we need more script kiddies playing with portscanners
on the net like we need..

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Examples of POD

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 03:34 , Elaine -HFB- Ashton wrote:

 Kevin Old [[EMAIL PROTECTED]] quoth:
 *I was wondering if anyone had a couple of scripts that showed uses of 
 POD
 *among Perl code?
 Perl includes a little utility called 'podchecker' which you can use to
 check your POD for validity once you get it written.

there is always the '-m' option to perldoc which
allows one to 'read the whole module - pod/comment/code

hence say perldoc -m CGI gives you all of the dope on the module
including the basic formatting of the 'pop' after __END__

but my pet favorite 'guide to writing pod' which I used to
cut all of mine:

perldoc perlpod

found it again from the perldoc perl reference...

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to thread in Perl?

2002-04-17 Thread Ahmed Moustafa

 You are better off trying

 $SIG{CHLD} = 'IGNORE';

 at the top of your program and seeing if zombies are left out there.  If
 so then you might want to use pop or shift like this

 waitpid shift @children while @children;

Do I really need to hold the pid's of the kids process somewhere?
Can't I do something like that codemy $forked =  fork; waitpid $forked,
WNOHANG;/code?
What do you think?

Thanks,

Ahmed


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl simple array

2002-04-17 Thread Daniel Falkenberg


Hey All,

Just wondering why the following code won't print anything at all.

@data = test1,test2,test3,test4;

@data = split(/,/);

print $data[1];

Will not print anything...

Any ideas?

Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl simple array

2002-04-17 Thread Mark Anderson

perldoc -f split

Your split statement is attempting to split $_, not @data.

-Original Message-
From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:54 PM
To: [EMAIL PROTECTED]
Subject: Perl simple array



Hey All,

Just wondering why the following code won't print anything at all.

@data = test1,test2,test3,test4;

@data = split(/,/);

print $data[1];

Will not print anything...

Any ideas?

Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl simple array

2002-04-17 Thread A. Rivera

@data = (test1,test2,test3,test4);
print $data[1];

Regards,
Agustin Rivera
Webmaster, Pollstar.com / PollstarOnline.com
- Original Message - 
From: Daniel Falkenberg [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 17, 2002 6:53 PM
Subject: Perl simple array


 
 Hey All,
 
 Just wondering why the following code won't print anything at all.
 
 @data = test1,test2,test3,test4;
 
 @data = split(/,/);
 
 print $data[1];
 
 Will not print anything...
 
 Any ideas?
 
 Dan
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: setuid ing perl?

2002-04-17 Thread Michael Fowler

On Thu, Apr 18, 2002 at 12:11:48AM +0200, Henk-Jan wrote:
 I want to go for the recompile option...
 The thing is: It was automagically installed by CPAN.
 
 So how can I get perl 5.6.1 using CPAN?
 And then I would kow what to do..

perl should have been downloaded and extracted to your CPAN build directory. 
By default this is /root/.cpan/build.  You set the CPAN home directory when
you first configured it.

If you can't find it, or don't care to look, you can download the latest
from http://www.perl.com/pub/a/language/info/software.html#stable

I wouldn't suggest using the CPAN shell for compiling and installing perl. 
Read the documentation in the perl source directory for information on
configuration and compilation.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Character Types

2002-04-17 Thread Scott Lutz

I am trying to do a split on a string with what looks like square boxes
separating the data.
Is this a tab?
I was trying to find an ASCII value for this to split on it, but can't
find one.
Any ideas?

Scott Lutz
Pacific Online Support
Phone: 604.638.6010
Fax: 604.638.6020
Toll Free: 1.877.503.9870
http://www.paconline.net


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl simple array

2002-04-17 Thread Timothy Johnson

What you are telling Perl is this:

@data = test1,test2,test3,test4;
#Store this string in $data[0]

@data = split(/,/);
#replace the contents of @data with the result
#of splitting $_ by /,/
#($_ is not defined at this point)

print $data[1];
#print the second element of $data
#(which does not exist)


-Original Message-
From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:54 PM
To: [EMAIL PROTECTED]
Subject: Perl simple array



Hey All,

Just wondering why the following code won't print anything at all.

@data = test1,test2,test3,test4;

@data = split(/,/);

print $data[1];

Will not print anything...

Any ideas?

Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Character Types

2002-04-17 Thread Mark Anderson

Those are likely non-printable characters in whatever font you are using.

Use substr and ord to get the octal value and then split on it.

Double check to make sure they are all the same character.

/\/\ark

-Original Message-
From: Scott Lutz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 5:06 PM
To: Beginners (E-mail)
Subject: Character Types


I am trying to do a split on a string with what looks like square boxes
separating the data.
Is this a tab?
I was trying to find an ASCII value for this to split on it, but can't
find one.
Any ideas?

Scott Lutz
Pacific Online Support
Phone: 604.638.6010
Fax: 604.638.6020
Toll Free: 1.877.503.9870
http://www.paconline.net


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




qw for help in - Re: Perl simple array

2002-04-17 Thread drieux


On Wednesday, April 17, 2002, at 04:59 , A. Rivera wrote:

 @data = (test1,test2,test3,test4);
 print $data[1];


my @data = qw/test1 test2 test3 test4/ ;

gives us all a chance to remember that since hubris and
laziness are two of our three virtues why quote
and comma that which can be done short and simple?

 Just wondering why the following code won't print anything at all.

 @data = test1,test2,test3,test4;

 @data = split(/,/);

 print $data[1];



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Character Types

2002-04-17 Thread Timothy Johnson


If I had to guess, I'd say you're splitting a UNIX file, and the square
boxes are the UNIX endline characters.  To be sure, though, the best way
would be to download a freeware hex editor(there's loads of them on the
Internet, but I've been using one called XVI32).  Then you can eliminate the
lines using the hex representations of the characters.  Here's an example of
something that I used when I was parsing the Win32 EventLog.

${$event}{eventdescription} =~ tr/\x0D\x09\x0A//g;
#replace all of the characters x0D, x09, and x0A

In your case, I guess it would be more like:

@array = split /\x0D/,$var;
#(assuming you find the character is x0D)



-Original Message-
From: Scott Lutz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 5:06 PM
To: Beginners (E-mail)
Subject: Character Types


I am trying to do a split on a string with what looks like square boxes
separating the data.
Is this a tab?
I was trying to find an ASCII value for this to split on it, but can't
find one.
Any ideas?

Scott Lutz
Pacific Online Support
Phone: 604.638.6010
Fax: 604.638.6020
Toll Free: 1.877.503.9870
http://www.paconline.net


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




about formal sub routine declartions

2002-04-17 Thread drieux


I just found this in the perldoc

 Currently Perl subroutines have fairly limited
support for formal parameter lists. You can specify the
number of parameters and their type, but you still have to
manually take them out of the `@_' array yourself. Write a
source filter that allows you to have a named parameter
list. Such a filter would turn this:

sub MySub ($first, $second, @rest) { ... }

into this:

sub MySub($$@) {
   my ($first) = shift ;
   my ($second) = shift ;
   my (@rest) = @_ ;
   ...
}


does this still make sense?

does it improve the compiled object any?

and why not

sub MySub($$@) {
my( $first, $second, @rest ) = @_;
...
}




ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




question in list

2002-04-17 Thread Alex Cheung Tin Ka

Dear All,
I have a problem about the list value. 
I have got a scalar say $a='a' and a list say @b = ('a', 'b','c');
how can I check whether $a is one of the value in @b. Is there any easy way to do 
it and I got lost in perl.com's piles of documentation.

Thanks
Alex



Re: about formal sub routine declartions

2002-04-17 Thread John W. Krahn

Drieux wrote:
 
 I just found this in the perldoc
 
  Currently Perl subroutines have fairly limited
 support for formal parameter lists. You can specify the
 number of parameters and their type, but you still have to
 manually take them out of the `@_' array yourself. Write a
 source filter that allows you to have a named parameter
 list. Such a filter would turn this:
 
 sub MySub ($first, $second, @rest) { ... }
 
 into this:
 
 sub MySub($$@) {
my ($first) = shift ;
my ($second) = shift ;
my (@rest) = @_ ;
...
 }
 
 
 does this still make sense?
 
 does it improve the compiled object any?
 
 and why not
 
 sub MySub($$@) {
 my( $first, $second, @rest ) = @_;
 ...
 }


They both do the same thing although the second version may be faster
(You would have to benchmark to be sure.)


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: question in list

2002-04-17 Thread Timothy Johnson


Here are two ways:

$a = 'a';
@b = qw(a b c);
#
#(1)#Iterate till found
foreach(@b){
   if($a eq $_){
  print Found it!\n;
   }
}

#
#(2)#Use a hash

foreach(@b){
   $c{$_} = 1;
}

if($c{$a}){
   print \$a is in there.\n;
}else{
   print No it's not.\n;
}

-Original Message-
From: Alex Cheung Tin Ka [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 7:27 PM
To: [EMAIL PROTECTED]
Subject: question in list


Dear All,
I have a problem about the list value. 
I have got a scalar say $a='a' and a list say @b = ('a', 'b','c');
how can I check whether $a is one of the value in @b. Is there any easy
way to do it and I got lost in perl.com's piles of documentation.

Thanks
Alex

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: question in list

2002-04-17 Thread John W. Krahn

Alex Cheung Tin Ka wrote:
 
 I have a problem about the list value.
 I have got a scalar say $a='a' and a list say @b = ('a', 'b','c');
 how can I check whether $a is one of the value in @b. Is there any
 easy way to do it and I got lost in perl.com's piles of documentation.


if ( grep $a eq $_, @b ) { ... }


use Quantum::Superpositions;
if ( $a eq any( @b ) { ...  }


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: question in list

2002-04-17 Thread Alex Cheung Tin Ka

what is the difference with this?
grep(/$a/, @b);

grep $a eq $_, @b; 

perl is amazing


- Original Message - 
From: John W. Krahn [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 10:39 AM
Subject: Re: question in list


 Alex Cheung Tin Ka wrote:
  
  I have a problem about the list value.
  I have got a scalar say $a='a' and a list say @b = ('a', 'b','c');
  how can I check whether $a is one of the value in @b. Is there any
  easy way to do it and I got lost in perl.com's piles of documentation.
 
 
 if ( grep $a eq $_, @b ) { ... }
 
 
 use Quantum::Superpositions;
 if ( $a eq any( @b ) { ...  }
 
 
 John
 -- 
 use Perl;
 program
 fulfillment
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: question in list

2002-04-17 Thread John W. Krahn

Alex Cheung Tin Ka wrote:
 
 From: John W. Krahn [EMAIL PROTECTED]
 
  Alex Cheung Tin Ka wrote:
  
   I have a problem about the list value.
   I have got a scalar say $a='a' and a list say @b = ('a', 'b','c');
   how can I check whether $a is one of the value in @b. Is there any
   easy way to do it and I got lost in perl.com's piles of documentation.
 
  if ( grep $a eq $_, @b ) { ... }
 
  use Quantum::Superpositions;
  if ( $a eq any( @b ) { ...  }
 
 what is the difference with this?
 grep(/$a/, @b);
 
 grep $a eq $_, @b;


$ perl -e'
$a = q/d/; @b = qw/a b c d e f zzdzz g/;
grep /$a/  print( regex: $_\n ), @b;
grep $a eq $_  print( equate: $_\n ), @b;
'
regex: d
regex: zzdzz
equate: d



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Firewall

2002-04-17 Thread Jonathan E. Paton

 [..]
  The firewall type/configuration may vary enough that
  any script you devise wouldn't be perfect.  I suggest
  you try portscanning your website from a remote
  location, as firewalls are typically more lenient for
  outgoing traffic.
 
 actually let us not and say that we did
 
 that merely adds more frivilous lines in the loggers
 for various firewalls as they do what they do

So?  You think this is uncommon enough that anyone would
care?  AFAIK a computer on the web gets portscanned at
least once an hour, probably more.  If everyone else is
doing it (looking for boxes to hack) then it's not a bad
idea to fight fire with fire... hopefully spotting the
weaknesses.

If security, rather than curiosity (that you have a
firewall) is the issue, have a look at:

http://www.cs.uu.nl/cert-uu/satan.html
http://www.partyvibe.com/flavour/linux/security.htm

 we need more script kiddies playing with portscanners
 on the net like we need..

9854436578785 babies simutaneously waking up in the
night crying - there is enough script kiddies to worry
about them turning your website/server into a playground.

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]