[16497] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3909 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 4 00:05:40 2000

Date: Thu, 3 Aug 2000 21:05:11 -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: <965361911-v9-i3909@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 3 Aug 2000     Volume: 9 Number: 3909

Today's topics:
    Re: #include-type-of-thing-in-Perl <rtarpine@hotmail.com>
    Re: #include-type-of-thing-in-Perl <troyr@vicnet.net.au>
    Re: #include-type-of-thing-in-Perl <rtarpine@hotmail.com>
    Re: 5.005 to 5.6.0 migration- need help with some probl (Ilya Zakharevich)
    Re: Algorithm for efficient creation of unique, random  (Logan Shaw)
    Re: Database access <bwalton@rochester.rr.com>
        delimited text to HTML table converter ppopuri@hotmail.com
    Re: FormMail.pl problems (Gwyn Judd)
    Re: Help with LWP <kernel@start.no>
    Re: How do I parse "file0001" into 2 parts? <lauren_smith13@hotmail.com>
        How to automate a secure login <cyw@yahoo.com>
        How to explain this expression? ()
    Re: How to open and append to a file <godzilla@stomp.stomp.tokyo>
    Re: How to open and append to a file <c-stone@att.net>
        I need help <nikitta@ica.net>
    Re: Is Learning Perl worth buying? (Mark P.)
    Re: launch a browser and get a URL <lauren_smith13@hotmail.com>
    Re: launch a browser and get a URL <star@sonic.net>
    Re: launch a browser and get a URL <star@sonic.net>
        need help running .pl files with Apache <kernel@start.no>
    Re: need help running .pl files with Apache <troyr@vicnet.net.au>
    Re: remove entry from file --anyone!! <jeff@yoak.com>
    Re: remove entry from file --anyone!! <bwalton@rochester.rr.com>
        Sendmail problem <mitterer.alexander@steinbacher.at>
    Re: splitting on spaces <elephant@squirrelgroup.com>
    Re: very cool routine <bart.lateur@skynet.be>
    Re: When I use LIKE I get an error in ASP <bailey12@concentric.net>
        Why root can't run perldoc? <edmcheng@graduate.hku.hk>
    Re: Win2000 ActivePerl EXE association grief c741535@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 3 Aug 2000 22:57:26 -0400
From: "Ryan Tarpine" <rtarpine@hotmail.com>
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <8mdbi7$12s8$1@newssvr05-en0.news.prodigy.com>


    Excuse for my total lack of knowledge in this area (I've been using Perl
for three whole days now!), but could you please tell me how to
require/import a file in the same directory as the script being executed?
Maybe I totally missed the point somewhere; I tried looking in perlmod.  All
I know is that I shouldn't use 'bare words' (at least I've figured out what
they are - my first step).

Thanks (sigh),
Ryan Tarpine

Ulrich Ackermann <uackermann@orga.com> wrote in message
news:3989D904.B6A3D980@orga.com...
> Ryan Tarpine wrote:
> >
> > I am trying to program some CGI for my site on a shared server where I
only
> > have access to my directory.  What is the best way for me to reuse some
of
> > my (Perl) code in multiple scripts?
> >
> > Ryan Tarpine
> >
> > Tony Curtis <tony_curtis32@yahoo.com> wrote in message
> > news:87lmye6r9o.fsf@limey.hpcc.uh.edu...
>
> *snipp*
>
> > >
> > > However, you really don't want to do this if you don't
> > > absolutely have to.  Perl != C.  Perl has libraries and
> > > modules,
> > >
> > >     perldoc perlmod
> > >
> > > which are much cleaner,
> > >
> > >     perldoc -f require
> > >     perldoc -f use
> > >
> > > hth
> Why don't you just follow the hints Tony gave you? I think it
> answers not only your original post but also the second one!
>
> Ulrich
> --
> Ulrich Ackermann
> ORGA Kartensysteme GmbH (SY-PEAT-STA)
> Tel.:+49.5254.991-925
> mailto:uackermann@orga.com
>




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

Date: Fri, 4 Aug 2000 13:09:27 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <lvqi5.69053$N4.1897606@ozemail.com.au>

not sure if this is what ure after

require "filename";

???

--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"Ryan Tarpine" <rtarpine@hotmail.com> wrote in message
news:8mdbi7$12s8$1@newssvr05-en0.news.prodigy.com...
>
>     Excuse for my total lack of knowledge in this area (I've been using
Perl
> for three whole days now!), but could you please tell me how to
> require/import a file in the same directory as the script being executed?
> Maybe I totally missed the point somewhere; I tried looking in perlmod.
All
> I know is that I shouldn't use 'bare words' (at least I've figured out
what
> they are - my first step).
>
> Thanks (sigh),
> Ryan Tarpine
>
> Ulrich Ackermann <uackermann@orga.com> wrote in message
> news:3989D904.B6A3D980@orga.com...
> > Ryan Tarpine wrote:
> > >
> > > I am trying to program some CGI for my site on a shared server where I
> only
> > > have access to my directory.  What is the best way for me to reuse
some
> of
> > > my (Perl) code in multiple scripts?
> > >
> > > Ryan Tarpine
> > >
> > > Tony Curtis <tony_curtis32@yahoo.com> wrote in message
> > > news:87lmye6r9o.fsf@limey.hpcc.uh.edu...
> >
> > *snipp*
> >
> > > >
> > > > However, you really don't want to do this if you don't
> > > > absolutely have to.  Perl != C.  Perl has libraries and
> > > > modules,
> > > >
> > > >     perldoc perlmod
> > > >
> > > > which are much cleaner,
> > > >
> > > >     perldoc -f require
> > > >     perldoc -f use
> > > >
> > > > hth
> > Why don't you just follow the hints Tony gave you? I think it
> > answers not only your original post but also the second one!
> >
> > Ulrich
> > --
> > Ulrich Ackermann
> > ORGA Kartensysteme GmbH (SY-PEAT-STA)
> > Tel.:+49.5254.991-925
> > mailto:uackermann@orga.com
> >
>
>




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

Date: Thu, 3 Aug 2000 23:57:19 -0400
From: "Ryan Tarpine" <rtarpine@hotmail.com>
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <8mdf2h$o2i$1@newssvr05-en0.news.prodigy.com>


Aha!  The file I was trying to include consisted only of subroutines, with
nothing to be executed by do FILE.  Just returning a dummy value made it
work correctly.  Is there anything specific I should return as a dummy
value?

Thanks,
Ryan Tarpine

Troy Rasiah <troyr@vicnet.net.au> wrote in message
news:lvqi5.69053$N4.1897606@ozemail.com.au...
> not sure if this is what ure after
>
> require "filename";
>
> ???
>
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
> "Ryan Tarpine" <rtarpine@hotmail.com> wrote in message
> news:8mdbi7$12s8$1@newssvr05-en0.news.prodigy.com...
> >
> >     Excuse for my total lack of knowledge in this area (I've been using
> Perl
> > for three whole days now!), but could you please tell me how to
> > require/import a file in the same directory as the script being
executed?
> > Maybe I totally missed the point somewhere; I tried looking in perlmod.
> All
> > I know is that I shouldn't use 'bare words' (at least I've figured out
> what
> > they are - my first step).
> >
> > Thanks (sigh),
> > Ryan Tarpine
> >
> > Ulrich Ackermann <uackermann@orga.com> wrote in message
> > news:3989D904.B6A3D980@orga.com...
> > > Ryan Tarpine wrote:
> > > >
> > > > I am trying to program some CGI for my site on a shared server where
I
> > only
> > > > have access to my directory.  What is the best way for me to reuse
> some
> > of
> > > > my (Perl) code in multiple scripts?
> > > >
> > > > Ryan Tarpine
> > > >
> > > > Tony Curtis <tony_curtis32@yahoo.com> wrote in message
> > > > news:87lmye6r9o.fsf@limey.hpcc.uh.edu...
> > >
> > > *snipp*
> > >
> > > > >
> > > > > However, you really don't want to do this if you don't
> > > > > absolutely have to.  Perl != C.  Perl has libraries and
> > > > > modules,
> > > > >
> > > > >     perldoc perlmod
> > > > >
> > > > > which are much cleaner,
> > > > >
> > > > >     perldoc -f require
> > > > >     perldoc -f use
> > > > >
> > > > > hth
> > > Why don't you just follow the hints Tony gave you? I think it
> > > answers not only your original post but also the second one!
> > >
> > > Ulrich
> > > --
> > > Ulrich Ackermann
> > > ORGA Kartensysteme GmbH (SY-PEAT-STA)
> > > Tel.:+49.5254.991-925
> > > mailto:uackermann@orga.com
> > >
> >
> >
>
>




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

Date: 4 Aug 2000 02:11:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: 5.005 to 5.6.0 migration- need help with some problems
Message-Id: <8md8o6$he7$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler 
<lr@hpl.hp.com>],
who wrote in article <MPG.13f36e14634f912a98ac34@nntp.hpl.hp.com>:
> > better chance to get an answer, or even get things fixed when 5.6 goes
> > out of beta.
> 
> That's not the way it has been promoted, though, is it?

Definitely not...

> Should the Perl people be different from the rest of the industry in 
> regard to shipping prototypes as if they were products?

Until quite recently they/we at least could.  Especially one-month-after-_00.

Ilya


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

Date: 3 Aug 2000 22:12:27 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Algorithm for efficient creation of unique, random array
Message-Id: <8mdcar$j5m$1@provolone.cs.utexas.edu>

In article <slrn8ojugb.jno.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXIX September MCMXCIII in
><URL:news:8mcnnr$ifq$1@provolone.cs.utexas.edu>:
>"" 
>"" The great thing about the tree method would be that it's O(log N) to
>"" pick a node and also only O(log N) to update a node.  The bad thing is
>"" that's irritating to work with binary trees because it's a pain to
>"" delete a node.
>
>Then don't delete it. Just give it chance 0 to be selected.

Hmm.  Interesting idea.  It won't work in all cases (i.e. too much
adding/deleting in the tree), but it would be handy in some.

  - Logan


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

Date: Fri, 04 Aug 2000 02:32:02 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Database access
Message-Id: <398A2B59.67602431@rochester.rr.com>

Charles Betman wrote:
 ...
> What I'm looking for is a way to use a real database (in stead of flat
> files), accessing it through SQL / ODBC under the following conditions:
> 
> - I can use a standard account with an ISP that allows executing CGI-scripts
> - I don't need a database- or applicationserver
> - the database consists out of one or more files that contain the data
> (managed through SQL); no other processes or programmes are necessary
> 
> I've heard about MySQL, but I guess I need a provider that support a
> database like that.
> 
> I hope I made myself clear (always difficult in another language) and that
> somebody can tell me which tools / techniques to use, where to find
> documentation, whatever.
> 
> --
> Met vriendelijke groet,
> Charles
> http://www.betman.demon.nl/
> charles@betman.demon.nl

Hmmmm...if I follow what you want:  you want to use SQL, but don't want
to install a database program.  You could use the DBI module with
DBD::CSV or DBD::RAM.  That would let you use SQL on
comma-separated-value files (one file per table), or set up a "database"
in memory.  I believe the more recent versons of DBD::RAM include
support for saving/loading from disk.  Either will let you do SQLish
stuff without the database hassle.  I think you'll find you will also
need the SQL::Statement and SQL::Eval modules as well.
-- 
Bob Walton


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

Date: Fri, 04 Aug 2000 02:44:13 GMT
From: ppopuri@hotmail.com
Subject: delimited text to HTML table converter
Message-Id: <8mdalt$s82$1@nnrp1.deja.com>

Hi,

Does anyone know of a scipt which converts delimited text into an html
table and consequently an HTML page.  I am working on a project where
the end-user ftp's a file to the server and the CGI is supposed to pick
it up and do two things with it.  Firstly, the CGI should convert the
delimited text file into an HTML page involving tables.  Secondly, a
link to this newly created HTML file should be added on to another page
which maintains the links of all converted files.

Your assitance is greatly appreciated.

Thank you.


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


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

Date: Fri, 04 Aug 2000 03:28:10 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: FormMail.pl problems
Message-Id: <slrn8oke27.s2l.tjla@thislove.dyndns.org>

I was shocked! How could Red Jackson <redone~nospam~@siteconnect.com>
say such a terrible thing:
>Hi!
>Thanks for the tip! This is my first tangle with FormMail.
>Any suggestions for alternatives?

Not off hand. Anyone?

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"The sooner you fall behind, the more time you'll have to catch up!"


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

Date: Fri, 4 Aug 2000 05:36:52 +0200
From: "Christopher Thorjussen" <kernel@start.no>
Subject: Re: Help with LWP
Message-Id: <8mddmm$rio$1@snipp.uninett.no>

Try using CPAN and install the LWP bundle :)

perl -MCPAN -e shell
->install Bundle::LWP


-Christopher Thorjussen



"Jeffrey" <seesej@uswest.net> wrote in message
news:B5AC1473.81AF%seesej@uswest.net...
> Hi:
>  I am trying to use the LWP:UserAgent module and I am having the following
> problem.
>
> I am getting a code 500 back from any url that I try, but this script will
> run correctly from my desktop computer.
>
> When I try to get message (ok,server error,etc) I get an execution error
> from the "message" object
>
> "Can't locate auto/URI/URL/http/path_query.al in @INC............."
>
> Problem is I can't find path_query.al anywhere.
>
> My first question is. Why am I getting the code 500 in the first place?
> Secondly, what is the path_query.al and if I need it where can I get it.
>
> Thank you in advance for any help
> Jeff
>
> I am using Perl5 on Red Hat Linux release 6.2 with Apache.
>
> Here is an excerpt of the code I am attempting to use.
>
> ######################################################
> # Create a user agent object
> use LWP::UserAgent;
>
> $ua = new LWP::UserAgent();
> $request = new HTTP::Request('GET','http://www.excite.com/');
> $result = $ua->request($request);
>
> $content    = "\ncode .....: ".$result->code;
> $content   .= "\nmessage ..: ".$result->message;
> $content   .= "\ncontent ..: \n".$result->content;
>
> print $content;
> ######################################################
>




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

Date: Thu, 3 Aug 2000 18:12:07 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: How do I parse "file0001" into 2 parts?
Message-Id: <8md57v$8c4$1@brokaw.wa.com>


P&C <mailloop@localhost.com> wrote in message
news:3989e7f7.416042307@news.comstar.net...
> I have a series of file names:
>
> file0001, file0002, file0003 etc. and I need to parse off just the
> numeric part.
>

You mean like

$numericpart = $1 if /(\d+)$/;

?


> I've read the documentation and spent the afternoon trying to make
> this work but no luck.  What's the trick to this?

What documentation are you reading?  Have you read perlre?

The trick is to use a regular expression.

Lauren





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

Date: Fri, 4 Aug 2000 12:02:15 +1000
From: "CYW" <cyw@yahoo.com>
Subject: How to automate a secure login
Message-Id: <398a23ba$0$6808$7f31c96c@news01.syd.optusnet.com.au>

I have a online service provider which I can login from the web and download
some data.
I wanted to automate the process using perl. It's a secured login requires
the browser to support 128 bit encryption.

From Internet Exploer I can use the following as URL to login:
"http://www.myprovider.com/cgi-bin/login.pl?client_no=my_client_no&pin=my_pl
ain_text_pin".
Then use the following as URL to get data:
"http://www.myprovider.com/cgi-bin/getdata.pl?datadate=01/01/00&datacode=the
_code"

I downloaded some modules from CPAN and tried the following code but didn't
succeed.

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$ua = LWP::UserAgent->new();
my $req = POST 'http://www.myprovidercom/cgi-bin/123.pl',
               [ client_no => 'my_client_no', pin => 'my_pin' ];
$content = $ua->request($req)->as_string;
print $content; # for debugging purpose

$req = POST 'http://www.myprovidercom/cgi-bin/getdata.pl',
               [ data_date => '01/01/00', data_code => 'abc' ];
$content = $ua->request($req)->as_string;
print $content;


It appeared that the login didn't succeed. I viewed my provider's login page
source from IE, there's a section contains something like:
action="http://www.myprovider.com/cgi-bin/login.pl"
method=POST
name=client_no, type=text,
name=pin, type=password

What can I do in perl to automate the login? Was it the 128 bit encryption
causing problems?

Thanks for any help,
CYW






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

Date: 4 Aug 2000 03:15:54 GMT
From: u8526505@ms27.hinet.net ()
Subject: How to explain this expression?
Message-Id: <8mdcha$n2a@netnews.hinet.net>

$_=<>;
/hello/ and print "abc\n",print "ok\n";

the result is
hello <-- I input this
ok
abc
1

Is there a friendly way to rewrite it ?
Thanks

Derek


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

Date: Thu, 03 Aug 2000 20:07:12 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to open and append to a file
Message-Id: <398A3360.BF14842D@stomp.stomp.tokyo>

Chris Stone wrote:
 
> Well, I managed to find a Perl FAQ here
> http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html.
> Most of it's over my head, as I'm just beginning but I did 
> manage to write a script that may or may not work.  I do 
> have a few questions that I could not find in the above FAQ:


Good! You did some homework, you have learned and, you
have displayed effort!

Here is a site with a fairly decent script much like
yours. It does incorporate some security, does provide
some nice error checking for various functions and, does
make a good basic script upon which to build. I am not
suggesting you use it but rather study it and learn from
this script. It's a decent one, especially if you add
a few extra features. It's name is Flexbook:

http://scripts.riffnet.com/


> Can Perl open and write to an existing HTML document?
> And does this document need to have any special CHMOD commands?

Yes. No problem. Your permissions will need to be
read and write ON and execute OFF. Experiment with
your directory permissions. Permissions for your
directory depend on how your admin configured.
You might get away with just read and write for
your directory permissions. If you have problems,
check your permissions right off. Keep your guestbook
html file outside of your script directory for security,
at least until you learn security very well.
 
> Here is my script if you are curious:

Not bad for a beginner. Actually, a very nice
start on a script. Are you sure you are a
fresh beginner? I haven't looked close nor
have I tested your script but first glance,
it looks a great start.
 
(snipped some code)

An alternative for you, if you like. You have the
right concept on opening your old guestbook, reading
it and creating an array. You may shortcut this a
little bit, avoid the need for <!--**--> by simply
changing your order of events slightly:

Do your open file and all as usual.

Print your new entry first.

Now loop through your old entries array
and print each line with a simple foreach.
This will place your new entry at top and,
your old entries will follow. This eliminates
your need of "for iteration",  a counter and
matching for this <!--**--> placeholder.

You might have to play with your html tags
a little to get the look you want.

Later, you might wish to play with opening
for both a read and write, taking care of
business a bit easier.

Do look at Flexbook. This script has some error
checking which is infinitely superior to standard
issue error checking suggested within this group.
You will discover || die is silly cargo cult code.

Hmm... kinda think you should look over security
well. Guestbooks and message boards are often 
targets for abuse. There are a few, very few,
here in this newsgroup who promote crashing
these type of scripts just for fun. There are
zillions of jerks "out there" who search for
scripts just like yours, with malice intent.

http://www.eekim.com/pubs/cgibook/ch09/0902.html


Are you sure about your being a beginner?

Godzilla!


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

Date: Fri, 04 Aug 2000 04:04:51 GMT
From: "Chris Stone" <c-stone@att.net>
Subject: Re: How to open and append to a file
Message-Id: <Dhri5.20664$RG6.1700707@bgtnsc05-news.ops.worldnet.att.net>

Thanks for the encouragement and links. Truth is, I've been taking an online
course at http://www.ed2go.com but the pace is so slow that I only know the
basics (i.e. if/then, loops, basic syntax). It is only about half-way
through (he releases two lessons per week) but now I am wishing I had just
invested in a book (I have since ordered Learning Perl)

I guess it was just that after looking at the FAQ I felt like a beginner,
because I really didn't understand any of it.

I did a lot of programming on my TI-83 which is where most of my programming
experience comes from, plus lots of HTML, a little bit of PASCAL, and even
less of Java Script.

About the script: strangely, it does not work, I got a 500 server error,
I'll have to look back over it.

Again, thanks for the links and information,
Chris

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:398A3360.BF14842D@stomp.stomp.tokyo...
> Chris Stone wrote:
>
> > Well, I managed to find a Perl FAQ here
> > http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html.
> > Most of it's over my head, as I'm just beginning but I did
> > manage to write a script that may or may not work.  I do
> > have a few questions that I could not find in the above FAQ:
>
>
> Good! You did some homework, you have learned and, you
> have displayed effort!
>
> Here is a site with a fairly decent script much like
> yours. It does incorporate some security, does provide
> some nice error checking for various functions and, does
> make a good basic script upon which to build. I am not
> suggesting you use it but rather study it and learn from
> this script. It's a decent one, especially if you add
> a few extra features. It's name is Flexbook:
>
> http://scripts.riffnet.com/
>
>
> > Can Perl open and write to an existing HTML document?
> > And does this document need to have any special CHMOD commands?
>
> Yes. No problem. Your permissions will need to be
> read and write ON and execute OFF. Experiment with
> your directory permissions. Permissions for your
> directory depend on how your admin configured.
> You might get away with just read and write for
> your directory permissions. If you have problems,
> check your permissions right off. Keep your guestbook
> html file outside of your script directory for security,
> at least until you learn security very well.
>
> > Here is my script if you are curious:
>
> Not bad for a beginner. Actually, a very nice
> start on a script. Are you sure you are a
> fresh beginner? I haven't looked close nor
> have I tested your script but first glance,
> it looks a great start.
>
> (snipped some code)
>
> An alternative for you, if you like. You have the
> right concept on opening your old guestbook, reading
> it and creating an array. You may shortcut this a
> little bit, avoid the need for <!--**--> by simply
> changing your order of events slightly:
>
> Do your open file and all as usual.
>
> Print your new entry first.
>
> Now loop through your old entries array
> and print each line with a simple foreach.
> This will place your new entry at top and,
> your old entries will follow. This eliminates
> your need of "for iteration",  a counter and
> matching for this <!--**--> placeholder.
>
> You might have to play with your html tags
> a little to get the look you want.
>
> Later, you might wish to play with opening
> for both a read and write, taking care of
> business a bit easier.
>
> Do look at Flexbook. This script has some error
> checking which is infinitely superior to standard
> issue error checking suggested within this group.
> You will discover || die is silly cargo cult code.
>
> Hmm... kinda think you should look over security
> well. Guestbooks and message boards are often
> targets for abuse. There are a few, very few,
> here in this newsgroup who promote crashing
> these type of scripts just for fun. There are
> zillions of jerks "out there" who search for
> scripts just like yours, with malice intent.
>
> http://www.eekim.com/pubs/cgibook/ch09/0902.html
>
>
> Are you sure about your being a beginner?
>
> Godzilla!




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

Date: Thu, 03 Aug 2000 22:52:48 -0700
From: nikita <nikitta@ica.net>
Subject: I need help
Message-Id: <398A5A30.669251F9@ica.net>

Hi everybody

I going mad with this script
Can anybody please help me
the script should have given me 10 lines of information with the "Next"
button
but it gives me a sub "Error" instead.
I know there is a mistake somewhere i could find it.

Thanks in advance

 Serguei

========================================================================================

#!/usr/bin/perl -w
use CGI;
$query = new CGI;
$datafile = "/home/visualweb/html/vw/datas/data2.txt";
$main_script ="http://www.visualweb.org/cgi-bin/com/11a.cgi";
print $query->header(-type => 'text/html; charset=windows-1251');
print $query->start_html(-title=>'Catalog page');

if ($FORM{'display'} eq ""){
$FORM{'display'}=10; #10
}
if ($FORM{'num_begin'} eq ""){
$FORM{'num_begin'}=1;
}
if ($FORM{'num_end'} eq ""){
$FORM{'num_end'}=10;
}

    &parse_form; #21
    $ticker=0;

   if ($FORM{'display'}>$FORM{'num_end'}){
   $FORM{'num_end'}=$FORM{'display'};
}


   #31
    &open_file("DATAFILE","", $datafile);
     $read_file;
        $counter = 0;
         # split the fields at the | character
        @data = (/\|/, $line ,11);
    $num = $data[0];
    $one = $data[1];
    $two = $data[2];
    $line1 = $data[3];
    $line2 = $data[4]; #41
    $line3 = $data[5];
    $three = $data[6];
    $four = $data[7];
    $five = $data[8];
    $six = $data[9];
    $seven = $data[10];
      chop($seven);


#51
# begin print records
print "<center><img
src=\"http://www.visualweb.org/vw/datas/company.gif\">\n";
print "<center><h2>$title</h2>\n";


 if (($num != 0) && ($one ne " " || $two ne " ")){ #57
       $ticker++;

        if ($counter < $FORM{'num_end'}){
              $counter++;
            if ($counter>= $FORM{'num_begin'}){
              &print_data;}
         }
}

#end print records
     close(DATAFILE);
       if ($counter==0) {
         &sorry;
}

    $newbegin=($FORM{'num_end'}+1);
    $newend=$FORM{'num_end'}+$FORM{'display'};

    if ($ticker<$FORM{'num_end'}){
    $FORM{'num_end'}=$ticker;
    $switch="on";}

    if ($counter==0) {
    $FORM{'num_end'}=0;
    $FORM{'num_begin'}=0;
    $ticker=0;
    }

    print "<center><TABLE width=390 cellspacing=0 border=0>\n";
    print "<tr><td><form action=\"$main_script\" method=\"post\">\n";
    print "<input type=\"hidden\" name=\"num_begin\"
value=\"$newbegin\">\n";
    print "<input type=\"hidden\" name=\"num_end\"
value=\"$newend\">\n";
    print "<input type=\"button\" value=\"Back\" onClick=\"back()\">\n";



     if ($switch ne "on"){
    print "<input type=\"submit\" value=\"Next\">\n";}
    print " &nbsp;&nbsp;&nbsp;<font face=\"arial\"><B> found:
$FORM{'num_begin'}-$FORM{'num_end'} from
$ticker</B></form></td></tr></table>\n";
    exit;
print $query->end_html;

sub open_file {

  my ($filevar, $filemode, $datafile) = @_;

  open ($filevar,$filemode . $datafile) ||
     die ("Can't open $datafile");
}

sub read_file {

  my ($filevar) = @_;

  <$filevar>;
}

sub parse_form {
   read(STDIN, $cache, $ENV{'CONTENT_LENGTH'});
   if (length($cache) < 5) {
         $buffer = $ENV{QUERY_STRING};
    }

  @pairs = split(/&/, $cache);
   foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);

      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

      $FORM{$name} = $value;
   }
}

sub print_data{
       sub print _data contains  HTML code with  $num  $one  $two ......

$seven
exit;
}

sub sorry {

 print "content-type:text/html\n\n";
 print "<HEAD><title>Error!</title></head>\n";
 print "<body bgcolor=\"#fffff\">\n";
 print "<center><TABLE width=\"520\">\n";
 print "<TR><TD><H2>Error</h2></TD></TR>\n";
 print "<TR><TD><P>Error Error Error.</p></td></tr>\n";
 print "<BR><BR>\n";
 print "</TABLE></center>\n";

 print "</BODY></HTML>\n";
exit;
}






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

Date: Fri, 04 Aug 2000 02:28:05 GMT
From: perl@imchat.com (Mark P.)
Subject: Re: Is Learning Perl worth buying?
Message-Id: <398a2a02.1595667808@news.ionet.net>

On Thu, 3 Aug 2000 11:01:59 -0700, Larry Rosler <lr@hpl.hp.com> wrote:

>> > Learning Perl book work with Perl version 6.5?
>
>...

	Perl Porters are pretty damn quick.<G> Where can I get it?


MP


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

Date: Thu, 3 Aug 2000 18:18:15 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: launch a browser and get a URL
Message-Id: <8md5jf$8nj$1@brokaw.wa.com>


Tony Curtis <tony_curtis32@yahoo.com> wrote in message
news:87snslvqmj.fsf@limey.hpcc.uh.edu...
> >> On Thu, 03 Aug 2000 23:42:49 GMT,
> >> arthur <star@sonic.net> said:
>
> > Greetings, I am not sure how to do this so help is
> > greatly appreciated and please be patient with my
> > ignorance. I want to open a browser off my Desktop and
> > be at a specific URL.
>
> And your perl issue is...?

Let me recap an old script that I wrote up when David Cassell and Kragen
Sitaker said that it wasn't possible to do in Perl too.

#!perl -w
$page = 'http://www.yahoo.com'; # Change this line
exec ("explorer $page"); # Adjust if using other browser

Not everything's not a Perl problem.  ;-)

Lauren
--
print grep ord $_,map{y/a-z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9wxyz//d;print




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

Date: Fri, 04 Aug 2000 02:22:23 GMT
From: arthur <star@sonic.net>
Subject: Re: launch a browser and get a URL
Message-Id: <B5AECE32.4AD8%star@sonic.net>

in article 8md5jf$8nj$1@brokaw.wa.com, Lauren Smith at
lauren_smith13@hotmail.com wrote on 8/3/00 5:18 PM:

>>> ignorance. I want to open a browser off my Desktop and
>>> be at a specific URL.
>> 
>> And your perl issue is...?
>  
> #!perl -w
> $page = 'http://www.yahoo.com'; # Change this line
> exec ("explorer $page"); # Adjust if using other browser
> 
Thanks Lauren but when I try it I get:

# exec? I'm not *that* kind of operating system,

At least someone has a sense of humor *

~arthur



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

Date: Fri, 04 Aug 2000 02:29:36 GMT
From: arthur <star@sonic.net>
Subject: Re: launch a browser and get a URL
Message-Id: <B5AECFE4.4AD9%star@sonic.net>

Hi Lauren,

Oh yeah, it is a local file I want to launch. Hope that helps. I will try
and open one -wish me luck!

~arthur



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

Date: Fri, 4 Aug 2000 05:40:10 +0200
From: "Christopher Thorjussen" <kernel@start.no>
Subject: need help running .pl files with Apache
Message-Id: <8mddmn$rio$2@snipp.uninett.no>

I've got this script i want to run (and I know it works - works fine from
console).

but I can't seem to get Apache to acknowledge .pl files. I've tried both
from cgi-bin and from a normal folder. more or less just get the contents of
the file displayed to me in pure ascii.

any suggestions?

-Christopher Thorjussen




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

Date: Fri, 4 Aug 2000 13:38:07 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: need help running .pl files with Apache
Message-Id: <cWqi5.69068$N4.1898924@ozemail.com.au>

does it work with a .cgi extension?

--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"Christopher Thorjussen" <kernel@start.no> wrote in message
news:8mddmn$rio$2@snipp.uninett.no...
> I've got this script i want to run (and I know it works - works fine from
> console).
>
> but I can't seem to get Apache to acknowledge .pl files. I've tried both
> from cgi-bin and from a normal folder. more or less just get the contents
of
> the file displayed to me in pure ascii.
>
> any suggestions?
>
> -Christopher Thorjussen
>
>




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

Date: Thu, 03 Aug 2000 20:53:04 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: remove entry from file --anyone!!
Message-Id: <8md7o60i51@news1.newsguy.com>


[posted and mailed]

In article <8md44r$nol$1@nnrp1.deja.com>, hallian@hotmail.com wrote:
> simple question:
> 
> I need to replace the user fred from the magic file. File magic looks
> like this:

[znip]

How about:

perl -ni.bak -e 'print unless /^fred:/' magic

or if you'd like the long way...

# untested, watch for typos
use strict;
use IO::File;
my $fh = new IO::File;
$fh->open('+< magic') or die "open $!";
flock($fh,2) or die "flock $!";
my @lines = grep {!/fred:/} $fh->getlines();
seek($fh,0,0) or die "seek $!";
$fh->print() foreach @lines;
truncate($fh,tell($fh)) or die "truncate $!";
$fh->close() or die "close $!";





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

Date: Fri, 04 Aug 2000 02:55:55 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: remove entry from file --anyone!!
Message-Id: <398A30F3.755C62@rochester.rr.com>

hallian@hotmail.com wrote:
 ...
> I need to replace the user fred from the magic file.
> File magic looks like this:
> 
> jill:nothappy:9034: gill hill
> fred:happy:9012:hill road
> nill:pop:983:jd houise
> 
> I need to remove fred from the file and move nill up so that it looks
> like this:
> 
> jill:nothappy:9034: gill hill
> nill:pop:983:jd houise
 ...
perl -wne 'print unless /^fred:/' <magic.file >newmagic.file
-- 
Bob Walton


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

Date: Thu, 3 Aug 2000 17:01:54 +0200
From: "Mitzei" <mitterer.alexander@steinbacher.at>
Subject: Sendmail problem
Message-Id: <cNfi5.166$Xi3.4143@nreader1.kpnqwest.net>

I am using a script for a mailinglist. But with some mail addresses the
following error occurs: The mails donīt arrive at the destination POP. It
seems like the error is in the sendmail-proggy. My provider told me, that
sendmail uses different smpt-servers (destination domain) and some/most deny
"us".

Are there any parameters I can use to make a workaround? i.e:
"usr/sbin/sendmail -t" (donīt know what "-t" stands for)

tia
Alex Mitterer




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

Date: Fri, 04 Aug 2000 03:07:52 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: splitting on spaces
Message-Id: <MPG.13f404f5876c93069896c1@news>

Abigail writes ..
>jason (elephant@squirrelgroup.com) wrote on MMDXXIX September MCMXCIII in
><URL:news:MPG.13f381f58d444fe29896ba@news>:
>`' 
>`' with that as my only evidence I would propose that this group does not 
>`' judge the jeopardists harshly .. nor does it expect people to get it 
>`' right first time .. people don't get plonked for jeopardising (I'm 
>`' enjoying these jeopardy based words immensely) as they certainly do for 
>`' asking FAQs and OT questions (has anyone coined OTQ yet ?)
>
>Speak for yourself. I generally plonk jeopardists on their first offence.

there are so few absolute statements that you're not the exception to .. 
you're truly one of the spices that turners of phrase speak of when 
speaking of life :)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Fri, 04 Aug 2000 01:25:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: very cool routine
Message-Id: <8r6kos47u3gk7tippmu08r607qtcbh7h8g@4ax.com>

Robin Bank wrote:

>Anyone who stares
>at a computer screen long enough to reply to every single trvial post on a
>newsgroup would NOT look as good as that girl on the barstool.

Hmm... that means you're not that girl on the barstool, either?

-- 
	Bart.


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

Date: Fri, 04 Aug 2000 03:09:01 GMT
From: "Jeffrey R. Bailey" <bailey12@concentric.net>
Subject: Re: When I use LIKE I get an error in ASP
Message-Id: <htqi5.19342$sO2.81411@typhoon.tampabay.rr.com>

When I set proto-typed my companies web app I had the same problem.  If you
pass a wild card with the the 'like' operator use the '%' sign instead of
the the '*' and a '-' instead of '%'.  See if that works.
It seems like there is a knowledge base article from Microsoft about this.
Anthony Roberts-West <a.roberts-west@bigfoot.com> wrote in message
news:398180a5@eeyore.callnetuk.com...
> I am currently learning how to use ASP and Access.
>
> A problem I cannot seem to solve.
>
> I am using Access and ASP pages that use parameter queries to access a
> database from a website.
>
> The problem I am having is when ASP receives input from an HTML form.  The
> form works OK, but when ASP tries to query the database, it seems that my
> syntax for the LIKE command is not right and it cannot query the database.
>
> What am I doing wrong?  I have followed what it says in the book and am
> still stuck.  It works ok in access as a parameter query but not in ASP.
>
> Hope someone can help
>
> Anthony.
> a.roberts-west@bigfoot.com
>
>
> The HTML form page looks like this.
>
> <HTML>
> <HEAD>
> <META HTTP-EQUIV="Content-Type"
> CONTENT="text/html;charset=windows-1252">
> <TITLE>Houses with matching features</TITLE>
> <BODY>
> <FORM METHOD="GET" ACTION="matchingfeatures.asp">
> [Enter Details (*within asterisks*)] <INPUT TYPE="Text" NAME="[Enter
Details
> (*within asterisks*)]"><P>
> <INPUT TYPE="Submit" VALUE="Run Query">
> </FORM>
> </BODY>
> </HTML>
>
>
> The asp database page looks like this.
>
> <HTML>
> <HEAD>
> <META HTTP-EQUIV="Content-Type"
> CONTENT="text/html;charset=windows-1252">
> <TITLE>Houseswithmatchingfeatures</TITLE>
> </HEAD>
> <BODY>
> <%
> Param = Request.QueryString("Param")
> Data = Request.QueryString("Data")
> %>
> <%
> If IsObject(Session("DSNAnthony_conn")) Then
>     Set conn = Session("DSNAnthony_conn")
> Else
>     Set conn = Server.CreateObject("ADODB.Connection")
>     conn.open "DSNAnthony","",""
>     Set Session("DSNAnthony_conn") = conn
> End If
> %>
> <%
>     sql = "SELECT Properties.[Property ID], Properties.MarketingComment,
> Properties.Price  FROM Properties  WHERE ((Properties.MarketingComment)
> Like " & Request.QueryString("[Enter Details (*within asterisks*)]") &
> ")   "
>     If cstr(Param) <> "" And cstr(Data) <> "" Then
>         sql = sql & " And [" & cstr(Param) & "] = " & cstr(Data)
>     End If
>
> Response.Write sql
>
> '    Set rs = Server.CreateObject("ADODB.Recordset")
> '    rs.Open sql, conn, 3, 3
> %>
> <TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0><FONT FACE="Arial" COLOR
> #000000><CAPTION><B>Houseswithmatchingfeatures</B></CAPTION>
>
> <THEAD>
> <TR>
> <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial"
> COLOR=#000000>Property ID</FONT></TH>
> <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial"
> COLOR=#000000>MarketingComment</FONT></TH>
> <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial"
> COLOR=#000000>Price</FONT></TH>
>
> </TR>
> </THEAD>
> <TBODY>
> <%
> On Error Resume Next
> rs.MoveFirst
> do while Not rs.eof
> %>
> <TR VALIGN=TOP>
> <TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE="Arial"
> COLOR=#000000><%=Server.HTMLEncode(rs.Fields("Property
> ID").Value)%><BR></FONT></TD>
> <TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE="Arial"
>
COLOR=#000000><%=Server.HTMLEncode(rs.Fields("MarketingComment").Value)%><BR
> ></FONT></TD>
>
> <TD BORDERCOLOR=#c0c0c0  ALIGN=RIGHT><FONT SIZE=2 FACE="Arial"
>
COLOR=#000000><%=Server.HTMLEncode(rs.Fields("Price").Value)%><BR></FONT></T
> D>
>
> </TR>
> <%
> rs.MoveNext
> loop%>
> </TBODY>
> <TFOOT></TFOOT>
> </TABLE>
> </BODY>
> </HTML>
>
>
>
> It appears to be the  sql = "SELECT statement that has a problem where the
> LIKE keyword is used.
>
>
>
>
>
>
>
>




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

Date: Fri, 04 Aug 2000 02:25:35 GMT
From: Edmond Cheng <edmcheng@graduate.hku.hk>
Subject: Why root can't run perldoc?
Message-Id: <398A2A33.9400DB96@graduate.hku.hk>

Hi,

I login in as root and try to read some perl document using the
perldoc.  But I get the message:

Superuser must not run /usr/local/bin/perldoc without security audit and
taint checks.

My questions are:
1. Why user root cannot run perldoc?
2.  How can I get around of it without logout of root.

I am usring Perl 5.6 on Redhat 6.2

Thanks,
Edmond

I know there is security problem to login as root.  But it is my home
machine and I need to do some system administration, so most of the time
I use root.




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

Date: Fri, 04 Aug 2000 02:22:05 GMT
From: c741535@my-deja.com
Subject: Re: Win2000 ActivePerl EXE association grief
Message-Id: <8md9ca$rcb$1@nnrp1.deja.com>

Howdy Timothy,

Thanks very much for the reply! This is a good suggestion and I'll try
it out, although I don't see why this should be different from NT4
(with W2K you never know though). The fact that the ActivePerl
supports the MSI install but not inserting the file associations is
weird. On the other matter of being able to see debug output when using
the ISAPI DLL, do you know if this can be done?

Cheers, and thanx again

Andy.
In article <8m6ime$oeq$1@news.chatlink.com>,
  "Timothy H. Schilbach" <tschilbach@aodinc.com> wrote:
> Andy,
>
> I am a big NT webserver/ISP myself. I use windows NT 4.0 or Linux for
> webserving with PERL. The reason your having trouble is a simple
windows
> 2000 built in routine. Windows 2000 does not allow applications that
run in
> 16bit mode. Or I should say that it doesn't work with applications
that do
> not work in 16bit protected mode. This is why so many wonderful dos
games,
> windows 95 applications, and some unix emulated features do not work
on
> NT2k.
>
> Active PERL runs in the command prompt in a 16bit emulated
environment. I do
> not think it runs in protected mode (you may want to check with active
PERL
> or in the file properties itself). Because of this Active PERL will
not work
> on NT2k very well in the command prompt mode. Try forcing it to
protective
> mode and see if that helps any.
>
> You may want to check the latest documentation at the activestate site
to
> see if there will be any updates or changes for NT2k.
>
> Let me know if this helps.
>
> --
> Timothy H. Schilbach
> Alpha Omega Design Inc.
> tschilbach@aodinc.com
> 1-877-263-7094
> Visit our website at www.aodinc.com
>
> Web server hosting and dialup access for the future.
>



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


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