[11151] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4750 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 26 11:07:21 1999

Date: Tue, 26 Jan 99 08:00:29 -0800
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, 26 Jan 1999     Volume: 8 Number: 4750

Today's topics:
        Anyone know of a stock quote script? (Cypher)
        Camand line params into a perl script. <bill@highwater.co.uk>
    Re: Camand line params into a perl script. <jdf@pobox.com>
    Re: Can you pattern match using an array? (Tad McClellan)
        CGI, Xitami and other modules (A.J. Norman)
        database in perl <karenl@security7.com>
    Re: database in perl (Honza Pazdziora)
    Re: database in perl <mark.c.hamlin@bt.com>
        Deleting dupes with Perl jxdub@my-dejanews.com
    Re: Deleting dupes with Perl (Mike Stok)
    Re: Deleting dupes with Perl (Larry Rosler)
        Deleting duplicates in a text file wilsonjf@nima.mil
        FAQ: Using a variable as a variable name <tchrist@mox.perl.com>
        function prototypeing <pk@dwc.ch>
    Re: function prototypeing <jdf@pobox.com>
    Re: function prototypeing <pk@dwc.ch>
        help with DBD-ODBC and MSAccess bcs_webnet@my-dejanews.com
        How to change @INC path permenantly? <mark.c.hamlin@bt.com>
        how to implement login script? (Khoo Hui Tiong)
    Re: how to implement login script? <staffan@ngb.se>
        Multiuser-file access not working as Randal L Schwartz  mw@martinwinkler.com
    Re: Multiuser-file access not working as Randal L Schwa <jdf@pobox.com>
        Network file browser (Seshu Madhavapeddy)
        Newbie asks : "multitasking" possible using perl on Win <J.Clayton@ftel.co.uk>
        OLE:Storage vs Win32::OLE for Word Directory List billdraper@my-dejanews.com
    Re: perl and linux (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 26 Jan 1999 14:32:16 GMT
From: cypher5@yahoo.die.spammers.com (Cypher)
Subject: Anyone know of a stock quote script?
Message-Id: <78kjlg$64o$0@205.211.154.11>

Hi,
I'm looking for a stock quoting script that would send thw output to
email. Does anyone know of such a script?
All I need is the ticker symbol and the current value (Last traded at)
to be sent to an email message.

Cheers,
Cypher.

---
(A)bort (R)etry (W)hackthefuckoutofit
---
If you want to email me please take die.spammers out of my email address.


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

Date: Tue, 26 Jan 1999 11:15:07 +0000
From: Billy Bagshaw <bill@highwater.co.uk>
Subject: Camand line params into a perl script.
Message-Id: <36ADA3BB.6428715A@highwater.co.uk>

Hi,
    I'm running perl scripts under Win NT4 using bat files.
Can I pass command line params to the script from the bat file ?

Thanks Billy B.



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

Date: 26 Jan 1999 16:03:16 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Billy Bagshaw <bill@highwater.co.uk>
Subject: Re: Camand line params into a perl script.
Message-Id: <m3btjmgjpn.fsf@joshua.panix.com>

Billy Bagshaw <bill@highwater.co.uk> writes:

>     I'm running perl scripts under Win NT4 using bat files.
> Can I pass command line params to the script from the bat file ?

What happened when you tried it?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 26 Jan 1999 08:13:35 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Can you pattern match using an array?
Message-Id: <fiik87.vn1.ln@magna.metronet.com>

Bob Freedman (bfreedman@esdim.noaa.gov) wrote:
: Can you match a pattern using an array of strings?

: if (/@key/i) {....


   Perl FAQ, part 6:

      "How do I efficiently match many regular expressions at once?"



   For a quick hack, I usually just:


@key = qw(one two twohundred four);
$re = join '|', reverse sort @key;
$_ = 'twohundred';
print "matched '$1' in '$_'\n" if /($re)/o;


   If you are wondering why the reverse()/sort() is in there, note the
   different results with and without them (unless you _want_
   to match the shortest rather than the longest).

   Note the promise that you are making to perl by using the
   m//o option (search for 'promise' in 'perlop.pod')



   Or, if you are sure that @key is ordered to avoid the
   left-to-right matching behavior of perl (the reverse/sort
   thing above), then you can use Ilya's suggestion
   (he meant to say 'perlvar', not 'perlval'):


{  local $" = '|';
   print "matched '$1' in '$_'\n" if /(@key)/o;
}


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 26 Jan 1999 12:29:07 -0000
From: nja@le.ac.uk (A.J. Norman)
Subject: CGI, Xitami and other modules
Message-Id: <78kcej$8fb@harrier.le.ac.uk>

 I'm writing CGI scripts for the Xitami webserver on an NT machine, 
 with Perl 5.005_02 (ActiveState build 509).  

 I want to be able to use my own module within the CGI script - at the 
 moment I'm having to put mylib.pm into the standard Perl library 
 directory, C:\perl\lib.  Srinivasan's "Advanced Perl Programming" 
 lists three ways of putting another directory into Perl's load path, 
 and I have tried a couple of them - they work when I run the CGI 
 script from the command line, but when it's running via the server 
 nothing happens (which I assume means the module isn't being found, 
 hence @INC isn't being altered).  It's a minor problem, but I'd 
 really prefer not to have to put my own modules in with the main Perl 
 distribution if there's another way of doing it.  

-- 
Andrew Norman, Leicester, England
nja@le.ac.uk || andrew.norman@le.ac.uk
http://www.le.ac.uk/engineering/nja/


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

Date: Tue, 26 Jan 1999 11:02:44 +0200
From: "Karen Soudry" <karenl@security7.com>
Subject: database in perl
Message-Id: <78k094$dok$1@news.netvision.net.il>

HI

HELP!!!!

I need codes and examples on how to write a database in perl and the method
"search" in perl!!!

THANKS
KAREN




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

Date: Tue, 26 Jan 1999 11:41:12 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: database in perl
Message-Id: <F660Go.LK2@news.muni.cz>

On Tue, 26 Jan 1999 11:02:44 +0200, Karen Soudry <karenl@security7.com> wrote:
> 
> I need codes and examples on how to write a database in perl and the method
> "search" in perl!!!

Use the MySQL or PostrgreSQL database servers to store the data and do
the search for you and use the DBI to access the server!

www.postgresql.org, www.mysql.com, man DBI(3).

Hope this helps,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
 The total number of bytes in all expressions in the GROUP BY clause is
 limited to the size of a data block minus some overhead. --Oracle SQL Ref.
------------------------------------------------------------------------


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

Date: Tue, 26 Jan 1999 12:28:08 +0000
From: Mark Hamlin <mark.c.hamlin@bt.com>
To: Karen Soudry <karenl@security7.com>
Subject: Re: database in perl
Message-Id: <36ADB4D8.E49F7B2@bt.com>

The SQL+DBI/DBD will allow you to develop a generic set of products, ie when you
decide you need a bigger or better database or you want to implement your
systems with a clients current database, it will only take 5 secs to change your
perl scripts.  I've just implemented this on a linux server, and have found an
excellent bit of Perl freeware source to interact with my Postgres DB.  I just
need to customize it to make the perfect interface.

Feel free to mail me for more info.

Mark Hamlin


-- 

        ___....-----'---'-----....___
  =========================================
         ___'---..._______...---'___
        (___)      _|_|_|_      (___)
          \\____.-'_.---._'-.____//
            ~~~~'.__'---'__.'~~~~
                   ~~~~~~~
	'More speed'
		  Sisco

Work: mailto:mark.c.hamlin@bt.com
Personal: mailto:mark@dimitrinet.demon.co.uk

Please use you auto reply where possible to distribute to both mailboxes.


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

Date: Tue, 26 Jan 1999 15:16:53 GMT
From: jxdub@my-dejanews.com
Subject: Deleting dupes with Perl
Message-Id: <78km8q$ss6$1@nnrp1.dejanews.com>

I'm a beginner Perl user and I'm working on a project to take log files from
an Exchange server and look for recipients for that day.  I've written enough
to send a report out with all the users names, but now I need to delete the
duplicates...  Could anyone tell me a good way to do this? The file would
look like this:

jonesfw
smithjd
jonesfw
doejf
smithjd

And I need to send a report with only:

jonesfw
smithjd
doejf

Thanks in advance!

-Jim Wilson

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 26 Jan 1999 09:42:47 -0600
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Deleting dupes with Perl
Message-Id: <e3IrGKUS#GA.188@news1.texas.rr.com>

In article <78km8q$ss6$1@nnrp1.dejanews.com>,  <jxdub@my-dejanews.com> wrote:
>
>I'm a beginner Perl user and I'm working on a project to take log files from
>an Exchange server and look for recipients for that day.  I've written enough
>to send a report out with all the users names, but now I need to delete the
>duplicates...  Could anyone tell me a good way to do this? The file would
>look like this:
>
>jonesfw
>smithjd
>jonesfw
>doejf
>smithjd
>
>And I need to send a report with only:
>
>jonesfw
>smithjd
>doejf

There are several suggestions ins ection 4 of the faq,

  perldoc perlfaq4

should get you the document.  You can apply techniques used ion getting
unique elements of a list to your input data.

If perldoc doesn't work on your machine then you can look in the docs
section of http://www.perl.com for the FAQs.

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
                                   |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Tue, 26 Jan 1999 07:43:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Deleting dupes with Perl
Message-Id: <MPG.1117826da74703c29899c7@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <78km8q$ss6$1@nnrp1.dejanews.com> on Tue, 26 Jan 1999 
15:16:53 GMT, jxdub@my-dejanews.com <jxdub@my-dejanews.com> says...
 ...  I've written enough
> to send a report out with all the users names, but now I need to delete the
> duplicates...

perlfaq4:  "How can I extract just the unique elements of an array?"

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 26 Jan 1999 15:19:07 GMT
From: wilsonjf@nima.mil
Subject: Deleting duplicates in a text file
Message-Id: <78kmd0$sto$1@nnrp1.dejanews.com>

I'm a beginner Perl user and I'm working on a project to take log files from
an Exchange server and look for recipients for that day.  I've written enough
to compile a list with all the users names, but now I need to delete the
duplicates...  Could anyone tell me a good way to do this? The file would
look like this:

jonesfw
smithjd
jonesfw
doejf
smithjd

And I need to send a report with only:

jonesfw
smithjd
doejf

Thanks in advance!

-Jim Wilson

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 26 Jan 1999 06:52:56 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: FAQ: Using a variable as a variable name
Message-Id: <78knaf$hql$1@nntp.Stanford.EDU>

=head2 How can I use a variable as a variable name?

Beginners often think they want to have a variable contain the name
of a variable.

    $fred    = 23;
    $varname = "fred";
    ++$$varname;         # $fred now 24

This works I<sometimes>, but it is a very bad idea for several reasons.

The first reason is that they I<only work on global variables>.
That means above that if $fred is a lexical variable created with my(),
that the code won't work at all: you'll accidentally access the global
and skip right over the private lexical altogether.  Global variables
are bad because they can easily collide accidentally and in general make
for non-scalable and confusing code.

Symbolic references are forbidden under the C<use strict> pragma.
They are not true references and consequently are not reference counted
or garbage collected.

The other reason why using a variable to hold the name of another
variable a bad idea is that the question often stems from a lack of
understanding of Perl data structures, particularly hashes.  By using
symbolic references, you are just using the package's symbol-table hash
(like C<%main::>) instead of a user-defined hash.  The solution is to
use your own hash or a real reference instead.

    $fred    = 23;
    $varname = "fred";
    $USER_VARS{$varname}++;  # not $$varname++

There we're using the %USER_VARS hash instead of symbolic references.
Sometimes this comes up in reading strings from the user with variable
references and wanting to expand them to the values of your perl
program's variables.  This is also a bad idea because it conflates the
program-addressable namespace and the user-addressable one.  Instead of
reading a string and expanding it to the actual contents of your program's
own variables:

    $str = 'this has a $fred and $barney in it';
    $str =~ s/(\$\w+)/$1/eeg;		  # need double eval

Instead, it would be better to keep a hash around like %USER_VARS and have
variable references actually refer to entries in that hash:

    $str =~ s/\$(\w+)/$USER_VARS{$1}/g;   # no /e here at all

That's faster, cleaner, and safer than the previous approach.  Of course,
you don't need to use a dollar sign.  You could use your own scheme to
make it less confusing, like bracketed percent symbols, etc.

    $str = 'this has a %fred% and %barney% in it';
    $str =~ s/%(\w+)%/$USER_VARS{$1}/g;   # no /e here at all

Another reason that folks sometimes think they want a variable to contain
the name of a variable is because they don't know how to build proper
data structures using hashes.  For example, let's say they wanted two
hashes in their program: %fred and %barney, and to use another scalar
variable to refer to those by name.

    $name = "fred";
    $$name{WIFE} = "wilma";     # set %fred

    $name = "barney";           
    $$name{WIFE} = "betty";	# set %barney

This is still a symbolic reference, and is still saddled with the
problems enumerated above.  It would be far better to write:

    $folks{"fred"}{WIFE}   = "wilma";
    $folks{"barney"}{WIFE} = "betty";

And just use a multilevel hash to start with.

The only times that you absolutely I<must> use symbolic references are
when you really must refer to the symbol table.  This may be because it's
something that can't take a real reference to, such as a format name.
Doing so may also be important for method calls, since these always go
through the symbol table for resolution.

In those cases, you would turn off C<strict 'refs'> temporarily so you
can play around with the symbol table.  For example:

    @colors = qw(red blue green yellow orange purple violet);
    for my $name (@colors) {
        no strict 'refs';  # renege for the block
        *$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
    } 

All those functions (red(), blue(), green(), etc.) appear to be separate,
but the real code in the closure actually was compiled only once.

So, sometimes you might want to use symbolic references to directly
manipulate the symbol table.  This doesn't matter for formats, handles, and
subroutines, because they are always global -- you can't use my() on them.
But for scalars, arrays, and hashes -- and usually for subroutines --
you probably want to use hard references only.
-- 
There is no problem so small that it can't be blamed on Datakit --Andrew Hume


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

Date: Tue, 26 Jan 1999 12:22:27 +0100
From: Per Kistler <pk@dwc.ch>
Subject: function prototypeing
Message-Id: <36ADA573.8BFC2B06@dwc.ch>

Hi All

If I prototype a function within a module like:

sub printDebug($);

then I cannot call it like:

$this->printDebug "text";

but only with:

$this->printDebug("text");

But the, I think, the arguments checking by the compilier
is not performed. Why does it not work in modules as
it does outside?

Thanks, Per.
-- 
Per Kistler
Digital Wire Consulting
pk@dwc.ch (or: kistler@gmx.net)
-----------------------------------------------------------------------


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

Date: 26 Jan 1999 16:25:45 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Per Kistler <pk@dwc.ch>
Subject: Re: function prototypeing
Message-Id: <m390eqgio6.fsf@joshua.panix.com>

Per Kistler <pk@dwc.ch> writes:

> If I prototype a function within a module like:
> 
> sub printDebug($);
> 
> then I cannot call it like:
> 
> $this->printDebug "text";

That's not a prototype violation, it's a syntax error!  Without the
open paren following the method invocation, the parser assumes that
you're calling the method with no args.  Read perlobj, "Method
Invocation", for more pitfalls.

> but only with:
> 
> $this->printDebug("text");

Your method actually takes two params, the blessed ref and the
"text".  However...

Method calls bypass proto checking, according to the documentation.
perlsub:

       Method calls are not influenced by prototypes either,
       because the function to be called is indeterminate at
       compile time, because it depends on inheritance.

So it has nothing to do with the fact that the sub comes from a
module, but rather that you're making method calls instead of vanilla
subroutine invocations.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 26 Jan 1999 16:47:19 +0100
From: Per Kistler <pk@dwc.ch>
To: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: function prototypeing
Message-Id: <36ADE387.F25285DD@dwc.ch>

Hi Jonathan

I'm wondering why it works in C++. If at compiletime it would not
be clear, which method would be called, why would C++ and
Java be able have method prototyping, even with method overloading?

Regards, Per.

Jonathan Feinberg wrote:
> 

> Method calls bypass proto checking, according to the documentation.
> perlsub:
> 
>        Method calls are not influenced by prototypes either,
>        because the function to be called is indeterminate at
>        compile time, because it depends on inheritance.
> 
-- 
Per Kistler
Digital Wire Consulting
pk@dwc.ch (or: kistler@gmx.net)
-----------------------------------------------------------------------


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

Date: Tue, 26 Jan 1999 15:30:39 GMT
From: bcs_webnet@my-dejanews.com
Subject: help with DBD-ODBC and MSAccess
Message-Id: <78kn31$tgo$1@nnrp1.dejanews.com>

Is anyone using the DBD-ODBC mod. with MS Access?  I can select data this way
with a CGI scripts, but I can't seem to insert new records.  I get an error
saying that I must use and updatable query.  I have tried executing a prepared
statement, and I tried the "do" method of the connection object.

Please help.
Brian

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 26 Jan 1999 10:49:10 +0000
From: Mark Hamlin <mark.c.hamlin@bt.com>
Subject: How to change @INC path permenantly?
Message-Id: <36AD9DA6.E7009072@bt.com>

How do I change the @INC path permenantly?  Installing perl 5.005 using a pkgadd
Solaris build, it did not set the path correctly.

Thanks, Mark.

ps please send me a respose vua e-mail.
-- 

        ___....-----'---'-----....___
  =========================================
         ___'---..._______...---'___
        (___)      _|_|_|_      (___)
          \\____.-'_.---._'-.____//
            ~~~~'.__'---'__.'~~~~
                   ~~~~~~~
	'More speed'
		  Sisco

Work: mailto:mark.c.hamlin@bt.com
Personal: mailto:mark@dimitrinet.demon.co.uk

Please use you auto reply where possible to distribute to both mailboxes.


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

Date: 26 Jan 1999 12:56:31 GMT
From: isc50140@leonis.nus.edu.sg (Khoo Hui Tiong)
Subject: how to implement login script?
Message-Id: <78ke1v$om6$1@nuscc.nus.edu.sg>

	hi!
	i would like to implement a login script via WWW using perl
	how can i do this with the best security?
	also, how can i match the users' entry with the encrypted
	passwords in /etc/passwd??

	thanks for any advice!!!

--
Jonathan Khoo
National University of Singapore
email: khoohuit@comp.nus.edu.sg


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

Date: Tue, 26 Jan 1999 16:35:41 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: how to implement login script?
Message-Id: <36ADE0CD.52BA5621@ngb.se>

Hi!

>         i would like to implement a login script via WWW using perl
>         how can i do this with the best security?
>         also, how can i match the users' entry with the encrypted
>         passwords in /etc/passwd??

You don't. Dont use the /etc/passwd for logging in over the internet --
it's a major no-no. The result is that anyone who sniffs the password
over the net can telnet to your machine and use the user account, and
quite easily crack the root pass. 

It's not a good idea to have the users being used to using their 'real'
passwords in a form either -- what if someone puts up a form somewhere
that looks like yours and lures your users into logging in there?

Better to use the secure directories that your webserver probably comes
with. 

But, to answer the question, whether you choose to put the passwords in
etc or in /home/httpd...

crypt( $unencoded_password, $encoded_password ) eq $encoded_password;

where $encoded_password is taken from the passwordfile. Just make sure
to remove newlines.

But this is discussed in detail in FAQ and perlfunc, so take a look!

Staffan


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

Date: Tue, 26 Jan 1999 10:01:24 GMT
From: mw@martinwinkler.com
Subject: Multiuser-file access not working as Randal L Schwartz suggests?
Message-Id: <78k3ph$e1m$1@nnrp1.dejanews.com>

Hello group, I want to create a banner rotation system in Perl for a busy
site. Recently I read the article about web-hits counters by Randal at
http://www.stonehenge.com/ merlyn/WebTechniques/col04.html

I tried his approach and it works great except during the very busy hours
when about 15-20 users (or even more) visit my server simultaneously. Then
sometimes the server just flushes (double-gasp!) my logfile so I do not have
any statistics for the hours before. (Thank God I am doing a backup every 24
hours...)

Here is the function I use:
(the file "bannerdata.txt" contains the html-code and view/click-statistics I
need. one banner each line, but that is not important here)

sub getTheBanner{
  use Fcntl;
  $|++;
  # I need read/write access, so I have to use sysopen
  sysopen(FILE, "bannerdata.txt", O_RDWR|O_CREAT, 0644) or return $stdbanner;
  flock(FILE,2) or return $stdbanner;
  seek(FILE,0,0);
  @filedataG = <FILE>;

  #doing various stuff like selecting the best banner and updating its counter

  seek(FILE,0,0);
  truncate(FILE,0);
  foreach $bannerline (@filedataG) { print FILE $bannerline }
  close(FILE) or return $stdbanner;
  return $mybannercode;
}

I am using BSDI BSD/OS 3.1 Virtual Kernel #15: Tue Nov 17 11:54:04 MST 1998
and Perl 5.004

At the moment I have to run a cron script every 10 minutes that backs up my
logfile if it is not empty or sets it up again if it is. (not the best
solution, I guess)

Thank you for your help on this nasty problem - if there is any additional
info needed please post it here or send me an e-mail.

Martin

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 26 Jan 1999 16:02:40 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: mw@martinwinkler.com
Subject: Re: Multiuser-file access not working as Randal L Schwartz suggests?
Message-Id: <m3emoigjqn.fsf@joshua.panix.com>

mw@martinwinkler.com writes:


>   sysopen(FILE, "bannerdata.txt", O_RDWR|O_CREAT, 0644) or return $stdbanner;
>   flock(FILE,2) or return $stdbanner;

You neglect to close the file in the case that the lock fails. And if
the lock fails, aren't you interested in knowing about it?

>   seek(FILE,0,0);

Oops, you forget to check the success of this system call.  You must
check the success of *every* system call.

>   #doing various stuff like selecting the best banner and updating
>   #its counter

Hmm...  you're *sure* there's nothing relevant here?

>   seek(FILE,0,0);
>   truncate(FILE,0);

Same comment about error checking goes here.

>   close(FILE) or return $stdbanner;

If you failed to close the file, then something is seriously wrong,
and you really ought to be paying attention to that.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 26 Jan 1999 14:53:14 GMT
From: trinity@bnr.ca (Seshu Madhavapeddy)
Subject: Network file browser
Message-Id: <78kksq$kfi$1@crchh14.us.nortel.com>

I am building a web application  using cgi and perl.
I need to show a list of files (just like a file browser displays)
from any specified host machine on my LAN to the user. Then I have
to get the selected file names and transfer them to another host
machine.

- Is there anything like network file browser/manager available
that can be used within html or javascript program
- Also  I want to know how can I transfer the file from one host to
another using ftp (or anything relevant)

Thanx for any info,
Mohan


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

Date: Tue, 26 Jan 1999 15:39:44 +0000
From: James Clayton <J.Clayton@ftel.co.uk>
Subject: Newbie asks : "multitasking" possible using perl on Win32 ??
Message-Id: <36ADE1C0.6F480B45@ftel.co.uk>

I've being tasked with writing a perl script to read and write
a device via the RS-232 serial port of a PC running NT workstation.

I need to continually monitor several registers on this device and
continuously update a display representing the contents of these
registers as well as waiting for users to input values into a GUI
form to be written to other registers on this device.

I am confident I can write the code to drive the display and GUI
etc. but am unsure IF perl can read/write the serial port at
THE SAME TIME as monitoring the on screen fields/forms being updated by
the user (in order to write info to registers on an "update" command).

Is this sort of "multitasking" possible with perl on an NT box ?

Any help gratefully received

james
-- 
======================================================================
James Clayton                      email : j.clayton@ftel.co.nosp@m.uk


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

Date: Tue, 26 Jan 1999 11:47:25 GMT
From: billdraper@my-dejanews.com
Subject: OLE:Storage vs Win32::OLE for Word Directory List
Message-Id: <78ka0b$ihf$1@nnrp1.dejanews.com>

I am trying to produce a directory of Word8 files, listing the Title, Author,
Size, Date Last Ammended and then be able to have link on the title to open
the Word8 document in Word. I have tried using Win32::OLE on my PC with some
success but others suggest OLE::Storage is really what I need. Can someone
please suggest which is the most appropriate to use and any example scripts
that there may be. I am using Active State 5 on my machine but have Linux and
NT boxes also to store scripts if using OLE::Storage or specific WinNT
modules. All the Word8 documents are on a network drive. Also we use Apache
as the server.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 26 Jan 1999 08:43:07 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: perl and linux
Message-Id: <r9kk87.vn1.ln@magna.metronet.com>

Fernando (help@doit.wisc.edu) wrote:

: I tried a couple of simple programs on unix. I have the line
: "#!usr/bin/perl" as the very first line in my scripts.
   ^^^

   #!/usr/bin/perl -w
     ^             ^^
     ^             ^^

   You are missing a slash and the -w switch.

   You should use the -w switch on *all* of your perl programs.

   Really.

   All of them.


: Question: is there a way I can run my scripts in my linux boxes without
: having to type "perl" in front of the name? 

   Yes.

: How? 

   By giving a _correct_ path in the shebang line  ;-)


: If there isn't any way to do this, how do I make it so that a browser can
: actually use the scripts (it say that the file name.cgi was not found on
: this server)?


   Server setup questions are not Perl questions, and are off-topic
   for this newsgroup.

   Ask those questions in a newsgroup related to HTTP servers
   and/or CGI programming:

      comp.infosystems.www.authoring.cgi
      comp.infosystems.www.servers.unix


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4750
**************************************

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