[17572] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4992 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 29 21:05:44 2000

Date: Wed, 29 Nov 2000 18:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975549911-v9-i4992@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 29 Nov 2000     Volume: 9 Number: 4992

Today's topics:
        5.6.1 Schedule <joe@nall.com>
    Re: About to slit my own throat (Jerome O'Neil)
        Apache::AuthenDBI problems <root@fred.thresholdnetworks.com>
        Bart Lateur <bart.lateur@skynet.be> Thanks for the help <Please_reply@this.group>
    Re: Blind copy with sendmail (Tad McClellan)
        calling perl script in html? <joshb@isomedia.com>
        Calling perl with input type hidden probs?????? <gordy_hand@hotmail.com>
    Re: Calling perl with input type hidden probs?????? <taboo@comcen.com.au>
    Re: Calling perl with input type hidden probs?????? (David Efflandt)
        FAQ 4.24:   How do I reformat a paragraph? <faq@denver.pm.org>
    Re: find function nodo70@my-deja.com
    Re: find function <jeffp@crusoe.net>
    Re: find function (Tad McClellan)
    Re: find function (Tad McClellan)
    Re: find function nodo70@my-deja.com
    Re: find function (Tad McClellan)
    Re: for each file in dir ? (Gary E. Ansok)
        Form reposting in older browser problem <mcameron@mirusweb.com>
    Re: Form reposting in older browser problem (David Efflandt)
        getting the local host name or ipaddress gaddamsr@my-deja.com
        HELP! flock problem on NFS mounted dev? chuckk@monmouth.com
    Re: HELP! flock problem on NFS mounted dev? (Logan Shaw)
    Re: How do I null terminate a string ? (Adam Spragg)
        MIME::Lite Cc and Bcc doesnt seem to work for smtp ? dtbaker_dejanews@my-deja.com
    Re: Posting Guidelines? (Chris Fedde)
        Replacing a character with a string. <loch@uci.edu>
    Re: Replacing a character with a string. <wyzelli@yahoo.com>
    Re: Replacing a character with a string. (Logan Shaw)
        running encrypted files <kelley.a.kent@intel.com>
    Re: running encrypted files <joe+usenet@sunstarsys.com>
    Re: running encrypted files (Tad McClellan)
    Re: running encrypted files (Tad McClellan)
    Re: splitting a string into an array and preserving the (Tad McClellan)
        Substituting international characters <bonev@gmc.ulaval.ca>
    Re: Tieing an object (Chris Fedde)
    Re: Tieing an object bdesany@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 29 Nov 2000 19:43:09 -0600
From: Joe Nall <joe@nall.com>
Subject: 5.6.1 Schedule
Message-Id: <3A25B0AD.86C5D185@nall.com>

Any word on the release of 5.6.1?  I need to update the perl on a number of machines in the near future and would like to save myself a revision if possible.

joe


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

Date: Thu, 30 Nov 2000 01:30:02 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: About to slit my own throat
Message-Id: <u4iV5.856$1K6.372866@news.uswest.net>

cberry@cinenet.net (Craig Berry) elucidates:
> Anthony (apsaffer@hotmail.com) wrote:
>: No, it is NOT a spam generator. It is an anonymous email program made
>: for a legitimate organization that will not use it for spam.  
> 
> I can't think of any legitimate use for automated anonymous email.

Whistle blowers.


-- 
"Civilization rests on two things: the discovery that fermentation 
produces alcohol, and the voluntary ability to inhibit defecation.  
And I put it to you, where would this splendid civilization be without 
both?" --Robertson Davies "The Rebel Angels" 


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

Date: Thu, 30 Nov 2000 01:27:28 GMT
From: root <root@fred.thresholdnetworks.com>
Subject: Apache::AuthenDBI problems
Message-Id: <42iV5.3208$ES6.150125@nntp1.onemain.com>

I am using apache 1.3.14, mod_perl 1.24, and the newest ApacheDBI package.
The problem is that when I set a site to authenticate via the AuthenDBI module,
it doesn't really authenticate.  The username and password never get checked
against what is in the database, or so it would appear.  The authentication
window appears, and any username/password combination will gain entry into
the site.  My configuration is as follows:

in httpd.conf I have added the following:
PerlModule Apache::AuthenDBI

and the .htaccess file is as follows:
AuthName Hostname
AuthType Basic

PerlAuthenHandler Apache::AuthenDBI

PerlSetVar Auth_DBI_data_source DBI:mysql:apache_authen
PerlSetVar Auth_DBI_username    username
PerlSetVar Auth_DBI_password    password

PerlSetVar Auth_DBI_pwd_table   users
PerlSetVar Auth_DBI_uid_field   username
PerlSetVar Auth_DBI_pwd_field   password

require valid-user

What am I missing?

Sean Conley


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

Date: Thu, 30 Nov 2000 00:22:43 GMT
From: "Jason Kiss" <Please_reply@this.group>
Subject: Bart Lateur <bart.lateur@skynet.be> Thanks for the help !!!
Message-Id: <n5hV5.66672$DG3.1239503@news2.giganews.com>

It worked !!!!

Thanks for the Help !!!

----- Original Message -----
From: "Bart Lateur" <bart.lateur@skynet.be>
Newsgroups: comp.lang.perl.misc
Sent: Sunday, November 19, 2000 9:04 AM
Subject: Re: Can't run perl !!


> Jason wrote:
>
> >Why can't I run perl??? If I change the .pl to .cgi work fine but if I
leave
> >it .pl it show all the text !!! My perl extention is fine, example:
> >#!/usr/bin/perl
> >It worked on other website but not my server ???
>
> I think it's the server configuration. If the server doesn't know that
> the .pl extension belongs to a script, then it'll simply treat it as a
> data file. What is strange, is that with the script set to execution
> file mode, and .pl not recognized as script, then I get a server error.
>
> If the server is Apache, and your server configuration allows it, then
> you can override the default behaviour in a .htaccess file:
>
> <files "*.pl">
> SetHandler cgi-script
> </files>
>
> --
> Bart.
>




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

Date: Wed, 29 Nov 2000 17:58:46 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Blind copy with sendmail
Message-Id: <slrn92b2h6.4r5.tadmc@magna.metronet.com>

Ab Abson <menno@streuper.nl> wrote:
>Hello,
>
>I have the following code in my script:
>
>open (MAIL, "|/usr/lib/sendmail -t") || &ErrorMessage("error opening
>sendmail") ;


That error message is misleading.

If sendmail has a problem &ErrorMessage will NOT be called.

You should have a look at the Perl FAQ, part 8:

   "Why doesn't open() return an error when a pipe open fails?"


>close (MAIL) ;


Better check the return value from close() too when open()ed
with a pipe.


>Is it possible to send also a copy or even a blind copy?


Yes. Use the print() function to print the appropriate header(s).


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


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

Date: Thu, 30 Nov 2000 01:53:50 GMT
From: joshbaxley <joshb@isomedia.com>
Subject: calling perl script in html?
Message-Id: <904bvd$143$1@nnrp1.deja.com>

I have a perl script that simply takes a list of files in a directory
and lists them in html with links to them.

Now if I did this in ASP and not perl and I wanted to call it in an HTML
page, I would simply type:

<!-- #LOCATION File:page.asp -->

now how do I do this with perl?

cheers


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 30 Nov 2000 00:28:24 -0000
From: "Gordon Handley" <gordy_hand@hotmail.com>
Subject: Calling perl with input type hidden probs??????
Message-Id: <3a25a756.0@energise.enta.net>

Hi
    I am having a bit of a problem calling a perl file from a html file.  I
am using images as buttons and then input type hidden etc but I want to call
one perl script with three different images and don't want to have to put it
in a seperate form each time as this means the layout looks shit as the
buttons will not be put underneath each other.  This is the code I want to
implement, but this will not call the script.

<FORM method="post" action
="http://www.cs.cf.ac.uk/User-bin/G.Handley/houses.pl">
<input type="image" src="images/buttonnews.gif"
alt="Houses News" border=0><input type ="hidden" name="action" value="News">
<input type="image" src="images/buttonpeople.gif"
alt="People" border=0><input type ="hidden" name="action" value="People">
<input type="image" src="images/buttoncontacts.gif"
alt="Contacts" border=0><input type ="hidden" name="action"
value="Contacts"></FORM>

Is there away of doing it without having to split each image into a
different form.  I have tried tables and image maps , but I can't seem to
get it working.
The script itself is working fine as you can see at
www.housestalybont.co.uk/index1.html Any suggestions would be very welcome.
    Thanks




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

Date: 30 Nov 2000 12:05:38 +1100
From: "Kiel Stirling" <taboo@comcen.com.au>
Subject: Re: Calling perl with input type hidden probs??????
Message-Id: <3a25a7e2$1@nexus.comcen.com.au>


"Gordon Handley" <gordy_hand@hotmail.com> wrote:
>Hi>    I am having a bit of a problem calling a perl file from a html file.  I
>am using images as buttons and then input type hidden etc but I want to call
>one perl script with three different images and don't want to have to put it
>in a seperate form each time as this means the layout looks shit as the
>buttons will not be put underneath each other.  This is the code I want to
>implement, but this will not call the script.
>
><FORM method="post" action
>="http://www.cs.cf.ac.uk/User-bin/G.Handley/houses.pl">
><input type="image" src="images/buttonnews.gif"
>alt="Houses News" border=0><input type ="hidden" name="action" value="News">
><input type="image" src="images/buttonpeople.gif"
>alt="People" border=0><input type ="hidden" name="action" value="People">
><input type="image" src="images/buttoncontacts.gif"
>alt="Contacts" border=0><input type ="hidden" name="action"
>value="Contacts"></FORM>
>
>Is there away of doing it without having to split each image into a
>different form.  I have tried tables and image maps , but I can't seem to
>get it working.
>The script itself is working fine as you can see at
>www.housestalybont.co.uk/index1.html Any suggestions would be very welcome.
>    Thanks
Sounds like you need a java script 
Regards,
Kiel Stirling 


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

Date: Thu, 30 Nov 2000 01:39:29 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Calling perl with input type hidden probs??????
Message-Id: <slrn92bbuc.eor.efflandt@efflandt.xnet.com>

On Thu, 30 Nov 2000, Gordon Handley <gordy_hand@hotmail.com> wrote:
>    I am having a bit of a problem calling a perl file from a html file.  I
>am using images as buttons and then input type hidden etc but I want to call
>one perl script with three different images and don't want to have to put it
>in a seperate form each time as this means the layout looks shit as the
>buttons will not be put underneath each other.  This is the code I want to
>implement, but this will not call the script.
>
><FORM method="post" action
>="http://www.cs.cf.ac.uk/User-bin/G.Handley/houses.pl">
><input type="image" src="images/buttonnews.gif"
>alt="Houses News" border=0><input type ="hidden" name="action" value="News">
><input type="image" src="images/buttonpeople.gif"
>alt="People" border=0><input type ="hidden" name="action" value="People">
><input type="image" src="images/buttoncontacts.gif"
>alt="Contacts" border=0><input type ="hidden" name="action"
>value="Contacts"></FORM>
>
>Is there away of doing it without having to split each image into a
>different form.  I have tried tables and image maps , but I can't seem to
>get it working.
>The script itself is working fine as you can see at
>www.housestalybont.co.uk/index1.html Any suggestions would be very welcome.
>    Thanks

Although, this has nothing at all to do with Perl, one problem I see is
that you have multiple fields called "action", which would end up as a
list of actions if properly parsed in your CGI.  But you have no names for
your image buttons, so your CGI would not have a clue which
button was pressed.

'perldoc CGI' explains how to create what it calls image_button().  
The button you press will actually submit 2 values as button_name.x and
button_name.y where button_name is the name of the button.  But you have
not named ANY of your buttons.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Thu, 30 Nov 2000 01:17:00 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ 4.24:   How do I reformat a paragraph?
Message-Id: <gUhV5.16$_g6.135468544@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I reformat a paragraph?

    Use Text::Wrap (part of the standard Perl distribution):

        use Text::Wrap;
        print wrap("\t", '  ', @paragraphs);

    The paragraphs you give to Text::Wrap should not contain embedded
    newlines. Text::Wrap doesn't justify the lines (flush-right).

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep comming up.  If you are some how irritated by
seeing these postings you are free to ignore them or add the sender
to your killfile.  If you find errors or other problems with these
postings please send corrections or comments to the posting email
address.

If you are not able to find this or other Perl documentation from
your installation you may access it via the web by following the
appropriate links from one of the addresses listed below.

    http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search
    http://www.perldoc.com
    http://www.cpan.org
    http://www.perl.com

Answers to questions about LOTS of other stuff, mostly not related to
Perl, can be found at

    news:news.answers

and in the many thousands of other useful Usenet news groups.

The perlfaq manual pages contain the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

    When included as an integrated part of the Standard
    Distribution of Perl or of its documentation (printed or
    otherwise), this work is covered under Perl's Artistic
    License.  For separate distributions of all or part of
    this FAQ outside of that, see the perlfaq manpage.

    Irrespective of its distribution, all code examples here
    are public domain.  You are permitted and encouraged to
    use this code and any derivatives thereof in your own
    programs for fun or for profit as you see fit.  A simple
    comment in the code giving credit to the FAQ would be
    courteous but is not required.

-- 
    This space intentionally left blank


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

Date: Wed, 29 Nov 2000 23:11:47 GMT
From: nodo70@my-deja.com
Subject: Re: find function
Message-Id: <9042ff$p6e$1@nnrp1.deja.com>

In article <87ofyya0bd.fsf@limey.hpcc.uh.edu>,
  Tony Curtis <tony_curtis32@yahoo.com> wrote:
> >> On Wed, 29 Nov 2000 21:37:06 GMT,
> >> nodo70@my-deja.com said:
>
> > Below is a snip code using find.pl.  It keep complain
> > about $name and I don't know how to delare that in order
> > to get rid of error message.  Please help.  Thanks in
> > advance.
>
> > #/usr/local/bin/perl -w
> > use strict
>
> This does not compile.  Please post *real* code.
>

#!/usr/local/bin/perl -w
use strict;
require "find.pl";
use Cwd;

my (@realFiles);
my $curDir = cwd();
my $dir = $ARGV[0];

chdir "$dir";
&find(".");
chdir "$curDir";
foreach my $file (@realFiles) {
  print "$file\n";
}

sub wanted {
    unless (-d $_) {
        $_ = $name;
        s/^.\///;    # get rid of leading "./"
        push @realFiles, $_;
    }
}

If I don't put $_ = $name, the $_ equal the filename only, not a whole
full path name along.  Please advise.  Thanks.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 29 Nov 2000 19:01:49 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: find function
Message-Id: <Pine.GSO.4.21.0011291901050.5826-100000@crusoe.crusoe.net>

[posted & mailed]

On Nov 29, nodo70@my-deja.com said:

>use strict;

Put something along the lines of

  use vars '$name';

or

  our $name;  # if you're using Perl 5.6

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/





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

Date: Wed, 29 Nov 2000 18:05:16 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: find function
Message-Id: <slrn92b2tc.4r5.tadmc@magna.metronet.com>

nodo70@my-deja.com <nodo70@my-deja.com> wrote:

>Below is a snip code using find.pl.  It keep complain 


Messages are meant to help in debugging.

They help the helper help you.

You should not withhold them when asking for help.

What was the message text?


>about $name and I
>don't know how to delare that in order to get rid of error message.


   perldoc strict
   perldoc -f my


>#/usr/local/bin/perl -w
>use strict

>        $_ = $name;


I'll bet the "mystery message" was something like:

   "Global symbol "%s" requires explicit package name"

So you _could_ just do what it says and use an explicit package name:

   $_ = $main::name;

But don't do that. Declare it with my() instead.


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


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

Date: Wed, 29 Nov 2000 18:22:21 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: find function
Message-Id: <slrn92b3td.4tg.tadmc@magna.metronet.com>

Tad McClellan <tadmc@metronet.com> wrote:
>nodo70@my-deja.com <nodo70@my-deja.com> wrote:
>
>>Below is a snip code using find.pl.  It keep complain 


>I'll bet the "mystery message" was something like:
>
>   "Global symbol "%s" requires explicit package name"
>
>So you _could_ just do what it says and use an explicit package name:
>
>   $_ = $main::name;

>But don't do that. Declare it with my() instead.


Errr, don't use my().

I skimmed right past the use directives. Sorry.


The explicit package name should be:

   $_ = $File::Find::name;


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


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

Date: Thu, 30 Nov 2000 01:03:41 GMT
From: nodo70@my-deja.com
Subject: Re: find function
Message-Id: <90491a$uqs$1@nnrp1.deja.com>



> The explicit package name should be:
>
>    $_ = $File::Find::name;
>

Then it would complaint:
Name  "File::Find::name" used only once: possible typo at test.pl line
19

Any advise?

Thanks,
noDo


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 29 Nov 2000 19:34:18 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: find function
Message-Id: <slrn92b84a.509.tadmc@magna.metronet.com>

nodo70@my-deja.com <nodo70@my-deja.com> wrote:
>
>
>> The explicit package name should be:
>>
>>    $_ = $File::Find::name;
>>
>
>Then it would complaint:
         ^^^^^

"would" or "does"?


>Name  "File::Find::name" used only once: possible typo at test.pl line
>19
>
>Any advise?


I can't make it say that:

---------------------
#!/usr/bin/perl -w
use strict;
use File::Find;

find( \&wanted, '.');

sub wanted {
   print "$File::Find::name\n";
}
---------------------


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


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

Date: 29 Nov 2000 23:08:54 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: for each file in dir ?
Message-Id: <9042a6$dvq@gap.cco.caltech.edu>

In article <eu4V5.6159$5H3.167655@news1.oke.nextra.no>,
Werner Vesterås <vesteraas@nospam.usa.nospam.net> wrote:
>> Im trying to write a script that works as below :
>>
>> foreach file in a directory
>>   cat file >> aNewFile
>>
>> Each file in a specified directory is appended to a new file in turn.
>
>The following code takes a directory as an argument.  The contents of all
>files in this directory will be glued together in a file named out.txt, in
>the
>current working directory.  I'm quite sure your problem could be solved in a
>more elegant way, but hey - I'm not a guru!
>
>#!/usr/bin/perl -w
>
>if ((-d $ARGV[0]) || die("Not a directory!")) {
>
>  open OUT, ">out.txt" || die("Can't open file!");
>  foreach (<$ARGV[0]/*>) {
>    if (-f) {
>      open IN, "<".$_ || die("Can't open file!");
>      while (<IN>) {
>        print OUT;
>      }
>      close IN;
>    }
>  }
>  close OUT;
>}

One caution when trying an approach like this (and this applies to 
shell scripts as much as to Perl):

Make sure your output file isn't also in your list of input files!

If there happens to be any data in the output when it gets opened for
reading, then that data will be read, and appended to the output;
then that newly written data may be read as input, and appended, and
so on, with the read pointer following the write pointer right off
the end of your free disk space.

In the example script above, if $ARGV[0] is "." (or some other path
corresponding to the current directory), then disaster is lurking.

-- Gary Ansok


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

Date: Thu, 30 Nov 2000 01:02:14 GMT
From: Mike Cameron <mcameron@mirusweb.com>
Subject: Form reposting in older browser problem
Message-Id: <3A25B514.1F85326E@mirusweb.com>

I have a fairly large program that allows for user registration, login
and some database manipulation.  I have everything pretty much complete
and went to check the results in Netscape 3.04 and I am finding that
everytime I post something via a form to the script it gets reloaded. ie
gets posted twice.  I am using CGI.pm to process the form and could not
find anything in perldoc CGI or in the perl FAQ my code is too long to
know where to start looking.  Anyone had any similar experiences?  What
am I missing.  Using apache 1.3.14 on Redhat 7.0.  The program works
fine in netscape 4.7 and ie 5.0 but seems to be refreshing itself in
netscape 3.04.

I'm stumped.  Any help appreciated



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

Date: Thu, 30 Nov 2000 01:45:24 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Form reposting in older browser problem
Message-Id: <slrn92bc9f.eor.efflandt@efflandt.xnet.com>

On Thu, 30 Nov 2000 01:02:14 GMT, Mike Cameron <mcameron@mirusweb.com> wrote:
>I have a fairly large program that allows for user registration, login
>and some database manipulation.  I have everything pretty much complete
>and went to check the results in Netscape 3.04 and I am finding that
>everytime I post something via a form to the script it gets reloaded. ie
>gets posted twice.  I am using CGI.pm to process the form and could not
>find anything in perldoc CGI or in the perl FAQ my code is too long to
>know where to start looking.  Anyone had any similar experiences?  What
>am I missing.  Using apache 1.3.14 on Redhat 7.0.  The program works
>fine in netscape 4.7 and ie 5.0 but seems to be refreshing itself in
>netscape 3.04.
>
>I'm stumped.  Any help appreciated

I don't think this has anything to do with Perl, and without a working URL
that demonstrates the problem, we are as in the dark as you are.  One
thought is, what type of URL are you using for the action?  If you are
using something like a default index.cgi or similar in a dir without
specifying the filename, do you have a trailing slash after the directory 
in the action URL?

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Thu, 30 Nov 2000 01:24:12 GMT
From: gaddamsr@my-deja.com
Subject: getting the local host name or ipaddress
Message-Id: <904a7m$vo7$1@nnrp1.deja.com>

Hi,
How can i get real host name of localHost?.

I tried with gethostbyname("localHost") or gethostbyname("127.0.0.1")

returns me the only 127.0.0.1 not real ipaddress.

Any type of help is appreciated.
Thanks
--sreeni.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 30 Nov 2000 01:29:09 GMT
From: chuckk@monmouth.com
Subject: HELP! flock problem on NFS mounted dev?
Message-Id: <904agv$vs2$1@nnrp1.deja.com>

All,

(Summay: flock does not seem reliable when multiple users  -on multiple
machines of different UNIX flavors and versions - tries to append to the
same file on an NFS mounted device)


I have a perl script that is run by any developer on any of our
various flavors of unix boxes (some sun-os and some HP-UX).
I kept the script to using only the standard Perl functions and modules
included with the base distribution.

Multiple instances of this script can be running at the same time.
And each one simply appends a record to the same text file.
Here is the code snippet:

<SNIP>
#moved open closer to actual write of log file;
#    open(LOG,">>$logfile") ||  print "  [ERROR] PVCS PREPUT TRIGGER:
$?\n          Couldn't open LOGFILE $logfile \n";
 if(!sysopen(LOG,"$logfile",O_RDWR|O_APPEND|O_CREAT))
 {
     print "  [ERROR] PVCS PREPUT TRIGGER: $?\n          Couldnt open
LOGFILE $logfile \n" ;
     print LOGERR "  [ERROR] PVCS PREPUT TRIGGER: $?\n          Couldnt
open LOGFILE $logfile \n" ; exit(9);
 };


#changed locking to exclusive blocking lock
#left in code for non-blocking + retry just in case
my $lock_failed = 0;
my $counter = 0;
print "  STATUS: Waiting to get exclusive Lock for LOG file\n";
#if(! flock(LOG,2|4)) { $lock_failed = 1;};
if(! flock(LOG,2)) { $lock_failed = 1;};
while($lock_failed == 1)
{
    close(LOG); #lock failed close file
    print " $mydate_time Sorry, Log file locked. Retrying....\n";
    sleep 2;
    if ($counter >= 10)
    {
          print LOGERR "  [ERROR] $mydate_time  Couldnt get an unlocked
logfile $logfile\n           to write ... Try Delta again\n";
          print LOGERR "          If it fails again, contact SCM
Group\n";
          print        "  [ERROR] Couldnt  get an unlocked logfile
$logfile\n           to write ... Try Delta again\n";
          print        "          If it fails again, contact SCM
Group\n";
          exit(9);
        };
        $counter = $counter + 1;
        #my $newlog = $logfile . "_$counter";
        my $newlog = $logfile;
        #if(! open(LOG,">>$newlog") )
        if(!sysopen(LOG,"$newlog",O_RDWR|O_APPEND|O_CREAT))
        {
        print "  [ERROR] PVCS PREPUT TRIGGER: $?\n          Couldnt open
LOGFILE $newlog \n" ;
        print LOGERR "  [ERROR] PVCS PREPUT TRIGGER: $?\n
Couldnt open LOGFILE $newlog \n" ; exit(9);
         };
        $lock_failed = 0;
        flock(LOG,2|4) or $lock_failed = 1;
    };
    #END 2.1
    select(LOG); $| = 1; select(STDOUT); #multiple writes are possible
to logs - unbuffer so it works ok.
print "  STATUS: Got Lock ok...\n";
&write_log();
close(LOG);


<SNIP>

I'm stumped.....
Chuck





Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 29 Nov 2000 19:54:18 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: HELP! flock problem on NFS mounted dev?
Message-Id: <904c0a$kgd$1@boomer.cs.utexas.edu>

In article <904agv$vs2$1@nnrp1.deja.com>,  <chuckk@monmouth.com> wrote:
>(Summay: flock does not seem reliable when multiple users  -on multiple
>machines of different UNIX flavors and versions - tries to append to the
>same file on an NFS mounted device)

That's a very good summary of the state of NFS locking for the entire
time I've dealt with it.  The problem is probably a bug in one or more
of the operating systems involved.  Your best hope is to find a patch
or patches that fix it.  However, in general it's best not to rely on
locking over NFS, if your software will be run by others who may have
similar problems and would have to track down patches that may or may
not even exist.

If I'm right and this really is an OS issue and not a Perl issue, you
might want to check out comp.protocols.nfs.

Hope that helps.

  - Logan


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

Date: 30 Nov 2000 00:29:14 GMT
From: atspragg@garbanzo.engr.ucdavis.edu (Adam Spragg)
Subject: Re: How do I null terminate a string ?
Message-Id: <90470q$7vn$2@mark.ucdavis.edu>

Neil Trenholm (neil@alaweb.com) wrote:
: $this_string = "StringContents";
: How do I do this ?

I'm guessing...  $this_string = "StringContents\0";

That's "slash zero".

Adam




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

Date: Thu, 30 Nov 2000 00:15:09 GMT
From: dtbaker_dejanews@my-deja.com
Subject: MIME::Lite Cc and Bcc doesnt seem to work for smtp ?
Message-Id: <904667$sgs$1@nnrp1.deja.com>

I am testing out the MIME::Lite module, and on my development platform
at home ( windows98 PC ) I have to use the send('smtp') option because
sendmail is not available...

firstly I was a little surprised that I had to explicitly set this
option, I thought that MIME::Lite was supposed to look for sendmail, and
if it couldnt be found it used smtp.

secondly, I found that I was getting warnings about a 'bad command'
until I included several optional parameters like this:
MIME::Lite->send('smtp', 'mail', Hello=>'mail' , Timeout=>60 );

Lastly, I could NOT get Cc or Bcc to work at all. I could code the whole
thing into a loop, but I was hoping to avoid that since it takes several
seconds for each mail to get sent.

Does anyone know if the lack of Cc and Bcc using the smtp method is
repairable in any way? Did I miss something special that needs to be
set to allow Cc? Is this a limitation, or a bug?

Dan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 30 Nov 2000 00:05:09 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Posting Guidelines?
Message-Id: <VQgV5.14$_g6.170940416@news.frii.net>

In article <ngpa2tglf13brgkd6m0p7mmhpfcrg7nsaq@4ax.com>,
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote:
>
>Something like the (in?)famous "Quoting Strategies and the Jeopardy Game"
>postings that Tom Christiansen used to post regularly about a year ago?
>
>Short excerpt:
>
>: The following message will be posted periodically until observed
>: clue-levels in these parts improve, or until the heat death of the
>: Universe arrives.
>: 
>

Did I miss the heat death of the universe again?  Rats. This is the second
time that happend to me.

-- 
    This space intentionally left blank


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

Date: Thu, 30 Nov 2000 00:00:45 GMT
From: L Hoang <loch@uci.edu>
Subject: Replacing a character with a string.
Message-Id: <3A2598AD.1C078583@uci.edu>

Hi all
How can I replace a character with a string.
For example, I have a huge string that contains many "a dog" in it. Now,
I want to write a Perl code to replace all the "a" character with string
"the". How can I do that?

Thanks.



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

Date: Thu, 30 Nov 2000 11:08:01 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Replacing a character with a string.
Message-Id: <g6iV5.19$gy2.3114@vic.nntp.telstra.net>

"L Hoang" <loch@uci.edu> wrote in message
news:3A2598AD.1C078583@uci.edu...
> Hi all
> How can I replace a character with a string.
> For example, I have a huge string that contains many "a dog" in it.
Now,
> I want to write a Perl code to replace all the "a" character with
string
> "the". How can I do that?
>

s/\ba\b/the/g;

Will replace all occurences of the bare word 'a' with the word 'the'.

Will not replace 'an' or other instances of 'a' surrounded by other
letters.

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: 29 Nov 2000 19:37:09 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Replacing a character with a string.
Message-Id: <904b05$kdr$1@boomer.cs.utexas.edu>

In article <3A2598AD.1C078583@uci.edu>, L Hoang  <loch@uci.edu> wrote:
>How can I replace a character with a string.
>For example, I have a huge string that contains many "a dog" in it. Now,
>I want to write a Perl code to replace all the "a" character with string
>"the". How can I do that?

If it always occurs as part of a fixed string, you can replace the
whole thing with a larger string than just "the":

	$my_string =~ s/a dog/the dog/g;

If it doesn't always occur as part of a fixed string (for instance,
newlines or extra spaces between the words), you can either save the
part that you don't want to change:

	$my_string =~ s/a(\s+dog)/the$1/g;

Or, you can take advantage of a feature which is probably unique to
Perl's regular expressions, called a zero-width positive look-ahead
assertion:

	$my_string =~ s/a(?=\s+dog)/the/g;

A zero-width positive look-ahead assertion basically is just a part of
the pattern that must match but which isn't changed when the matched
string is replaced.

You can find more information by doing "perldoc perlre".

Hope that helps.

  - Logan


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

Date: Wed, 29 Nov 2000 16:04:57 -0700
From: "Kelley Kent" <kelley.a.kent@intel.com>
Subject: running encrypted files
Message-Id: <904217$aht@news.or.intel.com>

I have some Perl files stored in common areas on our network where everyone
has access. I was wondering of there was a way to store these Perl files
(.pl, .cgi, etc) encrypted [not sure how i would do this though], and then
have some "master" perl control file that would decrypt the files and then
execute them. In this way, people could see the perl files but not know the
contents, meaning they could not execuste them and whatnot.

And I'm running on Linux, fyi. Any ideas? I've not dealt with any encryption
before.

Thanx,

Kelley




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

Date: 29 Nov 2000 18:27:01 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: running encrypted files
Message-Id: <m33dgawe9m.fsf@mumonkan.sunstarsys.com>

"Kelley Kent" <kelley.a.kent@intel.com> writes:

> I have some Perl files stored in common areas on our network where everyone
> has access. 

The public too has resources stored in wetware that virtually everyone (still) 
has access to ;)

> I was wondering of there was a way to store these Perl files
> (.pl, .cgi, etc) encrypted [not sure how i would do this though], and then
> have some "master" perl control file that would decrypt the files and then
> execute them. In this way, people could see the perl files but not know the
> contents, meaning they could not execuste them and whatnot.
> 
> And I'm running on Linux, fyi. Any ideas? I've not dealt with any encryption
> before.
> 

This seems to be a common theme for posters from your domain. Why is that?

-- 
Joe Schaefer


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

Date: Wed, 29 Nov 2000 18:13:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: running encrypted files
Message-Id: <slrn92b3cq.4r5.tadmc@magna.metronet.com>

Kelley Kent <kelley.a.kent@intel.com> wrote:

>I have some Perl files stored in common areas on our network where everyone
>has access. I was wondering of there was a way to store these Perl files
>(.pl, .cgi, etc) encrypted

>meaning they could not execuste them and whatnot.


I agree, having people actually run programs is very annoying.

Once the programs are written, they should just be put
on the shelf and admired, not put to such boringly common
things as getting work done.


>I've not dealt with any encryption
>before.


Why do you feel you need to change that?


Anyway, start with (as usual!) the Perl FAQ:

   "How can I hide the source for my Perl program?"


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


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

Date: Wed, 29 Nov 2000 18:09:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: running encrypted files
Message-Id: <slrn92b34v.4r5.tadmc@magna.metronet.com>

Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
>"Kelley Kent" <kelley.a.kent@intel.com> writes:

>> I was wondering of there was a way to store these Perl files
>> (.pl, .cgi, etc) encrypted

>This seems to be a common theme for posters from your domain. Why is that?
                                                               ^^^^^^^^^^^

Shhh!

It's a secret.


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


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

Date: Wed, 29 Nov 2000 19:26:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: splitting a string into an array and preserving the "\n"
Message-Id: <slrn92b7lm.4v5.tadmc@magna.metronet.com>

Tom Christiansen <tchrist@perl.com> wrote:

>Why thank you; that's very nice.  It's also risibly wrong.  There's
>no reason to kowtow to confusion by the uninformed masses.  


The Association of Computing Machinery are uninformed masses?


>All the world
>is not Texas, you know.


For that, y'all ern't gittin no beef jerky for Christmas this year!

:-)


>"Online" hardly means "Internet".   Bah.  Teach the kiddies.


"Online" is used twice to mean "Internet" on the cover
of the December 2000 CACM.


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


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

Date: Thu, 30 Nov 2000 01:36:47 GMT
From: Ilian Bonev <bonev@gmc.ulaval.ca>
Subject: Substituting international characters
Message-Id: <3A25AF2F.1F2A3942@gmc.ulaval.ca>

HI,

Is there a simpler way of performing the following:

$intstring =3D~ tr/[=E8,=E9,=EA,=EB]/e/;
$intstring =3D~ tr/[=E0,=E1,=E2,=E4,=E5]/a/;
$intstring =3D~ tr/[=EC,=ED,=EE,=EF]/i/;
$intstring =3D~ tr/[=F2,=F3,=F4,=F5,=F6]/o/;
$intstring =3D~ tr/[=E7]/c/;
$intstring =3D~ tr/[=E6]/ae/;
$intstring =3D~ tr/[=F9,=FA,=FB,=FC]/u/;

where $intstring is a string containing international characters.

Thanks in advance.

Ilian


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

Date: Thu, 30 Nov 2000 00:22:55 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Tieing an object
Message-Id: <z5hV5.15$_g6.190088192@news.frii.net>

In article <90405s$nfv$1@nnrp1.deja.com>,  <bdesany@my-deja.com> wrote:
>I have a Graph::Undirected object ($G), which is rather large and I'd
>like to tie it so memory usage isn't so much of an issue. Being the
>newcomer to perl (and programming in general) that I am, it is not
>immediately obvious to me how to tie this object. MLDBM seems like it
>might be the thing, but the docs tell me it works on hashes (%o),
>whereas even though my object references a multilevel hash, it is
>outwardly a scalar ($G). Does anyone have an approach to this problem I
>can explore? Or maybe even a canned recipe to actually accomplish
>this? :) Thanks-

You don't appear to be as much the novice as you give yourself
credit for. ;-)  Tie is probably not the word that you mean though.
Serialize, freeze or marshal might be more 'Computer Science' words
for what you are taling about.

I'm not familiar with how Graph::Undirected is implemented.  If
you 'use Data::Dumper" and then 'print Dumper($G)' do you get a
dump of the structure of the $G object?  If you do then it might
be possible to preserve it in an MLDBM file.  If you get just a
blessed scalar or a blessed CODE object then the persistence will
have to be added inside the Graph::Undirected class.  

chris

-- 
    This space intentionally left blank


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

Date: Thu, 30 Nov 2000 00:16:31 GMT
From: bdesany@my-deja.com
Subject: Re: Tieing an object
Message-Id: <90468p$shn$1@nnrp1.deja.com>

Just to be more clear (hopefully), I'm talking about tying a static
object to disk, and having access to the object's contents without
having to read the whole thing into memory.

I can store it on disk with Data::Dumper, but to access it I have to
read it all back in.

Can I create a subclass of Graph::Undirected that implements the
required methods for tying a scalar such that they are mapped to
methods inherited from Graph::Undirected?

In article <90405s$nfv$1@nnrp1.deja.com>,
  bdesany@my-deja.com wrote:
> I have a Graph::Undirected object ($G), which is rather large and I'd
> like to tie it so memory usage isn't so much of an issue. Being the
> newcomer to perl (and programming in general) that I am, it is not
> immediately obvious to me how to tie this object. MLDBM seems like it
> might be the thing, but the docs tell me it works on hashes (%o),
> whereas even though my object references a multilevel hash, it is
> outwardly a scalar ($G). Does anyone have an approach to this problem
I
> can explore? Or maybe even a canned recipe to actually accomplish
> this? :) Thanks-
> -Brian.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4992
**************************************


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