Thank you nkuipers for answering.

I already tried declaring variables with "my", i already checked the path, i
tested the hash with another name - all this doesn't make difference.

To me, it seems that my /etc/aliases.db in written in a format uncompatible
with the dbmopen().

I'm on the 17 chapter of the book "Learning Perl second edition" and I'm
stuck in this problem. (to open the /etc/aliases.db file for reading is an
exercise of the chapter 17).

If somebody there has a server runing Sendmail, you have the aliases.db file
too.

Moreover to simply solve this exercise, i'd like to know it the dbmopen()
really works with my system files.

Thanks for any help,
Bruno.


----- Original Message -----
From: "nkuipers" <[EMAIL PROTECTED]>
To: "Bruno Negrao - Perl List" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 12:30 PM
Subject: RE: dbmopen can't open /etc/aliases.db file


> >Uncaught exception from user code:
> >        No aliases!: Invalid argument at ./zz line 3.
>
> Well you have three arguments.  If you are *sure* that the undef is not
the
> problem, that leaves only two to possibly be invalid.  To start, try
battening
> down the hatches with use strict, predeclaring your vars with my.  Does
using
> a hash NOT called ALIAS make a difference (the implication being maybe
that is
> somehow a reserved identifier for hashes on your system or distro)?  Are
you
> *sure* that the path specified in the dbmopen call is 100% correct?  Dumb,
> dumb questions but most problems in programming turn out to be really
stupid,
> and it doesn't hurt to brainstorm and try anything.
>
>
> >
> >I must admit that the errors are shorter but the program still doesn't
> >work!!
> >Oh, hell!!!
> >
> >Thank you for any help,
> >bnegrao.
> >
> >
> >----- Original Message -----
> >From: "Michael Kelly" <[EMAIL PROTECTED]>
> >To: "Perl Beginners List" <[EMAIL PROTECTED]>
> >Sent: Friday, September 27, 2002 1:04 AM
> >Subject: Re: dbmopen can't open /etc/aliases.db file
> >
> >
> >> On Thu, Sep 26, 2002 at 09:38:18PM -0300, Bruno Negrao - Perl List
wrote:
> >> > Hi,
> >>
> >> Hi Bruno,
> >>
> >> > I'm triyng to open the /etc/aliases.db file for reading with the
dbmopen
> >> > function - the result is that I can't open the file for reading, or
> >> > something like this. yes, I have permission because I'm root.
> >> >
> >> > My script is:
> >> > #!/usr/bin/perl -w
> >> > use diagnostics;
> >> > dbmopen(%ALIAS,'/etc/aliases',undef) ||
> >> >     die "No aliases!: $!";
> >> > while (($key,$value) = each(%ALIAS)) {
> >> >     chop($key,$value);
> >> >     print "$key $value\n";
> >> > }
> >>
> >> Disclaimer: I've never messed around with dbmopen() before, so I can't
> >test this
> >> example, but seeing as nobody with more authority has answered this
yet,
> >I'll
> >> give it a shot:
> >>
> >> dbmopen() expects a file permission mask (an octal number) as its third
> >argument,
> >> which 'undef' is not. You might try something like this as your lines 3
> >and 4:
> >>
> >> dbmopen(%ALIAS,'/etc/aliases', 0644) ||
> >>     die "No aliases!: $!";
> >>
> >> Even if you're sure /etc/aliases is there, that should make dbmopen()
> >happy.
> >>
> >> Again, not sure if that's the answer, but it seems logical to me,
> >> --
> >> Michael
> >>
> >> --
> >> 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]

Reply via email to