[27179] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9005 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 28 21:05:33 2006

Date: Tue, 28 Feb 2006 18:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 28 Feb 2006     Volume: 10 Number: 9005

Today's topics:
        Problems with chmod <mdudley@king-cart.com>
    Re: Problems with chmod <glex_no-spam@qwest-spam-no.invalid>
        quote causing DBD::CSV failure <Mark.Fenbers@noaa.gov>
    Re: quote causing DBD::CSV failure xhoster@gmail.com
    Re: quote causing DBD::CSV failure <Mark.Fenbers@noaa.gov>
    Re: simple pointer operations (newbe) robic0
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 28 Feb 2006 18:23:35 -0500
From: Marshall Dudley <mdudley@king-cart.com>
Subject: Problems with chmod
Message-Id: <4404DB77.E787EFED@king-cart.com>

I am having problems with chmod not setting the mode as requested.

Platform - FreeBSD 4.8-RELEASE
perl - perl, version 5.005_03 built for i386-freebsd

Using the following two lines with $name = "mdtest":

        chmod 0600,
"/usr/cataris/$name/admin_files/password","usr/cataris/$name/customers/customer.db",
"/usr/cataris/$name/data_files/data.file";
        $mode = 0777; chmod $mode,
"/usr/cataris/$name/password","/usr/cataris/$name/startdate";

I get the following permissions:

execonn# pwd
/usr/cataris/mdtest
execonn# ls -l admin_files
total 42
-rw-r--r--  1 nobody  cataris    225 Feb 28 14:39 Offline-user_lib.pl
-rw-r--r--  1 nobody  cataris    254 Feb 28 14:39 PayPal-IPN-user_lib.pl

-rw-r--r--  1 nobody  cataris    177 Feb 28 14:39 PayPal-user_lib.pl
-rw-r--r--  1 nobody  cataris   1456 Feb 28 14:39 commerce_user_lib.pl
-rw-------  1 nobody  cataris      0 Feb 28 14:39 password    CORRECT
-rw-r--r--  1 nobody  cataris  33179 Feb 28 14:39 shipping.db
execonn# pwd
/usr/cataris/mdtest
execonn# ls -l customers
total 0
-rw-r--r--  1 nobody  cataris  0 Feb 28 14:39 customer.db  WRONG, should
have been -rw-------
execonn# ls -l data_files
total 0
-rw-------  1 nobody  cataris  0 Feb 28 14:39 data.file  CORRECT
execonn# ls -l
total 20
drwx------  2 nobody  cataris  512 Feb 28 14:39 admin_files
drwx------  2 nobody  cataris  512 Feb 28 14:39 customers
drwx------  2 nobody  cataris  512 Feb 28 14:39 data_files
drwx------  2 nobody  cataris  512 Feb 28 14:39 files
drwx------  5 nobody  cataris  512 Feb 28 14:39 html
drwx------  2 nobody  cataris  512 Feb 28 14:39 log_files
-rw-r--r--  1 nobody  cataris  221 Feb 28 14:39 password  WRONG should
have been RWXRWXRWX
drwx------  2 nobody  cataris  512 Feb 28 14:39 shopping_carts
-rwxrwxrwx  1 nobody  cataris   11 Feb 28 14:39 startdate CORRECT
drwx------  2 nobody  cataris  512 Feb 28 14:39 upload
execonn#

As you can see the admin_files/password and data_files/data.file were
set correctly to 600 and the startdate was set correctly to 777, but the
password and customers/customer.db were both set incorrectly to 644.  I
have tried different variations, and even tried only one file per
command, but invariable some are set wrong no matter what I do, and when
set wrong they seem to always set to 644, no matter what was asked for.

Anyone have any ideas, I have tried every form of the command I can find
in examples and docs, but they all mess up sometimes.  If I change the
second line to 0660, then both files end up getting set to 644 instead.

Thanks,

Marshall



------------------------------

Date: Tue, 28 Feb 2006 17:38:23 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Problems with chmod
Message-Id: <Q95Nf.23$917.905@news.uswest.net>

Marshall Dudley wrote:
> I am having problems with chmod not setting the mode as requested.
> 
> Platform - FreeBSD 4.8-RELEASE
> perl - perl, version 5.005_03 built for i386-freebsd
> 
> Using the following two lines with $name = "mdtest":
> 
>         chmod 0600,
> "/usr/cataris/$name/admin_files/password","usr/cataris/$name/customers/customer.db",
                                              ^ missing a / here?
> "/usr/cataris/$name/data_files/data.file";
>         $mode = 0777; chmod $mode,
> "/usr/cataris/$name/password","/usr/cataris/$name/startdate";
> 
> I get the following permissions:
> 
> execonn# pwd
> /usr/cataris/mdtest
> execonn# ls -l admin_files
> total 42
> -rw-r--r--  1 nobody  cataris    225 Feb 28 14:39 Offline-user_lib.pl
> -rw-r--r--  1 nobody  cataris    254 Feb 28 14:39 PayPal-IPN-user_lib.pl
> 
> -rw-r--r--  1 nobody  cataris    177 Feb 28 14:39 PayPal-user_lib.pl
> -rw-r--r--  1 nobody  cataris   1456 Feb 28 14:39 commerce_user_lib.pl
> -rw-------  1 nobody  cataris      0 Feb 28 14:39 password    CORRECT
> -rw-r--r--  1 nobody  cataris  33179 Feb 28 14:39 shipping.db
> execonn# pwd
> /usr/cataris/mdtest
> execonn# ls -l customers
> total 0
> -rw-r--r--  1 nobody  cataris  0 Feb 28 14:39 customer.db  WRONG, should
> have been -rw-------
> execonn# ls -l data_files
> total 0
> -rw-------  1 nobody  cataris  0 Feb 28 14:39 data.file  CORRECT

> -rw-r--r--  1 nobody  cataris  221 Feb 28 14:39 password  WRONG should
> have been RWXRWXRWX

This is in the data_files directory, which I don't see in the second 
chmod above.

Maybe run each chmod separately, doing some error checking to make sure 
it was successful.  I think it's just an issue with your paths.


------------------------------

Date: Tue, 28 Feb 2006 18:42:46 -0500
From: Mark <Mark.Fenbers@noaa.gov>
Subject: quote causing DBD::CSV failure
Message-Id: <du2pfk$hs1$1@news.nems.noaa.gov>

(I don't seem to be able to prohibit the data portion below from 
line-wrapping -- Sorry!)

Below is a Perl script followed by the data it is reading (to be in a 
file called "./data/location".  The data portion has a line used as 
column headings, followed by 10 lines of data.  The 9th line of data has 
some double quotes in one of the fields.  This ceases the reading of the 
data at line 8.  I have no idea why.  I tried adding csv_escape => '"' 
and csv_quote => '"' to the connect function, but these seem to have no 
effect.  If I remove the quote from the file, all 10 lines are read and 
printed.  In fact, all 11,000 lines of the full-length version of 
location will be read in and printed, but the quotes halt it wherever 
they are encountered.  I'm stupified!  Please offer helpful suggestions 
in this regard.  (DBD::CSV 0.22)   (SQL::Statement 1.14), and 
(Text::CSV_XS 0.23)

Mark

______________________________________________________________________
#!/usr/bin/perl -w

use strict;
use DBI;

my $dbstr = 'DBI:CSV:f_dir=data';
my $dbh = DBI->connect($dbstr,undef,undef,
		{ChopBlanks => 1,PrintWarn => 1,
		PrintError => 0,RaiseError => 1,
		csv_eol => "\n",csv_sep_char => '|'}
	);

my $sql = "SELECT * FROM location ORDER BY lid";
my $sth = $dbh->prepare("$sql");

if(defined($sth)) {
	$sth->execute();
}

my $data = $sth->fetchall_arrayref;
$sth->finish();
$dbh->disconnect();

if(defined $data) {
	print "\$data is defined.  Number of records = " . 		
		scalar @$data . "\n"; }
else { print "\$data is undefined\n"; }	

my $i = 0;
foreach (@$data) {
	print "$i: " . (join ', ',@$_) . "\n";
	$i++;
}

exit;
__END__

lid|county|coe|cpm|detail|elev|hdatum|hsa|hu|lat|lon|lremark|lrevise|name|network|rb|rfc|sbd|sn|state|waro|wfo|wsfo|type|des|det|post|stntype|tzone
06C|Unk|||at|0||LOT||41.9844444444444|88.0980555555556|||Chicago/Schaumburg|Unk||Unk|||IL||LOT|||||1||CST6CDT
GNCK2|Gallatin|||at|0||ILN||38.705|84.8238888888889|Eagle 
Creek|2005-03-02|Glencoe|Unk|Ohio River 
(OHL)|OHRFC|||KY||ILN|||GLENCOE|Eagle Creek|1|3000|EST5EDT
WNSI2|Shelby|||7 
SE|0||ILX||39.3594444444444|88.5058333333333||2005-05-11|Windsor|Unk|Little 
Wabash (LWA)|OHRFC|||IL||ILX|||WINDSOR 7SE||1|9000|CST6CDT
LNBO1|Washington|||at|0||RLX||39.5630555555556|81.2038888888889|Little 
Muskingum River at Bloomfield, OH.||Bloomfield|Unk|Huntington Segment - 
Ohio|OHRFC|||OH||RLX|||Bloomfield||1||EST5EDT
07S|Unk|||at|||Unk||47.9667|117.433||||Unk||Unk|||XX||Unk|||||0|ASOS|EST5EDT
CLE1412|Ashtabula||||||CLE||41.53|80.53|PAUL MECHLING, 
440-577-1111||PIERPONT 2SE|Unk||OHRFC|||OH||CLE|||||1||EST5EDT
CLE1414|Ashtabula||||||CLE||41.85|80.8|COOP, 
n/a||ASHTABULA|Unk||OHRFC|||OH||CLE|||||1||EST5EDT
CLE1415|Ashtabula||||||CLE||41.68|80.67|COOP, 
n/a||DORSET|Unk||OHRFC|||OH||CLE|||||1||EST5EDT
OPKW2|Monongalia|||1 
N|860||PBZ||39.5644444444444|80.0491666666667|Monongahela River at 
Opekiska Lock|2005-02-10|Opekiska|Unk|Monongahela 
River|OHRFC|||WV||PBZ|||OPEKISKA 1N|39d33'52" -80d02'57"|1|3000|EST5EDT
22G|Unk|||at|0||CLE||41.3441666666667|82.1777777777778|||Lorain/Elyria|Unk||OHRFC|||OH||CLE|||||1|ASOS|EST5EDT


------------------------------

Date: 01 Mar 2006 01:46:53 GMT
From: xhoster@gmail.com
Subject: Re: quote causing DBD::CSV failure
Message-Id: <20060228205033.938$wo@newsreader.com>

Mark <Mark.Fenbers@noaa.gov> wrote:
> (I don't seem to be able to prohibit the data portion below from
> line-wrapping -- Sorry!)
>
> Below is a Perl script followed by the data it is reading (to be in a
> file called "./data/location".  The data portion has a line used as
> column headings, followed by 10 lines of data.  The 9th line of data has
> some double quotes in one of the fields.  This ceases the reading of the
> data at line 8.  I have no idea why.  I tried adding csv_escape => '"'
> and csv_quote => '"' to the connect function, but these seem to have no
> effect.

Those are already the default values, so of course that has no effect.
What you need to do *unset* them, as the " character is, in your data, not
used to escape thing and is not used to quote things.

> my $dbstr = 'DBI:CSV:f_dir=data';

my $dbstr = 'DBI:CSV:f_dir=data;csv_quote_char=;csv_escape_char=';

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: Tue, 28 Feb 2006 20:59:31 -0500
From: Mark <Mark.Fenbers@noaa.gov>
To: xhoster@gmail.com
Subject: Re: quote causing DBD::CSV failure
Message-Id: <44050003.8040007@noaa.gov>


> my $dbstr = 'DBI:CSV:f_dir=data;csv_quote_char=;csv_escape_char=';
> 

Actually, I like your solution better because I do not have to 
preprocess my file to change " into "".

Mark


------------------------------

Date: Tue, 28 Feb 2006 16:24:19 -0800
From: robic0
Subject: Re: simple pointer operations (newbe)
Message-Id: <mqp9021sr0i9g8f2uff1qh2hh2vnht81am@4ax.com>

On 25 Feb 2006 16:24:27 GMT, Abigail <abigail@abigail.nl> wrote:

>Dirk Lehmann (ldirk@cs.tu-berlin.de) wrote on MMMMDLXI September MCMXCIII
>in <URL:news:dtpr2b$cvo$01$1@news.t-online.com>:
>:)  
>:)  It wasn't the complete code:
>:)  
>:)  ######
>:)  #!/usr/local/bin/perl -w
>:)  
>:)  use strict;
>:)  
>:)  my $a = \12345;
>:)  print "\$a points to address $a and their is $$a\n\n";
>:)  
>:)  my $b = [reverse(10..15)]; #equal to '$b = \(reverse(10..15))'
>
>Eh, no. 
>
>    $ perl -wle '$b = [reverse (10 .. 15)]; print ref $b'
>    ARRAY
>    $ perl -wle '$b = \(reverse (10 .. 15)); print ref $b'
>    SCALAR
>
>
>
>Once again, Perl has references. Not pointers. And while the
>stringification of a reference of an array contains a memory address,

A memory address, really? A physical memory address, or a virtual address
within the process space? 

>and that memory address is indeed the address of the array,

Really? How would you know that? Is it something percolated up from the
Perl C core?

>address of the first element.

How can an address be known in Perl script? A literal number
isin't an address!

> It's the address of a struct (the array)

No it isin't. If its a number, its an index.

>of which one element points to an array of pointers of structures
>containing scalars.
>
>Perl is not C.

Right! Perl isin't C! If you program in C you may be used to thinking
in terms of addresses and contents. Just make sure you know what forum
your in. 

robic0
>
>
>
>Abigail



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9005
***************************************


home help back first fref pref prev next nref lref last post