sessions

2005-10-31 Thread Adriano Allora

hi to all,
I use session (CGI::Sessions) to record some data in a textual 
search-engine (CQP). I have this problem: I need to destroy a session 
before starting the new one, but I cannot.


actually I wrote this code:


$qualecookie = $pagina-cookie(CGIRICERCA);
if($qualecookie)
{
$session = new CGI::Session(undef, $qualecookie, 
{Directory='/tmp'});

$session-delete();
}

the cookie CGIRICERCA store the session ID, so, when the user come 
again in the first page I verify his/her cookie: if (s)he has the 
cookie I delete the session... er, I would delete it.

Someone can show me the error?


another way to solve my problem would be deleting the cookie only, for 
example with:


$pagina-cookie(-name='CGIRICERCA',-value=);

but: how can I delete a cookie before a redirection (without header 
writing)?



thank you all,

alladr

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


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




How to change the Owner of a file

2005-10-31 Thread Rakesh Mishra
Hi folks
Can any body tell me how to change the owner of a file ??

I have written this script ...

unless (chown $uid , $gid , $filename)
{
die chown failed :$!;
}

this code will give me the error you can't change  permission denied 
can any body tell me , how to over come this error

bye
rakesh


Transforming HoA into AoH

2005-10-31 Thread Gundala Viswanath
Dear Sirs,

I want to convert a HoA into AoH. Basically what it does
is to create a distinct hash for each pair of array element that comes
from different keys (see the example below).

Please also note that the size of the hash and array maybe varying
in the input HoA. And also note that the element of the array is actually
a string that contain white space.

Here is the example, given this HoA:

my $HoA = {
'flintstones' = [ fred-1 foo-2, barney-1 bar-2 ],
'jetsons' = [ george-1 foo-2, jane-1 bar-2],
};


How can I convert them to an AoH

my $AoH = [ # Desired results.

{
'flinstones' = fred-1 foo-2,
'jetsons' = george-1 foo-2
},
{
'flinstones' = fred-1 foo-2,
'jetsons' = jane-1 bar-2
},
{
'flinstones' = barney-1 bar-2,
'jetsons' = george-1 foo-2
},
{
'flinstones' = barney-1 bar-2,
'jetsons' = jane-1 bar-2
},

];

How can I go about it? I'm really lost. Hope
to hear from you guys again.
Thanks so much beforehand.
--Gundala


Re: How to change the Owner of a file

2005-10-31 Thread Dan Klose
On Mon, 2005-10-31 at 13:45 +0530, Rakesh Mishra wrote:
 Hi folks

Hello,

 Can any body tell me how to change the owner of a file ??
 
 I have written this script ...
 
 unless (chown $uid , $gid , $filename)
 {
 die chown failed :$!;
 }
 
 this code will give me the error you can't change  permission denied 
 can any body tell me , how to over come this error
 
I think perl runs with the same authority level as the user account you
are using...  If you have permissions to change file ownership then the
script should work.

Have you tried changing the permissions by hand? (Just to see if you
can!)

So if the above assumption is correct and you can't change the
permissions I would check if you can run the script as root or get sudo
accounts.

Hope that is of some use.


DAn,


 bye
 rakesh
-- 


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




Re: How to change the Owner of a file

2005-10-31 Thread gustav
 Hi folks
 Can any body tell me how to change the owner of a file ??

 I have written this script ...

 unless (chown $uid , $gid , $filename)
 {
 die chown failed :$!;
 }

 this code will give me the error you can't change  permission denied 
 can any body tell me , how to over come this error

 bye
 rakesh

chmod?

http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/Web/People/rgs/pl-exp-file.html

/G
http://www.varupiraten.se/




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




Re: Transforming HoA into AoH

2005-10-31 Thread John W. Krahn
Gundala Viswanath wrote:
 Dear Sirs,

Hello,

 I want to convert a HoA into AoH. Basically what it does
 is to create a distinct hash for each pair of array element that comes
 from different keys (see the example below).
 
 Please also note that the size of the hash and array maybe varying
 in the input HoA. And also note that the element of the array is actually
 a string that contain white space.
 
 Here is the example, given this HoA:
 
 my $HoA = {
 'flintstones' = [ fred-1 foo-2, barney-1 bar-2 ],
 'jetsons' = [ george-1 foo-2, jane-1 bar-2],
 };
 
 
 How can I convert them to an AoH
 
 my $AoH = [ # Desired results.
 
 {
 'flinstones' = fred-1 foo-2,
 'jetsons' = george-1 foo-2
 },
 {
 'flinstones' = fred-1 foo-2,
 'jetsons' = jane-1 bar-2
 },
 {
 'flinstones' = barney-1 bar-2,
 'jetsons' = george-1 foo-2
 },
 {
 'flinstones' = barney-1 bar-2,
 'jetsons' = jane-1 bar-2
 },
 
 ];

my $AoH;
while ( my ( $key, $val ) = each %$HoA ) {
push @$AoH, map +{ $key = $_ }, @$val;
}


John
-- 
use Perl;
program
fulfillment

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




Re: Transforming HoA into AoH

2005-10-31 Thread Xavier Noria

On Oct 31, 2005, at 9:56, Gundala Viswanath wrote:


Here is the example, given this HoA:

my $HoA = {
'flintstones' = [ fred-1 foo-2, barney-1 bar-2 ],
'jetsons' = [ george-1 foo-2, jane-1 bar-2],
};


How can I convert them to an AoH

my $AoH = [ # Desired results.

{
'flinstones' = fred-1 foo-2,
'jetsons' = george-1 foo-2
},
{
'flinstones' = fred-1 foo-2,
'jetsons' = jane-1 bar-2
},
{
'flinstones' = barney-1 bar-2,
'jetsons' = george-1 foo-2
},
{
'flinstones' = barney-1 bar-2,
'jetsons' = jane-1 bar-2
},

];


Looks like you want all the possible permutations of the values  
(within each key). If that's right this is a possible solution. I  
wrote this code based on iterators (inspired by HOP), in case the  
structure is not small:


use strict;
use warnings;

use Data::Dumper;


my $HoA = {
'flintstones' = [ fred-1 foo-2, barney-1 bar-2 ],
'jetsons' = [ george-1 foo-2, jane-1 bar-2],
};

print Dumper(HoA_to_AoH($HoA));

sub HoA_to_AoH {
my ($HoA) = @_;

my @keys = keys %{$HoA};
return [] if not @keys;

my @AoH = ();

my $nkeys = @keys;
my $nvals = @{$HoA-{$keys[0]}};
my $iter = indexes($nvals, $nkeys);
while (my $idxs = $iter-()) {
my %H = ();
my $i = 0;
for my $k (@keys) {
$H{$k} = $HoA-{$k}[$i];
++$i;
}
push @AoH, \%H;
}

return [EMAIL PROTECTED];
}

# Returns an iterator that generates all permutations with
# repetitions of numbers from 0 to $n-1 in blocks of $k.
#
# Permutations are generated as arrayrefs, and undef is returned
# when the iterator is exhausted.
sub indexes {
my ($n, $k) = @_;
my $max_i = $n-1;
my @idxs = (-1, (0) x ($k-1));
return sub {
my $exhausted = 1;
IDXS:
for my $i (@idxs) {
if ($i  $max_i) {
++$i;
$exhausted = 0;
last IDXS;
}
$i = 0;
}
return $exhausted ? undef : [ @idxs ];
};
}

-- fxn


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




Re: Transforming HoA into AoH

2005-10-31 Thread Xavier Noria

On Oct 31, 2005, at 12:34, Xavier Noria wrote:


sub HoA_to_AoH {
my ($HoA) = @_;

my @keys = keys %{$HoA};
return [] if not @keys;

my @AoH = ();

my $nkeys = @keys;
my $nvals = @{$HoA-{$keys[0]}};
my $iter = indexes($nvals, $nkeys);
while (my $idxs = $iter-()) {
my %H = ();
my $i = 0;
for my $k (@keys) {
$H{$k} = $HoA-{$k}[$i];
++$i;
}
push @AoH, \%H;
}

return [EMAIL PROTECTED];
}


Sorry, there's a bug there (I forgot to use $idxs):

sub HoA_to_AoH {
my ($HoA) = @_;

my @keys = keys %{$HoA};
return [] if not @keys;

my @AoH = ();
my $nkeys = @keys;
my $nvals = @{$HoA-{$keys[0]}};
my $iter = indexes($nvals, $nkeys);
while (my $idxs = $iter-()) {
my %H = ();
my $i = 0;
for my $k (@keys) {
$H{$k} = $HoA-{$k}[$idxs-[$i]];
++$i;
}
push @AoH, \%H;
}

return [EMAIL PROTECTED];
}



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




Re: Transforming HoA into AoH

2005-10-31 Thread Gundala Viswanath
Hi John,
Thanks a lot for the answer.
But your code gives this instead:
$VAR1 = [
{
'2,3,jetsons' = 'george-1 foo-2'
},
{
'2,3,jetsons' = 'jane-1 bar-2'
},
{
'1,2,flintstones' = 'fred-1 foo-2'
},
{
'1,2,flintstones' = 'barney-1 bar-2'
}
];

Please correct me if I'm wrong in understanding your code
like this:

__BEGIN__
my $res = hoa2aoh_yours($HoA);
print Dumper $res;


sub hoa2aoh_yours
{
my ($HoA) = @_;
my $AoH;
while ( my ( $key, $val ) = each %$HoA )
{
push @$AoH, map +{ $key = $_ }, @$val;
}

return $AoH;
}
__END__

Let me give you another simpler example, given this
my $HoA2 = {
'flintstones' = [ fred, barney ],
'jetsons' = [ george, jane],
};

It should return this:
$VAR1 = [
{
'flintstones' = 'fred',
'jetsons' = 'george'
},
{
'flintstones' = 'fred',
'jetsons' = 'jane'
},
{
'flintstones' = 'barney',
'jetsons' = 'george'
},
{
'flintstones' = 'barney',
'jetsons' = 'jane'
}
];

The very first example still holds, it's just a bit more complex.

--Gundala


On 10/31/05, John W. Krahn [EMAIL PROTECTED] wrote:

 Gundala Viswanath wrote:
  Dear Sirs,

 Hello,

  I want to convert a HoA into AoH. Basically what it does
  is to create a distinct hash for each pair of array element that comes
  from different keys (see the example below).
 
  Please also note that the size of the hash and array maybe varying
  in the input HoA. And also note that the element of the array is
 actually
  a string that contain white space.
 
  Here is the example, given this HoA:
 
  my $HoA = {
  'flintstones' = [ fred-1 foo-2, barney-1 bar-2 ],
  'jetsons' = [ george-1 foo-2, jane-1 bar-2],
  };
 
 
  How can I convert them to an AoH
 
  my $AoH = [ # Desired results.
 
  {
  'flinstones' = fred-1 foo-2,
  'jetsons' = george-1 foo-2
  },
  {
  'flinstones' = fred-1 foo-2,
  'jetsons' = jane-1 bar-2
  },
  {
  'flinstones' = barney-1 bar-2,
  'jetsons' = george-1 foo-2
  },
  {
  'flinstones' = barney-1 bar-2,
  'jetsons' = jane-1 bar-2
  },
 
  ];

 my $AoH;
 while ( my ( $key, $val ) = each %$HoA ) {
 push @$AoH, map +{ $key = $_ }, @$val;
 }


 John
 --
 use Perl;
 program
 fulfillment

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





Re: How to change the Owner of a file

2005-10-31 Thread JupiterHost.Net



[EMAIL PROTECTED] wrote:

Hi folks


Hello,


Can any body tell me how to change the owner of a file ??

I have written this script ...

unless (chown $uid , $gid , $filename)
{
die chown failed :$!;
}


chown $uid, $gid, $filename or die chown failed: $!;


this code will give me the error you can't change  permission denied 
can any body tell me , how to over come this error


You must be have permission to chown the file and apparently you don't 
so you need to either:


 a) run the script as a user that does have permission
 b) ask whoever has permission of it to give you a copy or loosen its 
permissions for you.


The whole idea of permissions is to not let changes (IE chmod) be doen 
to a file by people who are nto allowed (IE you)


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




Re: How to change the Owner of a file

2005-10-31 Thread Shawn Corey

Rakesh Mishra wrote:

Hi folks
Can any body tell me how to change the owner of a file ??

I have written this script ...

unless (chown $uid , $gid , $filename)
{
die chown failed :$!;
}

this code will give me the error you can't change  permission denied 
can any body tell me , how to over come this error

bye
rakesh



Yes, you must the the recipient of the change, unless you have superuser 
privileges. In other words, you must be $uid. This is because many UNIX 
systems have quotas on how much data you can store. To borrow someone 
else's capacity, create your file and chown to someone who doesn't have 
much data stored. If it has read-access for everyone, you can get the 
file back by copying it. Unfortunately the new version of chown prevent 
this.


--

Just my 0.0002 million dollars worth,
   --- Shawn

Probability is now one. Any problems that are left are your own.
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

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




How to detect if the other end of the TCP connection has gone offline

2005-10-31 Thread Karjala
I'm writing a simple client-server application, and I'm trying to find a 
way to tell if the other end of an open TCP connection has gone offline.


I heard that with C you can send a packet of data and check if an ACK 
packet comes back. If it doesn't then the connection is closed. But how 
can that be done with Perl?


I'm using the IO::Socket library, but if Socket can do it, I'm 
willing to revert to that.


Thanks for your time,
- Karj.


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




Re: How to change the Owner of a file

2005-10-31 Thread Chris Devers
On Mon, 31 Oct 2005, Shawn Corey wrote:

 Yes, you must the the recipient of the change, unless you have 
 superuser privileges. In other words, you must be $uid. This is 
 because many UNIX systems have quotas on how much data you can store. 

What??

That's hardly why this constraint exists.

If anyone can make changes to any other account's files, then there's no 
point in having ownership constraints at all. 

This is the broad bedrock of Unix security. Managing user account quotas 
is only a small facet of that, but there's much more to it.

 To borrow someone else's capacity, create your file and chown to 
 someone who doesn't have much data stored. If it has read-access for 
 everyone, you can get the file back by copying it. Unfortunately the 
 new version of chown prevent this.

The new version of chown prevents what?

I'm sorry, I'm having trouble following you, but to the extent that I do 
understand, the description just skims the surface of what's going on. 

 * * * * * 

This topic is really beyond the scope of this list, but I'll try to do 
the short, short version of the topic.

On Unix systems -- Linux, OSX, Solaris, BSD, Irix, etc -- every file on 
the system has, among other things, two fundamental properties: 
ownership, and permissions. 

Every file belongs to a specific user account, and to a group.

Every file has access permissions pertaining to the user/owner, to the 
group, and to everyone else. 

The most obvious permissions are read, write, and execute; if you do a 
`ls -l` command, you'll see these represented as something like

  rwxrwxrwx  --  full permissions for everyone
  rwxr-xr-x  --  read/write/execute for owner, read/execute for others
  rw-rw-rw-  --  read/write for everyone, no execute for anyone
  r--r--r--  --  read-only access for everyone, no write/execute at all
  --x--x--x  --  execute-only for everyone, no read/write at all

Etc.

If someone else's file has group-read permission, and I'm in the same 
group, then I can read -- and so copy -- that file. If I'm not in the 
same group, but 'other'/'world' has read permission, then again I can 
read or copy the file. But if both group and world forbids access, or 
group permits it but I'm not in the right group, then I'm locked out, 
and cannot read or copy the file. That's it. Nothing about quotas.

Only the owner of a file, or an administrative user (root, or someone 
using sudo to grant themselves root access) can change permissions on a 
file. Only the admin / root user can reassign ownership from one account 
to another account. 

If non-admins could do these things, then you've defeated the whole 
point of this privilege separation, because anyone can do anything, and 
you're set back to Windows 95 level security -- i.e. none at all.

If this still doesn't make sense to you, then go find a good Unix book 
and spend half an hour reading the chapter on ownership  permissions. 
Two excellent ones are _Unix Power Tools_ (has a drill on the cover) and 
_Unix Administration Handbook_ (red or purple cover with a hand-drawn 
cartoon illustration; the _Linux Administration Handbok_ is most of the 
same material but has a green cover). 

 * * * * *

But, again, please don't come to the conclusion that this model has 
anything to do with quota management -- it's really the other way 
around. 

Saying that things work this way to support quotas is a bit like, I 
don't know, perhaps saying that American drivers drive on the right side 
of the road because that's the side with all the signage. Well, yes, 
that *is* the side with all the signage, but we don't drive on that side 
to make reading easier, we put the signs there because that's where all 
the drivers are. It's a side effect, not the original purpose.

Similarly, quota management is a *side effect* of the way permissions 
are set up -- they're something you get nearly for free once this 
framework is in place -- but they are not the primary purpose, nor is 
keeping them correct the primary motivation for why things work, or 
deliberately don't work in some contexts, the way they do.


-- 
Chris Devers

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




Re: How to detect if the other end of the TCP connection has gone offline

2005-10-31 Thread Jeff Pang
On client side, you can write:
$sock-shutdown(1);
to send an EOF to remote server.
When the server receive the EOF,it will end of writing socket to
client,and send back an EOF to client.At this point,the socket talks
between client and server have finished.






2005/10/31, Karjala [EMAIL PROTECTED]:
 I'm writing a simple client-server application, and I'm trying to find a
 way to tell if the other end of an open TCP connection has gone offline.

 I heard that with C you can send a packet of data and check if an ACK
 packet comes back. If it doesn't then the connection is closed. But how
 can that be done with Perl?

 I'm using the IO::Socket library, but if Socket can do it, I'm
 willing to revert to that.

 Thanks for your time,
 - Karj.


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




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




Perl Compile problems..

2005-10-31 Thread Travis Schwenke
I am new to Linux and trying to use some modules (even CGI.pm) and compile 
them for the Apache server I am playing with (educational purposes).  I am 
running Mandrivia 2006..

I am trying to compile a couple of modules and with both of them I get the 
same error.  I do:

perl Makefile.PL
make

then during the make process, I get

Manifying blib/man3/IO::String.3pm
Can't open blib/man3/IO::String.3pm for writing: Invalid argument
at /usr/lib/perl5/5.8.7/ExtUtils/Command/MM.pm line 126
make: *** [manifypods] Error 22

I have tried two different ones and get the same error. The one thing I 
noticed is that NOTHING exists in the man3 directory. In the case of this 
one, a file called String.pm does exist in the blib/lib/io directory. Same 
thing for the other one, the .pm files exist in the blib/lib/Image 
directory.  Also, I did have to modify the manifest because of CAPS vs. 
small on directory names.  The makefile did seem to generate with no errors. 
make test gives no errors either.

Any help would be greatly appreciated. 



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




Re: How to detect if the other end of the TCP connection has gone offline

2005-10-31 Thread Bob Showalter

Karjala wrote:
I'm writing a simple client-server application, and I'm trying to find a 
way to tell if the other end of an open TCP connection has gone offline.


If the other side has closed its end of the connection, you detect this 
by reading from the socket and receiving EOF (0 bytes read), or writing 
to the socket and getting SIGPIPE.


If the other side has crashed (not just process terminated, but server 
itself has crashed), or the network has gone down between the two, you 
either need to use some kind of timeout (based on what a reasonable 
response time would be), or use the SO_KEEPALIVE socket option. With the 
latter, the kernel will probe the remote side after some period of 
inactivity and shutdown the connection if the other side doesn't respond.


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




Re: How to change the Owner of a file

2005-10-31 Thread Shawn Corey

Chris Devers wrote:

What??

That's hardly why this constraint exists.

If anyone can make changes to any other account's files, then there's no 
point in having ownership constraints at all. 


Of course. I was being facetious.



The new version of chown prevents what?


New is a relative term. I have worked with systems where the /dev was 
writable by anyone and the raw devices readable! When I pointed this out 
to the sysadmin I was told it can't be changed since some of the system 
utilities require this; they didn't run in superuser mode. Needless to 
say (but I'm going to anyhow) I only kept what was absolutely necessary 
on that system. Modern systems haven't had this problem for decades and 
security is given much more consideration than back then.


And yes, back then chown worked exactly as I described; you could use it 
to borrow some else's quotas. Given the small size of the disks, this 
was not an uncommon practice.


BTW, (and this is really going to date me) I do have a copy of the B 
Language Manual.


--

Just my 0.0002 million dollars worth,
   --- Shawn

Probability is now one. Any problems that are left are your own.
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

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




Satya Sai is out of the office.

2005-10-31 Thread Satya_Sai

I will be out of the office starting  10/31/2005 and will not return until
11/07/2005.

I will respond to your message when I return.  Please contact
[EMAIL PROTECTED] or call DBA Hotline at 4477 for DBA assisstance.


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




Re: Perl Compile problems..

2005-10-31 Thread Travis Schwenke
A.  Sorry if the post shows up multiple times.  First time using news from 
this machine.  Setup was messed, but I think they might have made it through 
once I fixed it.

B.  I FIGURED it out!  Running from a FAT32 drive and the directory/filename 
CASE was incorrect causing the files to not be created in directories it 
couldn't find.  Moved everthing to a different mount and it worked fine.

Time to ditch the FAT32 drive (well, reformat it).

Travis Schwenke [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am new to Linux and trying to use some modules (even CGI.pm) and compile 
them for the Apache server I am playing with (educational purposes).  I am 
running Mandrivia 2006..

 I am trying to compile a couple of modules and with both of them I get the 
 same error.  I do:

 perl Makefile.PL
 make

 then during the make process, I get

 Manifying blib/man3/IO::String.3pm
 Can't open blib/man3/IO::String.3pm for writing: Invalid argument
 at /usr/lib/perl5/5.8.7/ExtUtils/Command/MM.pm line 126
 make: *** [manifypods] Error 22

 I have tried two different ones and get the same error. The one thing I 
 noticed is that NOTHING exists in the man3 directory. In the case of this 
 one, a file called String.pm does exist in the blib/lib/io directory. Same 
 thing for the other one, the .pm files exist in the blib/lib/Image 
 directory.  Also, I did have to modify the manifest because of CAPS vs. 
 small on directory names.  The makefile did seem to generate with no 
 errors. make test gives no errors either.

 Any help would be greatly appreciated.
 



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




Re: How to change the Owner of a file

2005-10-31 Thread Jay Savage
We're getting a little off topic here, but this is an interesting
discussion, and I think tangentially related: part of good programming
is understanding your security model, so...

On 10/31/05, Chris Devers [EMAIL PROTECTED] wrote:
 On Mon, 31 Oct 2005, Shawn Corey wrote:

  Yes, you must the the recipient of the change, unless you have
  superuser privileges. In other words, you must be $uid. This is
  because many UNIX systems have quotas on how much data you can store.

 What??

 That's hardly why this constraint exists.


Well, I don't have a commit bit for any of the kenrels involved, so I
wasn't part of the conversation when chown was changed, but quotas are
the first reason I've always heard given for changing the behavior.

 If anyone can make changes to any other account's files, then there's no
 point in having ownership constraints at all.

 This is the broad bedrock of Unix security. Managing user account quotas
 is only a small facet of that, but there's much more to it.

  To borrow someone else's capacity, create your file and chown to
  someone who doesn't have much data stored. If it has read-access for
  everyone, you can get the file back by copying it. Unfortunately the
  new version of chown prevent this.

 The new version of chown prevents what?


The new version prevents anyone but the superuser from changing a
file's ownership. Actually the change was to the chown and lchown
system calls in various kernels (I think Linux was the first, maybe
Solaris?) not to chown itself.

 I'm sorry, I'm having trouble following you, but to the extent that I do
 understand, the description just skims the surface of what's going on.

  * * * * *

 This topic is really beyond the scope of this list, but I'll try to do
 the short, short version of the topic.

 On Unix systems -- Linux, OSX, Solaris, BSD, Irix, etc -- every file on
 the system has, among other things, two fundamental properties:
 ownership, and permissions.

 Every file belongs to a specific user account, and to a group.

 Every file has access permissions pertaining to the user/owner, to the
 group, and to everyone else.

 The most obvious permissions are read, write, and execute; if you do a
 `ls -l` command, you'll see these represented as something like

   rwxrwxrwx  --  full permissions for everyone
   rwxr-xr-x  --  read/write/execute for owner, read/execute for others
   rw-rw-rw-  --  read/write for everyone, no execute for anyone
   r--r--r--  --  read-only access for everyone, no write/execute at all
   --x--x--x  --  execute-only for everyone, no read/write at all

 Etc.

 If someone else's file has group-read permission, and I'm in the same
 group, then I can read -- and so copy -- that file. If I'm not in the
 same group, but 'other'/'world' has read permission, then again I can
 read or copy the file. But if both group and world forbids access, or
 group permits it but I'm not in the right group, then I'm locked out,
 and cannot read or copy the file. That's it. Nothing about quotas.


But we're talking about ownership, not permissions.

 Only the owner of a file, or an administrative user (root, or someone
 using sudo to grant themselves root access) can change permissions on a
 file. Only the admin / root user can reassign ownership from one account
 to another account.


 If non-admins could do these things, then you've defeated the whole
 point of this privilege separation, because anyone can do anything, and
 you're set back to Windows 95 level security -- i.e. none at all.


This would be true if the issue were a user's ability to reassign
other people's files to themselves, which has never been possible. The
issue the OP is (presumably) interested in is reassigning his own
files to another user. If I want to give you a file, there's no more
risk in chowning it to you than in giving your group rwx perms, or
having you cp it, or for that matter emailing it to.  These two
workflows accomplish exactly the same thing:

1)
chmod g+r chrissfile;
chgrp chirs chrissfile;
mv chrissfile my_pub_dir;
write chris ttyp3
 hey! Your file's ready. Copy if from /home/jay/my_pub_dir ^d
sleep 600; # by which time you hopefully finish copying
rm my_pub_dir/chrissfile # get my space back

2)
chown chris:chris chrissfile;
mv chrissfile /home/chris/dropbox

 If this still doesn't make sense to you, then go find a good Unix book
 and spend half an hour reading the chapter on ownership  permissions.
 Two excellent ones are _Unix Power Tools_ (has a drill on the cover) and
 _Unix Administration Handbook_ (red or purple cover with a hand-drawn
 cartoon illustration; the _Linux Administration Handbok_ is most of the
 same material but has a green cover).

  * * * * *


I don't think Shawn is confused about how unix permissions work. What
doesn't make sense to him is why at some point in the last six years
or so all *ix vendors changed thier kernels to prevent non-privilaged
users from changnig file ownership flags on their own files 

Mail::Mailer

2005-10-31 Thread Matthew Sacks
Trying to use Mail::Mailer, in the sample code below.

i) if I put -T on the first line invoking Perl, I get
an error like too late for -T option
?

ii) The program runs but the mail never arrives. The
eval block checks always succeed.  Where is the mail
going?  

-matthew sacks



#!/usr/bin/perl
 
use warnings;
use strict;
 
use Mail::Mailer qw(sendmail);
 
my $mailer = new Mail::Mailer ('sendmail');
 
my %headers = (To = '[EMAIL PROTECTED]',
   From = '[EMAIL PROTECTED]',
   Subject = 'mail test');
eval {
$mailer-open(\%headers);
};
if ($@) {
   print the open failed: [EMAIL PROTECTED];
}
eval {
print $mailer This is the third test message.;
};
if ($@) {
   print the print failed: [EMAIL PROTECTED];
}
 
$mailer-close;



__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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




How to forward message to another number

2005-10-31 Thread K.Moeng
Hello.
I would like to forward the messages that get recived by this programme and 
send them to a different number.
Now how do i do that without sending to the person who sent the message.

Say the number is 26771445566.

Plus how can i make sure that the message is not empty from the sender.
Here are examples of a sender 

Sender TimeMessage
26771445566 11:01-12:00:00Please send me a Pizza 
with extra cheece plus 2 cokes and a hot dog.

regards



#!/usr/bin/perl -w
use DBI;

$dsn= dbi:mysql:db_pu:localhost;
my $user= mysql;
my $password = mysql123;
$dbh = DBI-connect($dsn,$user,$password);

##GET ARGS ##
$msg = $ARGV[1];
$source = $ARGV[0];

$msg =~ s/\/' /ig;  

$time = localtime();
open (OUTFILE ,C:\\logs\\pu.txt);
print OUTFILE $time\t$source\t$msg\n;
close(OUTFILE);

$found =1;
  {

 if ($found == 1)
  {

 $statement = insert into t_main (time_in, cli, msg) values 
(now(),'$source','$msg');
 $sth= $dbh-prepare($statement);
 $sth-execute;
 $sth-finish;

 print Thank you for sending your request. Give us 1 hour to process it. SAME 
DAY PULA ENERGY GAS DELIVERY.\n;
   }
  }
 $dbh-disconnect;