Re: reading multi-line into an array

2002-05-13 Thread Felix Geerinckx

on Mon, 13 May 2002 20:16:08 GMT, [EMAIL PROTECTED] (Shaun Fryer)
wrote: 

> I'm curious if anyone has an better idea of how to recieve
> multiple lines of  into a single array. 
> [...]
> sub PromptForBody {
>   print ': ';
>   $thisLine = ;
>   unless ($thisLine eq ".\n") {
> push(@messageBody,$thisLine);
> &PromptForBody;
>   }
> }
> 

I would do it like this:

#! perl -w
use strict;

my @messageBody = ();

print ': ';
while (defined(my $thisLine = )) {
last if $thisLine eq ".\n";
push(@messageBody,$thisLine);
print ': ';
}

print "You typed:\n";
print foreach @messageBody;

-- 
felix

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




Re: Delete a line and replace

2002-05-13 Thread Sudarsan Raghavan

Could try this too
perl -p -i.bak -e '/^ftp/ ? undef $_ :  s/\bguest\b/ftp/gi' /etc/passwd
the -i.bak will also create a /etc/passwd.bak for you


Timothy Johnson wrote:

>
> Actually it's a good question, and I should have explained myself.  When you
> do this line on a file, it slurps up the entire contents of the file into an
> array:
>
>   @infile = ;
>
> So the way to read a huge file without loading the entire file into memory
> is to use a while loop:
>
> but this changes the way you go about this a little bit.  The code becomes:
>
>   ##
>
>   open(INFILE,"/etc/passwd");
>   open(OUTFILE,">/etc/passwd.bak"); #open a temp file to write
>
>   while(){ #loads each line into $_, one line per loop
> if($_ =~ /^ftp/i){ #if it starts with "ftp"
>$_ = '';#make it a zero-length string
> }elsif($_ =~ /guest/i){ #else if it contains "guest"
>$_ =~ s/guest/ftp/gi;#replace it with "ftp"
> }
> print OUTFILE $_; #write the changed code to the temp file
>   }
>
>   open(INFILE,"/etc/passwd.bak"); #now we copy the contents of
>   open(OUTFILE,">/etc/passwd");   #the temp file to the original
>   while(){
>  print OUTFILE $_;
>   }
>   close INFILE;
>   close OUTFILE;
>   unlink "/etc/passwd.bak"; #remove the temp file
>
>   ##
>
> So the one real difference is that instead of creating a copy in memory, we
> have to create a temporary file to hold the contents of our changes.
>
> -Original Message-
> From: Langa Kentane
> To: 'Timothy Johnson'
> Sent: 5/13/02 10:54 PM
> Subject: RE: Delete a line and replace
>
> Hi
> Just a quick newbie question:
> How would you recommend we do that on a big file?
>
> -Original Message-
> From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
> Sent: 13 May 2002 08:05 PM
> To: 'Jorge Goncalvez'; [EMAIL PROTECTED]
> Subject: RE: Delete a line and replace
>
> You can try something like this:
>
> open(INFILE,"/etc/passwd");
> @infile = ; #don't do this if your file gets big
> close INFILE;
>
> foreach(@infile){
>   if($_ =~ /^ftp/i){ #if it starts with "ftp"
>  $_ = '';#make it a zero-length string
>   }elsif($_ =~ /guest/i){ #else if it contains "guest"
>  $_ =~ s/guest/ftp/gi;#replace it with "ftp"
>   }
> }
>
> open(OUTFILE,">/etc/passwd");
> print OUTFILE @infile;
>
> -Original Message-
> From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 1:41 AM
> To: [EMAIL PROTECTED]
> Subject: Re:Delete a line and replace
>
> Hi, i have this file /etc/passwd like this:
>
> Everyone:*:0:0:,S-1-1-0::
> SYSTEM:*:18:18:,S-1-5-18::
> Administrators:*:544:544:,S-1-5-32-544::
> Administrator:unused_by_nt/2000/xp:500:513:U-LININF54\Administrator,S-1-
> 5-21
> -175 7981266-2139871995-725345543-500:/home/Administrator:/bin/bash
> anonymous:unused_by_nt/2000/xp:1017:513:U-LININF54\anonymous,S-1-5-21-17
> 5798
> 1266
> -2139871995-725345543-1017:/home/anonymous:/bin/bash
> ftp:unused_by_nt/2000/xp:1018:513:U-LININF54\ftp,S-1-5-21-1757981266-213
> 9871
> 995-
> 725345543-1018:/:/bin/bash
> Guest:unused_by_nt/2000/xp:501:513:U-LININF54\Guest,S-1-5-21-1757981266-
> 2139
> 8719
> 95-725345543-501:/home/Guest:/bin/bash
> HelpAssistant:unused_by_nt/2000/xp:1000:513:Remote Desktop Help
> Assistant
> Account,U-LININF54\HelpAssistant,S-1-5-21-1757981266-2139871995-72534554
> 3-10
> 00:/
> home/HelpAssistant:/bin/bash
>
> I wanted to delete all the line which begins with ftp and then replace
> Guest
> by
> ftp in all file.
>
> 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]
>
> --
> 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]




/r/n : this is probably an embarassingly easy question.

2002-05-13 Thread Ciaran Finnegan

Hi all, first post, so please be nice.

I've got a simple sockets server running

$local = IO::Socket::INET->new(Proto=>"tcp", LocalPort=>"23", Listen=>"1")
or die "Can't open Socket\n";

$remote = $local->accept;

$remote->autoflush(1);


I'm reading input like so...

while (<$remote>) {print;
}
close $local, $remote

A hardware device connects to the socket and sends characters (barcode
scanner output, variable length, alphanumeric) followed by '/r'

My (very basic) understanding is that if it used '/r/n' my code would work.

I don't have much control over the hardware side of things.

And as you can probably see I'm not too clued up on the software side of
things.

tia

/ciaran.

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




RE: Delete a line and replace

2002-05-13 Thread Timothy Johnson

 
Actually it's a good question, and I should have explained myself.  When you
do this line on a file, it slurps up the entire contents of the file into an
array:

  @infile = ;

So the way to read a huge file without loading the entire file into memory
is to use a while loop:


but this changes the way you go about this a little bit.  The code becomes:

  ##

  open(INFILE,"/etc/passwd");
  open(OUTFILE,">/etc/passwd.bak"); #open a temp file to write

  while(){ #loads each line into $_, one line per loop
if($_ =~ /^ftp/i){ #if it starts with "ftp"
   $_ = '';#make it a zero-length string
}elsif($_ =~ /guest/i){ #else if it contains "guest"
   $_ =~ s/guest/ftp/gi;#replace it with "ftp"
}
print OUTFILE $_; #write the changed code to the temp file
  }

  open(INFILE,"/etc/passwd.bak"); #now we copy the contents of
  open(OUTFILE,">/etc/passwd");   #the temp file to the original
  while(){
 print OUTFILE $_;
  }
  close INFILE;
  close OUTFILE;
  unlink "/etc/passwd.bak"; #remove the temp file

  ##

So the one real difference is that instead of creating a copy in memory, we
have to create a temporary file to hold the contents of our changes.

-Original Message-
From: Langa Kentane
To: 'Timothy Johnson'
Sent: 5/13/02 10:54 PM
Subject: RE: Delete a line and replace

Hi
Just a quick newbie question:
How would you recommend we do that on a big file?

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]] 
Sent: 13 May 2002 08:05 PM
To: 'Jorge Goncalvez'; [EMAIL PROTECTED]
Subject: RE: Delete a line and replace



You can try something like this:

open(INFILE,"/etc/passwd");
@infile = ; #don't do this if your file gets big
close INFILE;

foreach(@infile){
  if($_ =~ /^ftp/i){ #if it starts with "ftp"
 $_ = '';#make it a zero-length string
  }elsif($_ =~ /guest/i){ #else if it contains "guest"
 $_ =~ s/guest/ftp/gi;#replace it with "ftp"
  }
}

open(OUTFILE,">/etc/passwd");
print OUTFILE @infile;

-Original Message-
From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 1:41 AM
To: [EMAIL PROTECTED]
Subject: Re:Delete a line and replace


Hi, i have this file /etc/passwd like this:


Everyone:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Administrator:unused_by_nt/2000/xp:500:513:U-LININF54\Administrator,S-1-
5-21
-175 7981266-2139871995-725345543-500:/home/Administrator:/bin/bash
anonymous:unused_by_nt/2000/xp:1017:513:U-LININF54\anonymous,S-1-5-21-17
5798
1266
-2139871995-725345543-1017:/home/anonymous:/bin/bash
ftp:unused_by_nt/2000/xp:1018:513:U-LININF54\ftp,S-1-5-21-1757981266-213
9871
995-
725345543-1018:/:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:U-LININF54\Guest,S-1-5-21-1757981266-
2139
8719
95-725345543-501:/home/Guest:/bin/bash
HelpAssistant:unused_by_nt/2000/xp:1000:513:Remote Desktop Help
Assistant 
Account,U-LININF54\HelpAssistant,S-1-5-21-1757981266-2139871995-72534554
3-10
00:/
home/HelpAssistant:/bin/bash


I wanted to delete all the line which begins with ftp and then replace
Guest
by 
ftp in all file.

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]

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




HTML::Stream mod

2002-05-13 Thread Jackson, Jonah

Anyone use this module?  I can't seem to use a file handle for the stream.  The syntax:

use HTML::Stream qw(:funcs);
open (FP,">$htmlfile") || die "Could not open file $htmlfile for write\: $!\n";
$ht =3D HTML::Stream->new (FP);
$ht->text("This is a test\n");

gives me an empty file named $htmlfile.

replace the third line with=20

$ht =3D HTML::Stream->new /*STDOUT;

I do get:

This is a test

on the console.

I'm a perl newbie so I could be doing a million things wrong.  Anyone anna point my 
tricycle back in the right direction?

Jonah Jackson
Senior Network Engineer
iKnowMed
[EMAIL PROTECTED]

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




No recipient addresses found in header error

2002-05-13 Thread Lance Prais

I am getting the following error, does anyone know what could be causing
this?

No recipient addresses found in head

Thanks
Lance


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




Re: split with LIMIT misunderstanding?

2002-05-13 Thread Zachary Buckholz

Think I figured it out properly.

if ($_ =~ /^\$myquery/) { quotemeta($_); (undef, $line{myquery}) =
split(/=/, $_, 2); }

This gives me MYQUERY = "url=$url&email=$email&i_rank=yes";

If this is not the 'proper' way please let me know of a better way.

Thanks
zack


"Zachary Buckholz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a bunch of text files that follow the format
> variable = value 
>
> I am trying to read each file and insert it into SQL but before I can do
> that I need to parse
> the values into a hash.
>
> One of the fields has the URL which can contain & and = characters, so
after
> the first split I seem to miss the rest.
>
> I tried using the LIMIT feature of split which if I am reading it
correctly
> 'limits the amount of times it will split'.
>
> But I am not getting the desired results. See example
>
> TEXT FILE HAS THIS
> $method="GET";
> $engname="SurfGopher";
> $line="http://www.surfgopher.com/cgi-bin/submit.cgi";;
> $myquery="url=$url&email=$email&i_rank=yes";
>
> When I run the script and print the output I get this
> MYQUERY =
> value = www.surfgopher.com/cgi-bin/submit.cgi
> value = GET
> value = SurfGopher
>
> THIS IS THE LINE OF CODE USING SPLIT
> if ($_ =~ /^\$myquery/) { (undef, $line{myquery}) = split(/=/, $_, 1) }
>
> THIS IS THE LINE PRINTING THE OUTPUT IN QUESTION
> print "MYQUERY = $line{myquery}\n";
>
>
> I could just do a $line =~ s/\$myquery\=//;
> and be done with it, but I want to know why and how to use the LIMIT
> argument.
>
> Thanks
> zack
>
>
>



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




split with LIMIT misunderstanding?

2002-05-13 Thread Zachary Buckholz

I have a bunch of text files that follow the format
variable = value 

I am trying to read each file and insert it into SQL but before I can do
that I need to parse
the values into a hash.

One of the fields has the URL which can contain & and = characters, so after
the first split I seem to miss the rest.

I tried using the LIMIT feature of split which if I am reading it correctly
'limits the amount of times it will split'.

But I am not getting the desired results. See example

TEXT FILE HAS THIS
$method="GET";
$engname="SurfGopher";
$line="http://www.surfgopher.com/cgi-bin/submit.cgi";;
$myquery="url=$url&email=$email&i_rank=yes";

When I run the script and print the output I get this
MYQUERY =
value = www.surfgopher.com/cgi-bin/submit.cgi
value = GET
value = SurfGopher

THIS IS THE LINE OF CODE USING SPLIT
if ($_ =~ /^\$myquery/) { (undef, $line{myquery}) = split(/=/, $_, 1) }

THIS IS THE LINE PRINTING THE OUTPUT IN QUESTION
print "MYQUERY = $line{myquery}\n";


I could just do a $line =~ s/\$myquery\=//;
and be done with it, but I want to know why and how to use the LIMIT
argument.

Thanks
zack




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




Re: TIMTOWTDI

2002-05-13 Thread bob ackerman


On Monday, May 13, 2002, at 10:40  AM, Todd Wade,,,Room 108 wrote:

> Bob Ackerman wrote:
>
>>
>> this one wins the prolix award of the solutions we have seen today.
>> we dare a non-perl programmer to believe this could mean something.
>> I'm not sure i believe it means whatever. especially (?)(.)  - zero or 
>> one
>> character followed by a character?
>> followed by a non-greedy run of characters up to dot? something to lose
>> sleep over, i think.
>> and this is the beginner's list. geez. and that was only one line out of
>> three.
>
> sub current_weather_conditions {
>   my($weather) =
> get('http://weather.noaa.gov/pub/data/forecasts/zone/oh/ohz021.txt');
>   ($weather) or return('Today\'s weather conditions are currently
>   unavailable');
>   $weather =~ s/.*?\n\.[^.]*?\.{3}(.*?)\n\..*/$1/s;
>   $weather =~ tr/[A-Z]\n/[a-z] /;
>   $weather =~ s/( ?)(.)(.*?)\./$1\U$2\E$3\./g;
>   return($weather);
> }
>
> Actually its not too tough. Obviously get() stores the contents of the web
> document in $weather. The current weather conditions is always the "first"
> weather condition. Each forecast starts with a ( . ), has a string of
> letters, then has three ( ... )'s followed by the forecast. This is the
> delimiter for each "section" of weather forecasts.
>
> I call the first forecast in the document the current weather, so I only
> want the first forecast.
>
> .*? matches all characters until the first \n\.[^.]*?\.{3}
>
> \n\.[^.]*?\.{3} is the forecast delimiter. The first time in the string a
> period follows a newline, then has some characters that are not periods,
> then has three periods in a row.
>
> Now I am sitting at the nothing in between a period and the first letter 
> of
> the current weather conditions, so I start to "record" the following text.
> All the text from the first letter of the current weather conditions up to
> the next period that follows a newline is captured. Then the .* is to 
> match
> the rest of the contents of the string. Then /$1/ replaces $weather with
> the current weather conditions.
>
> All the characters in the string are capitalized, so some formatting needs
> done before I can send it to whereever it is heading. The next line
> lowercases all characters and turns newlines into spaces. (Theres some
> rookie mistakes in there, see the following post)
>
> The last substution before the return capitalizes The first character in
> each sentence. ( ?) matches and records to $1 the space in between every
> sentence.

ah. i missed the seeing the space. that is what really confused me before.
  seeing (?) then (.)
makes sense with the space.

> The ? makes the space optional because The first sentence in
> $weather has no space in front of it. then the (.) matches and records to
> $2 any character. This is the first character in the sentence. The (.*?)\
> .
> Matches and records to $3 all the characters up to the next period. Then
> the right hand side of the substutution replaces the matched part of the
> string with the (optional) space that was stored in $1, then turns on
> uppercasing, then inserts $2, the first letter of each sentence, then 
> turns
> off uppercasing, then inserts the rest of the sentence, then puts a period
> at the end of the sentence (The \ in front of the period dosent need to be
> there. This was one of my first all-by-myself regexes, so ive learned alot
> since then. I also would use +'s instead of *'s nowadays...) The g after
> the / makes it so the right hand side of the regex is applied to every
> string that matches the left hand side.
>
> Im only half way through my CS bachelors, but I do want to teach this 
> stuff
> one day... How did I do with this?
>
> Todd W.
>

I'm still not sure you would convince anyone to attempt something like 
this is any computer language.
still looks like something to go blind working out. perhaps displaying the 
regex down a column with explanation to right would work better. seems 
like too much prose there. in another language, one would suggest 
factoring the problem into subfunctions for comprehensibility. you have 
split it into 3 lines - but factoringa a regex tends to make it less 
efficient.


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




RE: Different ways of declaring variables

2002-05-13 Thread Hanson, Robert

To add what Chas mentioned, it also changes the context of the expression.

One good example is the localtime() function.  In "scalar" context it
returns a date string, and in "list" context it returns a list of the date
parts.  When you use the parens on the left side of the assignment you are
forcing list context.

Try these two bits of code and see the difference in the output:

my $x = localtime;
print $x;

my ($x) = localtime;
print $x;

Rob


-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 6:11 PM
To: Scott Lutz
Cc: Beginners (E-mail)
Subject: Re: Different ways of declaring variables


On Mon, 2002-05-13 at 18:07, Scott Lutz wrote:
> I am wondering about the different ways of initializing a single scalar.
> 
> usual method:
> my $variable;
> 
> but I am trying to get what (if anything) is being done differently by
> this :
> my ($variable);
> 
> Thanks!
> 
> 
> Scott Lutz
> Pacific Online Support
> Phone: 604.638.6010
> Fax: 604.638.6020
> Toll Free: 1.877.503.9870
> http://www.paconline.net

The parentheses allow you to declare more than one variable at a time
like this:

my ($id, $name, $age);

They also allow you to do a list assignment (instead of a scalar
assignment) like this:

my ($id, $name, $age) = $sth->fetchrow_array;
 
-- 
Today is Pungenday the 60th day of Discord in the YOLD 3168


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


-- 
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: Different ways of declaring variables

2002-05-13 Thread Chas Owens

On Mon, 2002-05-13 at 18:07, Scott Lutz wrote:
> I am wondering about the different ways of initializing a single scalar.
> 
> usual method:
> my $variable;
> 
> but I am trying to get what (if anything) is being done differently by
> this :
> my ($variable);
> 
> Thanks!
> 
> 
> Scott Lutz
> Pacific Online Support
> Phone: 604.638.6010
> Fax: 604.638.6020
> Toll Free: 1.877.503.9870
> http://www.paconline.net

The parentheses allow you to declare more than one variable at a time
like this:

my ($id, $name, $age);

They also allow you to do a list assignment (instead of a scalar
assignment) like this:

my ($id, $name, $age) = $sth->fetchrow_array;
 
-- 
Today is Pungenday the 60th day of Discord in the YOLD 3168


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


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




Different ways of declaring variables

2002-05-13 Thread Scott Lutz

I am wondering about the different ways of initializing a single scalar.

usual method:
my $variable;

but I am trying to get what (if anything) is being done differently by
this :
my ($variable);

Thanks!


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


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




Re: Installing modules without a C compiler

2002-05-13 Thread Craig Moynes/Markham/IBM



Ok that seems to do the trick, the only thing I am worried about is during
the installation to the real directory some data is appended to
perllocal.pod. The documentation for MakeMaker say you can disable this
with pure_install, but I can't find anywhere that explains the use of
perllocal.pod.

A quick look at its contents show multiple copies of modules I have
installed locally (due to not uninstalling I imagine).

Does anyone know about the need for perllocal.pod ?

Thanks again,

-
Craig Moynes
[EMAIL PROTECTED]



   

  Chas Owens   

  cc:   [EMAIL PROTECTED]

   Subject:  Re: Installing modules 
without a C compiler   
  05/13/02 03:07 PM

  Please respond to

  Chas Owens   

   

   




On Mon, 2002-05-13 at 15:01, Craig Moynes/Markham/IBM wrote:
> Hi all,
>   Our servers are set up with a single development box, that contains
> all the compilers and what not.  All the modules I need to install have
to
> be compiled on the development box, and then installed on each server
(make
> install).  This works for now, (thanks to nfs) but I would like to
package
> up the "installed files" so I can just drop them on boxes when needed,
and
> also to back up the install files so I can remove the source directory.
>
> Now I have installed a few modules, and I was just wondering if there was
> somewhere in those monsterous makefiles that I can see where and what is
> installed, or perhaps a verbose install mode so I can see exactly what is
> going where.
>
> I have seen the TO_INST_PM rule, which seems like it may lead to what I
am
> looking for.  Should I watch for anything else ?
>
> Thanks for your help,
>   Craig
>
> -
> Craig Moynes
> [EMAIL PROTECTED]
>

One method is to install into a temporary directory hierarchy (ie
/tmp/modulename/usr instead of /usr).

--
Today is Pungenday the 60th day of Discord in the YOLD 3168
This statement is false.

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


--
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: CGI QUESTION

2002-05-13 Thread Lance Prais

Let me ask this question.. when passing variables from a HTMl form to a CGI
script do you need to do anything special to the environment.

The reason I ask is I took an html page off  server_1 and used the exact
script that they used on the server_1 to process the email.  Placed it on
Server_2 with the script and the variables did not pass but work fine on
Server_1

Thanks



-Original Message-
From: David Gray [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 12:42 PM
To: 'Perl'; 'Lance Prais'
Subject: RE: CGI QUESTION

> I have a question regarding passing variables from a HTML
> form to a CGI script.  I have never worked with CGI in the
> past and assumed that if I included the variables with in the
> form and on submit called the CGI script that the variable
> would be amiable to it.  That doe not see, to be the case. Is
> my assumption correct?
>
> I am attempting to use the variables by the following code:
>
> (param('account'))
>
> Is that correct?

Are you using the CGI module? When I grab what's passed by a form
submission, I usually save a copy of them in a hash (assuming no
multi-valued form elements will be present) like so:

-
use CGI;
my $cgi = new CGI;

our %F = ();
$F{$_} = $cgi->param($_) for $cgi->param();
-

You can now access your form values with $F{account}

Please post more code (from your cgi script where you're trying to
access the values passed from the form) if this doesn't fix your
problem.

HTH,

 -dave



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




reading multi-line into an array

2002-05-13 Thread Shaun Fryer

I'm curious if anyone has an better idea of how to recieve multiple
lines of  into a single array. For example, I've written a
really basic emailer for administrating email lists I'm on. I can get
it to recieve single line entries, such as a To: From: CC: etc from
 with no problem, but haven't yet successfully tried recieving
multiple lines of text for the message body. I'm thinking something
like what follows, but I'm wondering if anyone sees a problem with
this or has a better solution along the same lines.

sub PromptForBody {
  print ': ';
  $thisLine = ;
  unless ($thisLine eq ".\n") {
push(@messageBody,$thisLine);
&PromptForBody;
  }
}

I haven't tried the above yet. It's just an idle idea at the moment.
For now, I'm just having it open `vi` and then read the contents of
the resulting temp file into a scalar value. That works okay for most
purposes, but for the shere fun of it, I want to try doing it a little
differently. Comments?

===
 Shaun Fryer
===
 London Webmasters
 http://LWEB.NET
 PH:  519-858-9660
 FX:  519-858-9024
===


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




Re: TIMTOWTDI

2002-05-13 Thread John W. Krahn

Todd Wade wrote:
> 
> John W. Krahn wrote:
> 
> > Todd Wade wrote:
> >
> > Why remove everything you don't want, why not just capture the data you
> > do want?
> 
> sure
> 
> >>  $weather =~ tr/[A-Z]\n/[a-z] /;
> >   ^   ^   ^   ^
> > Why are you translating a '[' to '[' and ']' to ']'?  Why are you
> > translating "\n" to " " when there are no newlines in $weather?
> 
> Youre right about part a, but not part b. There (usually) are newlines in
> $weather. Look at the document:
> 
> http://weather.noaa.gov/pub/data/forecasts/zone/oh/ohz021.txt

Yes, I had a look and there are newlines.  :-)  However it is usually
better to use lc() and uc() to change case then using tr///.


> > $weather =~ s/(\w+)/\u$1/g;
> 
> This assumes any non alphanumeric character denotes a sentence boundary.

$weather =~ s/(^|\.\s)(\w)/$1\u$2/g;



John
-- 
use Perl;
program
fulfillment

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




RE: Unique list

2002-05-13 Thread Jackson, Harry



>-Original Message-
>From: drieux [mailto:[EMAIL PROTECTED]]
>>
>> sub unique {
>
>neat function
>
>>  }
>
>may I counter propose based upon the benchmarks
>
>http://www.wetware.com/drieux/pbl/BenchMarks/uniqbyRefOrArray.txt
>
>ciao
>drieux
>
>---
>
>ps: harry, I have referenced you as the originator
>of the function - if that is incorrect - please send
>me email back channel indicating who should be blamed.

I know my last attempt was pretty shit but how do these fair. Do not pass
references but the arrays themselves and let me know how it gets on. I think
its faster than the original grep method. I know its ugly but its quick.


sub unique {
foreach (@_) { $_{$_}++}   
return [keys %_];
 }


Or you could butcher the grep method as I have done to get the following

sub GrepMe {
return [ grep { not $\{$_}++ } @_ ];
}



The above methods are a horrible way to abuse globals but I enjoyed seeing
how fast I could get them to run. I reckon that you could get them to go a
little bit quicker.


Harry.



*
COLT Telecommunications
Registered in England No. 2452736
Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ
Tel. +44 20 7390 3900

This message is subject to and does not create or vary any contractual
relationship between COLT Telecommunications, its subsidiaries or 
affiliates ("COLT") and you. Internet communications are not secure
and therefore COLT does not accept legal responsibility for the
contents of this message.  Any view or opinions expressed are those of
the author. The message is intended for the addressee only and its
contents and any attached files are strictly confidential. If you have
received it in error, please telephone the number above. Thank you.
*


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




Re: Installing modules without a C compiler

2002-05-13 Thread Chas Owens

On Mon, 2002-05-13 at 15:01, Craig Moynes/Markham/IBM wrote:
> Hi all,
>   Our servers are set up with a single development box, that contains
> all the compilers and what not.  All the modules I need to install have to
> be compiled on the development box, and then installed on each server (make
> install).  This works for now, (thanks to nfs) but I would like to package
> up the "installed files" so I can just drop them on boxes when needed, and
> also to back up the install files so I can remove the source directory.
> 
> Now I have installed a few modules, and I was just wondering if there was
> somewhere in those monsterous makefiles that I can see where and what is
> installed, or perhaps a verbose install mode so I can see exactly what is
> going where.
> 
> I have seen the TO_INST_PM rule, which seems like it may lead to what I am
> looking for.  Should I watch for anything else ?
> 
> Thanks for your help,
>   Craig
> 
> -
> Craig Moynes
> [EMAIL PROTECTED]
> 

One method is to install into a temporary directory hierarchy (ie
/tmp/modulename/usr instead of /usr). 

-- 
Today is Pungenday the 60th day of Discord in the YOLD 3168
This statement is false.

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


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




Re: trouble dereferencing

2002-05-13 Thread John W. Krahn

Damir Horvat wrote:
> 
> Hi!

Hello,

> I'm having problem dereferencing:
> ---
> %err = (
> "usage" => sub { die "\nUsage: $0  \n" },
> "zone" => sub { die "Zone allready exists!\n" }
> );
> 
> $zone = lc $ARGV[0] || $err{'usage'};
> print "$zone\n";


$zone = lc $ARGV[0] || $err{'usage'}->();
print "$zone\n";


John
-- 
use Perl;
program
fulfillment

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




Installing modules without a C compiler

2002-05-13 Thread Craig Moynes/Markham/IBM

Hi all,
  Our servers are set up with a single development box, that contains
all the compilers and what not.  All the modules I need to install have to
be compiled on the development box, and then installed on each server (make
install).  This works for now, (thanks to nfs) but I would like to package
up the "installed files" so I can just drop them on boxes when needed, and
also to back up the install files so I can remove the source directory.

Now I have installed a few modules, and I was just wondering if there was
somewhere in those monsterous makefiles that I can see where and what is
installed, or perhaps a verbose install mode so I can see exactly what is
going where.

I have seen the TO_INST_PM rule, which seems like it may lead to what I am
looking for.  Should I watch for anything else ?

Thanks for your help,
  Craig

-
Craig Moynes
[EMAIL PROTECTED]



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




RE: Help on syntax

2002-05-13 Thread Timothy Johnson


The ||= operator is used to set a default value, so that you have a value if
the user doesn't put one in. So what it is saying is that if $x doesn't have
a value or has a false value, then give it the value of $y if it is TRUE,
else make it an empty string.  I can't see the usefulness out of context.

-Original Message-
From: Eric Beaudoin [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 12, 2002 9:10 AM
To: José Nyimi
Cc: [EMAIL PROTECTED]
Subject: Re: Help on syntax


At 12:02 2002.05.12, José Nyimi wrote:

>Hello All,
>
>Could you explain this syntax please ?
>
>$x ||= $y || '';
>
>Thanks,
>
>José.
>

$a ||= $b is the same as $a = $a || $b;

So your exmaple translate to 

$x = $x || $y || '';

This, I think, means that $x take the value of $y if $x is false (undefined
, 0 or an empty string). If $y is also false, $x takes the empty string
value.

The || operate is a short-circuit meaning that it stop resolving the chain
as soon as it finds a True value. This has the effect that the first true
value will be result of the whole thing.

Hope this helps.


>-
>Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !

--
Éric Beaudoin   


-- 
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: Delete a line and replace

2002-05-13 Thread Timothy Johnson


You can try something like this:

open(INFILE,"/etc/passwd");
@infile = ; #don't do this if your file gets big
close INFILE;

foreach(@infile){
  if($_ =~ /^ftp/i){ #if it starts with "ftp"
 $_ = '';#make it a zero-length string
  }elsif($_ =~ /guest/i){ #else if it contains "guest"
 $_ =~ s/guest/ftp/gi;#replace it with "ftp"
  }
}

open(OUTFILE,">/etc/passwd");
print OUTFILE @infile;

-Original Message-
From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 1:41 AM
To: [EMAIL PROTECTED]
Subject: Re:Delete a line and replace


Hi, i have this file /etc/passwd like this:


Everyone:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Administrator:unused_by_nt/2000/xp:500:513:U-LININF54\Administrator,S-1-5-21
-175
7981266-2139871995-725345543-500:/home/Administrator:/bin/bash
anonymous:unused_by_nt/2000/xp:1017:513:U-LININF54\anonymous,S-1-5-21-175798
1266
-2139871995-725345543-1017:/home/anonymous:/bin/bash
ftp:unused_by_nt/2000/xp:1018:513:U-LININF54\ftp,S-1-5-21-1757981266-2139871
995-
725345543-1018:/:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:U-LININF54\Guest,S-1-5-21-1757981266-2139
8719
95-725345543-501:/home/Guest:/bin/bash
HelpAssistant:unused_by_nt/2000/xp:1000:513:Remote Desktop Help Assistant 
Account,U-LININF54\HelpAssistant,S-1-5-21-1757981266-2139871995-725345543-10
00:/
home/HelpAssistant:/bin/bash


I wanted to delete all the line which begins with ftp and then replace Guest
by 
ftp in all file.

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

2002-05-13 Thread Todd Wade,,,Room 108

Bob Ackerman wrote:

> 
> this one wins the prolix award of the solutions we have seen today.
> we dare a non-perl programmer to believe this could mean something.
> I'm not sure i believe it means whatever. especially (?)(.)  - zero or one
> character followed by a character?
> followed by a non-greedy run of characters up to dot? something to lose
> sleep over, i think.
> and this is the beginner's list. geez. and that was only one line out of
> three.

sub current_weather_conditions {
  my($weather) =
get('http://weather.noaa.gov/pub/data/forecasts/zone/oh/ohz021.txt');
  ($weather) or return('Today\'s weather conditions are currently
  unavailable');
  $weather =~ s/.*?\n\.[^.]*?\.{3}(.*?)\n\..*/$1/s;
  $weather =~ tr/[A-Z]\n/[a-z] /;
  $weather =~ s/( ?)(.)(.*?)\./$1\U$2\E$3\./g;
  return($weather);
}

Actually its not too tough. Obviously get() stores the contents of the web 
document in $weather. The current weather conditions is always the "first" 
weather condition. Each forecast starts with a ( . ), has a string of 
letters, then has three ( ... )'s followed by the forecast. This is the 
delimiter for each "section" of weather forecasts.

I call the first forecast in the document the current weather, so I only 
want the first forecast.

.*? matches all characters until the first \n\.[^.]*?\.{3}

\n\.[^.]*?\.{3} is the forecast delimiter. The first time in the string a 
period follows a newline, then has some characters that are not periods, 
then has three periods in a row.

Now I am sitting at the nothing in between a period and the first letter of 
the current weather conditions, so I start to "record" the following text. 
All the text from the first letter of the current weather conditions up to 
the next period that follows a newline is captured. Then the .* is to match 
the rest of the contents of the string. Then /$1/ replaces $weather with 
the current weather conditions.

All the characters in the string are capitalized, so some formatting needs 
done before I can send it to whereever it is heading. The next line 
lowercases all characters and turns newlines into spaces. (Theres some 
rookie mistakes in there, see the following post)

The last substution before the return capitalizes The first character in 
each sentence. ( ?) matches and records to $1 the space in between every 
sentence. The ? makes the space optional because The first sentence in 
$weather has no space in front of it. then the (.) matches and records to 
$2 any character. This is the first character in the sentence. The (.*?)\. 
Matches and records to $3 all the characters up to the next period. Then 
the right hand side of the substutution replaces the matched part of the 
string with the (optional) space that was stored in $1, then turns on 
uppercasing, then inserts $2, the first letter of each sentence, then turns 
off uppercasing, then inserts the rest of the sentence, then puts a period 
at the end of the sentence (The \ in front of the period dosent need to be 
there. This was one of my first all-by-myself regexes, so ive learned alot 
since then. I also would use +'s instead of *'s nowadays...) The g after 
the / makes it so the right hand side of the regex is applied to every 
string that matches the left hand side.

Im only half way through my CS bachelors, but I do want to teach this stuff 
one day... How did I do with this?

Todd W.


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




RE: CGI QUESTION

2002-05-13 Thread David Gray

> I have a question regarding passing variables from a HTML 
> form to a CGI script.  I have never worked with CGI in the 
> past and assumed that if I included the variables with in the 
> form and on submit called the CGI script that the variable 
> would be amiable to it.  That doe not see, to be the case. Is 
> my assumption correct?
> 
> I am attempting to use the variables by the following code:
> 
> (param('account'))
> 
> Is that correct?

Are you using the CGI module? When I grab what's passed by a form
submission, I usually save a copy of them in a hash (assuming no
multi-valued form elements will be present) like so:

-
use CGI;
my $cgi = new CGI;

our %F = ();
$F{$_} = $cgi->param($_) for $cgi->param();
-

You can now access your form values with $F{account}

Please post more code (from your cgi script where you're trying to
access the values passed from the form) if this doesn't fix your
problem.

HTH,

 -dave



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




Re: TIMTOWTDI

2002-05-13 Thread Todd Wade,,,Room 108

John W. Krahn wrote:

> Todd Wade wrote:
> 
> Why remove everything you don't want, why not just capture the data you
> do want?

sure

> 
>>  $weather =~ tr/[A-Z]\n/[a-z] /;
>   ^   ^   ^   ^
> Why are you translating a '[' to '[' and ']' to ']'?  Why are you
> translating "\n" to " " when there are no newlines in $weather?

Youre right about part a, but not part b. There (usually) are newlines in 
$weather. Look at the document:

http://weather.noaa.gov/pub/data/forecasts/zone/oh/ohz021.txt

> $weather =~ s/(\w+)/\u$1/g;

This assumes any non alphanumeric character denotes a sentence boundary.  

#!/usr/local/bin/perl

print change("there's more than one way to do it."), "\n";

sub change {

  $str = shift();
  $str =~ s/(\w+)/\u$1/g;
  return( $str );

}

__END__

[trwww@misa trwww]$ perl str.pl
There'S More Than One Way To Do It.
  ^ ^^^   ^   ^  ^  ^

The topic seemed to do with capitalizing the first letter in each sentence. 
It was interesting because it was one of the first working regexes I wrote, 
so I posted my code. That sub is probably the sub that sold me on perl =0). 
Dynamic weather report in 5 lines of code!!??!! Sweet.



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




Re: trouble dereferencing

2002-05-13 Thread Chas Owens

Yeah, this seems to be a Perl 5 vs Perl 5.6 issue.  In the third version
of the Camel on page 283 it says:

We could also have dereferenced it as &{ $HoF{lc $cmd} }(), 
or, as of the 5.6 release of Perl, simply $HoF{lc $cmd}().

On Mon, 2002-05-13 at 11:56, Damir Horvat wrote:
> On 13 May 2002 11:30:08 -0400 Chas Owens <[EMAIL PROTECTED]> wrote:
> 
> > On Mon, 2002-05-13 at 11:05, Damir Horvat wrote:
> > > Hi!
> > > 
> > > I'm not using strict 
> > 
> > You should be.
> > 
> > > and $err{'usage'}() does not work.
> > 
> > It works for me.  I am using Perl 5.6.1 on a Red Hat box.  What is your
> > configuration?
> 
> bash-2.05a$ perl -v
> 
> This is perl, version 5.005_03 built for i386-freebsd
> 
> Copyright 1987-1999, Larry Wall
> 
> Perl may be copied only under the terms of either the Artistic License or
> the GNU General Public License, which may be found in the Perl 5.0 source
> kit.
> 
> Complete documentation for Perl, including FAQ lists, should be found on
> this system using `man perl' or `perldoc perl'.  If you have access to the
> Internet, point your browser at http://www.perl.com/, the Perl Home Page.
> 
> bash-2.05a$ uname -a
> FreeBSD pxna.hide.voljatel.si 4.4-RELEASE FreeBSD 4.4-RELEASE #5: Tue Mar
> 19 09:48:23 CET 2002
> [EMAIL PROTECTED]:/usr/src/sys/compile/PXNA  i386
> 
> 
> old... anyway, thanks.
> 
>   Damir
-- 
Today is Pungenday the 60th day of Discord in the YOLD 3168
Hail Eris!

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


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




RE: Logging details

2002-05-13 Thread John Edwards

You could either redirect all STDERR output to a file, or pass all error
info to a sub routine. For the second method you could do...

if (system ($cmd)) {
  &fatalError("Error $!\n");
}  

sub fatalError {
my $error = shift;
open ERROR ">>error.txt" or die "Can't append to error.txt: $!";
print ERROR $error;
close ERROR;
die "\n";
}

John


-Original Message-
From: Shishir K. Singh [mailto:[EMAIL PROTECTED]] 
Sent: 13 May 2002 17:04
To: [EMAIL PROTECTED]
Subject: Logging details


Is there a better way of logging the details in a file. 

E.g. 

I would like the error message to go into a file instead of going to the
stderr

if (system ($cmd)) {
  die "Error $!\n";
}  



I don't want to code the above as 

open (LOG,"> $logFile");
if (system ($cmd)) {
  print LOG "Error $!\n";
  die;
}  


Any pointers!! 

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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Logging details

2002-05-13 Thread Shishir K. Singh

Is there a better way of logging the details in a file. 

E.g. 

I would like the error message to go into a file instead of going to the stderr

if (system ($cmd)) {
  die "Error $!\n";
}  



I don't want to code the above as 

open (LOG,"> $logFile");
if (system ($cmd)) {
  print LOG "Error $!\n";
  die;
}  


Any pointers!! 

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




RE: CGI QUESTION

2002-05-13 Thread Lance Prais


Bob,
Here is the portion of the HTML form below it you will find a portion of the
CGI Script:  As you see at the top I am posting the form so like I said I
assume the variables will be passed.  The other issue is I am using
JavaScript to validate client side but when it gets to the CGI script I am
getting the error page that you will find below.



  

  


  
Help Desk Service
Request

  

   

  Submit a New Help Desk Service
Request
  
 
  
* = required
  field
  

  
  

  
Name:* 
  

  


  

  

  
Email
  address:* 
 @

Please select
checkpoint.com
us.checkpoint.com
ts.checkpoint.com
   
  

  
  
  
Re-enter Email:* (For
  Verification)  
 @ 
Please select
checkpoint.com
us.checkpoint.com
ts.checkpoint.com
   
  




-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 10:42 AM
To: 'Lance Prais'; Perl
Subject: RE: CGI QUESTION

> -Original Message-
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 11:15 AM
> To: Perl
> Subject: CGI QUESTION
>
>
> I have a question regarding passing variables from a HTML
> form to a CGI
> script.  I have never worked with CGI in the past and assumed
> that if I
> included the variables with in the form and on submit called
> the CGI script
> that the variable would be amiable to it.  That doe not see,
> to be the case.
> Is my assumption correct?
>
> I am attempting to use the variables by the following code:
>
> (param('account'))
>
> Is that correct?

It depends. If that's the whole script, the answer is no.

1. What do you expect to be happening?
2. What do observe to be actually happening?
3. Post the whole script (or at least enough so we can
see what's going on).

--
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: CGI QUESTION

2002-05-13 Thread Bob Showalter

> -Original Message-
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 11:15 AM
> To: Perl
> Subject: CGI QUESTION
> 
> 
> I have a question regarding passing variables from a HTML 
> form to a CGI
> script.  I have never worked with CGI in the past and assumed 
> that if I
> included the variables with in the form and on submit called 
> the CGI script
> that the variable would be amiable to it.  That doe not see, 
> to be the case.
> Is my assumption correct?
> 
> I am attempting to use the variables by the following code:
> 
> (param('account'))
> 
> Is that correct?

It depends. If that's the whole script, the answer is no.

1. What do you expect to be happening?
2. What do observe to be actually happening?
3. Post the whole script (or at least enough so we can
see what's going on).

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




RE: Unique list

2002-05-13 Thread Jackson, Harry



>-Original Message-
>From: drieux [mailto:[EMAIL PROTECTED]]

>
>ps: harry, I have referenced you as the originator
>of the function - if that is incorrect - please send
>me email back channel indicating who should be blamed.


I am indeed the culprit.

H


*
COLT Telecommunications
Registered in England No. 2452736
Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ
Tel. +44 20 7390 3900

This message is subject to and does not create or vary any contractual
relationship between COLT Telecommunications, its subsidiaries or 
affiliates ("COLT") and you. Internet communications are not secure
and therefore COLT does not accept legal responsibility for the
contents of this message.  Any view or opinions expressed are those of
the author. The message is intended for the addressee only and its
contents and any attached files are strictly confidential. If you have
received it in error, please telephone the number above. Thank you.
*


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




Re: CGI QUESTION

2002-05-13 Thread drieux


On Monday, May 13, 2002, at 08:15 , Lance Prais wrote:

> I have a question regarding passing variables from a HTML form to a CGI
> script.  I have never worked with CGI in the past and assumed that if I
> included the variables with in the form and on submit called the CGI 
> script
> that the variable would be amiable to it.  That doe not see, to be the 
> case.
> Is my assumption correct?

your assumption seems to be reasonable enough, the
implementation details may be the annoying part.

> I am attempting to use the variables by the following code:
>
> (param('account'))

what I did would be the equivolent of:

my $account = param('account');

then since I wanted to stuff that into a @list_shrugged
I of course sent it off to a function that munged the $value
and handed me back a pretty

my @string = dtk_retArray($stuff);

that I felt happier to play with in perl proper

cf:

http://www.wetware.com/drieux/src/unix/perl/UglyCode.txt

it's ugly, and should be essentially trashed and restarted...
but well, I was in a bit of a hurry - got the basics solved,
then started to, well, play with it

you should never just play with perl code you
really should be proper about it you know, design
phase follows requirements analysis which followed the
market analysis review phase

ciao
drieux

---


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




CGI QUESTION

2002-05-13 Thread Lance Prais

I have a question regarding passing variables from a HTML form to a CGI
script.  I have never worked with CGI in the past and assumed that if I
included the variables with in the form and on submit called the CGI script
that the variable would be amiable to it.  That doe not see, to be the case.
Is my assumption correct?

I am attempting to use the variables by the following code:

(param('account'))

Is that correct?


Thank you in advance
Lance


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




Re: Unique list

2002-05-13 Thread drieux


On Monday, May 13, 2002, at 07:07 , Jackson, Harry wrote:
[..]
>> -Original Message-
>> From: Lance Prais [mailto:[EMAIL PROTECTED]]
>
> I seem to require what you want a lot so wrote this. Pass the arrays you
> want the unique values of as references to this sub routine. There is no
> checking for the amount of arrays passed and will currently handle 4.
>
> sub unique {

neat function

>  }

may I counter propose based upon the benchmarks

http://www.wetware.com/drieux/pbl/BenchMarks/uniqbyRefOrArray.txt

ciao
drieux

---

ps: harry, I have referenced you as the originator
of the function - if that is incorrect - please send
me email back channel indicating who should be blamed.


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




RE: kill NT process

2002-05-13 Thread David Gray

> I am stuck on windows working with a process that runs
> as a service.  There's a bug in the process (vendor
> code) and it doesn't show up in the output of net
> start, so net stop can't stop it.  
> 
> I need to have a script that kills this process using
> kill PID, but I am not aware of any command line tool
> I can grep the output of or Perl routine I can call to
> get the process ID of a process by a given name so
> that I can kill it.
> 
> Any ideas?  I looked at Win32::Process but I think
> that can only start new processes, not give me
> information about existing processes.

I just looked up kill in O'Reilly "Perl for System Administration" and
it recommended using either the NT Resource Kit (pulist.exe, tlist.exe,
kill.exe /f)
 or Win32::IProc. Only thing is, I can't seem to find a copy of
Win32::IProc anywhere... If anyone happens to have it on their system or
know where we could find it, please let us in on the secret!

Cheers,

 -dave



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




file manipulation

2002-05-13 Thread Anjana Banerjee

I'm writing a shell script, which will take a list of files on the
command line, so u run the script like

 
e.g

The list of files is not fixed, so I need to execute this for any number
of files given by the user

Step 1 Using either sed or gawk/awk , I need to separate these files by
white spaces

Step 2 Using either sed or gawk/awk Depending on the extension of the
file, I need to cd into the place where that directory is..



For Step 1, I thought a possible solution would be for a fixed size
only, but is no use in my case


gawk '{ printf "%s\t%s\t%s\t%s\t%s\t%s\n", $1, $2, $3, $4, $5, $6}'


Any ideas??






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




RE: Generalized uname

2002-05-13 Thread Timothy Johnson

 
When you create an executable using perl2exe or PerlApp, the code isn't
actually "compiled" in the sense that you might be thinking.  The
interpreter, your code, and all modules are embedded into the exe in such a
way that they can be extracted, linked, and run when you execute the exe.
You may not see perl.exe in there, but the interpreter is still there.

-Original Message-
From: Mayank Ahuja
To: Timothy Johnson
Cc: 'Mayank Ahuja '; 'Perl '
Sent: 5/13/02 12:09 AM
Subject: Re: Generalized uname


ooopss!! i was wrong ... $^O worked

According to "perldoc perlvar" :

$^O The name of the operating system under which this
 copy of Perl was built, as determined during the
 configuration process.  The value is identical to
 $Config{'osname'}.

I thought perl2exe won't be able to use $^O because the copy of the Perl
won't be available during run time 

But it workedi don't know how
Any ideas???

Thanks Timothy.


Timothy Johnson wrote:
> 
>  Are you SURE you can't use $^O?
> 
> -Original Message-
> From: Mayank Ahuja
> To: Perl
> Sent: 5/12/02 11:09 PM
> Subject: Generalized uname
> 
> Hi Group!
> 
> Is there a module, using which i can determine the Operating System on
> which my perl script is running?
> I cannot use $^O as the my script will be an executable (using
perl2exe)
> and therfore the interpreter won't be available during runtime
> 
> I came across a module Sys::Hostname which gives the hostname of the
> machine on all platforms
> Is there an equivalent module for determining the operating system
> (somthing which uses uname on Unix and something else for Windows)
> 
> Thanks in advance
> 
> --
> Regards
> Mayank
> 
> "The difference between ordinary and extraordinary is that little
extra"
>
-Anon
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Regards
Mayank

"The difference between ordinary and extraordinary is that little extra"
  -Anon

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




Re: trouble dereferencing

2002-05-13 Thread Chas Owens

On Mon, 2002-05-13 at 10:45, Damir Horvat wrote:
> Hi!
> 
> I'm having problem dereferencing:
> ---
> %err = (
>   "usage" => sub { die "\nUsage: $0  \n" },
>   "zone" => sub { die "Zone allready exists!\n" }
> );
> 
> $zone = lc $ARGV[0] || $err{'usage'};
> print "$zone\n";
> ---
> 
> bash-2.05a$ perl dnsaddzone.pl 
> CODE(0x804eed0)
> 
> 
> -- 
> ..
> Damir Horvat
> System administrator
> VOLJATEL telekomunikacije d.d.
> Smartinska 106
> SI-1000 Ljubljana
> Slovenia
> ..
> Tel. +386.(0)1.5875 832
> Fax. +386.(0)1.5875 899
> www.voljatel.si
> E-mail: [EMAIL PROTECTED]
> ..

You need to add parentheses to dereference a coderef.


#!/usr/bin/perl

use strict;

my %err = (
"usage" => sub { die "\nUsage: $0  \n" },
"zone" => sub { die "Zone allready exists!\n" }
);

my $zone = lc $ARGV[0] || $err{'usage'}();

print "$zone\n";



-- 
Today is Pungenday the 60th day of Discord in the YOLD 3168
You are what you see.

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


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




RE: trouble dereferencing

2002-05-13 Thread Shishir K. Singh

try 

$zone = lc $ARGV[0] || &{$err{'usage'}};

-Original Message-
From: Damir Horvat [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 10:45 AM
To: [EMAIL PROTECTED]
Subject: trouble dereferencing


Hi!

I'm having problem dereferencing:
---
%err = (
"usage" => sub { die "\nUsage: $0  \n" },
"zone" => sub { die "Zone allready exists!\n" }
);

$zone = lc $ARGV[0] || $err{'usage'};
print "$zone\n";
---

bash-2.05a$ perl dnsaddzone.pl 
CODE(0x804eed0)


-- 
...
Damir Horvat
System administrator
VOLJATEL telekomunikacije d.d.
Smartinska 106
SI-1000 Ljubljana
Slovenia
...
Tel. +386.(0)1.5875 832
Fax. +386.(0)1.5875 899
www.voljatel.si
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: Unicode to ansi conversion (or normalization)

2002-05-13 Thread David Gray

> I'm going to be working with XML files on Windows.  Notice 
> that in Notepad (on
> W2K+) you can save a file with different encodings, including 
> Unicode.  
> W2K+These
> XML files are Unicode.  Opened directly in Notepad, they take 
> on an appearance of having extra spaces between characters.
> 
> Grep and diff will barf on these files.  But if I save them 
> selecting ANSI encoding everybody's happy.
> 
> I'd like to put together a simple little script to convert 
> them to ANSI, help appreciated.



And especially,



Cheers,

 -dave



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




trouble dereferencing

2002-05-13 Thread Damir Horvat

Hi!

I'm having problem dereferencing:
---
%err = (
"usage" => sub { die "\nUsage: $0  \n" },
"zone" => sub { die "Zone allready exists!\n" }
);

$zone = lc $ARGV[0] || $err{'usage'};
print "$zone\n";
---

bash-2.05a$ perl dnsaddzone.pl 
CODE(0x804eed0)


-- 
..
Damir Horvat
System administrator
VOLJATEL telekomunikacije d.d.
Smartinska 106
SI-1000 Ljubljana
Slovenia
..
Tel. +386.(0)1.5875 832
Fax. +386.(0)1.5875 899
www.voljatel.si
E-mail: [EMAIL PROTECTED]
..

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




RE: Unique list

2002-05-13 Thread Jackson, Harry



>-Original Message-
>From: Lance Prais [mailto:[EMAIL PROTECTED]]



I seem to require what you want a lot so wrote this. Pass the arrays you
want the unique values of as references to this sub routine. There is no
checking for the amount of arrays passed and will currently handle 4.

sub unique {

#my $self = shift; 
my ($array1, $array2, $array3, $array4) = @_;
my (%hash,  @unique);

%hash   =  ();

foreach (@{$array1}, @{$array2}, @{$array3}, @{$array2}) { 
$hash{$_} = 1; 
}

push @unique, keys %hash;
 
return(\@unique);

 }

Harry


*
COLT Telecommunications
Registered in England No. 2452736
Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ
Tel. +44 20 7390 3900

This message is subject to and does not create or vary any contractual
relationship between COLT Telecommunications, its subsidiaries or 
affiliates ("COLT") and you. Internet communications are not secure
and therefore COLT does not accept legal responsibility for the
contents of this message.  Any view or opinions expressed are those of
the author. The message is intended for the addressee only and its
contents and any attached files are strictly confidential. If you have
received it in error, please telephone the number above. Thank you.
*


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




Re: Validation Error

2002-05-13 Thread drieux


On Sunday, May 12, 2002, at 11:09 , Bill Lyles wrote:

> Yes that is correct
> - Original Message -
> From: "bob ackerman" <[EMAIL PROTECTED]>
>> On Sunday, May 12, 2002, at 09:38  PM, Bill Lyles wrote:
>>
>>> Huh?

my complements to bob for the 'translation'...

>> i think you are calling an html file that gets the input and posts to 
>> this
>> cgi script.
>> so drieux is confused when you say the whole script. it is the whole cgi,
>> but there is an html file that does the post.

let's try this the other way then

given some 'principle html script'

http://localhost/my/dir/ThatPage.html

which when invoked calls out

http://localhost/cgi-bin/ThisCgi.cgi?

for the get method or

http://localhost/cgi-bin/ThisCgi.cgi

for the POST method - and the data is stashed in hidden
values that will be read as 'input' on STDIN

have you thought about using say LWP::Useragent to
call the original page? To make sure that it will
do the right thing

When you build the libwww-perl on the unix side it provides
a set of fun little tools - one named GET and the other POST
that allow one to do simple 'GET http://www.wetware.com/drieux'
types of 'give me the raw html' from there.

Because if the original html wrapper is SCRAGGED and not
passing along the values to the cgi - then of course it
will always blow chow






ciao
drieux

---


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




RE: File Search - String Match - String Count

2002-05-13 Thread David Gray

> I am trying to accomplish the following and have been unable 
> to find a good 
> routine (or build one) which does an adequate job.
> 
> 1.  Paste a big text file into an html text box which contains email 
> addresses scattered throughout.

You can use the CGI module for this. I'm not sure of the syntax, but I'm
sure someone else will be able to help you out with that.

> 2.  Upon form submission, perl routine will put that text 
> file into an 
> array for processing.

Same as above, the CGI module will help you with this.

> 3.  Perl will search the array for email addresses and pull 
> out.
> 4.  Perl will verify that the email addresses are in 
> valid syntax.
> 5.  Perl save the good emails and bad emails 
> into separate variables.
> 6.  Perl will report the number of 
> good emails and bad emails found in text 
> file.
> 7.  I then want to be able to process the good emails as needed.


Check out Email::Valid -- that should be able to do most of what you
need. However, a paste from the Email::Valid documentation:

Please note that there is no way to determine whether an address is
deliverable without attempting delivery (for details, see perlfaq 9 [aka
perldoc -q "valid mail address"])

Good luck,

 -dave



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




Re: Generalized uname

2002-05-13 Thread drieux


On Monday, May 13, 2002, at 12:09 , Mayank Ahuja wrote:
[..]
> $^O The name of the operating system under which this
>  copy of Perl was built, as determined during the
>  configuration process.  The value is identical to
>  $Config{'osname'}.
[..]

so why not do the old fashion

use Confing;

my $osName = $Config{'osname'};

that should survive the 'compile' time process


ciao
drieux

---


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




Tk::Optionmenu

2002-05-13 Thread Mayank Ahuja

Hi Group!!

I have an Optionmenu in my Tk application.
The Optionmenu has the following enteries ["First", "Second", "Third",
"Fourth"]

I also have 2 buttons in my application
If i press  the Optionmenu should display the first option in
the Optionmenu i.e. "First" and
if i press  the Optionmenu should display the last option in
the Optionmenu i.e."Fourth".

But how can i achieve the same.?

Any comments? Any ideas are most welcome.

Thanks in advance..

-- 
Regards
Mayank

"The difference between ordinary and extraordinary is that little extra"
  -Anon

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




Re: Pattern matching

2002-05-13 Thread Jonathan E. Paton

> Please help me. I am trying to do pattern matching for an IP address. I have
> tried the following and it does not work:
> unless ( $ip =- /[0-223]\.[0-255]\.[0-255]\.[0-255]/ )
> {
> die ( "Invalid IP\n" );
> }
> print ( "Valid IP" );
> 
> Is there a way I could actually do this without splitting the IP and working
> on each octect separately?

Validing IP addresses is covered in "Mastering Regular Expressions", Jeffrey
Friedl, O'Reilly.  It covers regular expressions in quite some detail, although
I'd like to see it updated for more modern Perls.

Avoiding regular expressions and using substr is fastest, however it took him
several lines of code.  The reason yours doesn't work is that [0-223] is a
character class the same as [0123]... it won't go from 0 to 223!  Going for
simple is probably best, hence splitting down with 'split' would be a good
beginners approach or when speed isn't critical.  search.cpan.org for modules
that may do this for you!

Jonathan Paton

=
---BEGIN GEEKCODE BLOCK---v3.12
GCS/E d+ s+: a20 C++(+++)>$ UHL++>+++ P+++ L++>
E- W++(-) N+ o? K- w--- !O M-- !V PS-- PE++ Y++ PGP
t@ 5-- X-- R- tv- b  DI+ D- G++ e h! !r--->++ !y---
END GEEKCODE BLOCK-
JAPH: print`perldoc perlembed`=~/(Ju.*)/,"\n"

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




Pattern matching

2002-05-13 Thread Langa Kentane

Greetings,
Please help me. I am trying to do pattern matching for an IP address. I have
tried the following and it does not work:
unless ( $ip =- /[0-223]\.[0-255]\.[0-255]\.[0-255]/ )
{
die ( "Invalid IP\n" );
}
print ( "Valid IP" );

Is there a way I could actually do this without splitting the IP and working
on each octect separately?

All suggestions welcome.

Kind Regards

Langa

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




Re: DBI for postgres

2002-05-13 Thread Gary Stainburn

On Monday 13 May 2002 10:10 am, Wim wrote:
> Hello,
>
> I'm looking for the DBI-driver for Postgres. Some months ago, I could
> download it from dbi.symbolstone.org.
> This site doesn't exists anymore. Can someone point me to the DBI
> interface for postgres?
> I searched cpan, but couldn't find it :-(
>
> Thanks
>
> Wim

Hi Will,

have a look at 

http://search.cpan.org/search?dist=DBI

for the DBI, and for the DBD::Pg module look at 

http://search.cpan.org/search?mode=module&query=DBD%3A%3APg
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 

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




Re: Generalized uname

2002-05-13 Thread Felix Geerinckx

on Mon, 13 May 2002 07:21:31 GMT, [EMAIL PROTECTED] (Jonathan 
e. paton) wrote:

>   Thus, your original program is compiled into Perl bytecode,
>   and is then run through a full interpreter - you have all the
>   power of Perl.  However, this means perl2exe is a poor way to
>   increase speed (in fact, it's worse than normal - as memory would
>   normally be shared between interpreters on Unix, which won't
>   happen if you have several scripts in exe form).

Don't know about perl2exe, but the ActiveState's PerlApp user guide 
states:

PerlApp is not a compiler. That is, the Perl source code and the
contents of embedded modules must be parsed and compiled on the 
fly when the executable is invoked. However, PerlApp makes it 
easier to distribute Perl scripts, as Perl (or a specific version 
and combination of Perl modules) does not need to be resident on 
the target system. PerlApp applications will not run any faster 
than the source Perl script.

It is the fact that a client machine doesn't need a full Perl 
installation for these programs to work that makes these tools useful 
to me. Consider e.g. the deployment of a program to a large number of 
(business) users.

-- 
felix

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




DBI for postgres

2002-05-13 Thread Wim

Hello,

I'm looking for the DBI-driver for Postgres. Some months ago, I could 
download it from dbi.symbolstone.org.
This site doesn't exists anymore. Can someone point me to the DBI 
interface for postgres?
I searched cpan, but couldn't find it :-(

Thanks

Wim


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




Re:Delete a line and replace

2002-05-13 Thread Jorge Goncalvez

Hi, i have this file /etc/passwd like this:


Everyone:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Administrator:unused_by_nt/2000/xp:500:513:U-LININF54\Administrator,S-1-5-21-175
7981266-2139871995-725345543-500:/home/Administrator:/bin/bash
anonymous:unused_by_nt/2000/xp:1017:513:U-LININF54\anonymous,S-1-5-21-1757981266
-2139871995-725345543-1017:/home/anonymous:/bin/bash
ftp:unused_by_nt/2000/xp:1018:513:U-LININF54\ftp,S-1-5-21-1757981266-2139871995-
725345543-1018:/:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:U-LININF54\Guest,S-1-5-21-1757981266-21398719
95-725345543-501:/home/Guest:/bin/bash
HelpAssistant:unused_by_nt/2000/xp:1000:513:Remote Desktop Help Assistant 
Account,U-LININF54\HelpAssistant,S-1-5-21-1757981266-2139871995-725345543-1000:/
home/HelpAssistant:/bin/bash


I wanted to delete all the line which begins with ftp and then replace Guest by 
ftp in all file.

Thanks. 


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




RE: System function not working

2002-05-13 Thread Kakade, Amod A

Thanks a lot Timothy for the help, 



Regards

Amod

Amod A. Kakadé
intel*  India
ARIES - DSS Project
6th Floor, Du Parc Trinity, 
17 M. G. Road
Bangalore, 560 001, India   
Phone 91 80 555 0940 / 531 8120 Ext. 2327
Fax 91 80 5321908
INET8 262 2327



-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 8:53 PM
To: 'Kakade, Amod A '; ''[EMAIL PROTECTED]' '
Subject: RE: System function not working


 
Check the $^E variable.  It should have OS-specific error information.

-Original Message-
From: Kakade, Amod A
To: '[EMAIL PROTECTED]'
Sent: 5/10/02 5:11 AM
Subject: System function not working

Hi

I have 2 machines one running Windows2000 advanced server  & other
running
the Windows 2000 Professional. 

If I run a perl program on Windows 2000 Professional machine it runs
successfully but same code does not work at return a code 65280 

 

What can be the reason behind this ?

 

Regards 

Amod 

Amod A. Kakadé 
intel*  India 
ARIES - DSS Project 
6th Floor, Du Parc Trinity, 
17 M. G. Road 
Bangalore, 560 001, India   
Phone 91 80 555 0940 / 531 8120 Ext. 2327 
Fax 91 80 5321908 
INET8 262 2327 

 

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




Re: Generalized uname

2002-05-13 Thread Jonathan E. Paton

> ooopss!! i was wrong ... $^O worked
> 
> According to "perldoc perlvar" :
> 
> $^O The name of the operating system under which this
>  copy of Perl was built, as determined during the
>  configuration process.  The value is identical to
>  $Config{'osname'}.
> 
> I thought perl2exe won't be able to use $^O because the
> copy of the Perl won't be available during run time 
> 
> But it worked... I don't know how
> Any ideas???

It is obvious:

  The only program that parses Perl is perl, and to really be
  Perl you also have to be perl.  The easiest way to turn
  Perl code into an executable is to embed the perl interpreter!

  Thus, your original program is compiled into Perl bytecode,
  and is then run through a full interpreter - you have all the
  power of Perl.  However, this means perl2exe is a poor way to
  increase speed (in fact, it's worse than normal - as memory would
  normally be shared between interpreters on Unix, which won't
  happen if you have several scripts in exe form).

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]