[18079] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 239 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 7 21:05:42 2001

Date: Wed, 7 Feb 2001 18:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981597913-v10-i239@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 7 Feb 2001     Volume: 10 Number: 239

Today's topics:
        Another XML::Parser Question kumar22@my-deja.com
    Re: Another XML::Parser Question <godzilla@stomp.stomp.tokyo>
    Re: Another XML::Parser Question (Eric Bohlman)
        Call for participation, YAPC Europe 2001, August 2-4, A <lg@grx.nl>
    Re: disk usage with perl (Martien Verbruggen)
        fixed dave_vb@my-deja.com
    Re: Get file in string by virtual path????? <peter.sundstrom-eds@eds.com>
        Hashes bakor@my-deja.com
    Re: Hashes (Eric Bohlman)
    Re: Hashes <uri@sysarch.com>
        Help! Good Perl Training class recomendation in Silicon gfichten@telocity.com
    Re: hex to binary conversion ? Please help <mjcarman@home.com>
    Re: hex to binary conversion ? Please help (Randal L. Schwartz)
    Re: multipart/form-data upload troubles (Apache, CGI.pm (David Efflandt)
    Re: Need Help Checking IP Address Syntax w/ PERL? (Damian Conway)
        Newbie - Perl for Win32 (Gasp!) <tjpontz@worldnet.att.net>
        Newbie here please help!  Permission errors while creat <jason.m.hill@usa.xerox.com>
    Re: Newbie here please help!  Permission errors while c <elijah@workspot.net>
        Package Positioning <chahn@peregrine.com>
    Re: Parse referer header from form post? <vaughn_gardner@byu.edu>
        Perl DBI newbie question ... <permission2@home.com>
    Re: perlmail vs procmail <mischief@velma.motion.net>
    Re: perlmail vs procmail (Eric Bohlman)
    Re: Place an array item in a specific place. <tony_curtis32@yahoo.com>
        Poetry in Perl ??? maheshasolkar@yahoo.com
    Re: Poetry in Perl ??? <wuerz@yahoo.com>
    Re: Poetry in Perl ??? <wyzelli@yahoo.com>
    Re: Poetry in Perl ??? (Mahesh A)
    Re: reposting a form (Eric Bohlman)
    Re: splitting a string on the / character garvan@my-deja.com
    Re: splitting a string on the / character <leekembel@hotmail.com>
    Re: splitting a string on the / character <uri@sysarch.com>
    Re: Stream? Pipe? Socket? <peter.sundstrom-eds@eds.com>
    Re: XML::Parser question (Eric Bohlman)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 08 Feb 2001 00:12:44 GMT
From: kumar22@my-deja.com
Subject: Another XML::Parser Question
Message-Id: <95so9m$fb0$1@nnrp1.deja.com>

Hey, does anyone know how to get the XML::Parser module NOT to
translate special character codes?

E.g. if I'm parsing a file with a &#8217; in it, I want Perl just to
print out &#8217;, not some weird attempt to render the Unicode
character I'm coding for.

I've tried playing with the "ProtocolEncoding" option but this doesn't
seem to make any difference.

Help?

Thanks,
Rakesh



This ball of the Lords of Death -- it is just a spherical knife.

-Popol Vuh


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 07 Feb 2001 17:30:27 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Another XML::Parser Question
Message-Id: <3A81F6B3.BB73FE@stomp.stomp.tokyo>

kumar22@my-deja.com wrote:
 
> Hey, does anyone know how to get the XML::Parser module NOT to
> translate special character codes?

(snipped)

There is an ancient sage saying,

"If you want something done right, do it yourself."

Write your own code rather than use a module.


Godzilla!

* loves words which violate English rules *


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

Date: 8 Feb 2001 01:32:29 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Another XML::Parser Question
Message-Id: <95ssvd$88r$2@bob.news.rcn.net>

kumar22@my-deja.com wrote:
> Hey, does anyone know how to get the XML::Parser module NOT to
> translate special character codes?

> E.g. if I'm parsing a file with a &#8217; in it, I want Perl just to
> print out &#8217;, not some weird attempt to render the Unicode
> character I'm coding for.

You can't prevent the parser from interpreting numeric character 
references.  You *might* be able to use the parser's original_string 
method, but it would probably be rather awkward.  Really the best choice 
is to look up the rules for UTF-8 encoding (they're fairly simple, but I 
don't remember them off the top of my head) and write a little function to 
re-entify anything that meets your criteria.


> I've tried playing with the "ProtocolEncoding" option but this doesn't
> seem to make any difference.

Of course it doesn't, because numeric character references use only ASCII 
characters.



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

Date: Thu, 08 Feb 2001 00:36:27 +0100
From: Leo Grapendaal <lg@grx.nl>
Subject: Call for participation, YAPC Europe 2001, August 2-4, Amsterdam
Message-Id: <r9uBOvGhge6iS0xKGIhVnms0x98h@4ax.com>


***************** CALL FOR PARTICIPATION ******************

                        European
               Yet Another Perl Conference
                        YAPC 2001

              http://www.yapc.org/Europe/

            Thursday-Saturday, August 2-4, 2001
                               at the
                    Hogeschool Holland
              Amsterdam, the Netherlands


     ** Abstract submission deadline:  June  1, 2001 **

Yet Another Perl Conference (YAPC) is an inexpensive (< 100 EURO) Perl
users and developers conference, with a mix of tutorials and
technical talks. The conference is set in Amsterdam, The Netherlands.

YAPC began as a grassroots users conference, from discussions
among Perl Mongers, and has grown from there.  We would like
to invite you to join us for three days of Perl, people, and
demonstrations, at a price that shouldn't hurt your wallet.
There will be a limit of around 500 people for the conference.

A number of members of the Perl community are contributing to this
event.

Look at the main web page for more details --
                                    http://www.yapc.org/Europe


  *********** CALL FOR PAPERS ***********

Potential presenters should submit a 200-300 word abstract to

        papers@yapceurope.org

in plain ASCII text or HTML by June 1st for consideration.
We would like your materials to be available online, but
that is not required.  If you have materials to include in
the proceedings, or course notes, please let us know of your
requirements in the abstract. If you have any special
presentation needs, please include them also.

The conference theme will be Security, so a portion of the
talks will be about that subject in some way. So if you have some
knowledge of Perl related security issues, or use Perl in security
related areas, you're more then welcome to share this with fellow
Perl users at the conference.

Suggestions :

*	writing secure Perl CGI programs
*	security bloopers
*	cryptography techniques
*	cryptography applications
*	security issues in past and coming versions of perl
*	How you use Perl to enhance security of your network or
             website
*	Modules useful in security
*	Whatever you find interesting that's Perl- and security
             related


A part of the time will be available for other Perl related subjects.
Suggestions for subjects:

*	Groupware, Agents, and Bots
*	Perl in the world of Windows
*	MacPerl
*	Perl for Speech and Language
*	Text and Document Processing
*	Machine Learning in Perl
*	HTML, XML, and Markup Languages
*	CGI and Web programming in Perl
*	Internet Programming
*	Database Interaction and Access with Perl
*	Scientific Computing (e.g. with PDL)
*	Practical Perl Programming
*	Module guts and usage on any particular Module.
*	Tutorials of all stripes: Modules, Objects, CPAN
*	Visionary or position papers on Perl, the past,
             the present, and the future
*	Anything cool :)

We have the following time slots in our schedule, so your
contribution could have one of the following durations:

180 minute tutorials
90 minute talks
40 minute talks
25 minute talks
lightning talks (5 minutes)


Conference fees will be waived for presenters at yapc
(lightning talks excepted), so another way to reduce your
costs is to give a good talk on something you're excited about.


We are looking for sponsors. Please contact Liz and Eric  
(sponsor@yapceurope.org) for information about how you can help 
support YAPC Europe. Much of the necessary funding for YAPC
comes from the generous donations of our sponsors.



  **** YAPC Europe 2001 **http://www.yapc.org/Europe/ ***
***************** CALL FOR PARTICIPATION ******************





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

Date: Thu, 08 Feb 2001 01:49:33 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: disk usage with perl
Message-Id: <slrn983una.cm5.mgjv@verbruggen.comdyn.com.au>

On Wed, 24 Jan 2001 19:21:37 +1100,
	Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> 
> sub wanted
> {
>     my ($bytes, $blocks) = ( (-l) ? lstat _ : stat _)[7,12];
>     $num_bytes += $bytes;
>     $num_blocks += $blocks;
> }
> 
> 
> Note that this doesn't follow symbolic links, deliberately. Also note
> that I count both blocks and bytes. You can also ask stat what the
> block size is on your file system, and multiply the second number by
> that. You'll find out that those numbers almost never match up.

I just realised that I am wrong here. The blocksize returned by stat
is the block size used on the file system. However, the number of
blocks returned by stat is the number of 512 byte blocks, irrespective
of the underlying file system's idea of how large a block is. POSIX
and various other standards define it this way. The similarity in
names is just confusing.

To get the number of bytes stored in all the files, look at
$num_bytes. To get the number of actual bytes allocated on the file
system for these files, multiply $num_blocks by 512.

There may be systems where stat returns different data, but that would
not be correct.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | The gene pool could use a little
Commercial Dynamics Pty. Ltd.   | chlorine.
NSW, Australia                  | 


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

Date: Wed, 07 Feb 2001 23:31:00 GMT
From: dave_vb@my-deja.com
Subject: fixed
Message-Id: <95slrl$d8u$1@nnrp1.deja.com>

Not sure exactly how, but I did.

I finally got regular shell commands to go to the log file, except they
were out of sync with the output of the perl script. The output of my C
programs still wasn't showing up at all.

To fix the former, I turned off buffering on stdout and stderr by adding

select((select(STDOUT), $|=1)[0]);
select((select(STDERR), $|=1)[0]);

This, for some reason, also fixed the latter problem.

I must confess I can't figure out what the heck happened and if anyone
does know, I'm curious to find out.


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 8 Feb 2001 11:39:33 +1300
From: "Peter Sundstrom" <peter.sundstrom-eds@eds.com>
Subject: Re: Get file in string by virtual path?????
Message-Id: <95sir6$7un$1@hermes.nz.eds.com>


"Martijn van Poppel" <Martijn.vanPoppel@atosorigin.com> wrote in message
news:0E16861EE7BCD111BE9400805FE6841F144A67B8@c1s5x001.cor.srvfarm.origin-it
 .com...
> > > Does anybody know how to get a file by the virtual location and not
the
> real
> > > location?
> >
> > use the 'LWP::Simple' module
> >
> > perldoc LWP::Simple
>
> Isn't there a way to do this without a module??

Why would you want to do it without a module?  Are you looking to gain
programming practice?




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

Date: Thu, 08 Feb 2001 01:38:10 GMT
From: bakor@my-deja.com
Subject: Hashes
Message-Id: <95sta2$jpm$1@nnrp1.deja.com>

I'm not sure if my last post went....

I want to thank everyone who responded!!

I applied the curly braces to print $days_in_month{$month};
and added the chomp and all is well...

I want to emphasize that I am brand new to perl....this was just an
intellectual exercise for me. Hashes are the one data type I'm having
problems with for some reason.

I have heard that system calls such as `date +%b` should be avoided if
possible...makes the code less portable I guess...must be 'cause I come
from a shell scripting background.

Thanx!


Sent via Deja.com
http://www.deja.com/


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

Date: 8 Feb 2001 00:05:17 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Hashes
Message-Id: <95snrt$rj6$2@bob.news.rcn.net>

Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "b" == bakor  <bakor@my-deja.com> writes:

>   b> %days_in_month=(Jan,31,Feb,28,Mar,31);

> that won't compile under use strict. either quote those tokens or use =>

In fact, it's close to the classic example of how barewords can get you in 
trouble: it would start failing mysteriously if the OP's requirements 
changed so that the month abbreviations had to be in lower case (assuming 
that the real hash had all 12 months).



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

Date: Thu, 08 Feb 2001 00:28:52 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Hashes
Message-Id: <x7zofynhkr.fsf@home.sysarch.com>

>>>>> "EB" == Eric Bohlman <ebohlman@omsdev.com> writes:

  EB> Uri Guttman <uri@sysarch.com> wrote:
  >>>>>>> "b" == bakor  <bakor@my-deja.com> writes:

  b> %days_in_month=(Jan,31,Feb,28,Mar,31);

  >> that won't compile under use strict. either quote those tokens or use =>

  EB> In fact, it's close to the classic example of how barewords can
  EB> get you in trouble: it would start failing mysteriously if the
  EB> OP's requirements changed so that the month abbreviations had to
  EB> be in lower case (assuming that the real hash had all 12 months).

ah, the famous oct bug. we had a thread on that a while ago. one more
reason why i always quote tokens in hashes and even with =>.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 08 Feb 2001 01:43:10 GMT
From: gfichten@telocity.com
Subject: Help! Good Perl Training class recomendation in Silicon Valley needed!
Message-Id: <95stjd$jtn$1@nnrp1.deja.com>

I hope that I can find my answer here:
I am looking for a good Perl training class for
the beginner in the workshop format (not over
WEB) in Silicon Valley.

There are many companies that offer to take
classes over the WEB,  however I am strong
believer in formal education in the classroom.

I would like to find 2-5 days professional course
that will offer hands-on training in specially
built classrooms.

Can you recommend any company that offers that?

Thank you very much!

Gene


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 07 Feb 2001 16:43:03 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: hex to binary conversion ? Please help
Message-Id: <3A81CF77.922D5E0C@home.com>

"Peter J. Acklam" wrote:
> 
> Michael Carman <mjcarman@home.com> writes:
> 
>> "Peter J. Acklam" wrote:
>>>
>>> Michael Carman <mjcarman@home.com> writes:
>>>
>>>> print dec2bin(hex('BC')), "\n";
>>>>
>>>> sub dec2bin {
>>>>     my $str = unpack('B32', pack('N', shift));
>>>>     $str =~ s/^0+(?=\d)//; # strip leading zeroes
>>>>     return $str
>>>> }
>>>
>>> This is "number 2 bin" or "int 2 bin", not "decimal 2 bin".
>>
>> It really is decimal.
> 
> Not according to Randal L. Schwartz.  See the thread "converting
> between dec. and hex" in alt.perl for more information.
> 

Heh, I see you had the same discussion with Randal that I've just had
with you. And in a roundabout sort of way, we all agree. To me it's
mostly just semantics anyway.

Truth be told, I didn't write that function myself; I took it out of the
Cookbook long ago the first time I needed to do that conversion, and
dec2bin() is what Tom Christensen called it there. I suggest letting our
two illustrious authors butt heads on this if they really have strong
feelings on the nomenclature. :)

Why's Randal over in alt.perl anyway? Is he doing penance?

-mjc


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

Date: 07 Feb 2001 16:11:40 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: hex to binary conversion ? Please help
Message-Id: <m1wvb2rq2r.fsf@halfdome.holdit.com>

>>>>> "Michael" == Michael Carman <mjcarman@home.com> writes:

Michael> Why's Randal over in alt.perl anyway? Is he doing penance?

There's a lot more "blind leading the blind" there than in the real
groups.  I practice triage, trying to help where my help will do the
most good.

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: Thu, 8 Feb 2001 01:53:20 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: multipart/form-data upload troubles (Apache, CGI.pm)
Message-Id: <slrn983uuo.bdg.efflandt@efflandt.xnet.com>

On Wed, 07 Feb 2001, name too long <idontreadthis56@hotmail.com> wrote:
>{Pardon if this is a dup, I can't find my post anywhere.}

Well you cross posted to 2 groups here, but also posted it separately to
the cgi newsgroup where it belongs.  I gave you a suggestion there.

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


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

Date: 7 Feb 2001 23:45:50 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <95smne$1f1$1@towncrier.cc.monash.edu.au>

use Regexp::Common;

$addr =~ $RE{net}{IPv4}
	or die "Bad IP address! No biscuit!"

# Damian


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

Date: Thu, 08 Feb 2001 01:21:25 GMT
From: "TJ Pontious" <tjpontz@worldnet.att.net>
Subject: Newbie - Perl for Win32 (Gasp!)
Message-Id: <pwmg6.3541$Nj5.170806@bgtnsc07-news.ops.worldnet.att.net>

I have Perl 5.6.0 installed on Windows 2000 server, and the command line
runs scripts perfectly. However, when I submit a form from a web page, it
displays the perl script instead of running the script.  Did I miss a
setting I'm supposed to use somewhere in NT or IIS5 ?

[Yes, I know that Win32 thing makes me the oddball in a Unix/Linux world,
but hey, somebody has to do it, right?]  Thanks.







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

Date: Wed, 07 Feb 2001 15:03:40 -0500
From: Jason Hill <jason.m.hill@usa.xerox.com>
Subject: Newbie here please help!  Permission errors while creating directories.
Message-Id: <3A81AA1C.1BF5FF7B@usa.xerox.com>

I am a beginning user of Perl, and think that it is a very useful
language.  However I'm having trouble getting it to create a directory
with the permissions that I desire.  (This is being done on a UNIX
server).  I want the directory to have the permissions:
User(ReadWriteExecute), Group(ReadExecute), World(ReadExecute).  Is the
sample below the only commands that I need?  When I run this, the
directory gets the permissions: User(WriteExecute), Group(Read),
World(Execute).  What did I do wrong?  Do I need to use a different
value, another command?  Thank for your help everyone.

Here's a sample of what I am doing:

 $dirname = \dica\server;
 $mode = 755;    # Permissions for the directory
  mkdir ($dirname, $mode);



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

Date: 8 Feb 2001 02:03:12 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Newbie here please help!  Permission errors while creating directories.
Message-Id: <eli$0102072012@qz.little-neck.ny.us>

In comp.lang.perl.misc, Jason Hill  <jason.m.hill@usa.xerox.com> wrote:
>  $dirname = \dica\server;

I presume that is not actual code.

>  $mode = 755;    # Permissions for the directory
>   mkdir ($dirname, $mode);

Mode is traditionally an octal number. chmod assumes the numbers
you give it are octal on its own. Perl needs to be told to use
octal, by putting a leading zero on the number:

  $mode = 0755;

FWI:
$ perl -we 'printf("%d\t%d\n", 755, 0755);printf("%o\t%o\n", 755, 0755);'
755	493
1363	755

A mode of (octal) 1363 would be -wxrw-ws, very strange indeed.

Elijah
------
easy mistake


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

Date: Wed, 7 Feb 2001 14:36:30 -0800
From: "Christopher Hahn" <chahn@peregrine.com>
Subject: Package Positioning
Message-Id: <95skha$bjr$1@dfw-ixnews3.ix.netcom.com>

Hello all,

I wrote a simple script:
##################
#
# This package will be used to support SSI from the BAMF ServiceCenter
# Unix Monitor page
#
package SCUnixLog;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(UnixLogs);##################
our @EXPORT_OK = qw(IdentifyLog);
our $VERSION = 1.00;
<SNIP>
##################

and I placed it into:
/usr/local/lib/perl5/site_perl/5.6.0

Then I wrote a small test script:
##################
#!/usr/local/bin/perl -w
#
# This small script will be called as a SSI from the BAMF ServiceCenter
# Unix Monitor page
#
use SCUnixLog;
UnixLogs();
##################

This worked nicely. (Note: I did use theproper extension)

My question is: why does this fail when I put the module
into the subdirectory:
/usr/local/lib/perl5/site_perl/5.6.0/Peregrine

and change the script's use line:
use Peregrine::SCUnixLog;

The error is:
Undefined subroutine &main::UnixLogs called at ./UnixLogsSSI2.pl line 9.

This odd, as "use HTML::Simple" refers to:
/usr/local/lib/perl5/site_perl/5.6.0/HTML/Simple.pm

Hmmmmm....

Any ideas appreciated, and a direct response is ok,

Christopher

P.S. This happens to be version 5.6, running on Linux.




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

Date: Wed, 07 Feb 2001 16:17:55 -0700
From: Vaughn Gardner <vaughn_gardner@byu.edu>
Subject: Re: Parse referer header from form post?
Message-Id: <3A81D7A3.EADE7020@byu.edu>

Worked like a charm.  Thanks!

bits101010@my-deja.com wrote:
> 
> Look in %ENV of your cgi script.
> 
> In article <3A81C395.50686AF8@byu.edu>,
>   Vaughn Gardner <tma370@byu.edu> wrote:
> >       I've got a couple of different servers submitting form posts to
> a cgi,
> > Dan I'd like to log their input into separate files.  I'm assuming
> that
> > the natural way to do this would be to parse the the referer header,
> but
> > I'm not sure how to do it.
> >       I've looked into the LWP and CGI modules, and I can't figure
> out how to
> > use them to do this.  For example, the CGI module has several methods
> > for creating a header to send to a client, but not one I can find for
> > reading received headers.  The HTTP::Headers module has a referer()
> > method, btu I can't tell how this would be used in conjunction with
> the
> > CGI module.  Am I missing something?  Please help a young perl hacker.
> >
> > Thanks,
> > Vaughn
> >
> 
> Sent via Deja.com
> http://www.deja.com/


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

Date: Thu, 08 Feb 2001 02:00:08 GMT
From: "Joe Halbrook" <permission2@home.com>
Subject: Perl DBI newbie question ...
Message-Id: <I4ng6.112589$g6.50011773@news1.elmhst1.il.home.com>

I was curious about something:

When I run my script using telnet it works fine.
When I call it from a browser, which loads a
pop-up window, then does some DBI stuff,
the pop-up works fine, but the DBI stuff blows.

Do I have to do something special when calling
the script from a browser?

Code ...

  use DBI;

  $agent              = "$ENV{'HTTP_USER_AGENT'}";
  $remote           = "$ENV{'REMOTE_ADDR'}";
  $ref                   = "$ENV{'HTTP_REFERER'}";

  my $database_name     = $db;
  my $location                    = "12.34.56.789";
  my $port_num                 = "3306";
  my $database                 =
"DBI:mysql:$database_name:$location:$port_num";
  my $db_user                   = "user";
  my $db_password          = "pswd";

  my $dbh               = DBI->connect($database,$db_user,$db_password);

  my $sth               = $dbh->prepare("INSERT INTO ct$table
                                  (ctDate,hostID,userAgent,ipAddr,refURL)
                                  VALUES
(NULL,'$host','$agent','$remote','$ref')");

  $rows                 = $sth->execute();

  $sth->finish();
  $dbh->disconnect();

  exit(0);

Thank you, in advance for your help!

Joe





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

Date: Thu, 08 Feb 2001 01:03:19 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: perlmail vs procmail
Message-Id: <t83s2n2kj28948@corp.supernews.com>

Abigail <abigail@foad.org> wrote:
> Bruce Ingalls (bingalls@panix.com) wrote on MMDCCXVII September MCMXCIII
> in <URL:news:wi2zofyb7i4.fsf@mail.conde-dev.com>:
  BI> I am starting a new project to handle email list bounces
  BI> in a mixed Solaris and Linux environment. I'd like your
  BI> opinions on available tools. I've worked with procmail,
  BI> but I've heard of perl tools, which may be easier to work
  BI> with. Others I may have missed?

A> Please ask else where.
 
  BI> I regret upsetting the applecart of this exclusive
  BI> community.

This is not an exclusive community. It is a Perl community. If
one has a Perl question or comment, we welcome it.

  BI> I did the work of looking at other options, in particular,
  BI> there is no comp.lang.perl.tools newsgroup.

Which I would hope, if it existed, would be about tools to
help with writing or maintaining programs in Perl. Notice
the "lang" in "comp.lang.perl.misc". That means "language",
just as it does in the rest of the "comp.lang.*" newsgroups.

If there were a newsgroup called
"comp.mail.processing.auto.written-in-perl" or something similar
then that would be the proper newsgroup to ask about mail
processing software written in Perl.

A> And there is would be inappropriate as well. You are obviously
A> under the impression I did write gibberish, but the phrase
A> "The quality and userfriendlyness are not determined by the
A> language of the source code." contains a big hint.

  BI> I hope that this is not the tone that the perl community
  BI> is setting. In other newsgroups, I would see suggestions
  BI> of alternate recommendations, before off topic posts would
  BI> be chased away, nay, redirected.

First, this newsgroup is not the whole Perl community, and Abigail
is not the whole newsgroup. There are other Perl newsgroups, there
are official and unofficial Perl web sites, there are Perl mailing
lists, and there are the Perl Mongers who have their own web sites
and mailing lists.

Second, most newsgroups do not have the volume this one has. I've
also not seen as many off-topic posts per total posts in other
groups as here, probably because the book and magzine publishers
have tried to make Perl a buzzword synonymous with Web page design,
which it of course is not.

A> If you expect people here to know which of the over 70,000
A> groups is most appropriate for your question, you are sadly
A> mistaken. It's *your* problem, and you can't figure out the
A> right place to ask, and now you are upset we don't pinpoint
A> where you should ask? 

It is friendly for people to try to help someone by giving a
possibly correct group in which to ask. However, if we don't
know where to redirect a question, should we pretend instead
of mentioning that this is not a good place to ask? Telling
someone he is wrong is not a personal attack. It is merely
a statement of fact or opinion. Pointing out that someone
has asked a question in other than the best forum can actually
be helpful, as compared to letting the person wait for an
answer that may not come or that may be wrong when it arrives.

A> This isn't pre-school. You are expected to do your homework.
A> People are not getting paid to spoonfeed you.

Abigail may seem curt here, but I'd bet it's because Bruce was
downright rude toward her. 

  BI> Sadly, I have seen newbies being redirected to places
  BI> like this, for its famous community support.

"Like this" and "its"? Is this statement about comp.lang.perl.misc
or about 'places' like it? This newsgroup has not just famous
community support, it is legendary. Like all legends, it's the
best parts you hear about at a distance. ;)  It is a supportive
environment, if you ask questions about the group's topic and
use some common sense and etiquette in doing so.

A> Oh, it does. It's a Perl community. This is not the mail community.

This is one of the best points in Abigail's post.

A> And communities don't like whiners.

Actually, since much of Perl is from Larry's linguistic background
and I got interested in Perl due to my linguistic background, I'll
give another point of view. The word "community" has been mentioned.
A "community" is a group assembled in the name of shared interests.
Our shared interest here is the Perl language. Outsiders who come
in and try to distract from our shared interest should expect to be
treated harshly, as they are truly outsiders. Those who are new but
share our interests are welcomed. This is how a community works,
either in the real world or on Usenet. (I studied Dynamics of
International Immigration in my Foreign Diplomacy coursework, too ;)

Now, Bruce, what _was_ you Perl question?

Chris

-- 
Christopher E. Stith

You must not lose faith in humanity. Humanity is an ocean;
if a few drops of the ocean are dirty, the ocean does not
become dirty.  -- Mohandas K. Gandhi



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

Date: 8 Feb 2001 01:26:11 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: perlmail vs procmail
Message-Id: <95ssjj$88r$1@bob.news.rcn.net>

Chris Stith <mischief@velma.motion.net> wrote:
> It is friendly for people to try to help someone by giving a
> possibly correct group in which to ask. However, if we don't
> know where to redirect a question, should we pretend instead
> of mentioning that this is not a good place to ask? Telling
> someone he is wrong is not a personal attack. It is merely
> a statement of fact or opinion. Pointing out that someone
> has asked a question in other than the best forum can actually
> be helpful, as compared to letting the person wait for an
> answer that may not come or that may be wrong when it arrives.

And it needs to be pointed out again and again that a "friendly" wrong 
answer is worth less than nothing, whereas a brusque or even rude right 
answer is worth plenty.

[3:30 PM on a Friday in front of the local high school]

Jason: "Dudes, I've got a chance to score with Cherly tonight but I don't 
have any condoms and I'm too embarrassed to buy some at Wal-Mat.  Anything 
I can do to keep from getting her pregnant?"

Josh: "Unless you really *know* she's on the pill, you either have to stop 
being such a chicken and buy the condoms or don't go all the way."

Jeremy: "Dude, just make sure she's on top all the time.  Me and Stacy did 
it last night when her parents were away and she didn't get pregnant."

Jeremy gave the friendly answer.  Josh gave the correct answer, sneaking 
in an insult.  Which one should Jason take?



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

Date: 07 Feb 2001 19:03:07 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Place an array item in a specific place.
Message-Id: <87snlqq94k.fsf@limey.hpcc.uh.edu>

>> On Wed, 07 Feb 2001 21:01:24 GMT,
>> lkenny@fisheries.org (LK) said:

> I have already tried perlfaq1-4 for this answer, but
> couldn't quite get it.  I have an ordered array that I
> need to contain a specific number of items.  Some of the
> items just serve as a place holder in the array so that
> a program can go through each array and pick out the
> proper info that is listed in the corresponding array
> index spot.  I.E., I need $item[6] of the array @info to
> always be the city and state of the record.  But since
> some people have Aprtment or suite numbers, sometimes it
> becomes $item[7].

It sounds like you are trying to use an array for
something it's not meant for.  If you have a structure
with *named* fields in it, a hash is probably a better
idea.

e.g.

my %record = ( Name => 'Fred', Apartment => '403C', State => 'TX', ... );

and accessing the data in each record as
$record{Apartment} etc.  This way you don't need to
artificially pad the data with unused fields; it's as
spare as it needs to be.

I suspect it's actually going to be somewhat more
complicated, so see

    perldoc perldsc

about weird and wonderful data structures in perl.

hth
t
-- 
Eih bennek, eih blavek.


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

Date: 07 Feb 2001 15:23:38 -0800
From: maheshasolkar@yahoo.com
Subject: Poetry in Perl ???
Message-Id: <ug0hq84cl.fsf@MAHESHAK-PC.i-did-not-set--mail-host-address--so-shoot-me>


I have a string such as ...

my $Str = "23 this 24 delimiter 856 could 1983 be 86 anything";

This string has embedded integers. I, however, don't know how many integers would be emedded in a string. I want to bring all the integers into an array, which would look like ...

@Numbers = (23, 24, 856, 1983, 86);

How, do you think I can do this with minimum size of code? ... poetry in Perl???

-- 
#!/usr/local/bin/perl -w
use strict;print pack("C26",74,117,115,116,32,97,110,111,116,
104,101,114,32,80,101,114,108,32,104,97,99,107,101,114,33,10)


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

Date: Thu, 08 Feb 2001 00:36:38 +0100
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: Poetry in Perl ???
Message-Id: <080220010036385587%wuerz@yahoo.com>

In article
<ug0hq84cl.fsf@MAHESHAK-PC.i-did-not-set--mail-host-address--so-shoot-me>
, maheshasolkar@yahoo.com wrote:

> my $Str = "23 this 24 delimiter 856 could 1983 be 86 anything";
> 
> This string has embedded integers. I, however, don't know how many integers
> would be emedded in a string. I want to bring all the integers into an array,
> which would look like ...
> 
> @Numbers = (23, 24, 856, 1983, 86);


Bizarre question for someone with a pretentious japh signature. But
maybe I misunderstand, and

@Numbers = split /[^\d]+/, $Str;

won't do for some reason or other.

-mona


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

Date: Thu, 8 Feb 2001 10:26:59 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Poetry in Perl ???
Message-Id: <90mg6.8$jL6.1656@vic.nntp.telstra.net>

"Mona Wuerz" <wuerz@yahoo.com> wrote in message
news:080220010036385587%wuerz@yahoo.com...
> In article
>
<ug0hq84cl.fsf@MAHESHAK-PC.i-did-not-set--mail-host-address--so-shoot-me
>
> , maheshasolkar@yahoo.com wrote:
>
> > my $Str = "23 this 24 delimiter 856 could 1983 be 86 anything";
> >
> > This string has embedded integers. I, however, don't know how many
integers
> > would be emedded in a string. I want to bring all the integers into
an array,
> > which would look like ...
> >
> > @Numbers = (23, 24, 856, 1983, 86);
>

<snip>

> @Numbers = split /[^\d]+/, $Str;
>

or:
@Numbers = $Str =~ /(\d+)/g;

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;





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

Date: Thu, 08 Feb 2001 01:52:39 GMT
From: maheshasolkar@yahoo.com (Mahesh A)
Subject: Re: Poetry in Perl ???
Message-Id: <3a81f9e6.116050742@news>

Well,
Pattern-matching is one of the many areas of perl I haven't got a
chance to work much with. I am trying hard to learn it... and what
better way than consulting the knowledgeable !!

Ok, comming back to problem statement, I think I did not phrase it
properly. Here it comes again...

 .... I want to bring all the integers - and only the integers - into
an array, ....

The solution that I got almost worked. But there are a lot of NULLs in
the array with the integers.

--- script ---
my $Str = "23 this 24 delimiter 856 could 1983 be 86 anything";
my @Numbers = split /[^\d]/, $Str;
map {print "$_,"} @Numbers;
print "\n";

--- output ---
23,,,,,,24,,,,,,,,,,,856,,,,,,,1983,,,,86,

I'll sure come up with more problems after this is through!!

Cheers!

On Thu, 08 Feb 2001 00:36:38 +0100, Mona Wuerz <wuerz@yahoo.com>
wrote:

>In article
><ug0hq84cl.fsf@MAHESHAK-PC.i-did-not-set--mail-host-address--so-shoot-me>
>, maheshasolkar@yahoo.com wrote:
>
>> my $Str = "23 this 24 delimiter 856 could 1983 be 86 anything";
>> 
>> This string has embedded integers. I, however, don't know how many
integers
>> would be emedded in a string. I want to bring all the integers into
an array,
>> which would look like ...
>> 
>> @Numbers = (23, 24, 856, 1983, 86);
>
>
>Bizarre question for someone with a pretentious japh signature. But
>maybe I misunderstand, and
>
>@Numbers = split /[^\d]+/, $Str;
>
>won't do for some reason or other.
>
>-mona



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

Date: 8 Feb 2001 00:41:47 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: reposting a form
Message-Id: <95sq0b$rj6$3@bob.news.rcn.net>

nobull@mail.com wrote:
> "Yuval" <yuval@mypad.com> writes:

>> I have on my site a form, I would like it to post (and not "get" method) the
>> info the user typed to a CGI of mine. My script save the info and than send
>> it to a CGI on a different site.

> This has nothing to do with Perl.  The HTTP protocol provides no
> mechanism to allow a response from a web site to cause the client to
> issue a POST request without user intervention.  This is a security
> requirement.  (Think about it!)

I don't think that was what the OP wanted; to me, it sounded like he 
wanted his form-processing script (which was invoked by a POST done in the 
usual way) to pass some information on to a script on another site.  
Sounds to me like a simple matter of script A using LWP to make a 
connection to Site B and passing info to a script there.  For some reason, 
non-programmer Web developers seem to have a hard time envisioning this 
sort of processing, and think in terms of repointing the browser, often 
leading to an X-Y problem.


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

Date: Wed, 07 Feb 2001 22:59:53 GMT
From: garvan@my-deja.com
Subject: Re: splitting a string on the / character
Message-Id: <95sk13$bht$1@nnrp1.deja.com>

Try

s|/|newchar|

Perl lets you use any delimeter you wish as long as your consistent
within the statement.

g.









In article <3A81C776.1C7C@ukc.ac.uk>,
  mgj1 <mgj1@ukc.ac.uk> wrote:
> Hi,
> I was wondering if anyone knew how to split a string using the /
> character, for example the line which won't work is :
>
> my @temp = split ///, $direntry;
>
> because of the /// part, whereas if i wanted to split on a 'b' say the
> line:
>
> my @temp = split /b/, $direntry;
>
> obviously will work.
> Is there a way of splitting on the / character?
>
> thanks in advance,
> Mark.
>


Sent via Deja.com
http://www.deja.com/


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

Date: Wed, 07 Feb 2001 23:22:29 GMT
From: "Studio 51" <leekembel@hotmail.com>
Subject: Re: splitting a string on the / character
Message-Id: <VMkg6.102446$V22.20738840@news4.rdc1.on.home.com>

"mgj1" <mgj1@ukc.ac.uk> wrote in message news:3A81C776.1C7C@ukc.ac.uk...
> obviously will work.
> Is there a way of splitting on the / character?

Jesus people, it was a simple question, yet out of 3 posts no one could
state the obvious simple solution! Did you not know the answer that you need
to respond with "read the man pages"?

It's simple: /// should be /\//

I look forward to the day when you need help with something regarding Perl,
and some smart ass responds with "read the man pages".


-S51




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

Date: Thu, 08 Feb 2001 00:32:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: splitting a string on the / character
Message-Id: <x7wvb2nhey.fsf@home.sysarch.com>

>>>>> "S5" == Studio 51 <leekembel@hotmail.com> writes:

  S5> "mgj1" <mgj1@ukc.ac.uk> wrote in message news:3A81C776.1C7C@ukc.ac.uk...
  >> obviously will work.
  >> Is there a way of splitting on the / character?

  S5> Jesus people, it was a simple question, yet out of 3 posts no one
  S5> could state the obvious simple solution! Did you not know the
  S5> answer that you need to respond with "read the man pages"?

  S5> It's simple: /// should be /\//

and that is a lousy way to do it. leaning toothpick syndrome. typical of
a simple but poor answer.

  S5> I look forward to the day when you need help with something
  S5> regarding Perl, and some smart ass responds with "read the man
  S5> pages".

and you should probably read them yourself. someone else posted the
better way of using alternate delimiters.

someone throw this guy a stinking fish. he will never become a fisherman.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 8 Feb 2001 11:30:38 +1300
From: "Peter Sundstrom" <peter.sundstrom-eds@eds.com>
Subject: Re: Stream? Pipe? Socket?
Message-Id: <95siaf$758$1@hermes.nz.eds.com>


"Immortal Love" <s997659@ee.cuhk.edu.hk> wrote in message
news:Pine.GSO.4.05.10102072050100.23974-100000@sparc53.ee.cuhk.edu.hk...
> On 7 Feb 2001, Uri Guttman wrote:
>
> > The following message is a courtesy copy of an article
> > that has been posted to comp.lang.perl.misc as well.
> >
> >
> >
> >   IL> I would like to ask what they are and what is their difference?
thx.
> >
> > and your perl question is?
>
> oh, i see. sorry for posting message in wrong newsgroup. But what's
> newsgroup should i post? coz i read this from a network programing book in
> perl language. thx.

Try comp.unix.misc and/or comp.unix.questions




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

Date: 7 Feb 2001 23:53:07 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: XML::Parser question
Message-Id: <95sn53$rj6$1@bob.news.rcn.net>

kumar22@my-deja.com wrote:
> Bart, Tad & Martien:  Many many thanks, that's a lot to read & play
> with.  "CompactTree" and Martien's example are great.

You might also want to take a look at XML::Parser::EasyTree, available 
from CPAN, which creates a simple tree where nodes are hash references.



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

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 V10 Issue 239
**************************************


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