[15629] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3042 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 14 14:08:47 2000

Date: Sun, 14 May 2000 11:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958327510-v9-i3042@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 14 May 2000     Volume: 9 Number: 3042

Today's topics:
    Re: &nbsp - what is it? <gellyfish@gellyfish.com>
    Re: A couple of quick questions <gellyfish@gellyfish.com>
        ANN: Convert::TNEF 0.04 (Douglas Wilson)
    Re: Any body know how I access serial ports(unix) (David Efflandt)
        chat refresh <laoxiu100@hotmail.com>
    Re: Directory Help in perl <gellyfish@gellyfish.com>
    Re: Formulaire et fichier attache <gellyfish@gellyfish.com>
    Re: how to remove duplines by first column? (Randal L. Schwartz)
    Re: How to replace "\" , HELP! <jeff@vpservices.com>
        Newbie on Perl/CGI, which editor is the best on NT? <cantnoeseboy@netscape.net>
    Re: Newbie on Perl/CGI, which editor is the best on NT? <ganix#gmx.net>
        newbie question / extract records between patterns scherer6744@my-deja.com
    Re: newbie question / extract records between patterns <Luc-Etienne.Brachotte@wanadoo.fr>
    Re: Now serving 15? (How can I setup a small server in  (Monte Phillips)
    Re: NT ORACLE PERL DBD DBI->connect format <gellyfish@gellyfish.com>
    Re: page access dependant on $ENV{HTTP_REFERER} <gellyfish@gellyfish.com>
        perl, dbi, cgi problem <cyrilh@iname.com>
    Re: perl, dbi, cgi problem <jeff@vpservices.com>
    Re: Please Help friend on perl problem (Tad McClellan)
    Re: pure Perl Webserver with CGI & Win32::ODBC - I'm se <aran@mapcruzin.com>
        Reading/searching file problem <webmaster@ostas.lu.se>
    Re: Reading/searching file problem <dave@dave.org.uk>
        Redirection/Pulldown menu cgiscript for MacPerl? <webmaster@ostas.lu.se>
    Re: shooting yourself in the foot ... (Craig Berry)
    Re: sorry repost i need help despertly can someone just (Tad McClellan)
        strings and limits <ganix#gmx.net>
        tar in Perl, system or not <xah@xahlee.org>
    Re: tar in Perl, system or not <tony_curtis32@yahoo.com>
    Re: tar in Perl, system or not <Luc-Etienne.Brachotte@wanadoo.fr>
    Re: tar in Perl, system or not <tony_curtis32@yahoo.com>
    Re: tar in Perl, system or not <Luc-Etienne.Brachotte@wanadoo.fr>
    Re: the Test, to write to conference (Tad McClellan)
    Re: This error catching code should work right? (Tad McClellan)
    Re: UnixODBC - DBD::ODBC not connecting when run from b <gellyfish@gellyfish.com>
    Re: upgrading <gellyfish@gellyfish.com>
    Re: Using user-variables in external commands? (Eric Bohlman)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 13 May 2000 11:39:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: &nbsp - what is it?
Message-Id: <8fjbcr$860$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 16:20:07 -0700 Larry Rosler wrote:
> In article 
> <15F82521AF5D18AC.ECEC2093AACED09A.D67F8BB484DE18E5@lp.airnews.net> on 
> Fri, 12 May 2000 17:24:22 -0500, Paul Phillips <paul@partitura.com> 
> says...
>> I am a Perl novice.  In looking at some Perl programs I have seen this
>> construct:
>> 
>> &nbsp
>> 
>> I've looked in my llama and camel books and do not find a reference to
>> it.
>> 
>> Can someone tell me what it does?
> 
> That isn't Perl.  It is incorrect HTML.
> 

sub nbsp
{
  return '&nbsp;'
}

perhaps ;-?

/J\
-- 
We're laughing with her, Marge. There's a big difference. Ha ha
ha! ...with her.
-- 
fortune oscar homer


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

Date: 13 May 2000 11:31:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: A couple of quick questions
Message-Id: <8fjaud$6n3$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 20:09:20 GMT jlamport@calarts.edu wrote:
> In article <8fh8qq$507$1@nnrp1.deja.com>,
>   Kostis <ke77le@my-deja.com> wrote:
>> Hi all.
>> Does anyone know if the anonymous subroutine passed to a map function
>> constitute a closure if it appears within the implementation of a
>> subroutine?
>> I'm developing for mod_perl and would like to make sure that:
>> sub someSub {
>> return map {someOthersub($_)} @array;
>> }
>> won't cause a leak.
>> (Obviously assuming that someOtherSub doesn't leak...)
> 
> What anonymous subroutine?  There are no anonymous subroutines (nor any
> closures) in the code you've posted.  I'm not sure I understand the
> question, since I don't see how this would cause a leak, or even cause
> you to *suspect* a leak.  (Though is there a reason you've written this
> as
> 
> map {someOthersub($_)} @array;
> 
> rather than
> 
> map( someOthersub, @array );
> 

Probably because it wont work :

my @array = qw(foo bar zub cow arp bla);


my @arr2 = map {someOtherSub($_)} @array;

print "@arr2\n";

my @arr2 = map(someOtherSub,@array);


print "@arr2\n";

sub someOtherSub
{
   my $foo = shift || $_;

   return " * $foo * ";
}

Output :

 * foo *   * bar *   * zub *   * cow *   * arp *   * bla * 
someOtherSub someOtherSub someOtherSub someOtherSub someOtherSub someOtherSub


/J\
-- 
And Lord, we are especially thankful for nuclear power, the cleanest,
safest energy source there is. Except for solar, which is just a pipe
dream.
-- 
fortune oscar homer


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

Date: Sun, 14 May 2000 15:58:03 GMT
From: dwilson@gtemail.net (Douglas Wilson)
Subject: ANN: Convert::TNEF 0.04
Message-Id: <8fmjat$b8c$1@play.inetarena.com>

Ever wanted to convert those pesky MS-TNEF attachments from a perl program?

Uploaded the latest version to CPAN a few days ago, so it should be avalable
by now. Just search for 'TNEF'.

Cheers,
Douglas Wilson




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

Date: 14 May 2000 17:14:05 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Any body know how I access serial ports(unix)
Message-Id: <slrn8htnmq.592.efflandt@efflandt.xnet.com>

On Sun, 14 May 2000 22:21:44 +1000, Stephen Lohning <stephen@oxnee.com> wrote:
>Does any body how how I can access serial ports on a linux
>Redhat 5.2 machine.
>Which CPAN module should I look for?

First you might read /usr/doc/HOWTO/Serial-HOWTO or if you want to do
something with sockets over tcp/ip see PPP-HOWTO and 'perldoc perlipc'.
Socket and IO::Socket should already be installed.

Other suggestions to get from CPAN are the libnet package (includes
Net::FTP and others) and separate Net::Telnet.  I have not used the Expect
module, but that might help for communicating with something directly on
the port.  You should get in the habit of using /dev/ttyS#'s for the port
because cua#'s disappear in newer kernels.

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



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

Date: Mon, 15 May 2000 00:02:56 +0900
From: "sang" <laoxiu100@hotmail.com>
Subject: chat refresh
Message-Id: <8fmeuq$jl0$1@nn-os106.ocn.ad.jp>

Hi alls

I am developing a chat room with perl.
It is slow when i use refresh , is there another way
to chat?

Thanks in advance




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

Date: 13 May 2000 20:00:58 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Directory Help in perl
Message-Id: <8fk8pa$8io$1@orpheus.gellyfish.com>

In comp.lang.perl.misc Luc-Etienne.Brachotte <Luc-Etienne.Brachotte@wanadoo.fr> wrote:
> CoDoGG a écrit :
> 
>> Could some please help me..
>> I am writing a perl CGI program, and I want to find a file in the
>> directory.
>>
>> Is there a easy way that I could generate a list or a array of filenames
>> of a certain directory to easily loop through and compare.
>>
>> Thanks alot,
>> Co-DoGG
> 
> This loops on all files in the current directory:
> 
> while (<>)
> {
>    #file name in $_
> }

Er.  I dont think so.  This will deliver the contents of any files
supplied on the command line or via STDIN in $_ one line at a time.
One would generally use opendir() and readdir() to get the *names*
of the files.

In your construct I think you meant $ARGV which contains the name of the
current file being processed by the <> of course printing it within the
loop will cause it be printed once for each line in the file.

/J\
-- 
Son, this is the only time I'm ever gonna say this. It is not okay
to lose.
-- 
fortune oscar homer


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

Date: 13 May 2000 11:48:10 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Formulaire et fichier attache
Message-Id: <8fjbta$9rr$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 15:57:23 -0700 Jeff Zucker wrote:
> Fabien Quesnel wrote:
>> 
>> Voila mon problème :
>> J'ai besoin d'offrir à mes visiteurs la possibilité d'envoyer par mail leur
>> CV en .doc.
>> 
>> J'ai un champ Input="FILE" dans mon formulaire. Je fait "parcourir," je
>> choisi mon fichier, j'obtient donc (par ex) :
>> c:\mesdocs\toto.doc dans le champ du formulaire.
>> 
>> Or, à la réception de mon mail, j'obtient cette ligne, mais pas le fichier
>> attaché !
>> 
>> J'ai essayé des tas de scripts PERL, mais aucun ne prend en compte ce type
>> de champ si particulier !! Pourtant, les formulaires des services Yahoo ou
>> Hotmail par ex, permettent d'envoyer des fichiers attachés par mail !! Alors
>> ?
>> 
>> Cela fait 2 jours que je cherche, PLEAAAASSSEEE !!!!
> 
> Il faut utilizer CGI.pm pour ecririe le formulaire et le champ du type
> "FILE" et en suivant pour obtenir les resultats du formulaire au
> serveur.  En suit il faut utilizer des modules MIME-tools pour attacher
> les fichiers au email et des modules Mail-tools pour les envoyer.

Ou MIME::Lite pour le pauvre newbie peut etre. ;-} 

/J\
-- 
I'm just a technical supervisor who cared too much.
-- 
fortune oscar homer


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

Date: 14 May 2000 09:54:06 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: how to remove duplines by first column?
Message-Id: <m1r9b5rs29.fsf@halfdome.holdit.com>

>>>>> "Vallo" == Vallo Kallaste <vallo@matti.ee> writes:

Vallo> I'm having newsgroups file which I want to correct using sed. Actually 
Vallo> it's done already by using sed, awk, uniq and ed, but that's not 
Vallo> perfect :)
Vallo> File format is simple: newsgroups name, following at least one space or 
Vallo> tab or both, then following newsgroup topic which is free form text 
Vallo> until the end of line. There are lots of duplicate lines, duplicate in 
Vallo> sense of newsgroup name, not topic. I'll want to remove duplicate 
Vallo> lines, sorting and formatting afterwards is simple, e.g

Vallo> comp.os.linux.announce  Announcements blabla (Moderated)
Vallo> comp.os.linux.announce  Announcements blabla (Moderated) (Moderated)
Vallo> comp.os.linux.x		blabla.
Vallo> comp.os.linux.x		blabla

Vallo> I've got to the stage where the output contained unique newsgroups 
Vallo> lines without topic tail, but I can't get my mind around holding, 
Vallo> restoring and printing the original line if the line is unique.
Vallo> What is better for such manipulation: sed, awk, perl, whatever ..?

I don't know about "better", but one line in Perl is gonna be hard to beat:

  perl -ane 'print unless $seen{$F[0]}++' <input >output

That'll print the first one.  If you want to print the last one instead,
and you don't mind sorting the output by newsgroup name:

  perl -ane '$item{$F[0]} = $_; END { print $item{$_} for sort keys %item }' \
    <input >output

If you want to hang on to the original definition order, still printing the
last one of each:

  perl -ane '$item{$F[0]} = $_; $line{$F[0]} = $.; " \
    -e 'END {print $item{$_} for sort {$line{$a} <=> $line{$b}} keys %item}' \
    <input >output

I bet you can do all three of these in awk.  The first one will
probably take fewer keystrokes in awk, but the last two most certainly
will take more.  sed won't have enough state memory to do this
conveniently.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sun, 14 May 2000 07:47:20 -0700
From: Jeff Zucker <jeff@vpservices.com>
To: Murvin Ming-Wai Lai <mmlai@sfu.ca>
Subject: Re: How to replace "\" , HELP!
Message-Id: <391EBC78.A9A7796A@vpservices.com>

[courtesy cc to Murvin Ming-Wai]

Murvin Ming-Wai Lai wrote:
> 
> Because the \ has a very
> special usage in perl, I have difficulty to get rid of it.  The reason I
> want to do get rid or recognize \ is that I want to extract the file name
> or directory name from this input string.

You may want to use the File::Basename module which will extract a file
name from its path automatically and can work with a number of different
platform file naming conventions so it would handle these pesky windows
backslashes and also the Macintosh file and directory naming
conventions.  If not, this kind of regex will change the backslashes to
forward slashes:

	my $name =  'c:\dir\dir\file';
        $name    =~  s#\\#/#g;
        print $name;

The result will be 'c:/dir/dir/file';

Or if you change the middle line to:

        $name    =~  s#.*\\([^\\]*)$#$1#;

That will strip everything up to and including the last backslash and
result in "file".

Note that I used # instead of / to delimit the s/// operator to avoid
confusion with the slashes in the regex.  Also note that the backslash
is doubled so that it is treated as a literal backslash rather than as a
special character.

-- 
Jeff


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

Date: Sun, 14 May 2000 21:13:18 +0800
From: Cantonese Boy <cantnoeseboy@netscape.net>
Subject: Newbie on Perl/CGI, which editor is the best on NT?
Message-Id: <391EA66E.E9F59EF9@netscape.net>

I have tried visual perl, but it is not a shareware.
Which perl/CGI editor is better?

W



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

Date: Sun, 14 May 2000 17:54:11 +0200
From: "Ganix" <ganix#gmx.net>
Subject: Re: Newbie on Perl/CGI, which editor is the best on NT?
Message-Id: <dws2c9bv$GA.163@news-02.uni.net>

Hi!

I use Ultraedit for all kind of editing. It provides
syntaxhighlighting  for all kind of languages
and regular expression search and replace.
http://www.ultraedit.com

"Cantonese Boy" <cantnoeseboy@netscape.net> schrieb im Newsbeitrag
news:391EA66E.E9F59EF9@netscape.net...
> I have tried visual perl, but it is not a shareware.
> Which perl/CGI editor is better?
>
> W
>




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

Date: Sun, 14 May 2000 15:17:35 GMT
From: scherer6744@my-deja.com
Subject: newbie question / extract records between patterns
Message-Id: <8fmg26$ipd$1@nnrp1.deja.com>

Hello out there,

I have files of the following structure.

String1

 n lines

String 2

 n lines

String 3

 n lines

Now i have to extract the leading strings with the corresponding lines
e.g. in an array to make further work on them.

I there a possibility to use pattern matching or the ".." operator?

Thanks a lot for your help.

Mathias


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


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

Date: Sun, 14 May 2000 18:11:50 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: Re: newbie question / extract records between patterns
Message-Id: <391ED046.C11C229E@wanadoo.fr>

scherer6744@my-deja.com a écrit :

> Hello out there,
>
> I have files of the following structure.
>
> String1
>
>  n lines
>
> String 2
>
>  n lines
>
> String 3
>
>  n lines
>
> Now i have to extract the leading strings with the corresponding lines
> e.g. in an array to make further work on them.

you have 2-3 easy options
1) write a RE that includes the strings plus the lines, then write a
second to separate the strings.
2) write a RE that includes the strings plus the lines, with one
parenthesis for the string, and a second for the lines
3) in rare cases it is possible to write a RE that will return Strings1,
then lines1, then String2 ... In this case you add a scalar boolean flag
you complement at each iteration.

The choice depends on the content of lines according to the strings
contents.




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

Date: Sun, 14 May 2000 13:23:19 GMT
From: montep@hal-pc.org (Monte Phillips)
Subject: Re: Now serving 15? (How can I setup a small server in perl?)
Message-Id: <391ea875.2564475@news.hal-pc.org>

On Thu, 11 May 2000 15:16:06 -0700, "Malverian"
<malverian@hotmail.com> wrote:

>I've been working on this for a while, and actually I don't even have a
>script started. I would really be thankful if someone could tell me how I
>could set up a server in Perl.
>I want to be able to keep a certain port open on my computer, and when
>people connect to it, it will send information to them. Now, I've read every
>document on doing listen ports with Socket, but I still can't seem to figure
>it out. I'd like the server to allow 15 simultaneous connections and keep
>the connections until it is cancelled by the user.
>If someone could email and/or post a simple script that would print to the
>correct IP and keep the connection I would be extremely thankful!
>~Malv
>Malverian@hotmail.com


Re-assign an FTP to whatever port you want.  As to limiting numbers of
users that would be specific to the ftp prog.  Read the mans on them
to find out if and how.




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

Date: 13 May 2000 19:21:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: NT ORACLE PERL DBD DBI->connect format
Message-Id: <8fk6f3$10k$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 21:58:35 GMT mozarty@my-deja.com wrote:
> Hi,
> 
> I installed Perl 5.6.0 and DBI on my NT 4.0 Sevice pack 5
> With DBD::ODBC it works fine with ORACLE 8i 8.1.5 databse
> Then I installed DBD::Oracle and I have problem trying to connect
> database
> 
> I tried two formats:
> 
> my $dbh = DBI->connect('DBI:Oracle:host=$dbserver ,sid=$dbname', $user,
> $pass, 'Oracle');
> and
> $dbh = DBI->connect
> ('dbi:Oracle:G21DEV', 'USERNAME', 'PASSWORD', 'Oracle')
> 
> I have error message:
> Database connection not made: ORA-00000: normal, successful completion
> (DBD: log
> in failed, check ORACLE_HOME/bin is on your PATH) at test5.pl line 36.
> 
> On my NT ORACLE_HOME\bin is on PATH
> 

I have a feeling that Oracle 8i is not the same as the mainstream Oracle
database in some respects - you will almost certainly want to ask in
comp.databases.oracle to find out more.

/J\
-- 
Lisa, stop that racket! I'm trying to fix your mother's camera. Easy,
easy....I think I'll need a bigger drill.
-- 
fortune oscar homer


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

Date: 13 May 2000 11:22:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: page access dependant on $ENV{HTTP_REFERER}
Message-Id: <8fjacm$4t0$1@orpheus.gellyfish.com>

On 12 May 2000 20:42:04 GMT The WebDragon wrote:
> In article <m13dnn6hd6.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. 
> Schwartz) wrote:
> 
>  | >>>>> "Bill" == Bill  <bill@billcampbell.com> writes:
>  | 
>  | Bill> Below is the code I use in FILE-B. How would I change it so that 
>  | instead of
>  | Bill> relying on the passed variable from FILE-A, it would be dependant on
>  | Bill> $ENV{HTTP_REFERER} being FILE-A ?
>  | 
>  | Don't.  No.  Just say no.  I've spoken on this subject probably a half
>  | dozen times in the past six months, so you apparently haven't done
>  | your basic research (a simple trip to reference.com or deja.com)
>  | either.
>  | 
>  | The "Referer" header is trivially faked, dropped, and often wrong.
>  | It's useful as a hint or an item for logging, but *never* as a portion
>  | of a security policy.
>  | 
>  | Don't use it.
>  | 
>  | Don't go there.
> 
> heh, just curious, but do you recommend anything else ?

One less trivially spoofed method of only allowing your form to submit
to your program is to have your form generated with a hidden field
containing some unique key that is checked by the program.  Of course this
is not entirely proof against abuse but a lot more so.  You probably want
to ask in comp.infosystems.www.authoring.cgi for more discussion on this
stuff.

/J\
-- 
Bart, a woman is like beer. They look good, they smell good, and you'd
step over your own mother just to get one!
-- 
fortune oscar homer


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

Date: Sun, 14 May 2000 10:03:55 -0700
From: "Cyril H." <cyrilh@iname.com>
Subject: perl, dbi, cgi problem
Message-Id: <391EDC7B.F7C64550@iname.com>

Hi,

I did a really simple script to connect a database. This script works
fine if executed with the comment line. I used the file DBI.pm as
interface, and no problem occurs.

When I run this script as a CGI it doesn't work. In fact, I think the
interpreter  my web server use cannot find the file DBI.pm.

Do you have any idea ?
Moveover, I'd like to know which web server you are using (and where you
found it).

Thanks in advance for your help.

\Cyril H.




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

Date: Sun, 14 May 2000 07:54:48 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: perl, dbi, cgi problem
Message-Id: <391EBE38.41C6B5A8@vpservices.com>

"Cyril H." wrote:
> 
> Hi,
> 
> I did a really simple script to connect a database. This script works
> fine if executed with the comment line. I used the file DBI.pm as
> interface, and no problem occurs.
> 
> When I run this script as a CGI it doesn't work.

There is a FAQ on www.perl.com (search under CGI) listing common reasons
scripts fail as CGI's when they work on the command line.  The chances
are high it is a permissions problem.

> In fact, I think the
> interpreter  my web server use cannot find the file DBI.pm.
> 
> Do you have any idea ?

There is no way to guess without seeing the actual error message you
recieved.  If you post the error message, we can try to help.

> Moveover, I'd like to know which web server you are using (and where you
> found it).

I use apache, but that should be irrelevant.  AFAIK, DBI works with any
webserver.

-- 
Jeff


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

Date: Sun, 14 May 2000 09:39:29 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Please Help friend on perl problem
Message-Id: <slrn8htb4h.run.tadmc@magna.metronet.com>

On Sat, 13 May 2000 23:37:21 GMT, velocity <velocity@youreallythinkitsme.com> wrote:

>could you rewrite it so it is right?need it badly thanx
                                     ^^^^^^^^^^^^^

As soon as your check clears.


Come to clp.misc to get _help_ writing programs.

Go to a newsgroup with "jobs" in its name  to hire someone 
to _write_ code for you.


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


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

Date: Sun, 14 May 2000 15:14:44 GMT
From: "Aran Meuser" <aran@mapcruzin.com>
Subject: Re: pure Perl Webserver with CGI & Win32::ODBC - I'm searching
Message-Id: <EpzT4.3509$f3.36367@typhoon.southeast.rr.com>

It doesn't matter what web server you use as long as Perl/CGI works.  If
Perl in general works then you should be able to use DBI, and DBD::ODBC
perfectly well.  If you can't its not the web servers fault, but mopst
likely an ODBC or a Perl module problem.

As for a 100% Perl web server check out: http://stockholm.ptloma.edu/httpi/
HTTPi doesn't allow you to do much in the way of standard Perl/CGI scripts,
but it has some interesting features.  I am currently working on a Perl web
server, but its a month or so down the road until it is released.

With a little modifitcation you could keep a persistent ODBC connection and
run Perl scripts using HTTPi.

Aran


"Salvo Jr" <salvojr@rocketmail.com> wrote in message
news:8fm12f$noh$2@nslave1.tin.it...
> can anyone help me to find a pure Perl Webserver with CGI & Win32::ODBC
> support (under Win9x)?
> I tried "MacPerl" webserver and "HTTPD" webserver but Win32::ODBC don't
work
> Thank You
> Salvo Jr
> salvojr@rocketmail.com
>
>




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

Date: Sun, 14 May 2000 12:47:39 +0200
From: Jimmy Lantz <webmaster@ostas.lu.se>
To: Forum Macperl <macperl-forum@macperl.org>, Web Macperl <macperl-webcgi@macperl.org>
Subject: Reading/searching file problem
Message-Id: <391E844B.509D31DC@ostas.lu.se>

Hi, I have the following problem:
I need to read a file and search for a match according to the following criterias:


$match = KIN213:;

open(IN, "$file");

How do I match the line in the file ???? And set the text to var $titel ?

close(IN);
}

Below are some samples of lines in the file(the jidderish is supposed to
be random text and that's the text I need to set to the variabel $titel:

OSH435: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
KIN213: jfjfdshfjhsd this is a match jdhf
JAP346: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
THA212: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
KAN234: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
KIN244: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
KIN262: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf

Pls. someone help me.
Your sincerely
Jimmy Lantz


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

Date: Sun, 14 May 2000 17:11:41 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Reading/searching file problem
Message-Id: <3ojthskpfeol266fdd02ah1h8b83p174hp@4ax.com>

On Sun, 14 May 2000 12:47:39 +0200, Jimmy Lantz
<webmaster@ostas.lu.se> wrote:

>Hi, I have the following problem:
>I need to read a file and search for a match according to the following criterias:
>
>
>$match = KIN213:;
>
>open(IN, "$file");
>
>How do I match the line in the file ???? And set the text to var $titel ?
>
>close(IN);
>}
>
>Below are some samples of lines in the file(the jidderish is supposed to
>be random text and that's the text I need to set to the variabel $titel:
>
>OSH435: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
>KIN213: jfjfdshfjhsd this is a match jdhf
>JAP346: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
>THA212: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
>KAN234: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
>KIN244: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf
>KIN262: jfjfdshfjhsdfkjhsdjfhdjhfdjhfjdhf

For help on opening files see perldoc -f open (and _please_ check
return codes from open).

For help on reading from files see the section on I/O Operators in
perldoc perlop.

For help on matching text see the section on Reqex Quote-Like
Operators in perldoc perlop and also perldoc perlre.

For help on spliting lines of date see perldoc -f split.

If you need general help on usingthe Perl documentation that came with
your Perl distribution, see perldoc perldoc and my articles at
<http://www.mag-sol.com/Articles/rtfm.html>.

hth,

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Sun, 14 May 2000 12:32:58 +0200
From: Jimmy Lantz <webmaster@ostas.lu.se>
Subject: Redirection/Pulldown menu cgiscript for MacPerl?
Message-Id: <391E80DA.96929259@ostas.lu.se>

Hi, I'm looking for a redirection script for Macperl.
Is there any who knows where I can find one?
Yours sincerely
Jimmy Lantz


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

Date: Sun, 14 May 2000 17:28:47 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: shooting yourself in the foot ...
Message-Id: <shtoifohje4128@corp.supernews.com>

Ilmari Karonen (iltzu@sci.invalid) wrote:
: >Does anyone have a "shooting yourself in the foot with perl"?
: 
: "You grab the gun and pull the trigger without aiming.  The bullet
:  hits your foot, which is what Perl assumed you wanted."

*applause*  That gets my vote.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

Date: Sun, 14 May 2000 09:34:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: sorry repost i need help despertly can someone just look what is wrong
Message-Id: <slrn8htar8.run.tadmc@magna.metronet.com>

On Sat, 13 May 2000 23:35:55 GMT, velocity <velocity@youreallythinkitsme.com> wrote:

>Can any of you guys tell me why this program wont work.

>#!/usr/bin/perl

Enable warnings and use the strict pragma.


#!/usr/bin/perl -w
use strict;


>$from   = "\"vinny\"\<vinny\@perlguru.com\>";     # change this
                     ^                    ^

Those backslashes serve no purpose.

Angle brackets are not meta in strings, so they don't need escaping.

The code would work identically if you left them out.

But since you do not need either of the 2 "extra" things
(interpolation and backslash escapes) that double quotes
give you over what single quotes give you, you can do
without all of those backslashes if you use single quotes.

   $from   = '"vinny"<vinny@perlguru.com>';

That will be much easier to read and understand.


[ snip rest of code. I won't spend human time on code that 
  doesn't have warnings and strict enabled.
]


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


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

Date: Sun, 14 May 2000 18:00:33 +0200
From: "Ganix" <ganix#gmx.net>
Subject: strings and limits
Message-Id: <ekaVABcv$GA.219@news-02.uni.net>

Hi
Silly question, but is there a common way of
getting - say 10 characters long - parts out of
a string and put them into an array?
I suppose perl can triuph with some certain
command for this purpose.
I think at some kind of split with regular expression.

Thanks.




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

Date: Sun, 14 May 2000 08:22:31 -0700
From: Xah <xah@xahlee.org>
Subject: tar in Perl, system or not
Message-Id: <B54412C7.8C47%xah@xahlee.org>

how to do tar in perl?

I have, for example:

#!/usr/local/bin/perl
use strict;
my $ff = '~xah/file.tar';
qx(tar -xvf $ff)
__END__

that does not work. It just spits out the archive content to standard out
but no directory is created. I tried some variations with options and both
Solars 2.6's /usr/sbin/tar and GNU tar but fruitless. I think it has to do
with device switching.

Also, is there a tar implemented with C with Perl interface that's
compatible with GNU tar?

I have been out of Perl circle for years (though still use Perl daily)... is
http://language.perl.com/ppt/
alive and it's implementations good in general?

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html





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

Date: Sun, 14 May 2000 16:01:59 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: tar in Perl, system or not
Message-Id: <87k8gx5de0.fsf@shleppie.uh.edu>

>> On Sun, 14 May 2000 08:22:31 -0700,
>> Xah <xah@xahlee.org> said:

> how to do tar in perl?  I have, for example:

> #!/usr/local/bin/perl use strict; my $ff =
> '~xah/file.tar'; qx(tar -xvf $ff) __END__

> that does not work. It just spits out the archive
> content to standard out but no directory is created. I

It's looking for a file in the current directory called
'~xah/file.tar' which presumably doesn't exist.

Actually you are looking for a file called 'file.tar' in
the home directory of user 'xah'.  Perl doesn't directly
understand the ~USER notation.

The User::pwent module is probably what you are looking
for.  Or if you are actually 'xah' then it's your home
directory, i.e. $ENV{HOME}.  Or roll something with
getpwent() yourself if you want to get your hands slightly
dirtier than you would with User::pwent.

If this is really in CGI context then that's another
barrel of worms... 

hth
t


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

Date: Sun, 14 May 2000 18:03:39 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: Re: tar in Perl, system or not
Message-Id: <391ECE5B.7787EFCF@wanadoo.fr>

Xah a écrit :

> how to do tar in perl?
>
> I have, for example:
>
> #!/usr/local/bin/perl
> use strict;
> my $ff = '~xah/file.tar';
> qx(tar -xvf $ff)
> __END__
>
> that does not work. It just spits out the archive content to standard out
> but no directory is created. I tried some variations with options and both
> Solars 2.6's /usr/sbin/tar and GNU tar but fruitless. I think it has to do
> with device switching.

Your problem is not Perl but UNIX
basically tar syntax is:
tar xvf <tar file> <directory or file to tar>




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

Date: Sun, 14 May 2000 16:09:35 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: tar in Perl, system or not
Message-Id: <87hfc15d1b.fsf@shleppie.uh.edu>

>> On Sun, 14 May 2000 18:03:39 +0200,
>> Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr> said:

> Xah a écrit :
>> how to do tar in perl?
>> 
>> I have, for example:
>> 
>> #!/usr/local/bin/perl use strict; my $ff =
>> '~xah/file.tar'; qx(tar -xvf $ff) __END__
>> 
>> that does not work. It just spits out the archive
>> content to standard out but no directory is created. I
>> tried some variations with options and both Solars
>> 2.6's /usr/sbin/tar and GNU tar but fruitless. I think
>> it has to do with device switching.

> Your problem is not Perl but UNIX basically tar syntax
> is: tar xvf <tar file> <directory or file to tar>

Nope.  xah is extracting files, presumably the whole
archive from the original context.

You'd be right if xah were creating an archive (flags
would then be 'cvf').  The tar invocation is correct, but
this is getting off-topic for clpm.

hth
t


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

Date: Sun, 14 May 2000 18:15:33 +0200
From: Luc-Etienne Brachotte <Luc-Etienne.Brachotte@wanadoo.fr>
Subject: Re: tar in Perl, system or not
Message-Id: <391ED125.71B171C0@wanadoo.fr>



Tony Curtis a écrit :

> > Your problem is not Perl but UNIX basically tar syntax
> > is: tar xvf <tar file> <directory or file to tar>
>
> Nope.  xah is extracting files, presumably the whole
> archive from the original context.
>
> You'd be right if xah were creating an archive (flags
> would then be 'cvf').  The tar invocation is correct, but
> this is getting off-topic for clpm.

Yes, you're right.



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

Date: Sun, 14 May 2000 09:36:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: the Test, to write to conference
Message-Id: <slrn8htav0.run.tadmc@magna.metronet.com>

On Sun, 14 May 2000 02:24:36 +0400, Teterlev Sergey <teterlevsv@mtu-net.ru> wrote:

>just a test


just killfiled


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


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

Date: Sun, 14 May 2000 09:27:46 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: This error catching code should work right?
Message-Id: <slrn8htaei.run.tadmc@magna.metronet.com>

On Sat, 13 May 2000 17:54:40 -0600, Kevin Stone <stone@stoneentertainment.com> wrote:
>I'm experimenting with error catching code that is more robust than the
>standard "WORK OR DIE" method.  Below is an example of my error catching
>code.  All I'm doing is opening a file saving its contents to an array and
>closing it.  My intent is to create highly descriptive, intuitive error
>messages for a log file and also for printing it to the screen...
>
>$status = open (DBASE, $database);
>if ($status > 0) {last;}
             ^^^   ^^^^

What loop is that last() meant to leave?

You have not shown a loop in your code.


>else
>   {
>   $error='failed to open';
>   $file='database file';
>   $location='add entries';


You are not really using global variables there are you?

You don't need to, you can pass them to errorlog() as arguments
(assuming that errorlog() uses them).


>   &errorlog;
>   }
>@database = <DBASE>;
>$status = close (DBASE);
>if ($status == 1) {last;}
             ^^^^

Perl only guarantees non-zero. It may return 1 today and
-65535 tomorrow and still meet its specification.

You should check for non-zeroness (not equality to 1):

   if ($status != 0) {last;}


>The way I understand it, OPEN returns an undefined value if it fails and a
>non-zero value upon success.  CLOSE returns 1 upon success.  The problem
 ^^^^^^^^^^^^^^

"greater than zero" does not cover all "non-zero values".

-1 is a non-zero value.

You should check for non-zeroness (not greater than zero):

   if ($status != 0) {last;}


>is that it (that is the Server) does not seem to like me assigning a
>variable to catch the returned values from the OPEN and CLOSE functions. 
>Syntax is okay, but I get an INTERNAL SERVER ERROR unless I remove the
>"$status" variable.


What did it say in the error logs?


>What's the solution here?  Any help will be greatly appreciated!


There is something you are not telling us.

It is futile to speculate with out knowing what perl said
on STDERR.


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


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

Date: 14 May 2000 10:28:24 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: UnixODBC - DBD::ODBC not connecting when run from browser
Message-Id: <8flrjo$f9p$1@orpheus.gellyfish.com>

On Mon, 08 May 2000 17:09:34 GMT Kathryn Cassidy wrote:
> Hi there,
> 
> I've got a script which connects to an MS Access db on NT from a linux
> machine using DBD::ODBC and Easysoft's ODBC-ODBC Bridge.  Now when I run
> this from the command line it works perfectly with no errors or
> warnings.  If however, I run it from a browser I get the following
> errors in my apache error log:
> 
> DBI->connect failed: [unixODBC][Driver Manager]Data source name not
> found, and no default driver specified (SQL-IM002)
> [unixODBC][Driver Manager]Data source name not found, and no default
> driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1) at
> /usr/local/itg/helpdesk/cgi-bin/getMerchantDetails.pl line 10
> [unixODBC][Driver Manager]Data source name not found, and no default
> driver specified (SQL-IM002)
> [unixODBC][Driver Manager]Data source name not found, and no default
> driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1) at
> /usr/local/itg/helpdesk/cgi-bin/getMerchantDetails.pl line 10.
> [Mon May  8 17:55:34 2000] [error] [client 192.168.1.134] Premature end
> of script headers: /usr/local/itg/helpdesk/cgi-bin/getMerchantDetails.pl
> 
> 
> I assume this is a permissions issue as the webserver runs as nobody. 
> Does anyone know if unixODBC has problems with user nobody trying to
> access a DSN?  Does it need to run as a user with a shell or anything
> like that?  If that's not it then has anyone any other suggestions as to
> what could be causing this problem?
> 

The line of code with your connect string might be of some help.

/J\
-- 
Me lose brain? Uh, oh! Ha ha ha! Why I laugh?
-- 
fortune oscar homer


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

Date: 13 May 2000 11:37:10 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: upgrading
Message-Id: <8fjb8m$7ol$1@orpheus.gellyfish.com>

On Fri, 12 May 2000 22:18:56 GMT mparker200@my-deja.com wrote:
> How can I tell which perl modules have been installed on a Solaris
> system?  I think that they should be installed in site_perl but that is
> not always the case.
> 

perldoc perllocal

/J\
-- 
Don't eat me. I have a wife and kids. Eat them.
-- 
fortune oscar homer


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

Date: 13 May 2000 13:19:00 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Using user-variables in external commands?
Message-Id: <8fjko4$lio$1@slb2.atl.mindspring.net>

Anonymous Sender (nobody@mixmaster.shinn.net) wrote:
: I know that I have to escape chars if
: I use something like that:
: 
: system("sendmail $recipient");
: 
: because someone can do nasty things with
: that, but how is it if I use the following:

Specifically, the nasty things they can do involve passing additional 
commands to the shell in $recipient.

: open(MAIL,"| sendmail");
: print <<MAIL;
: To: $recipient
: 
: $body
: end
: close(MAIL);
: 
: Can someone here also do nasty things?

In this case, the shell never sees $recipient, so you're safe as long as 
there are no security holes in sendmail itself.


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

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


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