[23792] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5995 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 29 18:17:54 2004

Date: Thu, 29 Jan 2004 15:17:22 -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           Thu, 29 Jan 2004     Volume: 10 Number: 5995

Today's topics:
        10 lines revisited <todd@asgweb.net>
    Re: 10 lines revisited <jwillmore@remove.adelphia.net>
    Re: 10 lines revisited <1usa@llenroc.ude>
    Re: 10 lines revisited <tadmc@augustmail.com>
    Re: 10 lines revisited <tadmc@augustmail.com>
    Re: 10 lines revisited <usenet@morrow.me.uk>
    Re: 10 lines revisited <jwillmore@remove.adelphia.net>
    Re: 10 lines revisited <1usa@llenroc.ude>
    Re: 10 lines revisited <1usa@llenroc.ude>
    Re: 10 lines revisited <nospam@bigpond.com>
    Re: 10 lines revisited (Anno Siegel)
    Re: 10 lines revisited <tadmc@augustmail.com>
    Re: 10 lines revisited (Mark Jason Dominus)
    Re: 10 lines revisited <flavell@ph.gla.ac.uk>
    Re: 10 lines revisited (Mark Jason Dominus)
        [p&s] þÔÏ ÚÁ ÎÁÆÉÇ <Andrew.I.Triapitsin@p98.f6.n5004.z2.fidonet.org>
        __LINE__ variable containing an incorrect value <newsgroups@christophedavid.org>
    Re: __LINE__ variable containing an incorrect value (Mark Jason Dominus)
    Re: __LINE__ variable containing an incorrect value <newsgroups@christophedavid.org>
    Re: __LINE__ variable containing an incorrect value <skweek@no.spam>
    Re: Access-Zugriff mit Perl <mgjv@tradingpost.com.au>
    Re: Access-Zugriff mit Perl <founder@pege.org>
        adding existing nt user to nt global group (Arun)
    Re: adding existing nt user to nt global group <matthew.garrish@sympatico.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 21 Jan 2004 12:57:19 -0700
From: Todd Anderson <todd@asgweb.net>
Subject: 10 lines revisited
Message-Id: <400ED975.E1EB5DFD@asgweb.net>

Hello,
Because my host times out a script after 60 seconds, I created a cronjob
that prompts my script every minute. When started it counts the number
of lines in a flat file divides it by 10 to determine how many times it
will take to finish the billing ($number_of_sends). Then each time it's
prompted it processes 10 lines at a time ie: @billingnumber =
(351..360); and deducts the $number_of_sends by 1 for the next prompt.
This all works fine but I can't quite figure out how to get it to
recognize the 10 lines to process. Below is what I have. It is working
but it's also multiplying every line by 10.
Thanks in advance for any help.
(please NO rectal discharge)

$e_number = "0";
  open (USERS, "$file") || billerror
        ("$file Billing Notice" );
            flock(USERS, 2);
  while (<USERS>)
    {
    $line = $_;
    chomp $line;
    @fields = split (/\|/, $line);
        $e_number++;
        foreach $billingnumber (@billingnumber){
            if ($billingnumber eq "$e_number"){

            #do a bunch of stuff to these lines

             }#e_number
            else{ $hold_row .="$line\n"; }
        }#@billingnumber
}#while
 flock(USERS, 8);
  close (USERS);




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

Date: Wed, 21 Jan 2004 20:29:17 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: 10 lines revisited
Message-Id: <pan.2004.01.21.20.29.15.824762@remove.adelphia.net>

On Wed, 21 Jan 2004 12:57:19 -0700, Todd Anderson wrote:

> Hello,
> Because my host times out a script after 60 seconds, I created a cronjob
> that prompts my script every minute. When started it counts the number
> of lines in a flat file divides it by 10 to determine how many times it
> will take to finish the billing ($number_of_sends). Then each time it's
> prompted it processes 10 lines at a time ie: @billingnumber =
> (351..360); and deducts the $number_of_sends by 1 for the next prompt.
> This all works fine but I can't quite figure out how to get it to
> recognize the 10 lines to process. Below is what I have. It is working
> but it's also multiplying every line by 10.
> Thanks in advance for any help.
> (please NO rectal discharge)
> 
> $e_number = "0";
>   open (USERS, "$file") || billerror
>         ("$file Billing Notice" );
>             flock(USERS, 2);
>   while (<USERS>)
>     {
>     $line = $_;
>     chomp $line;
>     @fields = split (/\|/, $line);
>         $e_number++;
>         foreach $billingnumber (@billingnumber){
>             if ($billingnumber eq "$e_number"){
> 
>             #do a bunch of stuff to these lines
> 
>              }#e_number
>             else{ $hold_row .="$line\n"; }
>         }#@billingnumber
> }#while
>  flock(USERS, 8);
>   close (USERS);

One of the things you may want to think about using is the "$." operator. 
It holds the current line number of the file being proccessed.  This
mitigates the need to read the whole file into an array when doing the
processing.  So, when reading the file you could do something like
(untested):

while(<FILE>){
    next unless ($. >= 1);
    ... do whatever to the current line ....
    last if ($. == 10);
}

So, in summary .....

- if the current line is equal to or greater than the line you need, do
something with the file
- process the line if we need to and it matches the lower end of the
criteria
- after you process the line (if required), break out of the while with
the 'last' if we reached the last line we wish to process.

Hope I explained this is such a way as you can understand and you can use
this in your script.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Serocki's Stricture:  Marriage is always a bachelor's last
option. 



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

Date: 21 Jan 2004 21:00:11 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: 10 lines revisited
Message-Id: <Xns9477A2CB98985asu1cornelledu@132.236.56.8>

Todd Anderson <todd@asgweb.net> wrote in 
news:400ED975.E1EB5DFD@asgweb.net:

> (please NO rectal discharge)

What is it about "a minimal self contained example others can compile and 
run" that is so hard to understand?

In the absence of relevant information to solving whatever your problem 
is, here is an untested script which you can call with:

 ./showlines.pl filename 5 10

to show lines 5 to 10 in a file called filename:

#! /usr/bin/perl

use strict;
use warnings;

use Fcntl qw(:seek :flock);

my ($fn, $start, $end) = @ARGV;
if( $start > $end) { ($start, $end) = ($end, $start); }

open my $FILE, '<', $fn or die "Cannot open $fn: $!";

flock $FILE, LOCK_SH;
seek $FILE, 0, SEEK_SET 
    or die "Cannot seek to beginning of $FILE: $!";

while( $. < $start - 1 ) { <$FILE>; }
while( $. < $end ) { print $., ': ', scalar <$FILE>; }

flock $FILE, LOCK_UN;

__END__



-- 
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)


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

Date: Wed, 21 Jan 2004 14:56:58 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: 10 lines revisited
Message-Id: <slrnc0tpsq.7m0.tadmc@magna.augustmail.com>

Todd Anderson <todd@asgweb.net> wrote:


> $e_number = "0";


If you intend for it to be a number, then do not force it to be a string.

You should always have "use strict" enabled.


   my $e_number = 0;


>   open (USERS, "$file") || billerror


   perldoc -q vars

       What's wrong with always quoting "$vars"?


>             flock(USERS, 2);


You should import the constants, they can be different on 
different platforms.

You should check the return value to see if you actually
got what you asked for.


>   while (<USERS>)
>     {
>     $line = $_;


If you want it in $line, then put it into $line straightaway:

   while ( my $line = <USERS> )


>     chomp $line;

>             if ($billingnumber eq "$e_number"){


       What's wrong with always quoting "$vars"?

You are using the wrong operator. 

eq is for testing strings.

== is for testing numbers.


>             else{ $hold_row .="$line\n"; }


Why chomp() the newline off only to put it back in again/


>  flock(USERS, 8);


You should never unlock the file.

You have created a race here...


>   close (USERS);


close() will release the lock for you.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 21 Jan 2004 15:00:50 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: 10 lines revisited
Message-Id: <slrnc0tq42.7mr.tadmc@magna.augustmail.com>

James Willmore <jwillmore@remove.adelphia.net> wrote:
> On Wed, 21 Jan 2004 12:57:19 -0700, Todd Anderson wrote:


>> (please NO rectal discharge)


> One of the things you may want to think about using is the "$." operator. 


If this is the same "Todd Anderson", then he heard that 
already 3 years ago...


   Message-Id: <slrn92dp32.7rk.tadmc@magna.metronet.com>


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 21 Jan 2004 21:04:43 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: 10 lines revisited
Message-Id: <bumphb$f6k$1@wisteria.csv.warwick.ac.uk>


Todd Anderson <todd@asgweb.net> wrote:

use strict;
use warnings;

use Fcntl qw/:flock/;

> $e_number = "0";

my $e_number;

If you must initialise it, initialise it to 0 rather than "0"; but
undef is just fine.

>   open (USERS, "$file") || billerror
>         ("$file Billing Notice" );

open (my $USERS, $file) || billerror(...);

or, preferably

open my $USERS, $file or billerror(...);

I presume billerror() includes $! in its output?

>             flock(USERS, 2);

flock(USERS, LOCK_EX) or billerror("can't lock $file");

>   while (<USERS>)
>     {
>     $line = $_;

Why? What's wrong with $_?

>     chomp $line;
>     @fields = split (/\|/, $line);

my ...;

>         $e_number++;

As someone else said, use $.; alternatively, I would use Tie::File.

>         foreach $billingnumber (@billingnumber){

foreach my $billingnumber (@billingnumber) {

>             if ($billingnumber eq "$e_number"){

You certainly don't need the ""; and you probably meant to write

if ($billingnumber == $e_number) {

> 
>             #do a bunch of stuff to these lines
> 
>              }#e_number
>             else{ $hold_row .="$line\n"; }
>         }#@billingnumber
> }#while
>  flock(USERS, 8);

An explicit call to flock(..., LOCK_UN) is almost always a bug. The
lock will be released when the handle is closed.

>   close (USERS);

If you use open my $USERS, ... above you don't need to call close: the
handle will be closed when it goes out of scope.

Ben

-- 
perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
2047502190/'                                                 # ben@morrow.me.uk


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

Date: Wed, 21 Jan 2004 21:07:04 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: 10 lines revisited
Message-Id: <pan.2004.01.21.21.07.03.31575@remove.adelphia.net>

On Wed, 21 Jan 2004 15:00:50 -0600, Tad McClellan wrote:

> James Willmore <jwillmore@remove.adelphia.net> wrote:
>> On Wed, 21 Jan 2004 12:57:19 -0700, Todd Anderson wrote:
> 
> 
>>> (please NO rectal discharge)
> 
> 
>> One of the things you may want to think about using is the "$." operator. 
> 
> 
> If this is the same "Todd Anderson", then he heard that 
> already 3 years ago...
> 
> 
>    Message-Id: <slrn92dp32.7rk.tadmc@magna.metronet.com>

Ah .... that explains the final comment he made.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Tact is the ability to tell a man he has an open mind when he has
a hole in his head. 



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

Date: 21 Jan 2004 21:13:29 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: 10 lines revisited
Message-Id: <Xns9477A50C58D88asu1cornelledu@132.236.56.8>

Tad McClellan <tadmc@augustmail.com> wrote in
news:slrnc0tq42.7mr.tadmc@magna.augustmail.com: 

> James Willmore <jwillmore@remove.adelphia.net> wrote:
>> On Wed, 21 Jan 2004 12:57:19 -0700, Todd Anderson wrote:
> 
> 
>>> (please NO rectal discharge)
> 
> 
>> One of the things you may want to think about using is the "$."
>> operator. 
> 
> 
> If this is the same "Todd Anderson", then he heard that 
> already 3 years ago...
> 
> 
>    Message-Id: <slrn92dp32.7rk.tadmc@magna.metronet.com>

Tad, I am so impressed. It is amazing he has not even changed the code 
since then.

Sinan
-- 
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)


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

Date: 21 Jan 2004 21:15:11 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: 10 lines revisited
Message-Id: <Xns9477A556035D1asu1cornelledu@132.236.56.8>

"A. Sinan Unur" <1usa@llenroc.ude> wrote in
news:Xns9477A2CB98985asu1cornelledu@132.236.56.8: 

> flock $FILE, LOCK_UN;

Please disregard. Thanks to Tad's post, I now realize this is a bad idea.

Sinan.

-- 
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)


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

Date: Thu, 22 Jan 2004 12:26:25 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: 10 lines revisited
Message-Id: <bunce8$jo7d6$2@ID-202028.news.uni-berlin.de>

Todd Anderson wrote:

> Hello,
> Because my host times out a script after 60 seconds,

You many want to consider hosts with User Mode Linux which are now cheap,
have root access, and you can set up Perl/Apache any way you want.
http://user-mode-linux.sourceforge.net/uses.html

gtoomey


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

Date: 22 Jan 2004 11:27:52 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: 10 lines revisited
Message-Id: <buoc3o$6t8$5@mamenchi.zrz.TU-Berlin.DE>

Todd Anderson  <todd@asgweb.net> wrote in comp.lang.perl.misc:
> Hello,

[question snipped]

> Thanks in advance for any help.
> (please NO rectal discharge)

That's a rude thing to say when you are asking strangers for help, don't
you think?

Anno


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

Date: Thu, 22 Jan 2004 07:47:25 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: 10 lines revisited
Message-Id: <slrnc0vl3d.9hb.tadmc@magna.augustmail.com>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Todd Anderson  <todd@asgweb.net> wrote in comp.lang.perl.misc:
>> Hello,
> 
> [question snipped]
> 
>> Thanks in advance for any help.
>> (please NO rectal discharge)
> 
> That's a rude thing to say when you are asking strangers for help, don't
> you think?


It was like a little sign on his post:

   I've been flamed here before. Don't do it again.


In other words: do it my way, don't do it your long-established way.

Pffft!


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 24 Jan 2004 18:22:21 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: 10 lines revisited
Message-Id: <buud4t$p0p$1@plover.com>

In article <slrnc0tpsq.7m0.tadmc@magna.augustmail.com>,
Tad McClellan  <tadmc@augustmail.com> wrote:
>>  flock(USERS, 8);
>
>
>You should never unlock the file.
>
>You have created a race here...

Since Perl 5.6.0 (March 2000), Perl automatically flushes the handle
before unlocking the file.  I think this solves the race problem.



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

Date: Sat, 24 Jan 2004 18:35:43 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: 10 lines revisited
Message-Id: <Pine.LNX.4.53.0401241830030.20482@ppepc56.ph.gla.ac.uk>

On Sat, 24 Jan 2004, Mark Jason Dominus wrote:

> Since Perl 5.6.0 (March 2000), Perl automatically flushes the handle
> before unlocking the file.  I think this solves the race problem.

But, with respect, when one sees someone unlocking a file, it's
usually a good moment for closing it.  It appears that this particular
example code had in fact opened the file, right before flocking it.

It would seem kind-of symmetrical that when the code was done with the
file, it would be a good moment to close it, no?  And that in itself
will release the lock.  Irrespective of whether unlocking is, in and
of itself, apt to produce a race condition at this point.

Am I wrong?


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

Date: Sun, 25 Jan 2004 08:09:39 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: 10 lines revisited
Message-Id: <buvtk3$qs3$1@plover.com>

In article <Pine.LNX.4.53.0401241830030.20482@ppepc56.ph.gla.ac.uk>,
Alan J. Flavell <flavell@ph.gla.ac.uk> wrote:
>Am I wrong?

I don't know, but I agree with everyhthing you said.



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

Date: Wed, 28 Jan 2004 18:40:33 +0300
From: Andrew I Triapitsin <Andrew.I.Triapitsin@p98.f6.n5004.z2.fidonet.org>
Subject: [p&s] þÔÏ ÚÁ ÎÁÆÉÇ
Message-Id: <1075315342@p98.f6.n5004.z2.ftn>

www.livejournal.com/users/am_baal  ati-hq(at)narod.ru  ICQ:55482457
Aye, All


þÉÔÁÅÍ ÏÐÉÓÁÎÉÅ Minolta G500 ÎÁ foto.ru

÷ÉÄÉÍ ÔÁÍ ÓÌÏ×Á Ï ÐÏÄÄÅpÖËÅ SD & Memory Stick (!!!). õ ÍÏÎÉËÉ ÓÏ×ÓÅÍ ÞÔÏÌÉ
ÂÁÛÎÑ ÓßÅÈÁÌÁ, ÏÎÉ ÂÙ ÅÝÅ ÓÍÁpÔÍÅÄÉÀ ÔyÄÁ ÚÁÓyÎyÌÉ ? HÉÆÉÇÁ ÎÅ ÐÏÎÉÍÁÀ.
õÝÅpÂÎÏÓÔØ Ó×ÏÅÇÏ ÍÏÎÓÔpÁ ÐÏÎÉÍÁÅÔ ÄÁÖÅ ÓÏÎÉ, ÞÔÏ Ñ×ÎÏ ×ÉÄÎÏ ÉÚ 828.

Boo
NP: The Doors - When The Music's Over



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

Date: Sun, 25 Jan 2004 19:44:57 +0100
From: "Christophe David" <newsgroups@christophedavid.org>
Subject: __LINE__ variable containing an incorrect value
Message-Id: <WYOdnbfWbJ0xk4ndRVn2iw@giganews.com>

The output of the script below is :
    "died at __LINE__ = 11 at ./test_lines.pl line 10.

when I would expect :
    "died at __LINE__ = 9 at ./test_lines.pl line 9.

Running 5.8.0 on Linux and WIndows XP

Any clue ?

1> if    (0) {die('died at', '__LINE__ = ', __LINE__);}
2> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
3> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
4> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
5> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
6> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
7> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
8> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
9> elsif (1) {die('died at', '__LINE__ = ', __LINE__);}
10> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
11> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
12> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
13> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
14> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
15> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
16> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
17> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
18> elsif (0) {die('died at', '__LINE__ = ', __LINE__);}
19> else      {die('died at', '__LINE__ = ', __LINE__);}

---




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

Date: Sun, 25 Jan 2004 18:55:59 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: __LINE__ variable containing an incorrect value
Message-Id: <bv13fv$jf2$1@plover.com>

In article <WYOdnbfWbJ0xk4ndRVn2iw@giganews.com>,
Christophe David <newsgroups@christophedavid.org> wrote:
>when I would expect :
>    "died at __LINE__ = 9 at ./test_lines.pl line 9.
>
>Running 5.8.0 on Linux and WIndows XP

I have "died at __LINE__ = 9 at ./test_lines.pl line 9."
with "This is perl, v5.8.0 built for i586-linux".

>Any clue ?

I hope you won't be offended if I ask you if you're sure there aren't
two blank lines at the top of the file?




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

Date: Sun, 25 Jan 2004 20:04:55 +0100
From: "Christophe David" <newsgroups@christophedavid.org>
Subject: Re: __LINE__ variable containing an incorrect value
Message-Id: <wM-dnYYZoJn9jondRVn2tg@giganews.com>

> I have "died at __LINE__ = 9 at ./test_lines.pl line 9."  with "This is
perl, v5.8.0 built for i586-linux".
> I hope you won't be offended if I ask you if you're sure there aren't  two
blank lines at the top of the file?

I confirm there are no blank lines ;-)

Depending on the machine I try, the results vary, but up to now, I always
had a different line number reported by "die" and by __LINE__.

When you put the block of code depending on the conditon on another line,
everything seems OK.
---






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

Date: Sun, 25 Jan 2004 21:08:07 +0100
From: AlV <skweek@no.spam>
Subject: Re: __LINE__ variable containing an incorrect value
Message-Id: <bv17n8$1aq$1@news-reader2.wanadoo.fr>

Christophe David wrote:
> The output of the script below is :
>     "died at __LINE__ = 11 at ./test_lines.pl line 10.
> 
> when I would expect :
>     "died at __LINE__ = 9 at ./test_lines.pl line 9.
> 
> Running 5.8.0 on Linux and WIndows XP

Funny, I tried this (invoked as "perl tttt.pl") and it said:
	died at__LINE__ = 9 at tttt.pl line 8.

Be it with Perl 5.6.1, 5.8.0 or 5.8.2 on Linux :o)

Funnier, I tried to see what it would report with the condition set as 
true on the first line:
	died at__LINE__ = 1 at tttt.pl line 1.

Huh, so what does it say on line 2?
	died at__LINE__ = 2 at tttt.pl line 1.

No wonder Perl is considered a weird language :oD



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

Date: 20 Jan 2004 00:00:28 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Access-Zugriff mit Perl
Message-Id: <slrnc0orp6.aqq.mgjv@verbruggen.comdyn.com.au>

On 18 Jan 2004 12:28:19 -0800,
	Thomas <thomas.taunus@gmx.de> wrote:
> Hallo,
> 
> ich möchte auf eine Access-DB mit Perl zugreifen.

[translation: OP would like to read a (presumably Microsoft) Access
database]

I understand that this should be possible with DBI and the DBD::ODBC
driver. If you use Google to look for these, you should be able to
find some information.

> Dabei geht es mir in erster Linie darum, Datensätze in die Datenbank
> zu schreiben. Hintergrund: Ich möchte Systeminformationen auslesen
> (Auslastungen, Plattenplatz, etc.) und diese in eine Access-Datenbank
> schreiben um diese  anschl. graphisch auszuwerten.

[summary: description of what OP wants to read, with requirement to
somhow present data graphically. It's unclear to me what that means,
exactly.]

You, OP, need to specify what that means, exactly.

>                                                    Die Datenbank
> sollte irgenwo auf einem Server-Laufwerk abgelegt werden können. 

This confuses me. Are you, OP, saying that you want to store the
database on a server disk somehow?

If so, why bother with Access alltogether? Why don't you simply get
one of the free for use (PostgreSQL, MySQL) RDBMses, so you don't have
to fart around with files?

> Im
> Forum habe ich schon viele Anregungen zu diesem Thema gefunden, die
> ich jedoch als Perl-Neuling nicht verstehen, bzw. umsetzen kann. Wenn
> jemand ein Beispielsprogramm (gespickt mit vielen verständlichen
> Kommentaren) hätte, wäre ich dankbar.

[OP explains he has found references to this theme in "the forum" (I'm
assuming that that means this newsgroup), but can't understand them,
as a Perl newbie]

If you have trouble understanding these references, maybe you're too
new to tackle this problem? Anyway, if you decide to go with DBI and
DBD::ODBC, they come with lots of examples, and there's lots of
information around on the use. There's also a mailing list for DBI
related issues, which you could check.

Martien
-- 
                        | 
Martien Verbruggen      | Think of the average person. Half of the
Trading Post Australia  | people out there are dumber.
                        | 


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

Date: Wed, 21 Jan 2004 17:01:13 +0100
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: Access-Zugriff mit Perl
Message-Id: <400ea250$0$29030$91cee783@newsreader01.highway.telekom.at>

> > Why do You not make the graphics and so also in Perl?
> > For what is Access necessary?
>
> It is easier for me, the graphics to build in Access.

And why not to built the graphics in Perl using HTML?

HTML can be used as an universal output system


-- 
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: 28 Jan 2004 13:02:07 -0800
From: budhwani27@yahoo.com (Arun)
Subject: adding existing nt user to nt global group
Message-Id: <42cd0334.0401281302.5e94c5e1@posting.google.com>

I can't understand why I cant add users to a group
using this script. If I change the Netadmin line to
read GroupIsMember instead of GroupAddUsers, I can
check if the user belongs to a group. the error
message I get form this script is "Overlapped I/O
operation is in progress".

use Win32::NetAdmin;
use strict;

my $cwid1 = "test";


my $group= "testgroup" ;

my $server = "testdc"; 	  		  

my $domain1="dc\\";

my $user="";

my $passwd="";

`net use  \\\\$server /user:$domain1$user $passwd`;

if
(Win32::NetAdmin::GroupAddUsers($server,$group,$cwid1)){

        print "\"$cwid1\" has been added to the group
$group!\n";

}
else {

        print "\"$cwid1\" cannot be found!\n";


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

Date: Wed, 28 Jan 2004 22:41:00 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: adding existing nt user to nt global group
Message-Id: <ch%Rb.5683$qU3.425492@news20.bellglobal.com>


"Arun" <budhwani27@yahoo.com> wrote in message
news:42cd0334.0401281302.5e94c5e1@posting.google.com...
> I can't understand why I cant add users to a group
> using this script. If I change the Netadmin line to
> read GroupIsMember instead of GroupAddUsers, I can
> check if the user belongs to a group. the error
> message I get form this script is "Overlapped I/O
> operation is in progress".
>

Check if an error is being returned from the net use call you're making.
That would be my guess as to where things might be going wrong for you. The
overlapped i/o message means that some action is still in progress, and the
likely culprit would be the system call.

Matt




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

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 5995
***************************************


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