Re: Retrieving cookie expiration date

2003-07-16 Thread Octavian Rasnita
No, the expiration date is not sent by the browsers back to the server.
The browser only checks if the cookie is not expired, and if it is not, it
sends it, otherwise it doesn't.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Sawsan Sarandah [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 7:44 AM
Subject: Retrieving cookie expiration date


Greetings,

Is it possible using cgi.pm or other means to extract the expiration date 
time of a cookie on a remote computer?

If yes, how?

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: Retrieving cookie expiration date

2003-07-16 Thread Kipp, James
read 'perldoc cgi', go to the http cookies section. you can retrieve a
cookie into a hash which will include the exp date. 

HTH
Jim

-Original Message-
From: Sawsan Sarandah [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 12:44 AM
To: [EMAIL PROTECTED]
Subject: Retrieving cookie expiration date


Greetings,

Is it possible using cgi.pm or other means to extract the expiration date 
time of a cookie on a remote computer?

If yes, how?

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: multipart form data

2003-07-16 Thread fliptop
On Tue, 15 Jul 2003 at 17:30, Anshuman Kanwar opined:

[snip]
AK:So it sees the filename but not the data itself. Problem is that I want to
AK:save the Jpg pictures in some other files and the
AK:BOTZSERIAL=00:02:D3:00:01:01 type info in some other file, but I am not
AK:seeing the binary (jpg) data at all. How do I extract the .jpg files from
AK:this POST?

you need to use upload() instead of param() to read the image.  please
read perldoc CGI for more information and examples.


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



Re: Retrieving cookie expiration date

2003-07-16 Thread Octavian Rasnita
Could you tell us how to do that?
I've seen that the cookie is returned by the browsers in the HTTP_COOKIE
environment variable in the form:

HTTP_COOKIE=cookie_name=cookie_value;next_cookie_name=next_cookie_value; but
no expiration date is sent.

I don't think the CGI module is able to find the expiration date of a
cookie.

But if the programmer wants, he can set this expiration date in the value of
the cookie.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Kipp, James [EMAIL PROTECTED]
To: 'Sawsan Sarandah' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 2:45 PM
Subject: RE: Retrieving cookie expiration date


read 'perldoc cgi', go to the http cookies section. you can retrieve a
cookie into a hash which will include the exp date.

HTH
Jim

-Original Message-
From: Sawsan Sarandah [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 12:44 AM
To: [EMAIL PROTECTED]
Subject: Retrieving cookie expiration date


Greetings,

Is it possible using cgi.pm or other means to extract the expiration date 
time of a cookie on a remote computer?

If yes, how?

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]



Variable $q will not stay shared at

2003-07-16 Thread B. Fongo


Hello,

I'm working on my first Perl project. Most of my cgi programs work ok,
but a look at the apache error log reveals this warning which is clear
to me:

Variable $xy will not stay shared at /data/www/cgi-perl/envir.pl line
19. [Wed Jul 16 11:44:57 2003] [error] Undefined subroutine
Apache::ROOT::cgi_2dperl::environ_2epl::start_html called at
/data/www/cgi-
perl/envir.pl line 20.

For instance: This code will trigger such warning.  

#!/usr/bin/perl -w
use strict;
use CGI;
my $xy = new CGI;
print $xy-header();
print $xy-start_html();
print $xy-p( Perl-CGI);
print $xy-end_html;

#

I tried several alternatives, like invoking print() only once at header.
But I can't feature out what that warning actually means. My apache is
configure with mod_perl.

Besides that, my project will consist of 1 main Perl script and several
modules in a subdirectory which will be performing various functions.
Now; what I intend to do is always send the main script a parameter
through the URL, which will then indicate which of the modules should be
called.  Each of my modules will contains subroutines for various
functions:
My question is: How do I send a parameter to my script through a link on
my web page? I tried something like this, but did not work.  

a href=cgi-perl/mainprogram.pl?action=cup_of_coffeeA cup of coffee
/a

  What I'm trying to do here is to send the string cup_of_coffee to
the main program.

The main program will have something like this to store the parameter
from the url:
@forwarded_by_url = ??? # Am not sure here.


Can someone tell me how to implement it? That will be great!

Thanks

Babs


  





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



Re: Regular Expression

2003-07-16 Thread Paul D. Kraus
 I am having a hard time getting a regular expression to work the way i
want
 it to.  Take the following text: bla bla bla (la la) bla bla (di da)

my ( $var1, $var2 ) = ( $1, $2 ) if /$inputstring =~ m/bla bla bla (la la)
bla bla (di da)

$1 gets la la
$2 gets di da



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



Re: starting off

2003-07-16 Thread Paul D. Kraus
 need any tips as to start perl programming , so if you could help i would
really appreciate it . Iam really good with batch file programming , anda
bit  of C++ so if any help could be shot this way i would make it worth
your while ;D

http://www.amazon.com/exec/obidos/tg/detail/-/0596001320/qid=1058302461/sr=8-1/ref=sr_8_1/104-1265532-7934337?v=glances=booksn=507846

http://www.amazon.com/exec/obidos/ASIN/0596000278/qid=1058302479/sr=2-1/ref=sr_2_1/104-1265532-7934337

Buy them both.

Paul Kraus



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



RE: Getting the domain name

2003-07-16 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Mark 
Anderson wrote:

 We have a fairly simple redirect script a url is entered, and even tho
 there are
 directions to not enter the http://www; sometimes we get it or
 http://;...
 what is the simplest method to extract just the domain name if a
 http://www.somedomain_name.com; or http://somedomain_name.com; is enter
 so we
 can extract just the somedomain_name.com
 
 $domain =~ s{^(http:(//)?)?(www.)?}{};

And this second substitution seems to work to strip subdirectories 
(www.abc.com/catalog/):

$domain =~ s{(/.*/?)?$}{};

To combine them I'm guessing one would have to capture the middle:

$domain =~ s{^(http:(//)?)?(www.)?(.*)?(/.*/?)?$}{};
print $4\n;

(It works on my small example at least)

-K

-- 
Kevin Pfeiffer
International University Bremen

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



Re: Regular Expression

2003-07-16 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], Paul D. Kraus wrote:

 I am having a hard time getting a regular expression to work the way i
 want
 it to.  Take the following text: bla bla bla (la la) bla bla (di da)
 
 my ( $var1, $var2 ) = ( $1, $2 ) if /$inputstring =~ m/bla bla bla (la la)
 bla bla (di da)
 
 $1 gets la la
 $2 gets di da

But his line has parentheses. I think these have to be escaped if you want 
to match on them:  \(  and \) otherwise they become capturing Klaemmer. 
(Right?)

Here is what I came up with (I'm sure someone can do this more elegantly):

if ($line =~ /[^(]*\(([^)]+)\)[^(]*\(([^)]+)\)/) {
   print $1 and $2\n;
}


-- 
Kevin Pfeiffer
International University Bremen

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



search and count

2003-07-16 Thread Boon Chong Ang
Hi,

I am a beginner to Perl. Well, I have a scenario like this. I have a
pattern like VIOLATE in the file. So, I want to use the perl to search
that pattern and see how many times it found such pattern. For example

 

VIOLATE

ABC

ABC

ABC

VIOLATE  ABC VIOLATE [in the same row and so I want it to count as one]

ABC

ABC

VIOLATE

VIOLATE

 

I just want to report as 4 only. 

 

 

Thank you  best regards,

ABC

 



RE: search and count

2003-07-16 Thread Marcos . Rebelo
call this script like 
perl script.pl File_name.txt
perl script.pl  File_name.txt
more File_name.txt | perl script.pl

my $count=0;
while (){
   $count++ if /VIOLATE/;
}
print $count;

Must work

-Original Message-
From: Boon Chong Ang [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 10:30 AM
To: [EMAIL PROTECTED]
Subject: search and count


Hi,

I am a beginner to Perl. Well, I have a scenario like this. I have a
pattern like VIOLATE in the file. So, I want to use the perl to search
that pattern and see how many times it found such pattern. For example

 

VIOLATE

ABC

ABC

ABC

VIOLATE  ABC VIOLATE [in the same row and so I want it to count as one]

ABC

ABC

VIOLATE

VIOLATE

 

I just want to report as 4 only. 

 

 

Thank you  best regards,

ABC

 


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



RE: search and count

2003-07-16 Thread Boon Chong Ang
Marcos,
Thanks a lot!

Best regards,
ABC

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

Sent: Wednesday, July 16, 2003 4:36 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: search and count

call this script like 
perl script.pl File_name.txt
perl script.pl  File_name.txt
more File_name.txt | perl script.pl

my $count=0;
while (){
   $count++ if /VIOLATE/;
}
print $count;

Must work

-Original Message-
From: Boon Chong Ang [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 10:30 AM
To: [EMAIL PROTECTED]
Subject: search and count


Hi,

I am a beginner to Perl. Well, I have a scenario like this. I have a
pattern like VIOLATE in the file. So, I want to use the perl to search
that pattern and see how many times it found such pattern. For example

 

VIOLATE

ABC

ABC

ABC

VIOLATE  ABC VIOLATE [in the same row and so I want it to count as one]

ABC

ABC

VIOLATE

VIOLATE

 

I just want to report as 4 only. 

 

 

Thank you  best regards,

ABC

 

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



help needded

2003-07-16 Thread vemulakonda uday bhaskar
hi all

i have installed the Net::SFTP module along with all its 
prerequisite modules..

my code :

#!/usr/bin/perl

use Net::SFTP:

use strict;
use warnings;
my $host=xxx.xxx.xxx.xxx;
my $user=xxx;
my $password=xxx;
my $proto=sftp;
my 
$hp=Net::SFTP-new(host,user=$user,password=$password,proto=$proto) 
or die not connected;

the above was my code. but wheni run it, i get the following error 
:

Request for subsystem 'sftp' failed on channel '1' at 
/usr/lib/perl5/site_perl/5.6.0/Net/SFTP.pm line 66.

please give an advise so as to rectify the error.

with regards
uday
___
Click below to experience Sooraj R Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
  Kareena http://www.mpkdh.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: help needded

2003-07-16 Thread mgoland


- Original Message -
From: vemulakonda uday bhaskar [EMAIL PROTECTED]
Date: Wednesday, July 16, 2003 8:07 am
Subject: help needded

 hi all

Hi
 
 i have installed the Net::SFTP module along with all its 
 prerequisite modules..

Have you installed the correct version of ssh ??
 
 my code :
 
 #!/usr/bin/perl
 
 use Net::SFTP:
 
 use strict;
 use warnings;
 
 my $host=xxx.xxx.xxx.xxx;
 my $user=xxx;
 my $password=xxx;
 my $proto=sftp;
 
 my 
 $hp=Net::SFTP-
 new(host,user=$user,password=$password,proto=$proto) 
you need a $ by the host

...new($host,...);

 or die not connected;
 
 the above was my code. but wheni run it, i get the following error 
 :
 
 Request for subsystem 'sftp' failed on channel '1' at 
 /usr/lib/perl5/site_perl/5.6.0/Net/SFTP.pm line 66.
 
 please give an advise so as to rectify the error.
 
 with regards
 uday

hTh,
Mark G
 ___
 Click below to experience Sooraj R Barjatya's latest offering
 'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
   Kareena http://www.mpkdh.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: starting off

2003-07-16 Thread Perry, Alan
Paul D. Kraus wrote:

 need any tips as to start perl programming , so if you could help i would
really appreciate it . Iam really good with batch file programming , anda
bit  of C++ so if any help could be shot this way i would make it worth
your while ;D

http://www.amazon.com/exec/obidos/tg/detail/-/0596001320/qid=1058302461/sr=
8-1/ref=sr_8_1/104-1265532-7934337?v=glances=booksn=507846

http://www.amazon.com/exec/obidos/ASIN/0596000278/qid=1058302479/sr=2-1/ref
=sr_2_1/104-1265532-7934337

Buy them both.

Or, if you want to save a few bucks:

http://www.bookpool.com/.x/ooao5618mi/sm/0596001320
$2.97 cheaper than Amazon ($21.50 at Bookpool, $24.47 at Amazon)

http://www.bookpool.com/.x/ooao5618mi/sm/0596001320
$4.47 cheaper than Amazon ($30.50 at Bookpool, $34.97 at Amazon)

$7.44 total savings

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



Re: Regular Expression

2003-07-16 Thread Janek Schleicher
Nick Diel wrote at Tue, 15 Jul 2003 11:12:18 -0600:

 I am having a hard time getting a regular expression to work the way i want
 it to.  Take the following text: bla bla bla (la la) bla bla (di da)
 
 I want to extract the la la to one variable  and di da to antoher variable.
 What I have tried so far is using match variables, but so far I am only able
 to match either just la la or la la) bla bla (di da.

It would be better if you show us not only a description of your code, but
your real code.

The next will work:
my @variable = $string =~ /\((.*?)\)/g;

Now $variable[0] contains 'la la' and
$variable[1]  ' di da'.


Greetings,
Janek



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



RE: help needded

2003-07-16 Thread wiggins

On 16 Jul 2003 12:07:23 -, vemulakonda uday bhaskar [EMAIL PROTECTED] wrote:

 hi all
 
 i have installed the Net::SFTP module along with all its 
 prerequisite modules..
 

As I said before you need to help us to help you. Re-posting the same message without 
any new information is not likely to get any new responses.  As Mark G pointed out the 
code you have here can't work as the $host isn't being set correctly, but based on the 
line where you are getting the error it does appear you are able to connect over the 
Net::SSH::Perl connection so the problem lies somewhere else, please copy your real 
code (remove the password that is fine) and send it.

I would suggest (as I did before) to turn on the Debug flag, capture the output of the 
session and send it to the list so that we can peruse it for any problems.

 my code :
 
 #!/usr/bin/perl
 
 use Net::SFTP:
 
 use strict;
 use warnings;
 
 my $host=xxx.xxx.xxx.xxx;
 my $user=xxx;
 my $password=xxx;
 my $proto=sftp;
 
 my 
 $hp=Net::SFTP-new(host,user=$user,password=$password,proto=$proto) 
 or die not connected;
 
 the above was my code. but wheni run it, i get the following error 
 :
 
 Request for subsystem 'sftp' failed on channel '1' at 
 /usr/lib/perl5/site_perl/5.6.0/Net/SFTP.pm line 66.
 
 please give an advise so as to rectify the error.
 

See above, short of giving us more information to go on, you can take a look at line 
66 and trace it back to the problem yourself, but without the requested information 
there is no way for us to determine the problem.

I am assuming you are using Net::SFTP 0.05?

http://danconia.org

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



subroutines

2003-07-16 Thread Stuart White
Hello all,

I seem to be stuck on subroutines.  I've read the Perl
for Beginners Wrox chapter on them, and I'm still a
bit lost.  My problem is passing a scalar to a
subroutine, doing calculations therein, and then
returning a value; or basically, subroutines in
general.

I started out with a simple exercise, parsing a file,
passing the matched line contained in $_ to a
subroutine, and then having the subroutine print the
line in question.  That went rather well.  Here's that
code:

#
# Subroutine prototypes


sub FoulParser($);

#
# Main Program
#

#!/usr/bin/perl

use warnings;
use strict;
 
open(STATS, stats.txt) or die statfile\n;
my $foul; 
  while (STATS)
 {
#if ($_ = /(\w+) (Foul:) (\w+)/)
if ($_ =~ /Foul/)
{
 $foul = $_;
 FoulParser($foul);
}
 }  



# Subroutine Definitions
###
 
# This subroutine takes a scalar $foul, that is a 
#parsed line from the file, a line that contains the 
#word Foul and it prints out that line.


sub FoulParser($foul)
{ 
 print $foul\n;
}


I then moved on to the exercise that is giving me
difficulty, which begins the same way, but then
expands like so:  In the subroutine,have it tell me
whether or not the line matches the criterion and feed
the info back to the main function. Use a variable in
the main function to tally the total
fouls/rebounds/etc. and print the value at the end of
the program.

Here is the code for that one:

#
# Subroutine prototypes


sub FoulParser($);
sub PrintFouls();


#
# Main Program
#

#!/usr/bin/perl

use warnings;
use strict;
 
open(STATS, stats.txt) or die statfile\n;
my %fouls; 
my ($type, $totalFouls, $player);
my $foul; 

my $total;

 while (STATS)
 {
if ($_ =~ /(\w+) (Foul:) (\w+)/)
#if ($_ =~ /Foul/)
{
 $foul = $_;
   %fouls =  FoulParser($foul); 
  }
$totalFouls = PrintFouls();
print Total Fouls, both teams: $total; 
}


# Subroutine Definitions
###
 
# This subroutine parses the stats file for the
different types of fouls
# and puts them into a hash.  It then returns a hash
with the data. 
 
sub FoulParser($)
{ 
 my %foulsData;
 my %fouls;
 
 $fouls{$3}{$1}++;
   return %fouls;
}


# This subroutine uses foreach loops for printing out
the foultypes, 
# the player that fouled and the number of those type
of fouls an 
# individual player has.  


sub PrintFouls()
{
 my $totalFouls;
 foreach my $type (keys %fouls)
 {
  print \n$type Fouls\n;
  foreach my $player (keys %{$fouls{$type}})
  {

   print $player:$fouls{$type}{$player}\n;
 $totalFouls += $fouls{$type}{$player};
  }
 }
 #print player: $fouls{$type}{$player};
 return $totalFouls; 
} 

I think I've included extra variables where I don't
need them, but overall, I'm quite confused with
getting the program to do what I want it to do.  Any
suggestions?  Thanks in advance for your help. -stu

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: subroutines

2003-07-16 Thread Steve Grazzini
On Wed, Jul 16, 2003 at 07:50:56AM -0700, Stuart White wrote:
 I seem to be stuck on subroutines.

Okay, let's have a look;

 #
 # Subroutine prototypes
 
 
 sub FoulParser($);
 
 #
 # Main Program
 #
 
 #!/usr/bin/perl
 
 use warnings;
 use strict;
  
 open(STATS, stats.txt) or die statfile\n;
 my $foul; 
   while (STATS)
  {
   #if ($_ = /(\w+) (Foul:) (\w+)/)
   if ($_ =~ /Foul/)
   {
$foul = $_;
FoulParser($foul);
   }
  }

This is beside the point, but:

open (STATS, stats.txt) 
  or die open: stats.txt: $!;  # better error message

while (STATS) {
next unless /Foul/;  # use $_ to your advantage
FoulParser($_);  # and pass it directly to the sub
}

 
 
 
 # Subroutine Definitions
 ###
  
 #This subroutine takes a scalar $foul, that is a 
 #parsed line from the file, a line that contains the 
 #word Foul and it prints out that line.
 
 
 sub FoulParser($foul)
 ^

This doesn't do what you think it does.  Perl doesn't (yet) have named
prototypes, and trying to use one should have given you a warning.

The variable $foul you use here:

 { 
  print $foul\n;
 }

Is the one you declared near the top of the file.  The subroutine should
look more like:

  sub foul_parser ($) {
  my $foul = shift;
  print $foul\n;
  }

The arguments are passed in the @_ array, and shift() will give you the
first element of that array.

And the same sort of set-up will also fix your other subs.

  sub foo ($$) {
  my ($first, $second) = @_;
  }

-- 
Steve

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



Net:FTP to copy a file

2003-07-16 Thread Dan Muey
Howdy group,

Any body have any suggestions on the best way to copy a file with Net::FTP?

I don't want to simply rename() a file as I want to keep the existing one and create a 
new file that is the same.

I know how to use stor() to use content in variables:

my $stor = $ftp-stor(copyoforig.txt);
$stor-write($fileguts, length($fileguts));
$stor-close();

My question would be how would I use retr() to get 'orig.txt' into the variable 
$fileguts?

Would I simply do: $fileguts = $ftp-retr('orig.txt');

TIA all you wonderfull Perl folks!

Dan

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



Problems with Sockets

2003-07-16 Thread Ruben Montes
Hello,
I have developed an UDP server and I need to know the ip address of the
remote peer. This is the code:

use IO::Socket;

$server_port = 514;

$server = IO::Socket::INET - new(LocalPort = $server_port, Proto = udp)
or die Couldn't be a udp server on port $server_port : [EMAIL PROTECTED];

while ($him = $server -recv($datagram, 1024)) {

($portno, $ipaddr) = sockaddr_in($him);
$hostinfo = gethostbyaddr($ipaddr, AF_INET);
 print Client:$hostinfo  $datagram\n;
}

It doesn't work... I need to print te ip address of the remote peer. Can
anybody help me?

Regards,

Ruben

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



newbie : obtain gid of the current user

2003-07-16 Thread Sylvain Masnada
Hi all,
I'd like to get a script which allows me to get the gid of the user which is connected 
currently.
I've done this script which is not very useful for me because I have to run it like 
this : 
id | myscript.pl
My script is : 

while()
{
if(/^uid=\d+.\w+.\sgid=(\d+)/)
{
$gid=$1;
print gid:$gid\n;
}
}

My aim is to change the ip address following the gid. When I will change my gid (su 
toto) my
address will change too. If you could help me...

Thx in advance for u help
Sylvain

___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

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



Dollar signs in subroutines?

2003-07-16 Thread Rob Richardson
Greetings!

In the subroutines thread, the original poster declared his
FoulParser subroutine with this line:

  sub FoulParser($);

Then, Steve Grazzini suggested that subroutines might look like:

   sub foo ($$) {
   my ($first, $second) = @_;
   }

What do the dollar signs mean?  I've never seen them used this way
before!

Thanks!

RobR



__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: Dollar signs in subroutines?

2003-07-16 Thread royce . wells
The dollar signs tells the subroutine how many arguments you are passing to
the subroutine. Each $ is an argument. In the example you provided it will
accept 2 arguments passed to it.




The right word may be effective, but no word was ever as effective as a
rightly timed pause.
   --Mark Twain



|-+
| |   Rob Richardson   |
| |   [EMAIL PROTECTED]|
| |   o.com   |
| ||
| |   07/16/2003 10:52 |
| |   AM   |
| |   Please respond to|
| |   therobs  |
| ||
|-+
  
--|
  |
  |
  |   To:   [EMAIL PROTECTED]  
 |
  |   cc:  
  |
  |   Subject:  Dollar signs in subroutines?   
  |
  
--|




Greetings!

In the subroutines thread, the original poster declared his
FoulParser subroutine with this line:

  sub FoulParser($);

Then, Steve Grazzini suggested that subroutines might look like:

   sub foo ($$) {
   my ($first, $second) = @_;
   }

What do the dollar signs mean?  I've never seen them used this way
before!

Thanks!

RobR



__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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





The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.



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



RE: Problems with Sockets

2003-07-16 Thread Kipp, James
 
 use IO::Socket;
 
 $server_port = 514;
 
 $server = IO::Socket::INET - new(LocalPort = $server_port, 
 Proto = udp)
 or die Couldn't be a udp server on port $server_port : [EMAIL PROTECTED];
 
 while ($him = $server -recv($datagram, 1024)) {
 
 ($portno, $ipaddr) = sockaddr_in($him);
 $hostinfo = gethostbyaddr($ipaddr, AF_INET);
  print Client:$hostinfo  $datagram\n;
 }
 
 It doesn't work... I need to print te ip address of the 
 remote peer. Can
 anybody help me?
 

you can use the peerhost function to get the adr:
$addr = $server-peerhost;
$host = gethostbyaddr($addr, AF_INET);



 


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



RE: FTP to copy a file

2003-07-16 Thread Dan Muey
 
 Howdy group,
 
 Any body have any suggestions on the best way to copy a file 
 with Net::FTP?
 
 I don't want to simply rename() a file as I want to keep the 
 existing one and create a new file that is the same.
 
 I know how to use stor() to use content in variables:
 
 my $stor = $ftp-stor(copyoforig.txt); 
 $stor-write($fileguts, length($fileguts)); $stor-close();
 
 My question would be how would I use retr() to get 'orig.txt' 
 into the variable $fileguts?
 
 Would I simply do: $fileguts = $ftp-retr('orig.txt');

Am I thinking about the way dataconn class functions (IE retr and stor) work  right: ?

my $fileguts;
my $size = $ftp-size('orig.txt');

my $retr = $ftp-retr('orig.txt');
$retr-read($fileguts, $size);
$retr-close();

my $stor = $ftp-stor(copyoforig.txt); 
$stor-write($fileguts, length($fileguts)); 
$stor-close();

That would grab the orig.txt contents then write it back to the server it just got it 
from as copyoforig.txt?
Right?

I think that should do it, I juet need reassurance I'm not crazy!!

Thanks

Dan
 
 TIA all you wonderfull Perl folks!
 
 Dan
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



FW: search and count

2003-07-16 Thread bseel
I am a beginner to Perl. Well, I have a scenario like this. I have a
pattern like VIOLATE in the file. So, I want to use the perl to search
that pattern and see how many times it found such pattern. [Trimmed].


I am a beginner too but try this:
my $count
while my $filevar (file) 
{
while ($filevar =~ /VIO\w*LATE/)
{
++$count;
}
}

I think that this will work because Regular Expressions are very greedy, and will try 
to match as much as they can. So by puttting in the \w* in the middle, it will match 
if it is VIOLATE or if it is VIOLATE ABC VIOLATE. However it will also match VIO YOU 
LATE?

Would someone tell me if this is wrong becuase I have only been doing perl for a week, 
but I have been learning it very fast.

Brian

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



range operator for matching

2003-07-16 Thread Kevin Pfeiffer
Hi,

I found this in my to do directory (was this from perl.beginners - I don't 
remember and can't find it via Google). I tried the line-range operator 
here, but am wondering if it's possible with it to *not* catch the matching 
lines (i.e. only lines 3-4). I suppose if you captured into an array 
then you could just shift and unshift. I also tried a second way below not 
using range that seems to work well (or?).

-K
# problem:
# This is line1
# some text on line2
# line3 all about me
# good stuff on line4
# line 5 isn't that great
# I'm on line 6
#
# What I want to do is grab the text between 'line 2' and 'line 5'

# grabs lines 2 - 5 inclusive
while (DATA) {
   print if (/line2/ .. /line 5/);
}

## end

# grabs lines between 2 and 5
my ($on, $off);
while (DATA) {
   $off++ if /line 5/;
   print if $on and not $off;
   $on++ if /line2/;
}

__DATA__

This is line1
some text on line2
line3 all about me
good stuff on line4
line 5 isn't that great
I'm on line 6

-- 
Kevin Pfeiffer
International University Bremen

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



Re: range operator for matching

2003-07-16 Thread Steve Grazzini
On Wed, Jul 16, 2003 at 06:50:21PM +0200, Kevin Pfeiffer wrote:
 I found this in my to do directory (was this from perl.beginners - I don't 
 remember and can't find it via Google). I tried the line-range operator 
 here, but am wondering if it's possible with it to *not* catch the matching 
 lines (i.e. only lines 3-4). I suppose if you captured into an array 
 then you could just shift and unshift. I also tried a second way below not 
 using range that seems to work well (or?).

There's nothing wrong with the trick you used (and it might be
easier to understand than mine) but you can also switch on the
range operator's return value:

  while (DATA) {
my $range = /line2/../line5/;
print if $range  1 # skip the first line
 and $range !~ /E/; # and the last (which looks like 4E0)
  }

I don't think this is documented (is it?) but it can be handy.

-- 
Steve

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



needing help with the or, || operators

2003-07-16 Thread Josh Corbalis
I've been coding some basic programs learning perl and I'm having some
problems with the or operators. Here are a couple coding samples if anyone
knows what I'm doing wrong with this please tell me.

#!/usr/bin/perl
$gimp=STDIN;
chomp ($gimp);
if ($gimp eq gimp || gimps) {
print working;
}
print \n;

With this one I'm trying to just print out the string working if the user
enters either gimp or gimps. No matter what is entered here it still
prints out working though.

I've also replaced the || with or in that last example but it does the
same thing. 

I can fix the program with either this bit of code:

#!/usr/bin/perl
$gimp=STDIN;
chomp ($gimp);
if ($gimp eq gimp) {
print working;
} elsif ($gimp eq gimps) {
print working;
}
print \n;

or this one:

#!/usr/bin/perl
$gimp=STDIN;
chomp ($gimp);
if ($gimp eq gimp || $gimp eq gimps) {
print working;
}
print \n;

Is this a problem with the or operators or do I just always have to specify
$gimp eq string1 || $gimp eq string2? I would think you would be able to
just leave off the second $gimp eq.

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



Re: needing help with the or, || operators

2003-07-16 Thread royce . wells


In  the below example you are saying if $gimp equals gimp or if gimps.
The First part of the if is actually testing  values while the second part
of the if statement is always true... therefore always printing working.
 you could try

if ($gimp =~ /gimp/)
{
print working;
}

The above example matches if the word gimp is found anywhere in $gimp.





There are 10 types of people...
  Those who understand binary and those who dont



|-+
| |   Josh Corbalis  |
| |   [EMAIL PROTECTED]|
| |   k12.in.us   |
| ||
| |   07/16/2003 12:33 |
| |   PM   |
| ||
|-+
  
--|
  |
  |
  |   To:   [EMAIL PROTECTED]  
 |
  |   cc:  
  |
  |   Subject:  needing help with the or, || operators 
  |
  
--|




I've been coding some basic programs learning perl and I'm having some
problems with the or operators. Here are a couple coding samples if anyone
knows what I'm doing wrong with this please tell me.

#!/usr/bin/perl
$gimp=STDIN;
chomp ($gimp);
if ($gimp eq gimp || gimps) {
print working;
}
print \n;

With this one I'm trying to just print out the string working if the user
enters either gimp or gimps. No matter what is entered here it still
prints out working though.

I've also replaced the || with or in that last example but it does the
same thing.

I can fix the program with either this bit of code:

#!/usr/bin/perl
$gimp=STDIN;
chomp ($gimp);
if ($gimp eq gimp) {
print working;
} elsif ($gimp eq gimps) {
print working;
}
print \n;

or this one:

#!/usr/bin/perl
$gimp=STDIN;
chomp ($gimp);
if ($gimp eq gimp || $gimp eq gimps) {
print working;
}
print \n;

Is this a problem with the or operators or do I just always have to specify
$gimp eq string1 || $gimp eq string2? I would think you would be able
to
just leave off the second $gimp eq.

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





The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.



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



Creating html source ...

2003-07-16 Thread Jamie Risk
I have to assume that any of the simple HTML-izing I want to do with simple
text files has already been done.  I'm guessing modules, particularly CGI
but would appreciate a directed pointer to docs.

- Jamie




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



quota's

2003-07-16 Thread Joe Stuart
I'm trying to implement quota's using the quota interface for perl. The
problem I'm having is when I execute this code. 

#!/usr/bin/perl

use Getopt::Std;
use Quota;

getopt(f:s:h:);
die Usage: $0 -f filesystem -s soft quota -h hard quota\n
if(!$opt_f || !$opt_s || !$opt_h);

open(PASS, /etc/passwd) or die Unable to open users file\n;
@array = PASS;
close(PASS);

$dev = Quota::getqcarg($opt_f) or die Unable to translate path $opt_f:
$!\n;

foreach $i (@array) {
$i =~ /(\w+):x:(\d+)/;

unless($2 = 500) {

($block_curr, $block_soft, $block_hard,
$block_timelimit, $inode_curr,
$inode_soft, $inode_hard, $inode_timelimit) =
Quota::query($dev ,$2);

Quota::setqlim($dev, $2, $opt_s, $opt_h,
$inode_soft, $inode_hard, 1) or
die Unable to set quota's: $!\n;


I get this error message.
Unable to set quota's: No such file or directory

I'm out of ideas. 
thanks

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



Re: Creating html source ...

2003-07-16 Thread Rob Dixon
Jamie Risk wrote:
 I have to assume that any of the simple HTML-izing I want to do
 with simple text files has already been done.  I'm guessing
 modules, particularly CGI but would appreciate a directed pointer
 to docs.


The question is?

Rob




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



Re: newbie : obtain gid of the current user

2003-07-16 Thread John W. Krahn
Sylvain masnada wrote:
 
 Hi all,

Hello,

 I'd like to get a script which allows me to get the gid of the
 user which is connected currently.
 I've done this script which is not very useful for me because
 I have to run it like this :
 id | myscript.pl

You could run id inside your perl program.

my $id_output = qx/id/;


 My script is :
 
 while()
 {
 if(/^uid=\d+.\w+.\sgid=(\d+)/)
 {
 $gid=$1;
 print gid:$gid\n;
 }
 }

Perl supplies the User ID in $, the Effective User ID in $, the Group
ID in $( and the Effective Group ID in $).

print gid: $(\n;


To find the name assigned to $(:

my $group = getgrgid $(;
print Group: $group\n;


To get all groups that $( belongs to:

my @groups;
my $name = getpwuid $;
while ( my @ent = getgrent ) {
push @groups, $ent[ 0 ] if $ent[ -1 ] =~ /\b$name\b/;
}
print @groups\n


 My aim is to change the ip address following the gid.

The id program does not output an ip address.



John
-- 
use Perl;
program
fulfillment

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



trying out examples in Oreilly's Perl Graphics Programming

2003-07-16 Thread Joel Lopez
Hi,

I have been trying to get this perl script to work, but I'm can't seem
to figure out why it's not working.  You can see it here:

http://shawn.apocabilly.org/PGP/examples/example2-1.txt

When I run it I get this on my screen:

[EMAIL PROTECTED] imagemagick]# ./helloworld2
Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
Use of uninitialized value in addition (+) at ./helloworld2 line 31.
Use of uninitialized value in addition (+) at ./helloworld2 line 31.
Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
PNG

IHDR   PLTE2   n2IDATx] 
}29b6
nf$6$=
!)Z'(SH/KL%8{P4)+\RVCbb2{E

+ VWB2|+,
[*E H   EM)[pV
R^)IQzPhT,J8
(8
I[EMAIL 
PROTECTED]@^..e'Wd60r$'?1X(i

s,O ehrZ}~HT$pKQ/I\TTdb
:F#Z91P/RU
=2-+7SZCoKp 
!4bI)^+T=[B
yA%KA8
C)r2Ke*;Z57/RQ|rc?U|V.{
[EMAIL PROTECTED],\1}7D+5B4R5,#gsf
A5MXXfE#2:_xUtx
X*HSV!`gX,kbPB6*c|%:zo7G^+Ub7(8G
~y'T  e DGL1(%=) 
S^QeK*\PE
=/OrY(D=RrN/'Z^
 hbQ
h?P

;.c0jw/yVWn'A\USEUg%01L!,[EMAIL
 PROTECTED] 
{.SN{3]G%huJQk
 Q7aB/m
WS$R+A{xUjrpY_Za|cO-KK
OIm-eL|aH3n#$eCY3PV
YFX[q9{bVZN
*}2eVe~A*6s5eR.7)  
)/4([EMAIL PROTECTED]
~8+97eeT!eeJAL-(''5^K%s1J
-*?0L3
/y{b{SXPbA4^Rb)G2cFPMY_|J[
tX[v7+,kuF0~3`,9WyX
PE8;cS8!-XIul]  
)eQ%i i
i;%?$Z;*X$
,R)PwOSrSE,Y#~XRm?CPxIEN
[EMAIL PROTECTED] imagemagick]# xtermxtermxtermxtermxtermxtermxtermxtermxterm


I first typed it in, but then after I couldn't get it to work I copied
and pasted it into a file.

I'm using Red Hat 8 and have updated the libgd C library to version
1.8.4 and then used cpan to install GD.

I ran the demo for libgd and it made the graphic it was supposed to so I
think it's working ok.  Is there anyway to find out if everything is
installed correctly?

thanks,
Joel




Help !!! on sockets

2003-07-16 Thread Pandey Rajeev-A19514
Hi ,

I have done a silly mistake which am not able to detect.

Below is a subroutine, that takes the Socket_Handle and the Message as arguments.
First i send the message and then I start reading the Socket in a while loop until 
DONE is detected.
I am pushing each line in a @buffer.

When I print the @buffer outside the while loop , I am not getting the output.

Note : The commented line i.e. #print Server: $_; works and prints all the lines 
read from the socket.

Please somebody tell me what error have I been making.

Regards
Rajeev

sub send_msg {
$sock = shift @_;
$msg = shift @_;

my @buffer;

select($sock);
$| = 1;
select(STDOUT);

print $sock $msg, \n;
while ($sock) {
if( $_ =~ /^DONE$/) {
print Server: $_;
return;
}
#print Server: $_;
push @buffer, $_;
}
print @buffer;
}

*

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



Re: needing help with the or, || operators

2003-07-16 Thread John W. Krahn
Josh Corbalis wrote:
 
 I've been coding some basic programs learning perl and I'm having some
 problems with the or operators. Here are a couple coding samples if anyone
 knows what I'm doing wrong with this please tell me.
 
 #!/usr/bin/perl
 $gimp=STDIN;
 chomp ($gimp);
 if ($gimp eq gimp || gimps) {
 print working;
 }
 print \n;
 
 With this one I'm trying to just print out the string working if the user
 enters either gimp or gimps. No matter what is entered here it still
 prints out working though.
 
 I've also replaced the || with or in that last example but it does the
 same thing.
 
 I can fix the program with either this bit of code:
 
 #!/usr/bin/perl
 $gimp=STDIN;
 chomp ($gimp);
 if ($gimp eq gimp) {
 print working;
 } elsif ($gimp eq gimps) {
 print working;
 }
 print \n;
 
 or this one:
 
 #!/usr/bin/perl
 $gimp=STDIN;
 chomp ($gimp);
 if ($gimp eq gimp || $gimp eq gimps) {
 print working;
 }
 print \n;
 
 Is this a problem with the or operators

No.

 or do I just always have to specify
 $gimp eq string1 || $gimp eq string2?

Yes.  Or you could use a regular expression or grep.

$gimp =~ /\bstring[12]\b/

grep $gimp eq $_, 'string1', 'string2'


 I would think you would be able to
 just leave off the second $gimp eq.

Not in Perl5.  This may be a feature of Perl6?



John
-- 
use Perl;
program
fulfillment

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



Re: subroutines

2003-07-16 Thread John W. Krahn
Stuart White wrote:
 
 Hello all,

Hello,

 I seem to be stuck on subroutines.  I've read the Perl
 for Beginners Wrox chapter on them, and I'm still a
 bit lost.

The first thing that you should read is the documentation supplied with
Perl.  The document describing subroutines is perlsub.pod.

perldoc perlsub


 My problem is passing a scalar to a
 subroutine, doing calculations therein, and then
 returning a value; or basically, subroutines in
 general.

Subs in Perl are pretty simple.  All arguments to the sub are flattened
to a list and are available inside the sub in the @_ array but be
careful because modifying the contents of @_ will modify the contents of
the original variables.  All return values are also flattened to a list
when the sub ends.


John
-- 
use Perl;
program
fulfillment

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



Re: range operator for matching

2003-07-16 Thread Rob Dixon

Steve Grazzini [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 On Wed, Jul 16, 2003 at 06:50:21PM +0200, Kevin Pfeiffer wrote:
  I found this in my to do directory (was this from perl.beginners - I don't
  remember and can't find it via Google). I tried the line-range operator
  here, but am wondering if it's possible with it to *not* catch the matching
  lines (i.e. only lines 3-4). I suppose if you captured into an array
  then you could just shift and unshift. I also tried a second way below not
  using range that seems to work well (or?).

 There's nothing wrong with the trick you used (and it might be
 easier to understand than mine) but you can also switch on the
 range operator's return value:

   while (DATA) {
 my $range = /line2/../line5/;
 print if $range  1 # skip the first line
  and $range !~ /E/; # and the last (which looks like 4E0)
   }

 I don't think this is documented (is it?) but it can be handy.

No, I don't think it is documented (at least not on 5.6) but it's clear
you're meant to use it this way; this is one of the dark secrets of Perl.

I believe that

  perldoc perlop (search for 'Range Operators')

should read something like

  Each .. operator maintains its own boolean state. It [returns a
  sequence number starting at one] until the right operand is true,
  *AFTER* which the range operator becomes false again.

With the adjunct that the last /true/ value of the operator will be expressed
in engineering format, witness the program below whichshows that the first
line and the last line can be tested by checking for a value of one and a
regex match of /E/ respectively.

Together with the difference between the .. and the ... operator, I shall
pause before I dig further...

HTH somebody :)

Rob



  while (DATA) {
my $xx = /line2/ .. /line5/;
print defined $xx ? '$xx' : 'undef', \n;
  }

  __DATA__

  This is line1
  some text on line2
  line3 all about me
  good stuff on line4
  line5 isn't that great
  I'm on line6

OUTPUT

  ''
  ''
  '1'
  '2'
  '3'
  '4E0'





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



RE: Help !!! on sockets

2003-07-16 Thread Kipp, James
 
 When I print the @buffer outside the while loop , I am not 
 getting the output.
 
 Note : The commented line i.e. #print Server: $_; works and 
 prints all the lines read from the socket.
 
 Please somebody tell me what error have I been making.
 
 Regards
 Rajeev
 
 sub send_msg {
 $sock = shift @_;
 $msg = shift @_;
 
 my @buffer;
 
 select($sock);
 $| = 1;
 select(STDOUT);
 
 print $sock $msg, \n;
 while ($sock) {
 if( $_ =~ /^DONE$/) {
 print Server: $_;
 return;
 }
 #print Server: $_;
 push @buffer, $_;
 }
 print @buffer;
 }
 
try: $buffer .= $_; 
print $buffer;


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



RE: trying out examples in Oreilly's Perl Graphics Programming

2003-07-16 Thread wiggins


On 16 Jul 2003 11:28:31 -0700, Joel Lopez [EMAIL PROTECTED] wrote:

 Hi,
 
 I have been trying to get this perl script to work, but I'm can't seem
 to figure out why it's not working.  You can see it here:
 
 http://shawn.apocabilly.org/PGP/examples/example2-1.txt
 
 When I run it I get this on my screen:
 
 [EMAIL PROTECTED] imagemagick]# ./helloworld2
 Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
 Use of uninitialized value in addition (+) at ./helloworld2 line 31.
 Use of uninitialized value in addition (+) at ./helloworld2 line 31.
 Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
 ‰PNG

snip image data

 
 I first typed it in, but then after I couldn't get it to work I copied
 and pasted it into a file.
 
 I'm using Red Hat 8 and have updated the libgd C library to version
 1.8.4 and then used cpan to install GD.
 
 I ran the demo for libgd and it made the graphic it was supposed to so I
 think it's working ok.  Is there anyway to find out if everything is
 installed correctly?
 

What makes you think it didn't work correctly? The script just prints the image data 
to the screen, which is basically what that garbled mess was in your e-mail.  Try 
opening a file to write the image to, then print it to the handle, then open the image 
in a image viewer

As an option first try to capture the output of the script to a file and open that in 
the image viewer:

./helloworld2  output.png

The other messages are just warnings that we can help you get rid of later.

http://danconia.org


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



Pulling modules from CPAN installing

2003-07-16 Thread JOHN FISHER
Been lurking for a bit. My first question.  Please be kind.

I was reading a reply from Janek about using Text::CSV, Text::CSV_XS to simplify 
splits on comma files.

I tried  perl -e 'use Text::CSV''
... and got ...
===
Can't locate Text/CSV.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/cygwin-mul
ti /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/cygwin-multi /usr/lib/per
l5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
===

So, I figured I had to go to www.cpan.org. It was overwhelming. 
I negotiated to http://www.cpan.org/modules/by-module/Text/

Do I want these hyperlinks to get the module I want?
 Text-CSV-0.01.readme 
 Text-CSV-0.01.tar.gz   

Install instructions questions  http://www.cpan.org/modules/INSTALL.html
I am using Cygwin on an NT workstation.
So do I follow these instructions? 
   If you're running Windows 95 or NT with the core Windows distribution of Perl?

On the build it says use  make.  I get:
===
$ dmake
bash: dmake: command not found

$ perl -V:make
make='make';

$ make
bash: make: command not found
===
Is there something I need to load from cygwin to get the make or dmake command?

Grazie,
John



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



RE: Help !!! on sockets

2003-07-16 Thread Pandey Rajeev-A19514
Hi,

I am sorry to inform you so late.

Actually, my subroutine returned before printing. Else everything was correct.

Thanks for your help.

Regards
Rajeev

-Original Message-
From: Kipp, James [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 12:33 AM
To: Pandey Rajeev-A19514; [EMAIL PROTECTED]
Subject: RE: Help !!! on sockets


 
 When I print the @buffer outside the while loop , I am not 
 getting the output.
 
 Note : The commented line i.e. #print Server: $_; works and 
 prints all the lines read from the socket.
 
 Please somebody tell me what error have I been making.
 
 Regards
 Rajeev
 
 sub send_msg {
 $sock = shift @_;
 $msg = shift @_;
 
 my @buffer;
 
 select($sock);
 $| = 1;
 select(STDOUT);
 
 print $sock $msg, \n;
 while ($sock) {
 if( $_ =~ /^DONE$/) {
 print Server: $_;
 return;
 }
 #print Server: $_;
 push @buffer, $_;
 }
 print @buffer;
 }
 
try: $buffer .= $_; 
print $buffer;

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



Porting perl scripts on windows

2003-07-16 Thread Gupta, Sharad

Hello Friends,

I have always been on Unix and perl. Now i wanted to port some of my scripts to 
Windows.
Any pointers to web/books for understanding the implications is appreciated??

TIA,
-Sharad


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



VFS::Gnome Authentication

2003-07-16 Thread Joshua Colson
Does anyone have any pointers of where I might learn to use
authentication (username/password) with VFS::Gnome?

Any help would be appreciated.

Also, please cc me, as I often miss the email from the list.

Thanks.

Joshua Colson


signature.asc
Description: This is a digitally signed message part


RE: Pulling modules from CPAN installing

2003-07-16 Thread wiggins


On Wed, 16 Jul 2003 14:38:04 -0500, JOHN FISHER [EMAIL PROTECTED] wrote:

 Been lurking for a bit. My first question.  Please be kind.
 
 I was reading a reply from Janek about using Text::CSV, Text::CSV_XS to simplify 
 splits on comma files.
 
 I tried  perl -e 'use Text::CSV''
 ... and got ...
 ===
 Can't locate Text/CSV.pm in @INC (@INC contains: /usr/lib/perl5/5.6.1/cygwin-mul
 ti /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/cygwin-multi /usr/lib/per
 l5/site_perl/5.6.1 /usr/lib/perl5/site_perl .) at -e line 1.
 BEGIN failed--compilation aborted at -e line 1.
 ===
 
 So, I figured I had to go to www.cpan.org. It was overwhelming. 
 I negotiated to http://www.cpan.org/modules/by-module/Text/
 
 Do I want these hyperlinks to get the module I want?
  Text-CSV-0.01.readme 
  Text-CSV-0.01.tar.gz   
 
 Install instructions questions  http://www.cpan.org/modules/INSTALL.html
 I am using Cygwin on an NT workstation.
 So do I follow these instructions? 
If you're running Windows 95 or NT with the core Windows distribution of Perl?
 
 On the build it says use  make.  I get:
 ===
 $ dmake
 bash: dmake: command not found
 
 $ perl -V:make
 make='make';
 
 $ make
 bash: make: command not found
 ===
 Is there something I need to load from cygwin to get the make or dmake command?
 

You will need to install some of the developer tools from the Cygwin distribution, 
including make, and probably gcc and associated libraries. At least for any modules 
that have an XS component (C lib linked in).

Then you can either download and install by surfing CPAN (usually 
http://search.cpan.org is easier) or by using CPAN through Perl itself, at a Cygwin 
prompt:

 perl -MCPAN -e shell

Then just do:

 install module name
i.e. install Text::CSV

CPAN should do the rest.

You may want to have a look at perldoc perlmodinstall.

http://danconia.org

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



Socket::UNIX help

2003-07-16 Thread Cary Mathews
Background: I trying to write a perl wrapper script for the sophie
http://www.vanja.com/tools/sophie/ virus scanning tool. For those
unfamilier with sophie, it monitors a socket which programs can send
pathnames for scanning. Upon virus detection, it returns the virus
name; if no virus is found, it returns 0.

Problem: I'm using the IO::Socket::UNIX package (1.20) to access the
socket. When I run the script, it fails on the connection line with
the following error:
Can't use string (IO::Socket::UNIX) as a symbol ref while strict
refs in use at /usr/perl5/5.00503/sun4-solaris/IO/Socket.pm line 102.

I imagine I'm doing something wrong, but because I'm still a beginner,
I don't know what it would be.  If anyone can spot my error, and let
me know, I'd be much obliged!

I'd also be more than willing to answer any questions about things
I've overlooked or not mentioned.

-cary mathews

System information:
shell perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos localhost 5.8 sun4u sparc sunw,ultra-1 '
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='gcc', optimize='-O3', gccversion=
cppflags=''
ccflags =''
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16
alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib /usr/local/gcc/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R
/usr/perl5/5.00 503/sun4-solaris/CORE'
cccdlflags='-fPIC', lddlflags='-G'


Characteristics of this binary (from libperl):
  Built under solaris
  Compiled at Dec 22 1999 00:00:57
  @INC:
/usr/perl5/5.00503/sun4-solaris
/usr/perl5/5.00503
/usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site_perl/5.005
.

Basic program code to produce the error:
#-- cut here
#!/usr/bin/perl -w

use strict;
use IO::Socket::UNIX;

$| = 1;

my ($sock_path, $sophie_socket);

$sock_path = /u01/app/local/var/sophie;

$sophie_socket = \
IO::Socket::UNIX-connect($sock_path);

die could not bind to socket at $sock_path\n unless
defined($sophie_socket);
#-- cut here

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



RE: trying out examples in Oreilly's Perl Graphics Programming

2003-07-16 Thread Joel Lopez
Hi,

using this seems to get rid of the garbled stuff:
./helloworld2  output.png

Is output.png supposed to be an existing image or is it one that is created
on the fly?

The code refers to the book authors home directory:

my ($x1, $y1, $x2, $y2,
$x3, $y3, $x4, $y4) = $image-stringFT($black,
/home/shawn/arial.ttf, 48, 0, 40, 120, Hello World);

Is this where the image is read from or created to?  The book site doesn't
give an image to work with.

thanks for helping a lost man,
Joel

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 16, 2003 12:22 PM
To: Joel Lopez; [EMAIL PROTECTED]
Subject: RE: trying out examples in Oreilly's Perl Graphics Programming




On 16 Jul 2003 11:28:31 -0700, Joel Lopez [EMAIL PROTECTED]
wrote:

 Hi,

 I have been trying to get this perl script to work, but I'm can't seem
 to figure out why it's not working.  You can see it here:

 http://shawn.apocabilly.org/PGP/examples/example2-1.txt

 When I run it I get this on my screen:

 [EMAIL PROTECTED] imagemagick]# ./helloworld2
 Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
 Use of uninitialized value in addition (+) at ./helloworld2 line 31.
 Use of uninitialized value in addition (+) at ./helloworld2 line 31.
 Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
 ‰PNG

snip image data


 I first typed it in, but then after I couldn't get it to work I copied
 and pasted it into a file.

 I'm using Red Hat 8 and have updated the libgd C library to version
 1.8.4 and then used cpan to install GD.

 I ran the demo for libgd and it made the graphic it was supposed to so I
 think it's working ok.  Is there anyway to find out if everything is
 installed correctly?


What makes you think it didn't work correctly? The script just prints the
image data to the screen, which is basically what that garbled mess was in
your e-mail.  Try opening a file to write the image to, then print it to the
handle, then open the image in a image viewer

As an option first try to capture the output of the script to a file and
open that in the image viewer:

./helloworld2  output.png

The other messages are just warnings that we can help you get rid of later.

http://danconia.org


--
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: FTP to copy a file

2003-07-16 Thread Levon Barker
Hi Dan,

I was trying to figure something  like this a few months ago. Needed to move
a file to sub directory in the FTP server. All in Net::FTP.

Decided it wasn't worth figuring out. Instead I retrieved the file locally,
deleted the file on the server, cwd to the proper directory and then put it
the file up to the server.

Cheers,
Levon Barker

 -Original Message-
 From: Dan Muey [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 16, 2003 11:39 AM
 To: perl beginners list
 Subject: Net:FTP to copy a file


 Howdy group,

 Any body have any suggestions on the best way to copy a file with
 Net::FTP?

 I don't want to simply rename() a file as I want to keep the
 existing one and create a new file that is the same.

 I know how to use stor() to use content in variables:

 my $stor = $ftp-stor(copyoforig.txt);
 $stor-write($fileguts, length($fileguts));
 $stor-close();

 My question would be how would I use retr() to get 'orig.txt'
 into the variable $fileguts?

 Would I simply do: $fileguts = $ftp-retr('orig.txt');

 TIA all you wonderfull Perl folks!

 Dan

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



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



RE: FTP to copy a file

2003-07-16 Thread Dan Muey
 Hi Dan,
 

Howdy

 I was trying to figure something  like this a few months ago. 
 Needed to move a file to sub directory in the FTP server. All 
 in Net::FTP.
 
 Decided it wasn't worth figuring out. Instead I retrieved the 
 file locally, deleted the file on the server, cwd to the 
 proper directory and then put it the file up to the server.
 

I thought about that but it seems just as complicated and risks leaving lots of files 
around locally.
So I'll stick it out and make it work.
I'll figure it out and add it to my up and coming module (If it ever goes anywhere) as 
a simple routine:

$ftp-cpfile($origfile,$newfile[,1]); # the '1' being whether to allow 
overwriting $newfile if it exists already.
The key,  I think is to make sure I understand retr()

I bel;eive this will work:


my $guts;   

# What I need to verify is that doing this will put $origfile's content into $guts:
 

my $retr = $ftp-retr($origfile);
$retr-read($guts, $si);
$retr-close();
# ... or otherwise accomplish that. Anybody know if this is doing what I'm expecting 
it to do?

# I know this works for making $newfilename with $guts as it's content
my $stor = $ftp-stor($newfilename); 
$stor-write($guts, length($guts)); 
$stor-close();

Thyanks

DMuey
 Cheers,
 Levon Barker

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



Sockets

2003-07-16 Thread Jose M.Herrera
In the documentation of socket appears the fllowing:
$sockaddr = 'S n a4 x8'

What means this???

Thanks...



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



RE: trying out examples in Oreilly's Perl Graphics Programming

2003-07-16 Thread wiggins
Please don't top post...


On Wed, 16 Jul 2003 13:11:57 -0700, Joel Lopez [EMAIL PROTECTED] wrote:

 Hi,
 
 using this seems to get rid of the garbled stuff:
   ./helloworld2  output.png
 
 Is output.png supposed to be an existing image or is it one that is created
 on the fly?
 

It is created on the fly.  

 The code refers to the book authors home directory:
 
 my ($x1, $y1, $x2, $y2,
 $x3, $y3, $x4, $y4) = $image-stringFT($black,
 /home/shawn/arial.ttf, 48, 0, 40, 120, Hello World);
 

arial.ttf is the font that will be used for the words Hello World probably you need 
to replace that location with the path to a similar (Truetype) font on your local 
computer.

 Is this where the image is read from or created to?  The book site doesn't
 give an image to work with.
 

Neither. The image is essentially just a set of properties stored in a Perl object. 
Then when you have finished manipulating the object you call the 'png' method on the 
object to magically transform your Perl object into image data (a PNG) that can then 
be used in some way, specifically in the example it is printed to STDOUT. 

That is why I had you redirect the output into a file, namely output.png which is your 
newly generated image. If it were a CGI for example, you would want to print the 
proper MIME header, and then just print the data to STDOUT, but from a terminal window 
that is not terribly helpful.

 thanks for helping a lost man,

You will get there, somewhat complicated at first but once the samples make sense it 
is pretty much boundless what you can accomplish.

http://danconia.org

 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 16, 2003 12:22 PM
 To: Joel Lopez; [EMAIL PROTECTED]
 Subject: RE: trying out examples in Oreilly's Perl Graphics Programming
 
 
 
 
 On 16 Jul 2003 11:28:31 -0700, Joel Lopez [EMAIL PROTECTED]
 wrote:
 
  Hi,
 
  I have been trying to get this perl script to work, but I'm can't seem
  to figure out why it's not working.  You can see it here:
 
  http://shawn.apocabilly.org/PGP/examples/example2-1.txt
 
  When I run it I get this on my screen:
 
  [EMAIL PROTECTED] imagemagick]# ./helloworld2
  Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
  Use of uninitialized value in addition (+) at ./helloworld2 line 31.
  Use of uninitialized value in addition (+) at ./helloworld2 line 31.
  Use of uninitialized value in subtraction (-) at ./helloworld2 line 31.
  ‰PNG
 
 snip image data
 
 
  I first typed it in, but then after I couldn't get it to work I copied
  and pasted it into a file.
 
  I'm using Red Hat 8 and have updated the libgd C library to version
  1.8.4 and then used cpan to install GD.
 
  I ran the demo for libgd and it made the graphic it was supposed to so I
  think it's working ok.  Is there anyway to find out if everything is
  installed correctly?
 
 
 What makes you think it didn't work correctly? The script just prints the
 image data to the screen, which is basically what that garbled mess was in
 your e-mail.  Try opening a file to write the image to, then print it to the
 handle, then open the image in a image viewer
 
 As an option first try to capture the output of the script to a file and
 open that in the image viewer:
 
 ./helloworld2  output.png
 
 The other messages are just warnings that we can help you get rid of later.
 
 http://danconia.org
 
 

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



RE: FTP to copy a file

2003-07-16 Thread Dan Muey

Howdy all,

I've confirmed that my test script is choking on retr()

I've confirmed that the file exists

my $guts;
my $size = $ftp-size($file)
if(defined $size) {
my $retr = $ftp-retr($file);
$retr-read($guts, $size);
$retr-close();
$r .= I am done trying to get $file;
} else { $r .= $file size is not defined; }

This routine eventually does 
return $r; and if I change $file to a fake name I get the $file size is not defined 
returned
Otherwise it hangs unless I comment out the 3 $retr lines.

Before I go and do a whole bunch more tests could anyone tell me if I'm even doing 
retr() correctly and if the way I'm doing it will place the contents of $file on the 
server I'm connected to via FTP into the variable $guts like I'm expecting.

Any insights or experience?

Thanks!

Dan

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



Re: Sockets

2003-07-16 Thread John W. Krahn
Jose M.Herrera wrote:
 
 In the documentation of socket appears the fllowing:
 $sockaddr = 'S n a4 x8'
 
 What means this???

That is a format string to be used with pack() and/or unpack()

perldoc -f pack


John
-- 
use Perl;
program
fulfillment

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



RE: FTP to copy a file

2003-07-16 Thread wiggins


On Wed, 16 Jul 2003 15:58:39 -0500, Dan Muey [EMAIL PROTECTED] wrote:

 
 Howdy all,
 
 I've confirmed that my test script is choking on retr()
 
 I've confirmed that the file exists
 
 my $guts;
 my $size = $ftp-size($file)
 if(defined $size) {
   my $retr = $ftp-retr($file);
   $retr-read($guts, $size);
   $retr-close();
   $r .= I am done trying to get $file;
 } else { $r .= $file size is not defined; }
 
 This routine eventually does 
 return $r; and if I change $file to a fake name I get the $file size is not 
 defined returned
 Otherwise it hangs unless I comment out the 3 $retr lines.
 
 Before I go and do a whole bunch more tests could anyone tell me if I'm even doing 
 retr() correctly and if the way I'm doing it will place the contents of $file on the 
 server I'm connected to via FTP into the variable $guts like I'm expecting.
 
 Any insights or experience?
 

Naturally this is the worst possible way to do things (aka insecure, slow, bandwidth 
wasting (in two directions), error prone, but whatever floats your cereal.  I am also 
assuming you have explored all the other options, aka just getting a shell account and 
using a regular 'cp' command, etc.

Now obligatory stuff out of the way, it appears from the docs that 'retr' sets up the 
server to begin a file transfer, then you would use 'read' to fill the buffer like you 
said. You would then while loop over remote file reading buffer size (though it 
appears you are doing it all at once which may be a bad way to go with memory 
depending on file sizes) during each iteration the contents of the file should be in 
'guts'.  Easiest test would be to put a plain text file on the server and just print 
'guts' if it contains the file contents then joy!

To speed things up and keep the memory usage down I would setup 2 connections at the 
same time, one for your retr/read and the other for your stor/write, then loop over 
the remote file doing a buffer at a time, you would essentially setup a pipe.  Though 
that approach has its own problems, aka need to be allowed two connections at a time, 
partial file uploads, etc.  

In any case the easiest method to debug this is probably just to try it with plain 
text files and see what you get 

http://danconia.org

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



RE: FTP to copy a file

2003-07-16 Thread Dan Muey
 
 On Wed, 16 Jul 2003 16:49:40 -0500, [EMAIL PROTECTED] wrote:
 
  
  
  On Wed, 16 Jul 2003 15:58:39 -0500, Dan Muey 
 [EMAIL PROTECTED] 
  wrote:
  
   
   Howdy all,
   
   I've confirmed that my test script is choking on retr()
   
   I've confirmed that the file exists
   
   my $guts;
   my $size = $ftp-size($file)
   if(defined $size) {
 my $retr = $ftp-retr($file);
 $retr-read($guts, $size);
 $retr-close();
 $r .= I am done trying to get $file;
   } else { $r .= $file size is not defined; }
   
   This routine eventually does
   return $r; and if I change $file to a fake name I get the 
 $file size is not defined returned
   Otherwise it hangs unless I comment out the 3 $retr lines.
   
   Before I go and do a whole bunch more tests could anyone 
 tell me if 
   I'm even doing retr() correctly and if the way I'm doing it will 
   place the contents of $file on the server I'm connected 
 to via FTP 
   into the variable $guts like I'm expecting.
   
   Any insights or experience?
   
  
  Naturally this is the worst possible way to do things (aka 
 insecure, 
  slow, bandwidth wasting (in two directions), error prone, 
 but whatever 
  floats your cereal.  I am also assuming you have explored all the 
  other options, aka just getting a shell account and using a regular 
  'cp' command, etc.
  
  Now obligatory stuff out of the way, it appears from the docs that 
  'retr' sets up the server to begin a file transfer, then 
 you would use 
  'read' to fill the buffer like you said. You would then while loop 
  over remote file reading buffer size (though it appears you 
 are doing 
  it all at once which may be a bad way to go with memory 
 depending on 
  file sizes) during each iteration the contents of the file 
 should be 
  in 'guts'.  Easiest test would be to put a plain text file on the 
  server and just print 'guts' if it contains the file contents then 
  joy!
  
  To speed things up and keep the memory usage down I would setup 2 
  connections at the same time, one for your retr/read and 
 the other for your stor/write, then loop over the remote file 
 doing a buffer at a time, you would essentially setup a pipe. 
  Though that approach has its own problems, aka need to be 
 allowed two connections at a time, partial file uploads, etc.
  
  In any case the easiest method to debug this is probably 
 just to try 
  it with plain text files and see what you get 

I've tried that, it dies on the initial retr();

The files it's moving are pretty small(1-4K) as they are created by the 
same program so I think size doesn't matter, well err, you know what I mean ;p

The source! Of course! Thanks for the kick in the pants I bet I'll find my erro there.

Thanks!

Dan

  
 
 p.s. have a look at the source for Net::FTP particularly the 
 get/put methods as they are implemented using this same 
 technique (aka with retr/read,stor/write).
 
  http://danconia.org
 

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



Is there anyway to modify my bios clock by perl ?

2003-07-16 Thread LI NGOK LAM
Is there anyway to modify my BIOS clock by Perl ?
and more, is there anyway to adjust my BIOS clock, so
to sync. with other time servers ?

TIA

file changed??

2003-07-16 Thread Jose M.Herrera
I need to make a perl program which print Changed! when a file xx.txt is
changed.
please, any idea??

Thanks for all..


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



RE: Porting perl scripts on windows

2003-07-16 Thread Gupta, Sharad
Ok, Let me try to put it the other way.

Any good books on how to learn perl on windows??.

Thanx,
-Sharad

-Original Message-
From: Gupta, Sharad 
Sent: Wednesday, July 16, 2003 12:41 PM
To: [EMAIL PROTECTED]
Subject: Porting perl scripts on windows



Hello Friends,

I have always been on Unix and perl. Now i wanted to port some of my scripts to 
Windows.
Any pointers to web/books for understanding the implications is appreciated??

TIA,
-Sharad


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



secure socket connection

2003-07-16 Thread mario kulka
I'm trying to set up credit card processing and one of the first steps is to 
establish a secure socket connection - how can i do it? (My host does 
support it)

Thanks,
Mariusz
_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Variable $q will not stay shared at

2003-07-16 Thread B. Fongo


Hello,

I'm working on my first Perl project. Most of my cgi programs work ok,
but a look at the apache error log reveals this warning which is clear
to me:

Variable $xy will not stay shared at /data/www/cgi-perl/envir.pl line
19. [Wed Jul 16 11:44:57 2003] [error] Undefined subroutine
Apache::ROOT::cgi_2dperl::environ_2epl::start_html called at
/data/www/cgi-
perl/envir.pl line 20.

For instance: This code will trigger such warning.  

#!/usr/bin/perl -w
use strict;
use CGI;
my $xy = new CGI;
print $xy-header();
print $xy-start_html();
print $xy-p( Perl-CGI);
print $xy-end_html;

#

I tried several alternatives, like invoking print() only once at header.
But I can't feature out what that warning actually means. My apache is
configure with mod_perl.

Besides that, my project will consist of 1 main Perl script and several
modules in a subdirectory which will be performing various functions.
Now; what I intend to do is always send the main script a parameter
through the URL, which will then indicate which of the modules should be
called.  Each of my modules will contains subroutines for various
functions:
My question is: How do I send a parameter to my script through a link on
my web page? I tried something like this, but did not work.  

a href=cgi-perl/mainprogram.pl?action=cup_of_coffeeA cup of coffee
/a

  What I'm trying to do here is to send the string cup_of_coffee to
the main program.

The main program will have something like this to store the parameter
from the url:
@forwarded_by_url = ??? # Am not sure here.


Can someone tell me how to implement it? That will be great!

Thanks

Babs


  





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