Re: problem sending mail

2002-04-10 Thread Ask Bjoern Hansen

[EMAIL PROTECTED] (T3tsu0) writes:

> sub send_mail {
> open(MAIL,"|$mail_prog -t") || &error("unable to send mail to:
> $to_name - $to_addr");
[...]
> close(MAIL);

you really want to put error checking on the close() too.  In many
cases you won't be told until then if the open fails.

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();

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




Re: Opening another script and changing variables

2002-04-10 Thread drieux


On Tuesday, April 9, 2002, at 01:04 , Nikola Janceski wrote:

> If I knew then what I know now.. I would have setup a file that contained
> these variable values and never touch the cgi script. Then the rest of the
> script would just copy some files into directory and setup a webpage to 
> link
> to the cgi info. Because I did it the "dumb" way it took me 4 times longer
> to get it to work right.

this sounds like the classic problem of confusing
configuration data with executable

Things that should be 'default values' that can
be 'configured' should be 'sourced' into the executable
and then reset, adjusted etc as the run time requires,
eh no???




ciao
drieux

---


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




Re: Printing output to an Existing HTML file

2002-04-10 Thread Kojo Idrissa

Jenda,

Thanks for the response.  I've been too busy to try it, but I plan to 
soon.  I'll let you and the list know how it works out.

Thanks,

At 12:32 AM 4/4/2002 +0200, Jenda Krynicky wrote:
>From:   Kojo Idrissa <[EMAIL PROTECTED]>
> > This is probably a simple question, but I can't seem to find a simple
> > answer.  I'm pretty new to Perl, but I'm learning.
> >
> > I've written a small program that performs a calculation, and I want
> > the result to be displayed on my home page.  I'd also like the
> > calculation to be redone each time the page is viewed or reloaded.
>
>I guess the easiest solution would be to make a tiny CGI script
>that will read the HTML from a file, copy it to output until it finds a
>marker, then print the results of the computations and then
>continue copying the rest of the file.
>
>Or you could split the static HTML into two files, then you would
>read and copy to STDOUT the first file, then you'd write the
>computations and then copy the second file.
>
>For later it would be better to install and start using one of the
>HTML template modules from CPAN (I'm usualy not doing
>CGI/mod_perl so I can't suggest names or compare the options).
>
>Jenda


Kojo Idrissa

[EMAIL PROTECTED]
http://www.hal-pc.org/~kojo/




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




cdburner module? - 2 parts

2002-04-10 Thread Michael Gargiullo

Is there a way to figure out if there is a cd burner installed on a system?

Is there a cd burning module written already out there?

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




Re: Scope of my() declared variables WAS( Re: -e $filename...)

2002-04-10 Thread Elaine -HFB- Ashton

Timothy Johnson [[EMAIL PROTECTED]] quoth:
*>
*>Here's the part I still don't understand, and maybe some of you can show me
*>the light.  What is the difference between local() and my()?  I have never
*>used local(), the only examples I've ever been given involve scoping $_, and
*>if I am ever tempted to do that, I can usually trace it back to a bad
*>algorithm.

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

e.

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




Re: HELP needed with printing to a text file

2002-04-10 Thread bob ackerman


On Wednesday, April 10, 2002, at 01:34  PM, @fro @ndy wrote:

> Hi,
> Once again i have another problem regarding my message board lol. This 
> time the message board is fine but i have made an admin so that it will 
> read the contents of a text file where all the entries are printed to and 
> display them into a  so that i can easily remove/change 
> messages.
> Below is the code for the script...
>
>


>
> the problem that i am faced with is when it prints to the file called 
> test.txt a little symbol comes up where the next line should be. I tried 
> to paste the symbol onto here but it just goes to the next line without 
> showing it. Here is what the text file looks like:
> Andrew#Hello<>James#Nice Board
>
> This is how i would LIKE it too look like:
> Andrew#Hello
> James#Nice Board
>
> ANY HELP YOU COULD SEND ME WOULD BE MUCH APPRECIATED :o)
>
> Andrew
>

sounds like the file isn't a unix file with \n at line end. mac or windows 
file?
check it with:
hexdump -C 
and see what control characters are at end of line.
or just write a quick script to check for '0d' and print "yes" if there 
are.
if any '0d' you could filter those in your program.


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




Re: Renaming a File

2002-04-10 Thread Paul Johnson

On Wed, Apr 10, 2002 at 10:11:28AM -0400, Craig Sharp wrote:
> Allison,
> 
> Try this script.  I found it out on the net.  My need was to rename a
> set of files but I don't see any reason that this couldn't rename a
> single file.
> 
> #!/usr/local/bin/perl
> #
> # Usage: rename perlexpr [files]
> 
> ($regexp = shift @ARGV) || die "Usage:  rename perlexpr [filenames]\n";
> 
> if (!@ARGV) {
>@ARGV = ;
>chomp(@ARGV);
> }
> 
> 
> foreach $_ (@ARGV) {
>$old_name = $_;
>eval $regexp;
>die $@ if $@;
>rename($old_name, $_) unless $old_name eq $_;
> }
> 
> exit(0);

This looks like a bad copy of Larry Wall's rename script, which used to
be distributed with Perl.  It's even lost its attribution.  Here's the
real thing:

#!/usr/local/bin/perl -w

# rename program by Larry Wall
$op = shift or die "Usage: rename expr [files]\n";
chomp(@ARGV = ) unless @ARGV;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename($was,$_) unless $was eq $_;
}

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




HELP needed with printing to a text file

2002-04-10 Thread @fro @ndy

Hi,
Once again i have another problem regarding my message board lol. This time the 
message board is fine but i have made an admin so that it will read the contents of a 
text file where all the entries are printed to and display them into a  so 
that i can easily remove/change messages.
Below is the code for the script...

#!C:/Perl/bin/Perl.exe

$password = "andy";
$path = "admin.cgi";
$entries = "C:/localhost/test.txt";

if ($ENV{"REQUEST_METHOD"} eq 'GET') { $buffer = $ENV{'QUERY_STRING'}; }
else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
unless ($name eq "head" || $name eq "foot") {
$value =~ s/<([^>]|\n)*>//g;
$value =~ s///g;
$value =~ tr/+/ /;
}
$value =~ s/\n//g; # did sumthing here
$in{$name} = $value;
}

if($in{'action'} eq ""){&login;}
elsif($in{'action'} eq "check"){&auth;}
elsif($in{'action'} eq "change"){&changeit;}
else{&login;}

sub login {
print "Content-type: text/html\n\n";
print <


Password Required



Sorry but you need a 
password to view my message board


  

  

Password: 

  
  
 


  

  




DANE
exit;
}

sub auth {
   if ($in{'pass'} eq $password) {
  &main;
  exit;
   }
   elsif ($in{'pass'} ne $password) {
 print "Content-type: text/html\n\n";
 print "INCORRECT password. 
LOL.\n";
 exit;
   }
}

sub main {
open(DATA, "$entries");
flock DATA, 2;
@data = ;
close(DATA);

print "Content-type: text/html\n\n";
print <

Administration of Message Board




   
Administration Page
Add or Remove Entries:
 
  @data
   


  

  



DANE
exit;
}

sub changeit {
open(DATA,">$entries");
flock DATA, 2;
print DATA "$in{'w00t'}";
close(DATA);

&main;
exit;
}

the problem that i am faced with is when it prints to the file called test.txt a 
little symbol comes up where the next line should be. I tried to paste the symbol onto 
here but it just goes to the next line without showing it. Here is what the text file 
looks like:
Andrew#Hello<>James#Nice Board

This is how i would LIKE it too look like:
Andrew#Hello
James#Nice Board

ANY HELP YOU COULD SEND ME WOULD BE MUCH APPRECIATED :o)

Andrew





Re: URL file question

2002-04-10 Thread Felix Geerinckx

on Wed, 10 Apr 2002 19:33:43 GMT, Wade Olson wrote:

> What is the best way to read the contents of a file out the Internet?
> 
> Example: get the text from http://mycompany.com/index.html and put into

use LWP::Simple;
$text = get($url);

-- 
felix

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




precedence

2002-04-10 Thread Nikola Janceski

Hey all,
This has always pestered me. I have the following list printed out and taped
to the wall in my cubical. I got it from the top of 'perldoc perlop' and
have a few questions.

What does the (left/right/nonassoc) mean? 

What are examples of 'terms and list operators (leftward)'?

What are examples of 'named unary operators'?

What are examples of 'list operators (rightward)'?


 leftterms and list operators (leftward)
 left->
 nonassoc++ --
 right   **
 right   ! ~ \ and unary + and -
 left=~ !~
 left* / % x
 left+ - .
 left<< >>
 nonassocnamed unary operators
 nonassoc< > <= >= lt gt le ge
 nonassoc== != <=> eq ne cmp
 left&
 left| ^
 left&&
 left||
 nonassoc..  ...
 right   ?:
 right   = += -= *= etc.
 left, =>
 nonassoclist operators (rightward)
 right   not
 leftand
 leftor xor

Your knowledge and assistance is appreciated.


Nikola Janceski

I am not discouraged, because every wrong attempt discarded is another step
forward.
-- Thomas A. Edison 




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]




URL file question

2002-04-10 Thread Olson, Wade

Hi,

What is the best way to read the contents of a file out the Internet?

Example: get the text from http://mycompany.com/index.html and put into
string, array, redirect, etc?

TIA!
Wade

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




Re: I have numbers in an array how do extract them in a random order ?

2002-04-10 Thread Felix Geerinckx

on Wed, 10 Apr 2002 19:21:11 GMT, Jim-Cont Flaherty wrote:

> I have numbers in an array how do extract them in a random order ? .
> I want to feed them to a sql query to extract information , just the
> first 10 of them 

This is a frequently asked question:

perldoc -q random
How do I select a random element from an array?
How do I shuffle an array randomly?

But you can also retrieve a random record from a table with the following 
SQL statement:

SELECT * FROM table ORDER BY RAND() LIMIT 1

-- 
felix

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




RE: problem sending mail

2002-04-10 Thread t3tsu0

This is a function I've used in the past that works.

tet


Where:

$mail_prog= '/usr/bin/sendmail';


sub send_mail {
local($from,$to_name,$to_addr,$subject,$content) = @_;
open(MAIL,"|$mail_prog -t") || &error("unable to send mail to:
$to_name - $to_addr");
print MAIL "From: $to_name ",'<',"$from",'>',"\n";
print MAIL "To: $to_name ",'<',"$to_addr",'>',"\n";
print MAIL "Subject: $subject\n";
print MAIL "$content\n";
close(MAIL);
print "Mail to: $to_name - $to_addr, completed.";
}





-Original Message-
From: Aman Raheja [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 10, 2002 1:47 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: problem sending mail

It didn't work either way as suggested
using -t only
or
changing the delimiting tag with print statetent

I tried to do the same on the command line and it works. I wonder what
is 
missing here.
Help is greatly appreciated
Aman


>From: "Aman Raheja" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED], [EMAIL PROTECTED], 
>[EMAIL PROTECTED], [EMAIL PROTECTED]
>Subject: problem sending mail
>Date: Wed, 10 Apr 2002 12:25:46 -0500
>
>Hi all
>I am trying to send a mail with the following code and the last print
>statement doesn't print, ie, the mail is not sent.
>This code is called on submitting a form on the web
>
>open(MAIL, "/usr/sbin/sendmail -oi -t") || die "Can't open mail";
>print MAIL Subject: News
>all the message goes here
>END
>
>close(MAIL);
>print "The mail has been sent successfully";
>-
>If I remove the -oi -t switch from the first statement, the print
statement
>works but the mail is not sent.
>Please help and let me know what could I be missing, in or above the
code.
>
>Thanks
>Aman
>
>_
>Join the world's largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>


_
Chat with friends online, try MSN Messenger: http://messenger.msn.com

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




I have numbers in an array how do extract them in a random order ?

2002-04-10 Thread FLAHERTY, JIM-CONT

I have numbers in an array how do extract them in a random order ? . I want
to feed them to a sql query to extract information , just the first 10 of
them 
 
code 
 
##
 
$dbh =DBI ->connect($data_source, $username, $password) or die "cant connect
to
$data_source : my $dbh-> errstr\n";
my $sth1 = $dbh -> prepare("select num from tests where subject = '$test'
");
$sth1 -> execute or die " unable to execute query ";
#$sth1 -> finish;
 

   $count1 = 0;
  my $array_ref = $sth1->fetchall_arrayref();
 
  foreach $row(@$array_ref){
 
 $num1 = $row->[0];
 
 push(@numbers, $num1);
$count1++;
  }
 

###
#   now to extract them 
 
$num = rand(@numbers)
 
 
$dbh =DBI ->connect($data_source, $username, $password) or die "cant connect
to
$data_source : my $dbh-> errstr\n";
my $sth1 = $dbh -> prepare("select * from tests where num = '$num1' ");
$sth1 -> execute or die " unable to execute query ";

 
Help 
Jim f



Re: problem sending mail

2002-04-10 Thread fliptop

t3tsu0 wrote:

> Where:
> 
> $mail_prog= '/usr/bin/sendmail';
> 
> 
> sub send_mail {
> local($from,$to_name,$to_addr,$subject,$content) = @_;
> open(MAIL,"|$mail_prog -t") || &error("unable to send mail to:
> $to_name - $to_addr");
> print MAIL "From: $to_name ",'<',"$from",'>',"\n";
> print MAIL "To: $to_name ",'<',"$to_addr",'>',"\n";
> print MAIL "Subject: $subject\n";
> print MAIL "$content\n";
> close(MAIL);
> print "Mail to: $to_name - $to_addr, completed.";
> }


have you guys ever considered using mime::lite?  it simplifies sending 
mail, including attachments, etc.

http://search.cpan.org/search?dist=MIME-Lite

additionally, it's generally preferred that you not cross-post to 
several lists.  pick the one that's most appropriate (in this case, i 
chose [EMAIL PROTECTED]) and post to that list only.


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




RE: use of package in a script

2002-04-10 Thread David Gray

> Unless someone can come up with a really HOT idea as to why 
> one would want to put a 'package declaration' in an 
> application - and I have tried, but for the life of me, can 
> not come up with a good reason to go there...

How about as a mnemonic device, or to sort variables by category?
Consider:

$DEFAULT::DEBUG_LEVEL = 5;
@TMP::fileContents = ;

Then you can do things like:

for(keys %TMP::) {
  ${"TMP::$_"} = ''
}

Or

for(keys %DEFAULT::) {
  $$_ = ${"DEFAULT::$_"} unless defined $$_
}

I know there are other ways to do things like that, but purely for the
sake of argument ;)

 -dave



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




Re: displaying images

2002-04-10 Thread Jerry Preston

Mark,

The result is NOT FOUND.   I have made the changes and I still get NOT FOUND.

Jerry

"Charlton, Mark" wrote:

> With actual reference to the initial question this time, I forgot it in my
> previous post...
>
> What is the resultant output when you execute the command in the browser?
>
> Regards
>
> -Original Message-
> From: Charlton, Mark [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 10, 2002 6:07 PM
> To: 'Connie Chan '; 'Jerry Preston '; 'begginners '
> Subject: RE: displaying images
>
> In XHTML 1.0 quotes around parameters are compulsary.
>
> You can skip the quotes, but it is not valid XHTML code.  Therefore I feel
> it is better practice to always use quotes where possible to maintain
> standards compatability.  It also helps the browsers interpretation of the
> code, and IMHO makes the code more readable.
>
> Regards
>
> -Original Message-
> From: Connie Chan
> To: Jerry Preston; begginners
> Sent: 4/10/02 12:58 PM
> Subject: Re: displaying images
>
> > I can display an image using pure HTML:
> >
> > 
>
> First, this is wrong HTML, you should write as
> 
>
> > print"
> > 
> >   
> >   
>
> You should give a \ for %, that is 80\%.
>
> If no vars and aposophy are inside a print,
> you can use single quote pair, so you can
> write everything without using \ for escape
> char.
>
> As tips inside HTML. you can skip the
> quote sometimes :
> 1) 
> quotes are nessary
>
> 2) 
> quotes can skip.
>
> --
> 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]


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




RE: Scope of my() declared variables WAS( Re: -e $filename...)

2002-04-10 Thread David Gray

> Here's the part I still don't understand, and maybe some of 
> you can show me the light.  What is the difference between 
> local() and my()?  I have never used local(), the only 
> examples I've ever been given involve scoping $_, and if I am 
> ever tempted to do that, I can usually trace it back to a bad 
> algorithm.

perldoc -q lexical

 -dave



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




RE: Oracle sequences

2002-04-10 Thread David Gray

> I'm attempting to load an oracle database and am struggling 
> with how to retrieve a sequence for a table.
> 
> in SQL, the value is net_seq.nextval
> how do i use this in a perl script??

Do you have DBI installed? What have you tried? Can we see some code?

AFAIK, you can't directly retrieve the value of a sequence... The only
way I've ever used sequences is by setting something to either
net_seq.currval or net_seq.nextval - if there is a way to directly get
the current value with a select statement, I don't know the syntax for
it...

HTH,

 -dave



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




RE: extra space

2002-04-10 Thread Hanson, Robert

> I can't figure out what this is doing...
> my @sorted = map  { $_->[2] }
>  sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] }
>  map  { [ (split /\t/)[3,2], $_ ] }
>  @lines;

Hmmm... let's see.

> @lines;
1. Iterate over @lines

> map  { [ (split /\t/)[3,2], $_ ] }
2. For each line split it by tabs. Take the 4th and 3rd field (in that
order), along with the whole line, and create a 3 element anonymous array
from it.

> sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] }
3. Iterate over the list of array refs created in step #2 and sort them.
Sort them first on the numeric value of the 4th field from the original
string... and if they are equal then sort based on the 3rd field of the
original string.

> my @sorted = map  { $_->[2] }
4. Take the sorted list from step #3 and only return the 3rd element, which
is the original string before splitting.

In short: it sorts a list of tab delimited strings, first by the 4th field,
then by the 3rd field.

Does that sound right?

Here were your questions...

> 2. Generally to reproduce a two-key sort, you sort
> by the secondary key first, then the primary key.

Actually, reverse that.  The <=> operator returns -1, 0, or 1 based on the
comparison (zero if equal). The || operator evaluates the right side ONLY if
the left side fails (ie. is zero, empty, or undefined).

So in the script:
$a->[0] <=> $b->[0] || $a->[1] <=> $b->[1]

This code says compare item #0 first, and if equal, then compare item #1.
So #0 is the primary key, and #1 is secondary.

> 3.  What does the "->[\d]" do?

It is accessing the "\d" element of the array reference.  See perlreftut for
a good/breif explaination of using references.

> 1.  How do I do a reverse sort of column 4?

Change this: $a->[0] <=> $b->[0]
To this: $b->[0] <=> $a->[0]

Rob


-Original Message-
From: Bryan R Harris [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 2:18 PM
To: [EMAIL PROTECTED]
Subject: Re: extra space



Please forgive my ignorance, but I can't figure out what this is doing.
This routine correctly sorts @lines (array of lines with tab delimited
fields) by column 4.

# Step 3 - assumes columns 3 and 4 contain numeric data
my @sorted = map  { $_->[2] }
 sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] }
 map  { [ (split /\t/)[3,2], $_ ] }
 @lines;

A couple of quick questions:

1.  How do I do a reverse sort of column 4?
2.  Generally to reproduce a two-key sort, you sort by the secondary key
first, then the primary key.  This assumes that the sorting routine
maintains the order for equal values.  Does the perl sort routine allow for
this?
3.  What does the "->[\d]" do?

TIA.

- B


-- 
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]




Scope of my() declared variables WAS( Re: -e $filename...)

2002-04-10 Thread Timothy Johnson


Here's the part I still don't understand, and maybe some of you can show me
the light.  What is the difference between local() and my()?  I have never
used local(), the only examples I've ever been given involve scoping $_, and
if I am ever tempted to do that, I can usually trace it back to a bad
algorithm.

-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 11:31 AM
To: [EMAIL PROTECTED]
Subject: Re: (-e $filename) gives Use of uninitialized value at...


From:"Ahmed Moustafa" <[EMAIL PROTECTED]>

> What is the default scope for a variable defined inside a subroutine?

The scope os a lexical variable is always to the end of the 
enclosing block or eval()ed string or the file.

The body of a subroutine is just a block as far as scoping is 
concerned.

Jenda

P.S.: Please do not quote the whole history of the thread if you 
only need to ask a simple question.

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

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



This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




Re: (-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Jenda Krynicky

From:"Ahmed Moustafa" <[EMAIL PROTECTED]>

> What is the default scope for a variable defined inside a subroutine?

The scope os a lexical variable is always to the end of the 
enclosing block or eval()ed string or the file.

The body of a subroutine is just a block as far as scoping is 
concerned.

Jenda

P.S.: Please do not quote the whole history of the thread if you 
only need to ask a simple question.

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

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




Re: (-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Ahmed Moustafa

I put a print statement, just before the (-e $filename) line, to print the
$filename. It printed the $filename successfully and didn't give the
'uninitialized' warning for the print line.

- Original Message -
From: "Nikola Janceski" <[EMAIL PROTECTED]>
To: "'Agustin Rivera'" <[EMAIL PROTECTED]>; "Ahmed Moustafa"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, April 10, 2002 10:19 AM
Subject: RE: (-e $filename) gives Use of uninitialized value at...


> Assuming you have all warnings on, via -w or use warnings, I don't think
> $filename is losing scope, unless he uses it else where.
>
> The warning is good, it's telling  you that $filename = "" at that point
in
> your script. So either you lost the contents of $filename somewhere, or
lost
> scope of the $filename with content you wanted, or you reassigned it to
"".
> Either way you shouldn't be doing (-e ""); which is happening at that
point.
>
> > -Original Message-
> > From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 10, 2002 1:12 PM
> > To: Ahmed Moustafa; [EMAIL PROTECTED]
> > Subject: Re: (-e $filename) gives Use of uninitialized value at...
> >
> >
> > Seems like the method you use to assign filename doesn't always occur.
> > Maybe you have the my $filename='whatever' in an if statement?
> >
> > Agustin Rivera
> > Webmaster, Pollstar.com
> > http://www.pollstar.com
> >
> >
> >
> > - Original Message -
> > From: "Ahmed Moustafa" <[EMAIL PROTECTED]>
> > To: "Perl" <[EMAIL PROTECTED]>
> > Sent: Wednesday, April 10, 2002 10:02 AM
> > Subject: (-e $filename) gives Use of uninitialized value at...
> >
> >
> > > I'm using (-e $filename) to check the existence of
> > $filename. If the file
> > > exists, it returns true, otherwise it gives 'Use of
> > uninitialized value
> > > at...line #' (# is the line number of the if statement -if
> > ($filename)-.
> > Why
> > > does that happen and how I can fix it, please?
> > >
> > > Thanks in advance.
> > >
> > > --Ahmed


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




RE: File Paths and file names

2002-04-10 Thread David Gray

> I would like to write a perl program to run on NT to go 
> through a list of files, with full path and extract just the 
> file name. The path is random in length likewise so is the file name.

You could use a regular expression like:

$filename =~ s/[\\\/]([^\\\/])$/$1/;

To replace the full path with only what comes after the last '/' or '\'.

Hope that helps,

 -dave



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




Re: extra space

2002-04-10 Thread Bryan R Harris


Please forgive my ignorance, but I can't figure out what this is doing.
This routine correctly sorts @lines (array of lines with tab delimited
fields) by column 4.

# Step 3 - assumes columns 3 and 4 contain numeric data
my @sorted = map  { $_->[2] }
 sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] }
 map  { [ (split /\t/)[3,2], $_ ] }
 @lines;

A couple of quick questions:

1.  How do I do a reverse sort of column 4?
2.  Generally to reproduce a two-key sort, you sort by the secondary key
first, then the primary key.  This assumes that the sorting routine
maintains the order for equal values.  Does the perl sort routine allow for
this?
3.  What does the "->[\d]" do?

TIA.

- B


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




Re: (-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Jeff 'japhy' Pinyan

On Apr 10, Ahmed Moustafa said:

>What is the default scope for a variable defined inside a subroutine?

The default scope for ALL variables is to the package they belong to.  If
you declare a variable with 'my', or give it a fully qualified package
name (like $Foo::x), then the default is not the case.

-- 
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 **
 what does y/// stand for?   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]




Re: (-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Ahmed Moustafa

What is the default scope for a variable defined inside a subroutine?

- Original Message -
From: "Nikola Janceski"
To: "'Agustin Rivera'"; "Ahmed Moustafa"; <[EMAIL PROTECTED]>
Sent: Wednesday, April 10, 2002 10:19 AM
Subject: RE: (-e $filename) gives Use of uninitialized value at...


> Assuming you have all warnings on, via -w or use warnings, I don't think
> $filename is losing scope, unless he uses it else where.
>
> The warning is good, it's telling  you that $filename = "" at that point
in
> your script. So either you lost the contents of $filename somewhere, or
lost
> scope of the $filename with content you wanted, or you reassigned it to
"".
> Either way you shouldn't be doing (-e ""); which is happening at that
point.
>
> > -Original Message-
> > From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 10, 2002 1:12 PM
> > To: Ahmed Moustafa; [EMAIL PROTECTED]
> > Subject: Re: (-e $filename) gives Use of uninitialized value at...
> >
> >
> > Seems like the method you use to assign filename doesn't always occur.
> > Maybe you have the my $filename='whatever' in an if statement?
> >
> > Agustin Rivera
> > Webmaster, Pollstar.com
> > http://www.pollstar.com
> >
> >
> >
> > - Original Message -
> > From: "Ahmed Moustafa"
> > To: "Perl" <[EMAIL PROTECTED]>
> > Sent: Wednesday, April 10, 2002 10:02 AM
> > Subject: (-e $filename) gives Use of uninitialized value at...
> >
> >
> > > I'm using (-e $filename) to check the existence of
> > $filename. If the file
> > > exists, it returns true, otherwise it gives 'Use of
> > uninitialized value
> > > at...line #' (# is the line number of the if statement -if
> > ($filename)-.
> > Why
> > > does that happen and how I can fix it, please?
> > >
> > > Thanks in advance.
> > >
> > > --Ahmed


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




Re: why wont html templates work with perl ???

2002-04-10 Thread Elaine -HFB- Ashton

A Taylor [[EMAIL PROTECTED]] quoth:
*>I have been trying (and trying) to use the code below as I need to use HTML 
*>templates in perl, and I keep getting the same error.
*>
*>Can't locate HTML/Template.pm in @INC (@INC contains: 
*>/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 
*>/usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 .) 
*>at /home/sites/site171/web/ibglda6kekkd/test.pl line 5.
*>
*>This looks to me as though the server that provides the web space that I am 
*>using doesnt support 'use HTML::Template;'. Is this correct or have I 
*>really lost the plot ? (Probably both !!!) - If so, what is the 
*>alternative. There has to be another way of using templates in PERL  I 
*>have been told by the company that provide the web space that I cant upload 
*>modules - is this true - and can I upload the HTML::Template module ?

It means precisely what it says - it cannot locate that module in any of
it's known library paths. So, you can either ask your ISP to install that
module for you or you can read teh section on the CPAN FAQ,
http://www.cpan.org/misc/cpan-faq.html, about how to install a module in a
different location and how to use it. Given the above, you'd probably be
limited to asking the ISP to install it for you.

e.

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




RE: why wont html templates work with perl ???

2002-04-10 Thread Hanson, Robert

It probably means that they don't have it installed.  You can create your
own library directory by putting the files in a directory and adding that
directory to your library path (i.e. @INC).

See the lib pragma docs on how to add a library path.
http://www.perldoc.com/perl5.6.1/lib/lib.html

Rob


-Original Message-
From: A Taylor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 1:48 PM
To: [EMAIL PROTECTED]
Subject: why wont html templates work with perl ???


I have been trying (and trying) to use the code below as I need to use HTML 
templates in perl, and I keep getting the same error.

Can't locate HTML/Template.pm in @INC (@INC contains: 
/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 
/usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 .) 
at /home/sites/site171/web/ibglda6kekkd/test.pl line 5.

This looks to me as though the server that provides the web space that I am 
using doesnt support 'use HTML::Template;'. Is this correct or have I really

lost the plot ? (Probably both !!!) - If so, what is the alternative. 
There has to be another way of using templates in PERL  I have been told

by the company that provide the web space that I cant upload modules - is 
this true - and can I upload the HTML::Template module ?

>- filename = test.pl --
>
>#!/usr/bin/perl
>
>use HTML::Template;
>
>my $template = HTML::Template->new(filename => 'test.tmpl');
>
>$template->param(
>HOME => $ENV{HOME},
>PATH => $ENV{PATH},
>);
>
>print "Content-Type: text/html\n\n";
>
>print $template->output;
>
>
>print "\n\nINC = @INC \n\n";
>
>
>
>-- filename: test.tmplTHIS IS YOUR TEMPLATE
>FILE-
>
>
>
>Test Template
>
>My home directory is
>
>MY PATH is set to 
>
>
>
>__
>

Thanks for all your help so far - it is really appreciated !!!

All the best
Anadi

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
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: problem sending mail

2002-04-10 Thread Elaine -HFB- Ashton

Aman Raheja [[EMAIL PROTECTED]] quoth:
*>Hi all
*>I am trying to send a mail with the following code and the last print 
*>statement doesn't print, ie, the mail is not sent.
*>This code is called on submitting a form on the web
*>
*>open(MAIL, "/usr/sbin/sendmail -oi -t") || die "Can't open mail";
*>print MAIL Subject: News
*>all the message goes here
*>END
*>
*>close(MAIL);
*>print "The mail has been sent successfully";
*>-
*>If I remove the -oi -t switch from the first statement, the print statement 
*>works but the mail is not sent.
*>Please help and let me know what could I be missing, in or above the code.

#!/usr/bin/perl -w

open(MAIL, "|/usr/sbin/sendmail -oi -t -f foo\@bar.com") || die "Can't open
mail";
print MAIL <<'DNE';
To: amancgiperl\@hotmail.com
Subject: News

all the message goes here

DNE 

close(MAIL);

Other than the obvious changes you should *always* add -w and use perl -c
$programname whenever you find something works. Also, END is a reserved
word so never use that in a 'here' doc.

e.


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




why wont html templates work with perl ???

2002-04-10 Thread A Taylor

I have been trying (and trying) to use the code below as I need to use HTML 
templates in perl, and I keep getting the same error.

Can't locate HTML/Template.pm in @INC (@INC contains: 
/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 
/usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 .) 
at /home/sites/site171/web/ibglda6kekkd/test.pl line 5.

This looks to me as though the server that provides the web space that I am 
using doesnt support 'use HTML::Template;'. Is this correct or have I really 
lost the plot ? (Probably both !!!) - If so, what is the alternative. 
There has to be another way of using templates in PERL  I have been told 
by the company that provide the web space that I cant upload modules - is 
this true - and can I upload the HTML::Template module ?

>- filename = test.pl --
>
>#!/usr/bin/perl
>
>use HTML::Template;
>
>my $template = HTML::Template->new(filename => 'test.tmpl');
>
>$template->param(
>HOME => $ENV{HOME},
>PATH => $ENV{PATH},
>);
>
>print "Content-Type: text/html\n\n";
>
>print $template->output;
>
>
>print "\n\nINC = @INC \n\n";
>
>
>
>-- filename: test.tmplTHIS IS YOUR TEMPLATE
>FILE-
>
>
>
>Test Template
>
>My home directory is
>
>MY PATH is set to 
>
>
>
>__
>

Thanks for all your help so far - it is really appreciated !!!

All the best
Anadi

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: problem sending mail

2002-04-10 Thread Aman Raheja

It didn't work either way as suggested
using -t only
or
changing the delimiting tag with print statetent

I tried to do the same on the command line and it works. I wonder what is 
missing here.
Help is greatly appreciated
Aman


>From: "Aman Raheja" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED], [EMAIL PROTECTED], 
>[EMAIL PROTECTED], [EMAIL PROTECTED]
>Subject: problem sending mail
>Date: Wed, 10 Apr 2002 12:25:46 -0500
>
>Hi all
>I am trying to send a mail with the following code and the last print
>statement doesn't print, ie, the mail is not sent.
>This code is called on submitting a form on the web
>
>open(MAIL, "/usr/sbin/sendmail -oi -t") || die "Can't open mail";
>print MAIL Subject: News
>all the message goes here
>END
>
>close(MAIL);
>print "The mail has been sent successfully";
>-
>If I remove the -oi -t switch from the first statement, the print statement
>works but the mail is not sent.
>Please help and let me know what could I be missing, in or above the code.
>
>Thanks
>Aman
>
>_
>Join the world’s largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>


_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




problem sending mail

2002-04-10 Thread Aman Raheja

Hi all
I am trying to send a mail with the following code and the last print 
statement doesn't print, ie, the mail is not sent.
This code is called on submitting a form on the web

open(MAIL, "/usr/sbin/sendmail -oi -t") || die "Can't open mail";
print MAIL <";
-
If I remove the -oi -t switch from the first statement, the print statement 
works but the mail is not sent.
Please help and let me know what could I be missing, in or above the code.

Thanks
Aman

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




RE: displaying images

2002-04-10 Thread Charlton, Mark

With actual reference to the initial question this time, I forgot it in my
previous post...

What is the resultant output when you execute the command in the browser?

Regards

-Original Message-
From: Charlton, Mark [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 6:07 PM
To: 'Connie Chan '; 'Jerry Preston '; 'begginners '
Subject: RE: displaying images


In XHTML 1.0 quotes around parameters are compulsary.

You can skip the quotes, but it is not valid XHTML code.  Therefore I feel
it is better practice to always use quotes where possible to maintain
standards compatability.  It also helps the browsers interpretation of the
code, and IMHO makes the code more readable.

Regards

-Original Message-
From: Connie Chan
To: Jerry Preston; begginners
Sent: 4/10/02 12:58 PM
Subject: Re: displaying images



> I can display an image using pure HTML:
> 
> 

First, this is wrong HTML, you should write as 


> print"
> 
>   
>   

You should give a \ for %, that is 80\%.

If no vars and aposophy are inside a print, 
you can use single quote pair, so you can 
write everything without using \ for escape
char.

As tips inside HTML. you can skip the 
quote sometimes :
1) 
quotes are nessary

2) 
quotes can skip.


-- 
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]

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




Re: Keeping places with numbers

2002-04-10 Thread Jeff 'japhy' Pinyan

On Apr 10, Michael Gargiullo said:

>I have a loop that starts at 0 and goes to 9 and sets the variable $zip
>to the current number
>
>I need it to always be 5 places like a zip code, like so
>
>0
>1
>etc...
>
>How can I do that?

Here are two ways:

  # makes a VERY LARGE LIST
  for $id ('0' .. '9') { ... }

  # probably faster
  for ($id = '0'; $id ne '10'; $id++) { ... }

-- 
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 **
 what does y/// stand for?   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]




RE: Keeping places with numbers

2002-04-10 Thread Nikola Janceski

perldoc -f sprintf

$zip = sprintf("%05d", $zip);


> -Original Message-
> From: Michael Gargiullo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 10, 2002 1:16 PM
> To: Beginners
> Subject: Keeping places with numbers
> 
> 
> I have a loop that starts at 0 and goes to 9 and sets the 
> variable $zip
> to the current number
> 
> I need it to always be 5 places like a zip code, like so
> 
> 0
> 1
> etc...
> 
> How can I do that?
> 
> -Mike
> 
> 
> -- 
> 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]




RE: (-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Nikola Janceski

Assuming you have all warnings on, via -w or use warnings, I don't think
$filename is losing scope, unless he uses it else where.

The warning is good, it's telling  you that $filename = "" at that point in
your script. So either you lost the contents of $filename somewhere, or lost
scope of the $filename with content you wanted, or you reassigned it to "".
Either way you shouldn't be doing (-e ""); which is happening at that point.

> -Original Message-
> From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 10, 2002 1:12 PM
> To: Ahmed Moustafa; [EMAIL PROTECTED]
> Subject: Re: (-e $filename) gives Use of uninitialized value at...
> 
> 
> Seems like the method you use to assign filename doesn't always occur.
> Maybe you have the my $filename='whatever' in an if statement?
> 
> Agustin Rivera
> Webmaster, Pollstar.com
> http://www.pollstar.com
> 
> 
> 
> - Original Message -
> From: "Ahmed Moustafa" <[EMAIL PROTECTED]>
> To: "Perl" <[EMAIL PROTECTED]>
> Sent: Wednesday, April 10, 2002 10:02 AM
> Subject: (-e $filename) gives Use of uninitialized value at...
> 
> 
> > I'm using (-e $filename) to check the existence of 
> $filename. If the file
> > exists, it returns true, otherwise it gives 'Use of 
> uninitialized value
> > at...line #' (# is the line number of the if statement -if 
> ($filename)-.
> Why
> > does that happen and how I can fix it, please?
> >
> > Thanks in advance.
> >
> > --Ahmed
> >
> >
> > --
> > 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]
> 



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]




Keeping places with numbers

2002-04-10 Thread Michael Gargiullo

I have a loop that starts at 0 and goes to 9 and sets the variable $zip
to the current number

I need it to always be 5 places like a zip code, like so

0
1
etc...

How can I do that?

-Mike


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




Re: (-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Agustin Rivera

Seems like the method you use to assign filename doesn't always occur.
Maybe you have the my $filename='whatever' in an if statement?

Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com



- Original Message -
From: "Ahmed Moustafa" <[EMAIL PROTECTED]>
To: "Perl" <[EMAIL PROTECTED]>
Sent: Wednesday, April 10, 2002 10:02 AM
Subject: (-e $filename) gives Use of uninitialized value at...


> I'm using (-e $filename) to check the existence of $filename. If the file
> exists, it returns true, otherwise it gives 'Use of uninitialized value
> at...line #' (# is the line number of the if statement -if ($filename)-.
Why
> does that happen and how I can fix it, please?
>
> Thanks in advance.
>
> --Ahmed
>
>
> --
> 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: displaying images

2002-04-10 Thread Charlton, Mark

In XHTML 1.0 quotes around parameters are compulsary.

You can skip the quotes, but it is not valid XHTML code.  Therefore I feel
it is better practice to always use quotes where possible to maintain
standards compatability.  It also helps the browsers interpretation of the
code, and IMHO makes the code more readable.

Regards

-Original Message-
From: Connie Chan
To: Jerry Preston; begginners
Sent: 4/10/02 12:58 PM
Subject: Re: displaying images



> I can display an image using pure HTML:
> 
> 

First, this is wrong HTML, you should write as 


> print"
> 
>   
>   

You should give a \ for %, that is 80\%.

If no vars and aposophy are inside a print, 
you can use single quote pair, so you can 
write everything without using \ for escape
char.

As tips inside HTML. you can skip the 
quote sometimes :
1) 
quotes are nessary

2) 
quotes can skip.


-- 
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]




(-e $filename) gives Use of uninitialized value at...

2002-04-10 Thread Ahmed Moustafa

I'm using (-e $filename) to check the existence of $filename. If the file
exists, it returns true, otherwise it gives 'Use of uninitialized value
at...line #' (# is the line number of the if statement -if ($filename)-. Why
does that happen and how I can fix it, please?

Thanks in advance.

--Ahmed


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




RE: default value

2002-04-10 Thread Jeff 'japhy' Pinyan

On Apr 10, David Gray said:

>>   $question = $default if $question eq '';
>
>You could possibly shorten this last line to:
>
>$question ||= $default;
>
>This will set $question to $default if $question logically evaluates to
>false (which includes the case where $question is the empty string). If
>you only want to reset $question when it contains nothing, however, the
>previous solution is exactly what you want to do.

I'd have used that, but it doesn't allow the user to enter 0 as their
response, since 0 is false.

-- 
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 **
 what does y/// stand for?   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]




RE: default value

2002-04-10 Thread David Gray

>   $question = $default if $question eq '';

You could possibly shorten this last line to:

$question ||= $default;

This will set $question to $default if $question logically evaluates to
false (which includes the case where $question is the empty string). If
you only want to reset $question when it contains nothing, however, the
previous solution is exactly what you want to do.

 -dave



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




Re: displaying images

2002-04-10 Thread Connie Chan



> I can display an image using pure HTML:
> 
> 

First, this is wrong HTML, you should write as 


> print"
> 
>   
>   

You should give a \ for %, that is 80\%.

If no vars and aposophy are inside a print, 
you can use single quote pair, so you can 
write everything without using \ for escape
char.

As tips inside HTML. you can skip the 
quote sometimes :
1) 
quotes are nessary

2) 
quotes can skip.


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




RE: Execute .bat file from perl?

2002-04-10 Thread David Gray

> New to this - need to execute a .bat file from a perl script.
> 
> Any suggestions?

Look into the system command:

perldoc -f system

Hope that helps,

 -dave



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




displaying images

2002-04-10 Thread Jerry Preston

I can display an image using pure HTML:



But I cannot do it in perl.

I have tried the following:

$server='http://my.com';
print "\n";

print "";


print"

  
  

  

What I am I doing wrong?

Thanks,

Jerry





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




Re: RE:Ip address

2002-04-10 Thread Connie Chan

>From your attachement, it seems that you are refering to some other Modules,
perhapes "File". but you didn't use or require it in your script.. so it
becomes
an unknown method..

Besides, I don't know if the following are true or not :
1) "die" is no use in Win32 platform.
2) you skipped Exporter or some elements for module. so I think you can't
"use" it, but "require" it.
3) For package, I think a BEGIN{} and END{} pair should surround those
scripts

The above are my true experience. but if this only my case, please folks
help to give some corrections.

Have a nice day,
Connie



- Original Message -
From: "Jorge Goncalvez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 10, 2002 9:58 PM
Subject: RE:Ip address


> Hi, I tried to get the IP address in a Win98 machine I made a perl module
and I
> put it in /site/lib with .pm extension.
> it is Registry98.pm
>
> But I have this error:
> Can't call method Open of a undefined value at Registry98.pm line 22
>
> Why?
>
> Thanks
>






> --
> 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: Ip address

2002-04-10 Thread Smith, Jim R

Where does Open (upcase O) come from.
Did you mean to use open (lowcase o) ?

-Original Message-
From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 9:58 AM
To: [EMAIL PROTECTED]
Subject: RE:Ip address 


Hi, I tried to get the IP address in a Win98 machine I made a perl module
and I 
put it in /site/lib with .pm extension.
it is Registry98.pm

But I have this error:
Can't call method Open of a undefined value at Registry98.pm line 22

Why?

Thanks

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




Re: use of package in a script

2002-04-10 Thread Jenda Krynicky

From:  drieux <[EMAIL PROTECTED]>
> On Wednesday, April 10, 2002, at 07:27 , Jenda Krynicky wrote:
> 
> > From:   drieux <[EMAIL PROTECTED]>
> [..]
> >>  if the package assertion makes sense here
> >>   then this should be a Module
> >>hence start with h2xs
> >
> > Well ... imagine you need some custom class of objects in your
> > application or need to extend some class. Something small and
> > specific so it doesn't deserve it's own file, but the functions and
> > variables do have to belong to another package.
> 
> [..]
> Jenda,
> 
> I have a problem with your argument - you begin by positing the
> possible need for a sub Class in an application - and butress
> your point by pointing towards PM's that do the package in package.
> 
> { as previously noted, I have no fear of being merely pedantic }
> 
> having 'packages in packages' - in PM's makes sense to me -
> no problem there - it's the idea of trying to do this in
> an application 

Well I cannot give you an example to look at when it comes to 
scripts. Cause these are usualy not publicly available.

> So it still remains
> 'improbable' that one would want to do the "PM's" work inside
> the application itself...

Improbably yes, but forbidden no.

> if anying trying to wedgie this 'small subclass(es)' into an
> application leads into a "maze of twisty little passages all the same"
> - with the Fanged Beast Creature of code maintenance hell looming
> large.

If you'd happen to need several packages or the script started to 
grow big then of course it would be best to move the package to a 
module. But sometimes if the package is really small, the script is 
not going to be extended much etc. etc. etc. it's not worth the 
hassle.

That's all. Even if you do not introduce packages into the main 
script you still have to think all the time whether this should still be 
part of the script or should be moved into a module. Whether this is 
so specific that it's not worth making into a fullblown installed 
module or whether it only was moved out to a separate file to keep 
the main script maintainable, but only belongs to that script. 

One has to be carefull here and one has to try to do things as 
general and reusable as possible with reasonable effort.

But we've drifted to coding style issues and those tend to be overly 
personal and a bit fuzzy anyway. And tend to lead to flamewars 
which I'd really hate to get into.

Anyway ... to sum this all up I'd say:

1) If you are not sure you know whadaheck package means ... 
 don't use it in your code.
2) If you introduce another package in a script ... consider
 moving the code into a separate file and truning into a fullblown
 reuseable module. You don't have to, but it might be better.
3) Keep your scripts short and clean. If you start getting lost
 it's more than time to consider breaking the file into several.

Agreed? :-)

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

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




Re: Variables and Modules

2002-04-10 Thread drieux


On Monday, April 8, 2002, at 11:56 , Kevin Old wrote:

> Hello all,
>
> Quick question about variables.  I am editing a few scripts written by
> another programmer and he programs every variable surrounded in brackets,
> like ${var_name}.
>
> Is there any advantage to this?

in it's self this is a 'neutral' - probably a hold over
from doing things cautiously in /bin/sh and simply hauled
into doing that defensive coding in perl.

As you may have noted from earlier scoping questions think of the case

my $var = "me";
my $var2 = "${var}2";

at which point $var2 has the string 'me2'

without the curlies and quotes it would have the
bare word problem or worse... be simply self referential:

my $var2 = $var2 ;

Some coders are MORE PARANOID than others


ciao
drieux

---


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




Re: use of package in a script

2002-04-10 Thread drieux


Jenda,
On Wednesday, April 10, 2002, at 07:27 , Jenda Krynicky wrote:

> From: drieux <[EMAIL PROTECTED]>
>> Unless someone can come up with a really HOT idea as to why one
>> would want to put a 'package declaration' in an application -
[..]
>>  if the package assertion makes sense here
>>   then this should be a Module
>>hence start with h2xs
>
> Well ... imagine you need some custom class of objects in your
> application or need to extend some class. Something small and
> specific so it doesn't deserve it's own file, but the functions and
> variables do have to belong to another package.

we may have 'missed' each other by a mark, allow me to redefine
the rool more verbosely

let a = you are writing an application
let b = the need for a package declaration makes sense here

if ( a AND b)
then
that which follows the package assertion needs to be in a
perl module appropriately built with h2xs in compliance
with being CPAN style ready.

If on the other hand one is already into the evil art of writing
perl modules - then clearly one already groks the idea of using
package declarations inside of a package so as to sub class.

If You are cutting perl modules and do not grok packages -
one really should seek therapy for this problem.

ciao
drieux

---

remember boys and girls, all 'rules of thumb'
come with four fingers, a palm and several
class extensions - while on the other hand


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




need help in others programming..

2002-04-10 Thread senrong

Do anyone know where can I get help on Assembly programming language on the
net?...esp. in ANS?

thanks



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




Re: use of package in a script

2002-04-10 Thread drieux


On Wednesday, April 10, 2002, at 07:27 , Jenda Krynicky wrote:

> From: drieux <[EMAIL PROTECTED]>
[..]
>>  if the package assertion makes sense here
>>   then this should be a Module
>>hence start with h2xs
>
> Well ... imagine you need some custom class of objects in your
> application or need to extend some class. Something small and
> specific so it doesn't deserve it's own file, but the functions and
> variables do have to belong to another package.

[..]
Jenda,

I have a problem with your argument - you begin by positing the
possible need for a sub Class in an application - and butress
your point by pointing towards PM's that do the package in package.

{ as previously noted, I have no fear of being merely pedantic }

having 'packages in packages' - in PM's makes sense to me -
no problem there - it's the idea of trying to do this in
an application that starts out with

#!/usr/bin/perl
use strict;

package Foo::Bar;

package Foo::Baz;


this, this does not make sense - and as Jonathan noted would
not expressly protect the 'post package assertion code' from
any side effects before that assertion... So it still remains
'improbable' that one would want to do the "PM's" work inside
the application itself...

if anying trying to wedgie this 'small subclass(es)' into an application
leads into a "maze of twisty little passages all the same" - with
the Fanged Beast Creature of code maintenance hell looming large.

hence IF one wants to extend a class - why not simply do
the Decent Bit - whip out the h2xs - gin up the subClass
pm - and plonk your application in there in the .../bin directory
and have it all cleanly deliverable -

perl Makefile.PL
make
make dist

so that you can then haul around one puppy with the standard
CPAN style deliverable(s). This way if one's subClass turns
out to truly have merit - one is off to the PAUSE and gets it
into the modules - and everyone likes you for doing your patriotic
duty, complete with appropriate POD - and at least one good piece
of application code to illustrate that it's a decent thing and all.

some of my arguments about PM's are at:

http://www.wetware.com/drieux/CS/lang/Perl/PM/

My HORROR STORIES about trying to do a PM like approach in /bin/sh
which may help some understand the need for lexical scoping

http://www.wetware.com/drieux/CS/lang/shellScript/shlib.html

ciao
drieux

---


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




Re: rewrite without using two functions?

2002-04-10 Thread Randal L. Schwartz

> "Nikola" == Nikola Janceski <[EMAIL PROTECTED]> writes:

Nikola> Thanx... didn't know that it was an empty list... I thought it was ''

Ahh, but in a scalar context, it is!  Isn't context wonderful? :)

*This* would push alternating 1's and ""'s to the list:

@output = map { scalar /(foo)bar/ } "foobar", "shelter", "buffoobar";

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: rewrite without using two functions?

2002-04-10 Thread Randal L. Schwartz

> "David" == David Gray <[EMAIL PROTECTED]> writes:

David> When you have

David> LIST2 = map { m!^(.*)/\*$! } LIST1

David> It's shorthand for a loop like:

David> foreach my $el (@LIST1) {
David>   if($el =~ m!^(.*?)/\*$!) {
David> push @LIST2,$1
David>   } else {
David> push @LIST2,()
David>   }
David> }

Not really.  Don't muddle that up with an extra 'if', or you'll be implying
some Extra Magick in the map operator.  The map operator is dumb as rocks.
It just takes the last expr evaluated *in a list context* and appends
it to the end of the result list.  If anything, the "smooth operator" here
is the regex match in a list context!

So it's closer to this:

@LIST2 = ();
foreach (@LIST1) {
  my @result = m!^(.*?)/\*$!;
  ## at this point, @result is either $1 for a match, or () for a non match
  push @LIST2, @result;
  ## and thus we've either pushed $1 (single element) or empty list (nothing)
}

David> So when the regular expression doesn't match, it pushes an empty list,
David> which adds nothing to the array.

Yes, but not by the mechanism you're illustrating.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Regex, Taint, Review

2002-04-10 Thread K.L. Hayes

Hello All,

I have a script to process an inquiry form.(go figure ;)

Anyway, if someone could take a quick look and see if I'm missing
anything obvious or see anything that would allow a breach in
security, I would appreciate it.

Particularly my regex filters may need a third eye to catch something
because they still aggravate my brain tumor to figure out sometimes.

Also, I'd like to turn on taint checking but I believe that my
$ENV{'HTTP_REFERER'} & $ENV{REMOTE_ADDR} are the cause of errors when
I do. If someone could show me how to fix this, I'll name my third
born after you.

Also, before anybody gets their panties in a bundle, I've read all the
banter on this list about validating email addresses & how it can't be
done 100% of the time, the mods to look at & such. I'm just shooting
for a high 80% success. I got fred&[EMAIL PROTECTED] taken care of &
the rest can read my error page telling them to just send me an e-mail
with the info... ;)

Code is below, thanks a bunch!


#!/usr/bin/perl -w

use strict;
use CGI qw(:standard);
$CGI::DISABLE_UPLOADS = 1;
$CGI::POST_MAX= 512 * 1024;

my ($ENV,$sendmail,$time,$name,$email,$subject,$comments,
$bad_name,$bad_email,$bad_subject,$bad_comments);

$sendmail = '/usr/sbin/sendmail';
$time  = localtime(time);

$bad_name = param('name');
if ( $bad_name =~ /^([a-zA-Z\s_]+)$/ ) {
$name = $1; }
else {
error();
exit; }

$bad_email = param('email');
if( $bad_email =~ m/\w\S+\@\w\S+\./) {  
$bad_email =~ /([\w+\-\&\._]+\@[\w+\.\-_]+)/;
$email = $1; }
else {
error();
exit; }

# A one-word drop-down menu selection for this one. If they try to
# send anything else here... they can bite me ;)
$bad_subject = param('subject');
if ( $bad_subject =~ /^([a-zA-Z]+)$/ ) {
$subject = $1; }
else {
error();
exit; }

$bad_comments = param('comments');
if ( $bad_comments =~ /^([a-zA-Z\d\s\-\.\?!,_]+)$/ ) {
$comments = $1; }
else {
error();
exit; }

if (($ENV{'HTTP_REFERER'} eq "http://www.my-domain.com/contact/index.html";) ||
($ENV{'HTTP_REFERER'} eq "http://my-domain.com/contact/index.html";) ||
($ENV{'HTTP_REFERER'} eq "http://www.my-domain.com/contact/";) ||
($ENV{'HTTP_REFERER'} eq "http://my-domain.com/contact/";))
{
# DO NADA - JUST CONTINUE ON
}
else {
invalid();
exit; }

if(param()) {
open (MAIL, "| $sendmail -t -oi") || die "Can't open $sendmail : $!\n";
print MAIL "To: webmaster\@my-domain.com\n";
print MAIL "From: webmaster\@my-domain.com\n"; 
print MAIL "Subject: $subject\n\n";
print MAIL "On $time\n";
print MAIL "This information was received:\n\n";

## Personal Information ##

print MAIL "Inquiry Information:\n";
print MAIL "$ENV{REMOTE_ADDR}\n";
if($name) {
print MAIL "Name: $name\n"; }
else { error(); }
if($email) {
print MAIL "E-Mail: $email\n"; }
else { error(); }
if($subject) {
print MAIL "Subject: $subject\n"; }
else { error(); }
if($comments) {
print MAIL "Comments: $comments\n"; }
else { error(); }
close(MAIL);

print "Location: http://www.my-domain.com/thankyou.html\n\n";;
exit; }

print "Location: http://www.my-domain.com/contact/index.html\n\n";;

sub error {
print "Location: http://www.my-domain.com/contact/error.html\n\n";;
}
sub invalid {
print "Location: http://www.my-domain.com/contact/invalid.html\n\n";;
}


-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+=+
+ "Only two things are infinite, the universe and +
+ human stupidity, and I'm not sure about the former."+
+ -- Albert Einstien  +
+=+



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




Re: Validating form date

2002-04-10 Thread Ron

Hello Daniel

Here is one approach I use to validate an email address.

if ($email_new !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/)
 {
# Not a valid email address - Do this
 }else
# Valid email address - Do this
  }

Ron
==
"Daniel Falkenberg" <[EMAIL PROTECTED]> wrote in message
1018411064.2751.56.camel@gold">news:1018411064.2751.56.camel@gold...
Hello all,

I am just playing around with forms at the moment.  What I want to do is
have user enter data into form fiels then I want to validate that
entered date.  So far I can do things as basic as validating if fields
contain characters and so forth.  But what I want to do is something
like the following...

if ($realname eq "" || $email eq "" $email #does not contain an @
symbel) {
  # Then return an error!
} else {
  # continue
}

but in some instances the user will place enter their realname but not
their email. I would like the user to know where they went wrong in the
form.  Could some one explain to me what my best way of tackaling this
would be?

Regards,

Dan




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




Re: Variable question

2002-04-10 Thread Randal L. Schwartz

> "Bob" == Bob Ackerman <[EMAIL PROTECTED]> writes:

>> At no point do you have an "array" in a scalar context, or a "list"
>> in a scalar context.  Really.  You don't.  Ever.  Get it?
>> 
>> And why I'm harping on this is that I've seen this myth continue to
>> perpetuate, started from some bad verbage or bad understanding
>> somewhere, and I'm trying to root it out so that it doesn't keep
>> spreading like a bad meme.

Bob> oooh. i get it. i thought you were overboard, too - until that
Bob> last go around.  you are right. it is subtle, but important.

Thank you thank you thank you thank you!

It *is* important.  Spread the word. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




RE: Execute .exe or .bat files from perl??

2002-04-10 Thread Timothy Johnson

 
If you want to store the output in a variable then use backticks.

my $var = `echo This is my output.`;

or you can use system, which just returns the return value of the command:

my $returnvalue = system('ping -a 10.0.0.1');


-Original Message-
From: Rob
To: [EMAIL PROTECTED]
Sent: 4/9/02 3:46 PM
Subject: Execute .exe or .bat files from perl??

Anyone know how to call a .exe or .bat file from a perl script?



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




This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




RE: Renaming a File

2002-04-10 Thread Timothy Johnson

 
You can use the rename() function.

$file = "ABC";
rename($file, $file."dat") || die "Could not rename file!\n";

I think that's how you use it.  I can't test it here. Look it up in perlfunc
if it doesn't work.

perldoc -f rename

-Original Message-
From: Allison Ogle
To: a a
Sent: 4/10/02 7:05 AM
Subject: Renaming a File

Hi,

I am trying to open a file which has no file extension.  (For example
ABC ).
What I want to do is rename the file with a file extension.  (For
example
ABC.dat).  Does anyone know how to do this?
Thanks,

Allison


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



This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




Re: use of package in a script

2002-04-10 Thread Jenda Krynicky

From:   drieux <[EMAIL PROTECTED]>
> Unless someone can come up with a really HOT idea as to why one
> would want to put a 'package declaration' in an application - and I
> have tried, but for the life of me, can not come up with a good reason
> to go there... the simple rule of thumb would seem to be:
> 
>  if the package assertion makes sense here
>   then this should be a Module
>hence start with h2xs

Well ... imagine you need some custom class of objects in your 
application or need to extend some class. Something small and 
specific so it doesn't deserve it's own file, but the functions and 
variables do have to belong to another package.

Also if you look into some modules you'll find out that they often 
have several package statements. Eg. Interpolation.pm (0.66+) has 
packages Interpolation, Interpolation::S2A, Interpolation::A2A, 
Interpolation::A2S, Interpolation::general and Interpolation::internal.

Most of them span only about 10 lines. It would be silly to create 
separate files for them.

Or if you look into a recent Mail::Sender you'll see that there is not 
only package Mail::Sender, but also Mail::Sender::DBIO and 
Mail::Sender::IO. The Mail::Sender::DBIO implements a file handle 
that writes to and reads from a socket and logs everything into a 
file, the Mail::Sender::IO implements a filehandle that encodes the 
data as necessary for current part of email and sends them to the 
socket. The filehandle you get from $sender->GetHandle().

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

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




RE: Execute .exe or .bat files from perl??

2002-04-10 Thread Najamuddin, Junaid

This might help you
# looks for the existence of batch or exe files then logs it in a log file
or if do not 
# find it exits and then thru system command execute it you can also alter
it to get email or page if you want to do so 


use win32;
if (-e "$batch)
{print LOG "$batch exist";
}
else 
{print LOG "$batch do not exist\n";
close LOG;
exit;
system ("$batch");


junaid :)

-Original Message-
From: Rob [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 5:47 PM
To: [EMAIL PROTECTED]
Subject: Execute .exe or .bat files from perl??


Anyone know how to call a .exe or .bat file from a perl script?



-- 
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: Renaming a File

2002-04-10 Thread Michael Stidham


Try :

perldoc -f rename

HTH - Mike

>From: "Allison Ogle" <[EMAIL PROTECTED]>
>To: "a a" <[EMAIL PROTECTED]>
>Subject: Renaming a File
>Date: Wed, 10 Apr 2002 10:05:48 -0400
>
>Hi,
>
>I am trying to open a file which has no file extension.  (For example ABC 
>).
>What I want to do is rename the file with a file extension.  (For example
>ABC.dat).  Does anyone know how to do this?
>Thanks,
>
>Allison
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




Re: Renaming a File

2002-04-10 Thread Craig Sharp

Allison,

Here is the link for more information on the script.

http://www.evolt.org/article/Renaming_Files_with_Perl/17/351/

Craig A. Sharp
Unix Systems Administrator
DNS Administrator
Roush Industries
Office: 734-466-6286
Cell: 734-231-6769
Fax: 734-466-6939
[EMAIL PROTECTED]

I have not lost my mind, it's backed up on tape somewhere!


>>> "Allison Ogle" <[EMAIL PROTECTED]> 04/10/02 10:05AM >>>
Hi,

I am trying to open a file which has no file extension.  (For example ABC ).
What I want to do is rename the file with a file extension.  (For example
ABC.dat).  Does anyone know how to do this?
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: Renaming a File

2002-04-10 Thread Felix Geerinckx

on Wed, 10 Apr 2002 14:05:48 GMT, Allison Ogle wrote:

> What I want to do is rename the file with a file extension. 
   ^^

perldoc -f rename

-- 
felix

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




RE: Oracle sequences

2002-04-10 Thread David Kirol

my $sql = "SELECT net_seq.nextval FROM dual";
HTH

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 9:25 AM
To: [EMAIL PROTECTED]
Subject: Oracle sequences


Hi all

I'm attempting to load an oracle database and am struggling with how to
retrieve a sequence for a table.

in SQL, the value is net_seq.nextval
how do i use this in a perl script??


Thanks

Stephen Redding

BT Ignite Solutions
Telephone - 0113 237 3393
Fax - 0113 244 1413
Email - [EMAIL PROTECTED]

British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 180
This electronic message contains information from British Telecommunications
plc which may be privileged or  confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you  are not
the intended recipient be aware that any disclosure, copying, distribution
or use of the contents of  this information is prohibited. If you have
received this electronic message in error, please notify us by  telephone or
email (to the numbers or address above) immediately.



--
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: Renaming a File

2002-04-10 Thread Craig Sharp

Allison,

Try this script.  I found it out on the net.  My need was to rename a set of files but 
I don't see any reason that this couldn't rename a single file.

#!/usr/local/bin/perl
#
# Usage: rename perlexpr [files]

($regexp = shift @ARGV) || die "Usage:  rename perlexpr [filenames]\n";

if (!@ARGV) {
   @ARGV = ;
   chomp(@ARGV);
}


foreach $_ (@ARGV) {
   $old_name = $_;
   eval $regexp;
   die $@ if $@;
   rename($old_name, $_) unless $old_name eq $_;
}

exit(0);

Craig A. Sharp
Unix Systems Administrator
DNS Administrator
Roush Industries
Office: 734-466-6286
Cell: 734-231-6769
Fax: 734-466-6939
[EMAIL PROTECTED]

I have not lost my mind, it's backed up on tape somewhere!


>>> "Allison Ogle" <[EMAIL PROTECTED]> 04/10/02 10:05AM >>>
Hi,

I am trying to open a file which has no file extension.  (For example ABC ).
What I want to do is rename the file with a file extension.  (For example
ABC.dat).  Does anyone know how to do this?
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: Taint checking a bunch of word input

2002-04-10 Thread zentara

On Wed, 10 Apr 2002 08:03:09 -0500, [EMAIL PROTECTED] (Brent
Michalski) wrote:
>Well, I am guessing that you use some sort of whitespace between words,
>like a space.  The below regex does not include the space character!
>
>Change your character set to include more characters..
>
>From:
>[a-zA-Z0-9\.,;:]
>
>To:
>[a-zA-Z0-9\.,;: ]
>
>Or, to save a few chars..
>[\w\.,;: ]
>
>Would be a start.

Doh!!!  That did it.  Man this untainting business needs a decent module. :-)
Looking too hard, and missing the obvious.
Thanks.


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




Re: simulating c structures in perl

2002-04-10 Thread William.Ampeh


use Class::Struct;

struct STRUCT1 => {
   a => '$',#a is a scalar
   b => '$',
   c => '$',
};

$s = STRUCT1->new();

$s->a(1);
$s->b(2);
$s->c(3);

#
printf "\na = %d, b = %d c = %d\n\n", $s->a, $s->b, $s->c;


__

William Ampeh (x3939)
Federal Reserve Board


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




Renaming a File

2002-04-10 Thread Allison Ogle

Hi,

I am trying to open a file which has no file extension.  (For example ABC ).
What I want to do is rename the file with a file extension.  (For example
ABC.dat).  Does anyone know how to do this?
Thanks,

Allison


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




Re: simulating c structures in perl

2002-04-10 Thread Jonathan E. Paton

> How do I simulate an array of structures in perl?

my @array = \(%struct1, %struct2, %struct3);

or something like that anyway.  You learning or trying
to convert C code into Perl?  Compared to C, you don't
use an array as often in Perl - but hashes.

E.g.

my %records = (
'id0001' => {
name => "Jonathan",
email => "[EMAIL PROTECTED]"
},
'id0002' => {
name => "Roy Peters",
email => "[EMAIL PROTECTED]"
}
};

print $records{id0001}{name};

etc etc...

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:Ip address

2002-04-10 Thread Jorge Goncalvez

Hi, I tried to get the IP address in a Win98 machine I made a perl module and I 
put it in /site/lib with .pm extension.
it is Registry98.pm

But I have this error:
Can't call method Open of a undefined value at Registry98.pm line 22

Why?

Thanks



Registry98.pm
Description: Registry98.pm

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


Re: Variable Interpolation

2002-04-10 Thread Jenda Krynicky

From:   [EMAIL PROTECTED]
> Can you please help.
> 
> When does Interpolation occur at Compile Time , Run Time or Both. So
> far I know on both, then why does the following not work. ( how can I
> get it to work ?)
> 
> $scripts = 'cd $acu_home/bin \n nohup ${srv}_ss $srv.ini >
> $acu_home/bin/$srv.out&';
> $acu_home = "/luke/u01/app/rdf/product/4.1/acumate";
> $srv = "edg";
> print("SCRIPT: $scripts \n");
> system("$scripts");

Of course on runtime.
So in your case when the value for $stripts is computed the $srv 
and $acu_home variables are not yet set. And so you do not get 
what you need.

You would not expect this

#!perl
$sum = $x + $y;
$x = 1;
$y = 2;
print "Sum is $sum\n";

to print "Sum is 3" would you?

Resort the lines like this :

$acu_home = "/luke/u01/app/rdf/product/4.1/acumate";
$srv = "edg";
$scripts = 'cd $acu_home/bin \n nohup ${srv}_ss $srv.ini >
$acu_home/bin/$srv.out&';

Jenda

P.S.: Would it be possible to trim down the silly disclaimer in your 
messages to mailing list? If not it would be fine if you considered 
subscribing from an address that doesn't add this at all.

P.P.S.: This disclaimer obsession really drives me crazy. The 
world would be so much better place if it were not for the lawyers :-(

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me

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




Re: simulating c structures in perl

2002-04-10 Thread Roy Peters

How do I simulate an array of structures in perl?

eg.

struct {
int a;
int b;
int c
} STRUCT1;

int STRUCT1 s[5];

s[1].a =1;
s[1].b =2;
s[1].c =3;

How would I write this in perl?

Thanks.


The information contained in this message may be privileged 
and confidential and protected from disclosure.  If the 
reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any 
reproduction, dissemination or distribution of this 
communication is strictly prohibited. If you have received 
this communication in error, please notify us immediately by 
replying to the message and deleting it from your computer.

Thank you.
Tellabs


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




RE: simulating c structures in perl

2002-04-10 Thread Jonathan E. Paton

> Hmm... another question..  will this kinda of stuff be easier in Perl 6?

Perhaps, need to browse the RFC list at:

http://dev.perl.org/rfc

to find out.  Anything can change!

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: simulating c structures in perl

2002-04-10 Thread Jonathan E. Paton

> How would you define c type structures in perl?

perldoc Class::Struct

if installed... else:

> struct {
> int a;
> int b;
> int c
> } STRUCT1;
>
> int STRUCT1 s;

my %struct = (
a => undef,
b => undef,
c => undef
);

> s.a =1;
> s.b =2;
> s.c =3;

$struct{a} = 1;
$struct{b} = 2;
$struct{c} = 3;

And created brand new ones with:

my %struct2 = %struct;

but remember that's weak copying... not deep.  You will end up with two hashes with 
references to
the same data - so watch out!

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: simulating c structures in perl

2002-04-10 Thread walter valenti

Roy Peters wrote:

>How would you define c type structures in perl?
>
>eg.
>
>struct {
>int a;
>int b;
>int c
>} STRUCT1;
>
>int STRUCT1 s;
>
>s.a =1;
>s.b =2;
>s.c =3;
>
>How would I write this in perl?
>
>Thanks.
>
$s{'a'}=1;
$s{'b'}=2;
$s{'c'}=3;


Walter



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




RE: simulating c structures in perl

2002-04-10 Thread Nikola Janceski

Hmm... another question..  will this kinda of stuff be easier in Perl 6?

> -Original Message-
> From: Roy Peters [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 10, 2002 9:38 AM
> To: [EMAIL PROTECTED]
> Subject: simulating c structures in perl
> 
> 
> How would you define c type structures in perl?
> 
> eg.
> 
> struct {
> int a;
> int b;
> int c
> } STRUCT1;
> 
> int STRUCT1 s;
> 
> s.a =1;
> s.b =2;
> s.c =3;
> 
> How would I write this in perl?
> 
> Thanks.
> 
> 
> The information contained in this message may be privileged 
> and confidential and protected from disclosure.  If the 
> reader of this message is not the intended recipient, or an 
> employee or agent responsible for delivering this message to 
> the intended recipient, you are hereby notified that any 
> reproduction, dissemination or distribution of this 
> communication is strictly prohibited. If you have received 
> this communication in error, please notify us immediately by 
> replying to the message and deleting it from your computer.
> 
> Thank you.
> Tellabs
> 
> 
> -- 
> 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]




Re: Net::FTP

2002-04-10 Thread Elaine -HFB- Ashton

OZGUR GENC  [[EMAIL PROTECTED]] quoth:
*>
*>I can not install any Net::FTP module from http://search.cpan.org/ . I
*>can not uncompress any  downloaded  Net::FTP modules. Does anyone have
*>any idea what problem can be?

Well, you have to uncompress them before you can install them. Check to
make sure you have 'gzip' or 'gunzip' along with tar and that you have a
platform agreeable to the module, e.g. Win32:: on windows, not on Unix. 

You should also read the FAQ http://www.cpan.org/misc/cpan-faq.html with
particular attention to the module sections.

e.

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




simulating c structures in perl

2002-04-10 Thread Roy Peters

How would you define c type structures in perl?

eg.

struct {
int a;
int b;
int c
} STRUCT1;

int STRUCT1 s;

s.a =1;
s.b =2;
s.c =3;

How would I write this in perl?

Thanks.


The information contained in this message may be privileged 
and confidential and protected from disclosure.  If the 
reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any 
reproduction, dissemination or distribution of this 
communication is strictly prohibited. If you have received 
this communication in error, please notify us immediately by 
replying to the message and deleting it from your computer.

Thank you.
Tellabs


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




Re: Perl on the Palm OS?

2002-04-10 Thread Elaine -HFB- Ashton

[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth:
*>I would like to write a program in perl which can be run on a Palm OS
*>powered handheld. Any idea how I would go about doing this, or if it's even
*>possible at this point in time?

http://www.cpan.org/ports/

PalmOS - no known ports

So, no, it's not possible at this point.

e.

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




Variable Interpolation

2002-04-10 Thread DBuitendag



Hi .

Can you please help.

When does Interpolation occur at Compile Time , Run Time or Both.
So far I know on both, then why does the following not work. ( how can I get it
to work ?)

$scripts = 'cd $acu_home/bin \n nohup ${srv}_ss $srv.ini >
$acu_home/bin/$srv.out&';
$acu_home = "/luke/u01/app/rdf/product/4.1/acumate";
$srv = "edg";
print("SCRIPT: $scripts \n");
system("$scripts");

Thanks.

Derek





--Edcon Disclaimer -
This email is private and confidential and its contents and attachments are the
property of Edcon. It is solely for the named addressee. Any unauthorised use or
 interception of this email, or the review, retransmission, dissemination or
other use of, or taking of any action in reliance upon the contents of this
email, by persons or entities other than the intended recipient, is prohibited.
Save for communications relating to the official business of Edcon, the company
does not accept any responsibility for the contents of this email or any
opinions expressed in this email or its attachments .
If you are not the named addressee please notify us immediately by reply email
and delete this email and any attached files.
Due to the nature of email Edcon cannot ensure and accepts no liability for the
integrity of this email and any attachments, nor that they are free of any
virus.
Edcon accepts no liability for any loss or damage whether direct or indirect or
consequential,  however caused, whether by negligence or otherwise, which may
result directly or indirectly from this communication or any attached files.

Edgars Consolidated Stores LTD ,Post office box 200 Crown Mines, Telephone:
(011) 495-6000





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




Oracle sequences

2002-04-10 Thread stephen . redding

Hi all

I'm attempting to load an oracle database and am struggling with how to
retrieve a sequence for a table.

in SQL, the value is net_seq.nextval
how do i use this in a perl script??


Thanks

Stephen Redding

BT Ignite Solutions
Telephone - 0113 237 3393
Fax - 0113 244 1413
Email - [EMAIL PROTECTED]

British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 180
This electronic message contains information from British Telecommunications
plc which may be privileged or  confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you  are not
the intended recipient be aware that any disclosure, copying, distribution
or use of the contents of  this information is prohibited. If you have
received this electronic message in error, please notify us by  telephone or
email (to the numbers or address above) immediately.



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




Re: File Paths and file names

2002-04-10 Thread Felix Geerinckx

on Wed, 10 Apr 2002 12:50:42 GMT, Chris Green wrote:

> I would like to write a perl program to run on NT to go through a list
> of files, with full path and extract just the file name. The path is
> random in length likewise so is the file name.

If you already have the list of files

use File::Basename;

If you need to create the list of files from directories first, also

use File::Find;

-- 
felix

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




Re: Taint checking a bunch of word input

2002-04-10 Thread Brent Michalski


Well, I am guessing that you use some sort of whitespace between words,
like a space.  The below regex does not include the space character!

Change your character set to include more characters..

From:
[a-zA-Z0-9\.,;:]

To:
[a-zA-Z0-9\.,;: ]

Or, to save a few chars..
[\w\.,;: ]

Would be a start.



   

  zentara  

   cc: 

  Sent by: Subject: Taint checking a bunch of 
word input   
  Agent-Linux-Wine@oni 

  on.perl.org  

   

   

  04/09/02 09:34 PM

   

   





Hi,
Taint checking has got me stumped.
I'm using CGI to bring in a variable amount of data from
a Textarea in a form.

What's the best way to untaint a bunch of words?
They may or may not span multiple lines.

Everything I've tried will give me $1 being just the
first word.
For example:
if ($comment =~ /([a-zA-Z0-9\.,;:]*)/m){$comment = $1}

How do you get $1 to capture everything that would be
in normal comments, with resorting to (.*)  :-)




--
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]




Net::FTP

2002-04-10 Thread OZGUR GENC



Hi All,
I can not install any Net::FTP module from http://search.cpan.org/ . I
can not uncompress any  downloaded  Net::FTP modules. Does anyone have
any idea what problem can be?
Ozgur 

***

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]




File Paths and file names

2002-04-10 Thread Green, Chris

I would like to write a perl program to run on NT to go through a list of
files, with full path and extract just the file name. The path is random in
length likewise so is the file name.

Chris


This e-mail (and any attachments) may contain privileged and/or confidential 
information. If you are not the intended recipient please do not disclose, copy, 
distribute, disseminate or take any action in reliance on it. If you have received 
this message in error please reply and tell us and then delete it. Should you wish to 
communicate with us by e-mail we cannot guarantee the security of any data outside our 
own computer systems. For the protection of Legal & General's systems and staff, 
incoming emails will be automatically scanned.
 
Any information contained in this message may be subject to applicable terms and 
conditions and must not be construed as giving investment advice within or outside the 
United Kingdom.
 
Representative only of the Legal & General marketing group, members of which are 
regulated by the Financial Services Authority for the purposes of advising on life 
assurance and investment products bearing Legal & General's name. 
Legal & General Group PLC, Temple Court, 11 Queen Victoria Street, London, EC4N 4TP. 
Registered in England no: 166055.


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




Re: Validating form date

2002-04-10 Thread fliptop

Daniel Falkenberg wrote:

> I am just playing around with forms at the moment.  What I want to do is
> have user enter data into form fiels then I want to validate that
> entered date.  So far I can do things as basic as validating if fields
> contain characters and so forth.  But what I want to do is something
> like the following...
> 
> if ($realname eq "" || $email eq "" $email #does not contain an @
> symbel) {
>   # Then return an error!
> } else {
>   # continue
> }
> 
> but in some instances the user will place enter their realname but not
> their email. I would like the user to know where they went wrong in the
> form.  Could some one explain to me what my best way of tackaling this
> would be?


if you want to validate email addresses, consider using email::valid

http://search.cpan.org/search?dist=Email-Valid


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




Perl on the Palm OS?

2002-04-10 Thread ryanb

I would like to write a program in perl which can be run on a Palm OS
powered handheld. Any idea how I would go about doing this, or if it's even
possible at this point in time?

Thanks,
Ryan






Re: default value -simpler method?

2002-04-10 Thread Elias Assmann

>   my $age = param('age') || 12;
>
> Is that an acceptable way of doing things, or is there some
> glaringly obvious mistake? It seems to pick up null and undefined
> values okay, without any errors (i.e. no age param, or age= will
> get 12). Only problem is that it treats 0 as null/undefined, but
> that's fine in a lot of cases.

It doesn't treat 0 as undefined, it merely treats it as false :-)

my $age = param("age") eq "0" ? 0 : param("age") || 12;

will probably do what you want (except that it will fail on "0.0"
etc), as long as you don't get any non-empty strings that can't be
converted to a number... The solution depends somewhat on what you
want to do in that case I guess.

Now there remains only one question: How many people will use your
program whose age is 0? :-)

Elias

PS: Can't anyone come up with a nicer way to do this? Mine looks so
ugly...

-- 
"There are people who don't like capitalism, and there are people who don't like PCs,
but there's no one who likes the PC who doesn't like Microsoft."
 -- Bill Gates




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




Re: passing a email address to sendmail

2002-04-10 Thread p

SL,

There's a few problems with that there script, but to the point:
try either:
$mymail = '[EMAIL PROTECTED]';
or
$mymail = "usr\@someplace.com";

The \ escapes the next character, ie treats it as a plain @ sign, not as the beginning 
of an array name. Using single quotes means that variables don't get interpolated at 
all, so you don't need to escape @'s or $'s.

Tristan



You Wrote:
--

Hi,
could someone help me?111
Iam trying to send a email with an open pipe, but i can not interpolate 
the '@' of the email address in the " To:"
e.g.
i have one variable
$mymail = [EMAIL PROTECTED]

the  pipe
open (MAIL, '/usr/bin/sendmail -oi -t) || or die bkkabakb;
print  MAIL << ENDMAIL;
To: $mymail # this place i need tointerpolate " @someplace" ,
body
ENDMAIL
close MAIL;
etc...
Could someone help.
Thanks,
SL


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






___
sent via the murky.net webmail hegemony

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




Re: Checking if a hash has blank values.

2002-04-10 Thread Sudarsan Raghavan

[EMAIL PROTECTED] wrote:

> Hi,
>
> What's the preferred waying of doing things...
>
> if ($var eq '')
>
> or
>
> if (defined $var)
>
> I assume they both mean pretty much the same thing?
>

No, defined is used to tell if the value is undef or not.
undef is a special scalar value, it is treated as '' when used
as a string and 0 when used as a number.  If warnings are
turned on you will get a warning when it used in the RHS
of an expression.
perldoc perlsyn (read the section on 'Declarations')
e.g.

$var;
print "Is undef" if (!defined($var)); #prints Is Undef
$var = '';
print "value exists" if (defined($var)); #prints value exists

$var eq '' should be used for checking empty strings.

>
> Tristan


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




Réf. : Re: shrinking code

2002-04-10 Thread G . LE-HUU-HOA



What if $m != 0 at the beginning? Should it be something like :
print "-" x (80 - $m);
?

- Gilbert LE HUU HOA -
--
Focal Systems




   
 
"Tanton Gibbs" 
 
,  
farms.com>"Beginners" <[EMAIL PROTECTED]> 
 
  cc : 
 
10/04/02 05:14Objet :  Re: shrinking code  
 
   
 
   
 




print "-" x 80;
- Original Message -
From: "Michael Gargiullo" <[EMAIL PROTECTED]>
To: "Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, April 09, 2002 11:13 PM
Subject: shrinking code


> How can I write this smaller?
>
> while($m < 80){
> print "-";
> $m++
> }
>
> --
> 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]





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




Re: Re: Checking if a hash has blank values.

2002-04-10 Thread p

Hi,

What's the preferred waying of doing things...

if ($var eq '')

or

if (defined $var)

I assume they both mean pretty much the same thing?


Tristan


You Wrote:
--

Hi Tanton,

Yes, but what I really want it to do is go though all the values of the
hash and if any of them contain null values then print that out and tell
me whick key(s) value(s) contains null values?  Is this possible?

Therefore...

foreach $hash_key (keys %hash) {
  if ($hash{$_} == "" || $hash{$_} eq "") {
print $hash{$hash_key}, "Contains a null value!\n";
  else {
print "It worked!\n";
  }
}

Thx,

Dan


___
sent via the murky.net webmail hegemony

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




Re: Regex!

2002-04-10 Thread James Taylor


There's a few problems with your script. This one works:

$money = '$27.50';
$money =~ s/\$//;

Use single quotes instead of double, and don't forget the =~ instead of =

Daniel Falkenberg wrote:

>Hi Tim,
>
>I just tried running $money = s/\$//: over
>
>$money = "$21.80";
>
>And my returned result was nothing!  I.e it removed everything?
>
>Any ideas,
>
>Dan
>
>On Wed, 2002-04-10 at 09:34, Timothy Johnson wrote:
>
>>You have to escape the dollar sign in your regex just like you did in the
>>assignment.
>>
>>$money = s/\$//;
>>
>>-Original Message-
>>From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, April 09, 2002 5:10 PM
>>To: [EMAIL PROTECTED]
>>Subject: Regex!
>>
>>
>>Hello All,
>>
>>Just wondering how I can remove unwanted characters from a simple
>>variable.
>>
>>$money = "\$21.85";
>>
>>Now I simply want to strip the $ sign from that variable.
>>
>>Easy?  Well I thought it would be :)
>>
>>$money = s/$//; # Well thats what I thought!
>>
>>Regards,
>>
>>Dan
>>
>>
>>
>>-- 
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>This email may contain confidential and privileged 
>>material for the sole use of the intended recipient. 
>>If you are not the intended recipient, please contact 
>>the sender and delete all copies.
>>



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




Execute .exe or .bat files from perl??

2002-04-10 Thread Rob

Anyone know how to call a .exe or .bat file from a perl script?



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




passing a email address to sendmail

2002-04-10 Thread BDSOLMAIL

Hi,
could someone help me?111
Iam trying to send a email with an open pipe, but i can not interpolate 
the '@' of the email address in the " To:"
e.g.
i have one variable
$mymail = [EMAIL PROTECTED]

the  pipe
open (MAIL, '/usr/bin/sendmail -oi -t) || or die bkkabakb;
print  MAIL << ENDMAIL;
To: $mymail # this place i need tointerpolate " @someplace" ,
body
ENDMAIL
close MAIL;
etc...
Could someone help.
Thanks,
SL


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




Re: default value -simpler method?

2002-04-10 Thread p

Hi,

Just out of interest, could you do it this way:

  my $default = "/foo/bar/blat";

  print "File to use? [$default] ";
  chomp(my $question =  || $default);

I've just started using this sort of approach to assign default values to 
undefined/null parameters, eg:

  my $age = param('age') || 12;

Is that an acceptable way of doing things, or is there some glaringly obvious mistake? 
It seems to pick up null and undefined values okay, without any errors (i.e. no age 
param, or age= will get 12). Only problem is that it treats 0 as null/undefined, but 
that's fine in a lot of cases.

Tristan


You Wrote:
--


On Apr 9, Michael Gargiullo said:

>While asking a few questions to run a script.  How can I give a default
>answer?
>
>print "File to use:";
>chomp(my $question = );

Most programs do it like so:

  my $default = "/foo/bar/blat";

  print "File to use? [$default] ";
  chomp(my $question = );
  $question = $default if $question eq '';


___
sent via the murky.net webmail hegemony

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




RE: Location of SendMail

2002-04-10 Thread James Kelty

http://www.indigostar.com/sendmail.htm

-James

-Original Message-
From: @fro @ndy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 2:51 PM
To: [EMAIL PROTECTED]
Subject: Location of SendMail


Hello,

I am running Apache HTTP Server Version 1.3 on my Windows 2000 Professional
PC with ActiveState Perl. I was wondering if anyone knew where my SendMail
program would be located?

My friend said that you cant use sendmail on a Windows machine so i am
asking if this is true. If it is true are there any sendmail programs out
there that would work with my current OS?

Any help that you can offer with be of great assistance

Thank you

Andrew Logeswaran


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




Execute .bat file from perl?

2002-04-10 Thread Rob

New to this - need to execute a .bat file from a perl script.

Any suggestions?



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




  1   2   >