[16514] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3926 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 6 06:05:29 2000

Date: Sun, 6 Aug 2000 03: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: <965556311-v9-i3926@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 6 Aug 2000     Volume: 9 Number: 3926

Today's topics:
    Re: can i test cgi scripts on my own pc without a host? (Tim Hammerquist)
    Re: CGI.pm not passing ampersands properly (Juho =?iso-8859-1?Q?Cederstr=F6m?=)
        convert string from uppercase to lower case jliu34740@my-deja.com
        convert vowels from lowercase to uppercase [was: conver <elephant@squirrelgroup.com>
    Re: Deleting an element from hash of hashes? (Abigail)
    Re: Dereferencing correctly in regular expressions marius@bluebrush.com
    Re: editing PDF files with Perl... possible? <jmaggard@va.mediaone.net>
    Re: editing PDF files with Perl... possible? <elephant@squirrelgroup.com>
    Re: Editing.cfg file for use with anti-leech Perl scrip (Abigail)
    Re: file upload using perl (Abigail)
    Re: file upload using perl (Keith Calvert Ivey)
        First Days of Perl (Newbie) <dkocchi@home.com>
    Re: First Days of Perl (Newbie) (Abigail)
    Re: First Days of Perl (Newbie) <jmaggard@va.mediaone.net>
    Re: Gee, thanks for all the help  :-( <steve.jones@takethisoutproact.net>
    Re: Gee, thanks for all the help  :-( <steve.jones@takethisoutproact.net>
    Re: How to capture CGI program .exe output, modify it a <jmaggard@va.mediaone.net>
    Re: id and password:the easyiest way (Juho =?iso-8859-1?Q?Cederstr=F6m?=)
    Re: looking for a certain bot <jmaggard@va.mediaone.net>
    Re: Novice Question: Outputting an existing file nobull@mail.com
    Re: Perl Newbie Question <research@ev1.net>
    Re: Programming Ethics <jmaggard@va.mediaone.net>
        reading and writing to dmb file ( .db) drdementor@my-deja.com
    Re: Stumped Again! (Greg Andrews)
    Re: time output not showing leading 0's ? How do I... <lr@hpl.hp.com>
    Re: very cool routine <groovyt@erols.com>
        web based emails <trbovidd@mcmaster.ca>
        What's defined,and what's undef? <crud_alex@yahoo.com>
    Re: What's defined,and what's undef? (Prasanth A. Kumar)
    Re: XML to HTML with Perl marius@bluebrush.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 06 Aug 2000 06:58:58 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: can i test cgi scripts on my own pc without a host?
Message-Id: <slrn8oq3o9.kr.tim@degree.ath.cx>

On Sat, 05 Aug 2000 19:01:19 GMT, drdementor@my-deja.com
<drdementor@my-deja.com> wrote:
> I want to test scripts on my own pc without a host. I find it time

Yup, this calls for a webserver.  Either MS Personal Web Server or
Apache.  PWS supports ASP; Apache has more support (and makes sense).

> when i used to just know html i would prefer writing html in notepad
> and keep a browser open, way faster than havign to upload to a host
> then test...(ya i know writing html by hand is silly anymore with dream
> weaver and what not but i wanted to learn it and have control.)

Dreamweaver... hmm.  There are worse products on the market
(...FrontPage...) out there.  Personally, something like HomeSite was my
favorite webpage editor on Win32.  _CODE_ editor, internal browser, and
supported server mappings.  Very slick, but buggy in the later versions.
 ...ok, this is now a comp.editors argument.  Sorry.  =)

Basically, I'll be the last person to condemn someone for using a plain
text editor.  =)

-- 
-Tim Hammerquist <timmy@cpan.org>
For every problem, there is one solution
which is simple, neat and wrong.
	-- H. L. Mencken


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

Date: 6 Aug 2000 07:43:28 GMT
From: cederstrom@kolumbus.REMOVE_THIS.fi (Juho =?iso-8859-1?Q?Cederstr=F6m?=)
Subject: Re: CGI.pm not passing ampersands properly
Message-Id: <slrn8oncv5.167.cederstrom@sitruuna.cedenet.local>

On Fri, 4 Aug 2000 13:53:26 -0400, 
Edward Waldspurger <ewald@electronicfrontiers.com> wrote:
> I am using POST.  This happens both in IE 5 and Netscape 4.  [...]
> The problem still seems to be with my Perl.  The data is being sent from the

Your problem would occur if your browser didn't convert ampersand to %26.
Try calling your script this way:

	http://server/path/script.pl?value=foo%26bar

The result should be 'foo&bar'.


This works with IE5 and Lynx:
--------
#!/usr/bin/perl -wT
use strict;
use CGI;

print CGI->header;
my $x = CGI::param( 'value' );

print <<E;
<html><body>
        $x<br>

        <form method=post action=/cgi-bin/foo.pl>
                <input name=value>
                <input type=submit>
        </form>
</body></html>
E
--------

-- 
Juho Cederstrom    -    cederstrom<a>kolumbus.fi    s/<a>/@/


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

Date: Sun, 06 Aug 2000 07:26:23 GMT
From: jliu34740@my-deja.com
Subject: convert string from uppercase to lower case
Message-Id: <8mj3ut$qms$1@nnrp1.deja.com>

I have a defined string as the following:

$_="i HAve tWo  Cat home";

How do I convert the vowels in the above string from lower case to
uppercase?

TIA


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


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

Date: Sun, 06 Aug 2000 08:04:13 GMT
From: jason <elephant@squirrelgroup.com>
Subject: convert vowels from lowercase to uppercase [was: convert string from uppercase to lower case]
Message-Id: <MPG.13f7b961c58aa1189896ce@news>

  [ subject line changed to reflect actual topic ]

jliu34740@my-deja.com writes ..
>I have a defined string as the following:
>
>$_="i HAve tWo  Cat home";
>
>How do I convert the vowels in the above string from lower case to
>uppercase?

look up the transliteration operator in the "Regexp Quote-Like 
Operators" section of perlop

  perldoc perlop

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


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

Date: 06 Aug 2000 04:51:56 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Deleting an element from hash of hashes?
Message-Id: <slrn8oprmq.st1.abigail@alexandra.foad.org>

Baris (sumengen@hotelspectra.com) wrote on MMDXXXII September MCMXCIII in
<URL:news:398cdf07$1_1@goliath2.newsfeeds.com>:
-- Hello,
-- I have a hash:
-- %hash = (
-- i1 => {a1=>1, a2=>2},
-- i2 => {a1=>4,a3=>6}
-- );
--
-- to erase i2 from this hash I am doing this:
-- undef %{$hash{i2}};

Why?

-- delete $hash{i2};

That should be more than enough.

-- Is this good enough, especially in terms of cleaning memory?
-- Is there a perl doc for cleaning complex data structures?

Unless you have cyclic structures, you don't need to do anything special
to "clean" data structures. Just delete or splice it out, and Perls garbage
collector takes care of it.



Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: Sun, 06 Aug 2000 01:29:37 -0800
From: marius@bluebrush.com
Subject: Re: Dereferencing correctly in regular expressions
Message-Id: <lk9j5.15718$ho5.248837@news-east.usenetserver.com>

Do this:

$JSP =~ s/<%=\$(\w+)>/@{[ $req->param($1) ]}/g;

or the dumbed down version:

my $tmp=$req->param($1);
$JSP =~ s/<%=\$(\w+)>/$tmp/g;


> I have a code snippet that looks like this:
> [...]



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

Date: Sun, 06 Aug 2000 06:35:46 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Re: editing PDF files with Perl... possible?
Message-Id: <398D0739.BC2D6801@va.mediaone.net>

It is possible, but would require an in-depth knowledge of the PDF
format...

Dico Reyers wrote:

> Hi There,
>
> I am wondering if one can edit PDF files with Perl (or PHP).  I would
> like someone to be able to go to a specific URL and edit a PDF... move
> images/text?  Is this possible?
>
> Thanks,
>
> -Dico



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

Date: Sun, 06 Aug 2000 07:01:39 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: editing PDF files with Perl... possible?
Message-Id: <MPG.13f7aab3ee60413d9896cd@news>

Dico Reyers writes ..
>I am wondering if one can edit PDF files with Perl (or PHP).  I would
>like someone to be able to go to a specific URL and edit a PDF... move
>images/text?  Is this possible?

check out the Text::PDF module on CPAN

  http://www.cpan.org/modules/

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


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

Date: 06 Aug 2000 04:57:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Editing.cfg file for use with anti-leech Perl script...
Message-Id: <slrn8ops0p.st1.abigail@alexandra.foad.org>

Cyber Thief (fake@address.com) wrote on MMDXXXI September MCMXCIII in
<URL:news:MT1j5.22733$RG6.1882758@bgtnsc05-news.ops.worldnet.att.net>:
<> 
<> I've got a script that uses the "HTTP REFERER" to verify that user's who 
<> download files from my site are actually at the site, and not some stolen lin
<> The script relies on a .cfg file to know which URLS are permitted to access m
<> files. In setting up this file, I was required to put in the URL like this:
<> 
<> http:\/\/internettrash.com\/users\/cyberthief\/ 
<> end
<> 
<> Two lines, right? So, I make this file on Notepad and upload it to the CGI-BI
<> only to find all the info is bunched up together on one line. I run the progr
<> and it tells me my own site is not permitted to access files! Is there anyway
<> can edit this so the URL and the "end" command show up as separate lines. I 
<> would also like to add a couple other URLS for access, but I can't because th
<> each require their own line, yet the text gets compressed together when I 
<> upload in ASCII mode. I even tried uploading as binary. No dice. Any 
<> suggestions?


Besides the fact that your protection is about as silly as putting a
bucket of water on top of an ajar door to keep burglers out, what on
earth does your question have to do with Perl?

The fact your silly "protection" is written in Perl is irrelevant. Your
problem is the parsing of a configuration file. That's 100% an application
issue, and 0% an issue of the language the application was written in.

I suggest you contact tech support of the vendors of the application.



Abigail
-- 
 :;$:=~s:
-:;another Perl Hacker
 :;chop
$:;$:=~y:;::d;print+Just.$:


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

Date: 06 Aug 2000 04:49:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: file upload using perl
Message-Id: <slrn8oprhd.st1.abigail@alexandra.foad.org>

Johannes Stark (starktdh@gmx.de) wrote on MMDXXXII September MCMXCIII in
<URL:news:8migu2$ba8$1@merlin.rembrandtstr.bocholt.de>:
{} Yes of course I will, but the problem is solved in cgi.pm and I want to
{} understand that problem.

In that case, why not read the source of CGI.pm? It contains the solution
of the problem you're trying to understand.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};                # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: Sun, 06 Aug 2000 03:56:02 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: file upload using perl
Message-Id: <398fe0b0.97005420@news.newsguy.com>

"Johannes Stark" <starktdh@gmx.de> wrote:

>Yes of course I will, but the problem is solved in cgi.pm and I want to
>understand that problem.
>
>So once more: does anyone really know, whats up with STDIN + perl + cgi +
>posted data.

Look at the source of CGI.pm and compare it with your program to
see what's different.  What do you expect from us?  We don't
have your program, so we can't very well find the difference for
you -- it's unlikely anyone other than you would be sufficiently
interested to wade through your code anyway.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Sun, 06 Aug 2000 04:59:20 GMT
From: "David Kocchi" <dkocchi@home.com>
Subject: First Days of Perl (Newbie)
Message-Id: <Ig6j5.66690$ll.407881@news1.rdc1.az.home.com>

I downloaded active perl on my windows PC. After I write a line of script,
and save it as a text file. How do I view what I have written? According to
the book I'm reading it says to save the file with a cgi extension. When I
save the file it also adds the .txt at the end is this write?  test.cgi.txt




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

Date: 06 Aug 2000 05:36:11 GMT
From: abigail@foad.org (Abigail)
Subject: Re: First Days of Perl (Newbie)
Message-Id: <slrn8opu9o.st1.abigail@alexandra.foad.org>

David Kocchi (dkocchi@home.com) wrote on MMDXXXII September MCMXCIII in
<URL:news:Ig6j5.66690$ll.407881@news1.rdc1.az.home.com>:
@@ I downloaded active perl on my windows PC. After I write a line of script,
@@ and save it as a text file. How do I view what I have written? According to
@@ the book I'm reading it says to save the file with a cgi extension. When I
@@ save the file it also adds the .txt at the end is this write?  test.cgi.txt


If you write a C program using an editor, does it get saved as test.c.txt?
If not, how did you fix that? How would you view an Eiffel program you
have written? You'd do the same thing with a Perl program.

As for the .cgi extension, the book is wrong. Perl doesn't care how you
name your files.

But it looks to me you haven't reach to point of having Perl problems yet.
You seem to lack experience using fundamental programming tools.

Read the manpages, I would say.


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Sun, 06 Aug 2000 06:27:46 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Re: First Days of Perl (Newbie)
Message-Id: <398D0559.6AED133D@va.mediaone.net>

David,

    This most likely happens because of the way your file options are in
Windows.

Open "My Computer" view->Options (File Options in 98)
The second tab should be "View"  Make sure that "Hide file extensions for known
file types" is unchecked.

    When this is checked, it will auto-add extensions to the files. (So M$ can
recognize the file type)  There is no given extension you must use (caveat:
some webservers insist that you have a .cgi at the end of scripts.)  I end mine
in ".pl".

Happy Hacking!

David Kocchi wrote:

> I downloaded active perl on my windows PC. After I write a line of script,
> and save it as a text file. How do I view what I have written? According to
> the book I'm reading it says to save the file with a cgi extension. When I
> save the file it also adds the .txt at the end is this write?  test.cgi.txt



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

Date: Fri, 4 Aug 2000 11:24:55 +0100
From: "Steve Jones" <steve.jones@takethisoutproact.net>
Subject: Re: Gee, thanks for all the help  :-(
Message-Id: <398a9a7f_2@nnrp1.news.uk.psi.net>

OK, Phil, keep your shirt on. We have jobs to do as well, you know, and we
can't spend all our time banging answers into newsgroups for people starting
out.

Let's go through your problems. The natural home for Perl is Unix, but it
has been ported to NT and other OSes. That's why there are several versions
of the Perl interpreter. Each version is compiled to run on a different
platform, but the source code is the same (I think).

If you downloaded a file from the Internet and it froze your browser during
the download, I wouldn't blame the file.

Perl is interpreted. It doesn't have a compiler, it has an interpreter. You
don't compile the source to binary code. Perl executes text files containing
Perl scripts.

Some OS specific functions are different on NT and UNIX and so some scripts
may not work on both platforms if you have used these functions. I know
there are differences in the way file permissions work, internet programming
(non blocking sockets and reads),  process control (fork doesn't work on
NT), signals and message handling don't work the same way, records end with
\n on Unix and \r\n on Windows  etc. However, if you are using Unix already,
then most scripts will be OK. In any case, it depends on what type of script
you want to write - if it's a simple case of reading a file, splitting out
some information, making a few calculations and printing the results on the
screen, then you have no problem - it'll work the same (mostly) on NT and
Unix.

Your version - go to http://www.cpan.org/ports/index.html and you will see
binary ports for lots of different systems. If your system is supported,
this is the place to find the version of the binaries you need. Judging by
your post, you don't sound as if you are equiped to compile your own version
of Perl so download a precompiled version from here.

If you get "Bare word found where operator expected", that is a start
because this is a Perl message, so you've already got a version running.
There is something wrong with your program. Create a file called first.pl in
a text editor and put this line in it:
print "hello";
Then type
perl first.pl

If you see output, you are off the starting block.


--
Steve Jones
ProAct International, 9a Vale Street, Denbigh, North Wales

stevej@proact.net
"Phil Hawkins" <tarheel@sierratel.com> wrote in message
news:398A4CEC.8BD01EB6@sierratel.com...
> I have posted here twice in two days begging for help from you all and
> NO ONE seems to think my question merits anyone's attention.
>
> Nice group.  Real f****** nice group.
>
> Just so you know what I'm talking about, here's my question:
>
> ************
>
> I give up.  I bought a self-learning book on "Perl 5" and come to find
> out I must download Perl, but I go to the perl.com site and it get's
> more confusing.
>
> My host is Unix, so I tried to download the Perl 5.6.00... and it just
> froze my browser.  It appears that there are two versions?  One for NT
> and the other for
> Unix?  Huh?  I have to write two different scripts for each server
> type?  And what about the compiler?
>
> I'm brand new to this, so someone please tell me what to do to get the
> right version of Perl on my (local) machine...  I'm dazed and confused.
> The CD that came
> with the book loaded the "source code" but when I started to write my
> first scripts, it went belly up.  I got  wierd "Bare word found where
> operator expected"
> notice when all I tried to do is "% perl hello".  Christ.  Can't even
> get out of the starting block.
>
> Java was easier than this...
>
> Phil
>




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

Date: Fri, 4 Aug 2000 11:24:55 +0100
From: "Steve Jones" <steve.jones@takethisoutproact.net>
Subject: Re: Gee, thanks for all the help  :-(
Message-Id: <398a9add_1@nnrp1.news.uk.psi.net>

OK, Phil, keep your shirt on. We have jobs to do as well, you know, and we
can't spend all our time banging answers into newsgroups for people starting
out.

Let's go through your problems. The natural home for Perl is Unix, but it
has been ported to NT and other OSes. That's why there are several versions
of the Perl interpreter. Each version is compiled to run on a different
platform, but the source code is the same (I think).

If you downloaded a file from the Internet and it froze your browser during
the download, I wouldn't blame the file.

Perl is interpreted. It doesn't have a compiler, it has an interpreter. You
don't compile the source to binary code. Perl executes text files containing
Perl scripts.

Some OS specific functions are different on NT and UNIX and so some scripts
may not work on both platforms if you have used these functions. I know
there are differences in the way file permissions work, internet programming
(non blocking sockets and reads),  process control (fork doesn't work on
NT), signals and message handling don't work the same way, records end with
\n on Unix and \r\n on Windows  etc. However, if you are using Unix already,
then most scripts will be OK. In any case, it depends on what type of script
you want to write - if it's a simple case of reading a file, splitting out
some information, making a few calculations and printing the results on the
screen, then you have no problem - it'll work the same (mostly) on NT and
Unix.

Your version - go to http://www.cpan.org/ports/index.html and you will see
binary ports for lots of different systems. If your system is supported,
this is the place to find the version of the binaries you need. Judging by
your post, you don't sound as if you are equiped to compile your own version
of Perl so download a precompiled version from here.

If you get "Bare word found where operator expected", that is a start
because this is a Perl message, so you've already got a version running.
There is something wrong with your program. Create a file called first.pl in
a text editor and put this line in it:
print "hello";
Then type
perl first.pl

If you see output, you are off the starting block.


--
Steve Jones
ProAct International, 9a Vale Street, Denbigh, North Wales

stevej@proact.net
"Phil Hawkins" <tarheel@sierratel.com> wrote in message
news:398A4CEC.8BD01EB6@sierratel.com...
> I have posted here twice in two days begging for help from you all and
> NO ONE seems to think my question merits anyone's attention.
>
> Nice group.  Real f****** nice group.
>
> Just so you know what I'm talking about, here's my question:
>
> ************
>
> I give up.  I bought a self-learning book on "Perl 5" and come to find
> out I must download Perl, but I go to the perl.com site and it get's
> more confusing.
>
> My host is Unix, so I tried to download the Perl 5.6.00... and it just
> froze my browser.  It appears that there are two versions?  One for NT
> and the other for
> Unix?  Huh?  I have to write two different scripts for each server
> type?  And what about the compiler?
>
> I'm brand new to this, so someone please tell me what to do to get the
> right version of Perl on my (local) machine...  I'm dazed and confused.
> The CD that came
> with the book loaded the "source code" but when I started to write my
> first scripts, it went belly up.  I got  wierd "Bare word found where
> operator expected"
> notice when all I tried to do is "% perl hello".  Christ.  Can't even
> get out of the starting block.
>
> Java was easier than this...
>
> Phil
>




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

Date: Sun, 06 Aug 2000 07:16:07 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Re: How to capture CGI program .exe output, modify it and then pass back  to browser (client)
Message-Id: <398D10AE.4C7681A8@va.mediaone.net>

Barry,

    If it's a compiled .exe you need to wrap it in another program first:
cgi.perl -> output -> cgiprogram.exe -> output -> cgi.perl -> output -> browser

The biggest problems that you will have with this approach is increased
overhead, will you require interprocess communication, and passing vars.

This is assuming that it is a compiled program that does not allow for this kind
of configuration.

Look at the LWP modules like User Agent...
# Data is the post data from the original form

$data = @_   # Get data

# Create a request  From the perldoc
 my $req = new HTTP::Request POST => 'http://www.perl.com/cgi-bin/BugGlimpse';
 $req->content_type('application/x-www-form-urlencoded');
 $req->content($data);

my $res = $ua->request($req);

if ($res->is_success) {
      print $res->content;
  } else {
      print "Bad luck this time\n";
  }

Some of the syntax is off, and this wouldn't parse, but I think you get the
idea.

barrybx@my-deja.com wrote:

> Hi All,
>
> I'm a CGI dummy. This is a lengthy question, I really hope someone can help
> (save) me.
>
> I have a CGI program with no source code, i.e. cgiprogram.exe.
>
> The arguments pass to the cgi program must use post method, like the
> following:
>
> <form action=http://www.dummy.net/cgiprogram.exe method=post>
> <input name=par1 value=val1>
> <input name=par2 value=val2>
> ...
> </form>
>
> The output of the cgi program is directly return the browser (client). The
> format of the output is binary Content-Transfer-Encoding and the
> Content-type: text/html, i.e. somewhat like a binary html.
>
> I need to run the cgi program, get value from the output and redirect the
> output (data) to another url (html page).
>
> That means:
>
> Originally,
> cgiprogram -> output -> browser
>
> Intented to,
> cgiprogram -> output -> another cgi program -> browser
>
> Do I need to write something like a cgi proxy program (that a big project to
> me), or somewhat like a filter ?
>
> My main concern is how can I get the binary html data and redirect it to a
> cgi program instead of printing to browser directory.
>
> Could anybody kindly give me some advice or suggestion?
>
> Recommended booklist or examples are welcomed.
>
> Thanks.
>
> Hope someone can understand my words.
>
> Best Regards,
> Barry
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: 6 Aug 2000 07:43:34 GMT
From: cederstrom@kolumbus.REMOVE_THIS.fi (Juho =?iso-8859-1?Q?Cederstr=F6m?=)
Subject: Re: id and password:the easyiest way
Message-Id: <slrn8ondum.167.cederstrom@sitruuna.cedenet.local>

On 04 Aug 2000 12:25:59 EDT, 
bean <bean@agentkhaki.com> wrote:
> dbmopen(%auth_users, "auth_users", 0666);

What about locking? How should it be done with dbmopen or tie?
Is the best approach to have a separate lock file and lock it 
as explained in the FAQ?

-- 
Juho Cederstrom    -    cederstrom<a>kolumbus.fi    s/<a>/@/


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

Date: Sun, 06 Aug 2000 06:52:04 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Re: looking for a certain bot
Message-Id: <398D0B0C.7B5BB189@va.mediaone.net>

Actually, some spammer has probably already sent you an e-mail advertising one of
these fine products. ("fine" as in "Read The Fine Manual")

Blah, blah, blah, and a bottle of rum.

Abigail wrote:

> Gary Krupa (gary@rns1.earthlink.net) wrote on MMDXXXI September MCMXCIII
> in <URL:news:Pine.LNX.4.21.0008050812150.410-100000@rns1.earthlink.net>:
> %%
> %% Does anyone know where I can find a bot program that'll extract an
> %% e-mail address from a website, given search parameters? For example, I wish
> %% to have a list of e-mail addresses found on websites that feature
> %% automobile dealers.
>
> I don't think you find many people here that want to promote spamming
> by helping spammers.
>
> %% I'd be grateful for any help offered.
>
> Can we get $0.10 for each email address you find this way?
>
> Abigail
> --
> perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'



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

Date: 06 Aug 2000 10:41:12 +0100
From: nobull@mail.com
Subject: Re: Novice Question: Outputting an existing file
Message-Id: <u9vgxevi9z.fsf@wcl-l.bham.ac.uk>

aqutiv@my-deja.com writes:

> >  Location: URL

> why do that when you can simply do:
> 
> print "Content-type: text/html\n\n";
> 
> open F, "file.html" or die "Can't open file, $!";
> print for <F>;
> close F;

That approach is not cache-friendly.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sun, 06 Aug 2000 04:35:50 GMT
From: "Ken" <research@ev1.net>
Subject: Re: Perl Newbie Question
Message-Id: <GW5j5.1809$KO2.41028@typhoon.austin.rr.com>

while (<FILEHANDLER>) {
   @data = split(/\|/);
   @data = join("|",
            $data[0],$data[1],
            $datestr1, $data[2], $data[3], $data[4], $data[5],
            $datestr2, $data[6] , $data[7], $data[8], $data[9],
            $datestr3, $data[10], $data[11], $data[12], $data[13],
            $datestr4, $data[14], $data[15], $data[16] ,$data[17],
            $datestr5, $data[18], $data[19], $data[20], $data[21],
            $datestr6, $data[22], $data[23], $data[24], $data[25],
            $datestr7, $data[26], $data[27], $data[28], $data[29],
            );
given when I `print @data` I get the format I'm looking for, but the join
doesn't append to the file.  What would I need to append to the file once
the join has occurred?

TIA again,
Ken

"Prasanth A. Kumar" <kumar1@home.com> wrote in message
news:m31z035dd7.fsf@C654771-a.frmt1.sfba.home.com...
> "Ken" <research@ev1.net> writes:
>
> > I have a delimited file with data pertaining to each column.  I am
needing
> > to add dates into every 4th column.  I'm not grasping the concept of reg
> > exp, but the columns are delimited by |.  The layout of the file is as
such.
> >
> > data0|data1|data2|data3|data4|data5|data6|data7|...data29
> >
> > The first date will need to be placed between data1 and data2, the next
date
> > is then placed between data5 and data6.
> >
> > TIA
> > Ken
>
> You could instead use 'split' to breakup the string into an array
> based on the | delimiter. Then use 'splice' to insert or remove
> array elements and finally use 'join' to put it back together with the
> delimiter again being |.
>
> --
> Prasanth Kumar
> kumar1@home.com




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

Date: Sun, 06 Aug 2000 07:27:21 GMT
From: Jason Maggard <jmaggard@va.mediaone.net>
Subject: Re: Programming Ethics
Message-Id: <398D1351.D8A14436@va.mediaone.net>

If you hadn't programmed this someone else would have.
If someone else wouldn't have they could buy one.

The ethics of this really are not your concern, as programmers, we supply
information and methods of dealing with it.  What they choose to do with
that information is as ethereal as what I will choose to do upon recieving
their spam....

jthornton@my-deja.com wrote:

> Many of you have experienced this situation -- your employer (or
> contractor) asks you to write a program that, from your point-of-view,
> can lead to no good.
>
> Recently, I was asked to compile a database of names and e-mail
> addresses of users that share a common interest. It was thought that
> these e-mail addresses would be extracted from various mailing lists
> and newsgroups.
>
> The corporation I am working with is a young, public company that
> trades on the stock market. I work directly with the Chairman/CEO, and
> he made the request to compile this database.
>
> Immediately I told him that I did not think this would go over well. I
> told him that people will not want to receive unsolicited e-mail, and
> that the corporation could get itself blacklisted. He then said, "Don't
> make the mistake of assuming what we are going to do with them. Let
> this be a lesson...we'll do it right. If you see us about to do
> something wrong, scream and yell, but so don't assume."
>
> It's beyond me how you can appropriately use a list like this, but my
> time is under contract by this corporation. I wrote the code and
> populated the beginnings of the requested database, but I have not
> given it to them.
>
> What good can come from this? Is the proper use of this database my
> responsibility? Should the code never be written?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Sun, 06 Aug 2000 09:25:25 GMT
From: drdementor@my-deja.com
Subject: reading and writing to dmb file ( .db)
Message-Id: <8mjau3$ush$1@nnrp1.deja.com>



Im a little new tp perl but experienced programmer...

Picking up the perl very fast...
I wanted to store a hash to a file.

I got this code from the book, it doenst work....

use Fctl;
use NDBM_File;
tie %hash, "NDBM_File" , 'data' . O_RDWR|O_CREAT|O_EXCL , 0644;
$hash{drink} = 'root beer';
untie $hash;

thats the code, its supposed to make file data.db and put the hash into
it. I am getting errors.

error....################################## start  #############Illegal
modulus of constant zero in file write_to_database.cgi at line 61, next
2 tokens "file_hash;"
Execution of write_to_database.cgi aborted due to compilation errors.
error....#################################end #######################

i am using hypermart. they have full cgi... do i need to install a
modual or something? if so how do i do that? just drop it into the cgi
bin?

i dont have a pay host right now and this simple database seems good
enough for my needs right now.

thanks for all yoru help everyone...
learning perl fast,,, its fun stuff.. i know i still have a lot more to
learn but i know enough now that its gettign interesting...

Jim




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


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

Date: 6 Aug 2000 00:43:29 -0700
From: gerg@ncal.verio.com (Greg Andrews)
Subject: Re: Stumped Again!
Message-Id: <8mj4v1$sen$1@ncal.verio.com>

pjh@mccc.edu (Pete Holsberg) writes:
>This should be SOOO easy, but I just can't get it,
>
>I have a file that looks like this (SSNs and phone numers are bogus):
>
>   1 143-80-0908 BARGER-FOX, PAT BOB 04/08/00       (609) 466-1821  YES         
>   2 140-65-0756 FORD DOG, B J       06/23/00       (609) 587-2726  YES         
>   3 138-99-9890 BENJAMIN JR, EMILY  04/06/00       (609) 799-8130  YES         
>   5 124-58-0237 BROCK III, DANA M   03/29/00       (609) 371-5073  YES         
>   6 220-66-2813 BURRELL, DORETHA M  04/07/00       (609) 530-0308  YES         
>
>I want to produce two values for each line, as follows
>
>BARGERFOX and PAT
>FORDDOG and B
>BENJAMIN and EMILY
>BROCK and DANA
>BURRELL and DORETHA
>
>but I just can't get the right regular expressions. Can
>someone please take pity and send me some suggsted ones?
>

Here's my example.  I took a very straightforward approach, so I
didn't do everything with regular expressions, and I used a foreach
loop that probably isn't optimized, but I think you'll understand
what each step is doing:

#!/usr/bin/perl -w

# start and length of name field
$nameoffset = 14;  $namelength = 19;

# common suffixes to last names
@namesuffixes = qw( JR SR III );

open (INPUT, 'datafile')  or  die "Can't open datafile for input: $!\n";

# read lines and parse name field
while (<INPUT>) {
	# usually I'd chomp the end-of-line here, but it's
	# technically not necessary for this example script

        # extract name field from line and split into last/first
        $namefield = substr($_, $nameoffset, $namelength);
        ($lastname, $firstname) = split(/,/, $namefield);

        #### Canonicalize the last name field ####
        # strip trailing spaces
        $lastname =~ s/ +$//;

        # strip a trailing suffix
        foreach $suffix (@namesuffixes) {
		# skip suffix if it's not in the name
                next  unless  $lastname =~ / $suffix$/;

                # delete suffix and exit the loop
                last  if  $lastname =~ s/ $suffix$//;
        }

        # strip all remaining spaces and dashes
        $lastname =~ s/[- ]//g;


        #### Canonicalize the first name field ####
        # strip leading spaces, then strip
        # the first space and everything after
        $firstname =~ s/^ +//;
        $firstname =~ s/ .*$//;


        # print the finished last and first names
        print STDOUT $lastname, ' and ', $firstname, "\n";
}
##### end of script ######


Note that if the file can't be opened, the script calls the
'die' function.  There are other ways to handle that error
condition, but die was appropriate for this simple example
script.

(Also note that $nameoffset and $namelength are correct.
The field starts AFTER a field separator character and
ends BEFORE the next field separator!)


  -Greg
-- 
:::::::::::::::::::  Greg Andrews  gerg@wco.com  :::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


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

Date: Sun, 6 Aug 2000 00:05:01 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: time output not showing leading 0's ? How do I...
Message-Id: <MPG.13f6adf648c24c0798ac3a@nntp.hpl.hp.com>

In article <slrn8op3le.pjm.efflandt@efflandt.xnet.com>, 
efflandt@xnet.com says...

 ...

> Why do you play with month strings and year that you never use?  On
> Unix-like systems, that whole time block could be simplified to:
> 
> use POSIX;
> $TimeString = POSIX::strftime("%A-%H:%M",gmtime($tz * 3600 + time));
> 
> Look up the strftime function in 'perldoc POSIX' and the strftime time
> codes in 'man strftime' (probably same as in 'man date').

s/Unix-like/POSIX-compliant/;

Windows/DOS systems aren't Unix-like, but the C library used to produce 
the perl executable is POSIX-compliant.

If the documentation for the C function strftime() isn't available on 
the local system, it can be found readily on the Web.

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


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

Date: Sun, 06 Aug 2000 04:31:47 -0400
From: ZepHead <groovyt@erols.com>
Subject: Re: very cool routine
Message-Id: <groovyt-2BBE6B.04314706082000@news.erols.com>

In article <8m9fvk$arc$1@bcrkh13.ca.nortel.com>, 
bmetcalf@nortelnetworks.com wrote:

> 
>  > Simple and yet very very useful...
>  > 
>  > sub del_element
>  >         {
>  >         my ($element, @array) = @_;
>  >         my ($len, $count);
>  >         $len = @array;
>  >         $len = $len - 1;
>  >         $count = $element;
>  >         while ($count <= $len)
>  >                 {
>  >                 $array[$count] = $array[$count + 1];
>  >                 $count++;
>  >                 }
>  >         return (@array);
>  >         }
> 
> Wouldn't it be a lot easier to use splice?
> 
> Brandon

lol


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

Date: Sun, 6 Aug 2000 00:28:12 -0400
From: "Gilly" <trbovidd@mcmaster.ca>
Subject: web based emails
Message-Id: <8mips7$stj$1@informer1.cis.McMaster.CA>

Hi everyone,
I have been working on my own parser of emails for our system (our own
little version of procmail, if you will) and it is accepting mails
originating from our machine and in school, yet mails from hotmail, yahoo,
etc are not coming in.  Does someone here know how these emails are
formatted? ie do they have different headers that other emails? I have a
regular expression in perl set up to search for the line containing "To: ".
Much thanks for your time and assistance in this.

Gilly




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

Date: Sun, 6 Aug 2000 13:15:42 +0800
From: "­»΄δΈ}" <crud_alex@yahoo.com>
Subject: What's defined,and what's undef?
Message-Id: <lv6j5.11366$ho5.201371@news-east.usenetserver.com>

plz help me,i dun understand





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

Date: Sun, 06 Aug 2000 05:42:51 GMT
From: kumar1@home.com (Prasanth A. Kumar)
Subject: Re: What's defined,and what's undef?
Message-Id: <m3d7jnymg4.fsf@C654771-a.frmt1.sfba.home.com>

"­»΄δΈ}" <crud_alex@yahoo.com> writes:

> plz help me,i dun understand

'defined' is a predicate operator which indicates if some variable is
defined (has a value.) If is often used in an 'if' statement to test
the returned value of something because many functions return a
undefined state on error or exceptional condition.

'undef' on the other hand is a verb which will undefine something
which is already defined. You can also use it in noun form and assign
it to something or return it from a subroutine for use as stated
above.

-- 
Prasanth Kumar
kumar1@home.com


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

Date: Sun, 06 Aug 2000 01:08:00 -0800
From: marius@bluebrush.com
Subject: Re: XML to HTML with Perl
Message-Id: <509j5.15153$ho5.244445@news-east.usenetserver.com>

Uh... CGI is just a gateway interface. It's not written in anything. And you 
can write CGI's in the language of your choice, not only Perl.
You might want to look at XML::Parser for a start and hack your way from
there. THere's no XSLT-like translator for Perl as far as I know.

marius.

In article <8mghhd$5q9$1@nnrp1.deja.com>, harris_m@my-deja.com wrote:
> Hello,
> I have a CGI program, which reads XML document and XSLT style sheet
> translation document. XSLT defines translation from XML elements to HTML
> elements.
> 
> Is there some XSLT processor avilable in Perl? I found one in Java but
> since CGI is written in Perl, I am looking if there is somethig
> available in Perl.
> Thank you.
> M. Harris
> 
> 
> 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 3926
**************************************


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