[22149] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4370 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 9 06:06:39 2003

Date: Thu, 9 Jan 2003 03:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 9 Jan 2003     Volume: 10 Number: 4370

Today's topics:
    Re: /g is not working in counting substring globally <bernard.el-hagin@DODGE_THISlido-tech.net>
        a directory with embedded Perl ? <Frantisek.Rysanek@post.cz>
    Re: alternating formats on STDOUT <wksmith@optonline.net>
    Re: alternating formats on STDOUT <uri@stemsystems.com>
        Another string matching question. <mpattWINDOZE@bigfoot.com>
        Build problem with XML::LibXSLT on HP (Joe Nall)
    Re: DBI::do sometimes returns 0 when it should not (mys <rereidy@indra.com>
    Re: Dealing with split() and quotes <mdudley@execonn.com>
    Re: file size limits of perl Net::ftp <olli2@biop.uni-hannover.de>
    Re: finding files older than a given date <>
    Re: Finding required .pl's home ? <nobull@mail.com>
    Re: Finding required .pl's home ? (Anno Siegel)
        How to install mod locally? LIB=./foo fails (Chas Friedman)
        How to upload a file with content-type=multipart/form-d (kishore kiran)
    Re: How to upload a file with content-type=multipart/fo <nobull@mail.com>
    Re: Internet chat CGI script <calc83p@yahoo.com>
    Re: nested try blocks causing problems (Matt Venn)
        Net::Ping issue  <sunil_franklin@hotmail.com>
    Re: Net::Ping issue (Helgi Briem)
    Re: No such file or directory error (Rondoggung)
    Re: OO primer, please! <bik.mido@tiscalinet.it>
    Re: Taint check question <md0nilhe@mdstud.DIESPAMchalmers.se>
    Re: Taint check question (Helgi Briem)
    Re: using subroutines defined in other scripts <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: using subroutines defined in other scripts <jvandervloet@hotmail.com>
        What is a simple way to read and write zip files? <hal@thresholddigital.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 9 Jan 2003 06:39:17 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: /g is not working in counting substring globally
Message-Id: <avj5el$hon$7@korweta.task.gda.pl>

In article <OFXS9.26198$xb.11575@nwrddc02.gnilink.net>, Jürgen Exner
wrote:
> ashish anand wrote:
>>  counting substring TT in pattern ATTTAG through /g is not working. It
>> gives only 1 occurance of TT while there are 2 occurances of TT. how
>> to solve this problem.
> 
> Nope, there is only 1. Just replace any occurence (one by one) with e.g. X.
> For the first occurence you get AXTAG. Now, please show me the second
> occurence of TT in AXTAG.


I think that the OP wants to count the amount of TTs in the *original*
string, though.


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Thu, 9 Jan 2003 10:11:43 +0000 (UTC)
From: Frank Rysanek <Frantisek.Rysanek@post.cz>
Subject: a directory with embedded Perl ?
Message-Id: <Xns92FE71E27B72AFrantisekRysanekprag@147.32.80.9>

Dear everyone,

over the past two years or so, I have written an experimental 
object/hierarchical/directory database server, with embedded Perl - I call the poor 
creature a Kludge. If you decide to take a look, please be tolerant - and let me know 
your opinion.
This is an extremely premature release, just to get some peer review, whether or not 
this is worth the bother. So little time to spend coding, noone around to discuss
things with...

http://sweb.cz/Frantisek.Rysanek/kludge/kludge.html

A couple of features:
- lack of essential mature features necessary for any production use
- vaguely hierarchical
- string-oriented data
- multi-threaded
- bi-directional relationships
- general methods, including CTORs and DTORs, written in Perl - still just
    halfway there, though
- textual client protocol, like HTTP and SQL downsized and mixed together
- the tree of classes and the tree of instances stored in a twin-though-single
    hierarchical namespace
- relational back-end database (currently MySQL)
- written in rookie C++ code, gradual development of skills clearly visible
    (from "newbie" to "enthusiastic newbie" level).

Too afraid to cross-post to comp.databases.object.

Thanks for your patience.
And thanks to all the gurus who wrote all the wonderful software
components that I'm using.

Frank Rysanek


P.S.:
Originally I've posted this to c.l.p.announce, without properly reading the charter
of that group, thus violating several items of the charter. Obviously the message was 
rejected by the moderator.
The point is, I do not want to make immediate formal steps to better comply to the 
charter of that announcement newsgroup.
As the piece of software I am trying to "announce" has quite a bit of Perl in it and its 
"usage virtue" is relatively close, I'm hereby posting this to comp.lang.perl.misc 
(unmoderated group).
I'd probably be more or less off topic wherever I'd post that :( so I hope the group 
administrators will tolerate my ignorance.



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

Date: Thu, 09 Jan 2003 02:40:10 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: alternating formats on STDOUT
Message-Id: <ei5T9.20403$FT6.4183303@news4.srv.hcvlny.cv.net>


"monkeys paw" <fm_duendeBASURA@yahoo.com> wrote in message
news:Yl%S9.612934$P31.230769@rwcrnsc53...
> I've got two formats i would like to alternately use
> on STDOUT:
>

I agree with David's recommendation, but if you do have a good reason
for using formats,  change the format associated with the currently
selected filehandle by assigning to  the special variable $FORMAT_NAME
($~).  This is explained well in the book "Programming Perl".

Bill




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

Date: Thu, 09 Jan 2003 03:15:58 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: alternating formats on STDOUT
Message-Id: <x7fzs3nhci.fsf@mail.sysarch.com>

>>>>> "BS" == Bill Smith <wksmith@optonline.net> writes:

  BS> "monkeys paw" <fm_duendeBASURA@yahoo.com> wrote in message
  BS> news:Yl%S9.612934$P31.230769@rwcrnsc53...
  >> I've got two formats i would like to alternately use
  >> on STDOUT:
  >> 

  BS> I agree with David's recommendation, but if you do have a good reason
  BS> for using formats,  change the format associated with the currently
  BS> selected filehandle by assigning to  the special variable $FORMAT_NAME
  BS> ($~).  This is explained well in the book "Programming Perl".

better still is to use one of the formatting modules on cpan. damian
conway wrote one to effectively replace perl's builtin format. and it is
better, it doesn't have the problem of associating to a single file
handle (the special variable thing is a poor fix).

now i don't use formatted text much but i would much prefer a module
over perl's format stuff.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Thu, 09 Jan 2003 10:11:41 +0000
From: Martyn <mpattWINDOZE@bigfoot.com>
Subject: Another string matching question.
Message-Id: <3E1D4ADD.2070606@bigfoot.com>

Hi all,
	As an excercise (I'm just learning perl) I'm writing somthing to do 
some processing of spam mails using the subject line. What I'm trying to 
do at the moment is clean up my list  of spam subjects by removing any 
lines that are already matched by another line in the file. I'm doing 
this by reading the file into an array @textstrings, and producing a map 
here's the bit of code I've got at the moment.

@matchmap = map { qr/.*$_.*/i } grep !/^[ ]*$|^#.*/, @matchstrings;

for $string (@textstrings)
{
        for $stringobj (@matchmap) {
         	$a=$string=~/$stringobj/i;
         }
}


Now this will tell me if $stringobj is a  substring of $string, if it is 
then I want to remove $string, but how can I test whether $stringobj is 
the exact same line as $string ('cos then I don't want to remove it)


i.e. if the file contains

mortgage
cheap mortgage
viagra


I want to preserve "viagra" and "mortgage", but remove "cheap mortgage"
perhaps there is a better approach to this but I wanted to play with map 
  so chose to do it this way for the experience.

TIA for any help.

-- 
Speak to the Penguin, he is your friend.

Remove WINDOZE before replying by Email



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

Date: 8 Jan 2003 22:24:29 -0800
From: joe@nall.com (Joe Nall)
Subject: Build problem with XML::LibXSLT on HP
Message-Id: <9d1ed006.0301082224.37f56f9c@posting.google.com>

Test 07blankdoc fails:
t/07blankdoc.....ok 3/5Can't coerce GLOB to string in entersub at
t/07blankdoc.t line 44.
t/07blankdoc.....dubious
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 4-5

More detail:

cc: "LibXSLT.xs", line 619: warning 604: Pointers are not
assignment-compatible.
cc: "LibXSLT.xs", line 619: warning 563: Argument #1 is not the
correct type.
        cc -c  -I/opt/libxslt/include -I/opt/libxml/include/libxml2
-I/opt/iconv/include  -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings
-I/opt/iconv/include -I/opt/expat/include -I/op
t/zlib/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +DAportable 
  -DVERSION=\"1.52\"  -DXS_VERSION=\"1.52\" +Z
"-I/opt/perl-5.8.0/lib/CORE"  -DHAVE_BLANK -DHAVE_BLANK -DHAV
E_EXSLT perl-libxml-mm.c
Running Mkbootstrap for XML::LibXSLT ()
        chmod 644 LibXSLT.bs
        rm -f blib/arch/auto/XML/LibXSLT/LibXSLT.sl
        LD_RUN_PATH="/opt/libxslt/lib:/opt/libxml/lib:/opt/zlib/lib:/opt/iconv/lib:/lib"
/usr/bin/ld  -b +vnocompatwarnings -L/opt/iconv/lib -L/opt/expat/lib
-L/opt/zlib/lib LibXS
LT.o  perl-libxml-mm.o  -o blib/arch/auto/XML/LibXSLT/LibXSLT.sl  
-L/opt/libxslt/lib -L/opt/libxml/lib -L/opt/zlib/lib -L/opt/iconv/lib
-lxslt -lexslt -lxml2 -lz -liconv -lm
        chmod 755 blib/arch/auto/XML/LibXSLT/LibXSLT.sl
        cp LibXSLT.bs blib/arch/auto/XML/LibXSLT/LibXSLT.bs
        chmod 644 blib/arch/auto/XML/LibXSLT/LibXSLT.bs
Manifying blib/man3/XML::LibXSLT.3
        PERL_DL_NONLAZY=1 /opt/perl-5.8.0/bin/perl
"-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/*.t
t/01basic........ok
t/02dromeds......ok
t/03input........ok
t/04params.......ok
t/05quick........ok
t/06output.......ok
t/07blankdoc.....ok 3/5Can't coerce GLOB to string in entersub at
t/07blankdoc.t line 44.
t/07blankdoc.....dubious
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 4-5
        Failed 2/5 tests, 60.00% okay
t/08literal......ok
t/09exslt........ok
t/10functions....ok
Failed Test    Stat Wstat Total Fail  Failed  List of Failed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
t/07blankdoc.t    2   512     5    2  40.00%  4-5
Failed 1/10 test scripts, 90.00% okay. 2/79 subtests failed, 97.47%
okay.
*** Error exit code 2

Stop.
-----------------------------------------------
 /opt/perl-5.8.0/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
  Platform:
    osname=hpux, osvers=10.26, archname=PA-RISC2.0
    uname='hp-ux j5k b.10.26 a 9000785 2010344019 two-user license '
    config_args='-D prefix=/opt/perl-5.8.0/ -D
privlib=/opt/perl-5.8.0/lib -D archlib=/opt/perl-5.8.0/lib -D
sitelib=/opt/perl-5.8.0/lib/site_perl -D sitearch=/opt/perl-5.8.0/lib/
site_perl -D installsitelib=/opt/perl-5.8.0/lib/site_perl -D
libperl=libperl.sl -D cf_email=joe@nall.com -D lddlflags=-b -s -a
shared -D locincpth=/home/joe/perl-5.8.0/usr.include
 /opt/iconv/include /opt/expat/include /opt/zlib/include -D
libpth=/opt/iconv/lib /opt/expat/lib /opt/zlib/lib /lib /usr/lib
/usr/ccs/lib -D ldflags=-L/opt/iconv/lib -L/opt/expat/
lib -L/opt/zlib/lib -D perladmin=joe@nall.com -D optimize=+DAportable
-D useshrplib=true -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags =' -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings
-I/opt/iconv/include -I/opt/expat/include -I/opt/zlib/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ',
    optimize='+DAportable',
    cppflags='-Aa -D__STDC_EXT__ -D_HPUX_SOURCE -Ae -D_HPUX_SOURCE
-Wl,+vnocompatwarnings -I/opt/iconv/include -I/opt/expat/include
-I/opt/zlib/include'
    ccversion='A.10.32.20', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/usr/bin/ld', ldflags ='-L/opt/iconv/lib -L/opt/expat/lib
-L/opt/zlib/lib'
    libpth=/opt/iconv/lib /opt/expat/lib /opt/zlib/lib /lib /usr/lib
/usr/ccs/lib
    libs=-lnsl_s -lndbm -lmalloc -ldld -lm -lc -lndir -lcrypt -lsec
    perllibs=-lnsl_s -lmalloc -ldld -lm -lc -lndir -lcrypt -lsec
    libc=/lib/libc.sl, so=sl, useshrplib=true, libperl=libperl.sl
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-B,deferred '
    cccdlflags='+Z', lddlflags='-b +vnocompatwarnings -L/opt/iconv/lib
-L/opt/expat/lib -L/opt/zlib/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under hpux
  Compiled at Jan  8 2003 15:02:43
  @INC:
    /opt/perl-5.8.0/lib
    /opt/perl-5.8.0/lib/site_perl
    /opt/perl-5.8.0/lib/site_perl
    /opt/perl-5.8.0/lib/site_perl


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

Date: Wed, 08 Jan 2003 22:15:03 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: DBI::do sometimes returns 0 when it should not (mysql)?
Message-Id: <3E1D0557.1080803@indra.com>

ctcgag@hotmail.com wrote:
> uffesterner@spamhole.com (Rex Gustavus Adolphus) wrote:
> 
>>Hi
>>
>>I wonder if anyone else sometimes get 0 returned from a
>>DBI::do-statement that actually affects a certain number of rows.
>>
>>The specific database I'm accessing is mysql.
>>
>>For instance if the table "test_table" contains 4000 records
>>and I do:
>>$rows_affected = $db->do("delete from test_table");
>>
>>then $rows_affected is 0 and there is no records left in the table.
> 
> 
> 
> This is a documented special case.  Mysql implements a unrestricted
> delete statement about the way oracle implements "truncate table":
> by rebuilding the empty table and indices from scratch rather than
> deleting each row. 

<OT>
Oracle does not "rebuild the table" during a trucate operation.  When a 
truncate command is issued, all space used by the table and it's indexes 
are returned to the system.  This is done by esentially resetting the 
high water makr for the table.
</OT>

If you want to (slowly) delete all the rows and get an
> accurate count back, do a delete from test_table where 1>0.   (I don't know
> why the decided to report 0, rather than reporting an accurate count
> using the same fast method they do for select count(*) from test_table).
> 
> 
> 
>>I also seen this happen for update-statements,
>>that the $rows_affected is 0 although I know records has been updated.
> 
> 
> If you update a field by assigning it the value it already had,
> mysql detects this and doesn't actually update the row, and doesn't count
> it as being updated.  There's a connection flag for the C API to return
> number of rows matched rather than number actually changed, but I don't
> if there is such a flag for the Perl API or not.
> 
> Xho
> 




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

Date: Wed, 08 Jan 2003 23:49:48 -0500
From: Marshall Dudley <mdudley@execonn.com>
Subject: Re: Dealing with split() and quotes
Message-Id: <3E1CFF6B.E35DD49A@execonn.com>

Tad McClellan wrote:

> Marshall Dudley <mdudley@execonn.com> wrote:
>
> > But it does seem to work if you substitute a tag for a double quote (
> > $line =~ s/""/&quot;/g; )
>                 ^^^^^^
>
> That is not a "tag".
>
> Tags must start with < and end with >.
>
> That is an "entity reference".
>
> -

OK, call it entity reference.  I was using the words tags and tokens
decades before html was invented.

Marshall



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

Date: Thu, 09 Jan 2003 11:16:56 +0100
From: olli_local <olli2@biop.uni-hannover.de>
Subject: Re: file size limits of perl Net::ftp
Message-Id: <avji6r$fu3$1@newsserver.rrzn.uni-hannover.de>

Ken Ralph wrote:

Thanks for your help.
> Have you changed the timeout value & still fail around 10GB?
> 
> krr
> 
I increased the time limit and blocksize. Now it works !

Olli

> oe wrote:
> 
>>Happy new year,
>>
>>I've a question concerning perl with special regard to Net::FTP. Are
>>there any limits in file size ? I want to do ftp->put command of a pipe
>>which is the output of a tar command. It works well, but if the tar
>>command produces more then 10 GB output, the put command fails. If I do
>>it by hand on the linux shell (without piping but with an intermediate
>>file) it works well.
>>
>>Thanks for your answers,
>>
>>Olli



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

Date: Thu, 09 Jan 2003 02:28:35 -0500
From: Andrew Lee <>
Subject: Re: finding files older than a given date
Message-Id: <059q1vselffjbu6v8vhvv517kmmbm6usp8@4ax.com>

On 8 Jan 2003 09:17:11 -0800, schittdip@hotmail.com (Charles) wrote:

>What I want to do is create a script to run on a windows server that
>will recursively go into a directory and delete any files older than a
>given time period.  For example I would call the script and pass in a
>2 for 2 weeks old, and the directory,i.e, d:\stuff.  Then the script
>should be able to go into all the directories under d:\stuff and
>delete all files that are at least 2 weeks old.

As you now know File::find is the answer.  A quick start can be done
like this (on win systems) :

find2perl d:\stuff -mtime -14 -exec del {} \;  > myscript.pl




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

Date: 09 Jan 2003 08:46:46 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Finding required .pl's home ?
Message-Id: <u9fzs2ofue.fsf@wcl-l.bham.ac.uk>

"127.0.0.1" <craznar01@hotmail.com> writes:

> How do I find (from within) the directory a required .pl file resides in?

It can be inferred from __FILE__

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


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

Date: 9 Jan 2003 10:11:03 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Finding required .pl's home ?
Message-Id: <avjhrn$3lg$1@mamenchi.zrz.TU-Berlin.DE>

Brian McCauley  <nobull@mail.com> wrote in comp.lang.perl.misc:
> "127.0.0.1" <craznar01@hotmail.com> writes:
> 
> > How do I find (from within) the directory a required .pl file resides in?
> 
> It can be inferred from __FILE__

 ...or from $INC{ 'Shared.pl'} (after "require Shared").

Anno


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

Date: Thu, 9 Jan 2003 05:33:40 +0000 (UTC)
From: friedman@math.utexas.edu (Chas Friedman)
Subject: How to install mod locally? LIB=./foo fails
Message-Id: <avj1jk$lnt$1@geraldo.cc.utexas.edu>



You wrote:
 
>How do I install a module locally?  Following the man page for
>MakeMaker, I've tried both
>
>  % perl Makefile.PL LIB=${HOME}/lib
>
>and
>
>  % perl Makefile.PL PREFIX=${HOME}
>
>before calling
>
>  % make && make test && make install
>
>With the first approach, make test fails with a message to the
>effect that autosplit.ix can't be found.  With the second approach,
>the .pm file is never copied to the destination directory.
 ...

I've installed many modules locally with the following:
perl Makefile.PL LIB=/home/friedman/perllib PREFIX=/home/friedman/perllib
(and then make.)
(I unpack the source first in the perllib directory and the module ends up in
some directory below the perllib directory.) 
Probably you need both the LIB and PREFIX parts. (I'm unsure about using
$HOME; will the shell expand that before perl sees it?)
                    chas




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

Date: 8 Jan 2003 23:55:40 -0800
From: kishore_kiran_75@hotmail.com (kishore kiran)
Subject: How to upload a file with content-type=multipart/form-data in PERL/LWP module
Message-Id: <b55f7c23.0301082355.56123487@posting.google.com>

Hi,
I'm trying to simulate an user-agent, and I need to POST a form which
allows an user to upload a file from his machine and user e-mail
address. I was told that I should be using content-type as
multipart/form-data instead of application/x-www-form-urlencoded.

I've the following piece of code which works fine for form posts(not
involving file-uploads, with content-type
'application/x-www-form-urlencoded'), but trying to upload a file...

    $UA_request = new HTTP::Request POST=> $url_of_post;
    $UA_request->content_type('multipart/form-data');
    $params_of_post =
"email_addrs=good@yahoo.com&file_to_be_uploaded=C:\\picture.gif";
    $UA_request->content($params_of_post);
    my $UA_response = $UA_browser->request($UA_request);
    if ($UA_response->is_success) {
         print "Success. \n";
    } else {
         print "BAD REQUEST " . $UA_response->code . "\n";
    }

I get a 500 response from the server instead. I'm suspecting a problem
with the way i'm constructing my post parameters, could somebody
suggest why this is not working as expected, I Need to use Perl/LWP
module(and Apache webserver) to accomplish this, I've found some help
in newsgroups but they deal with CGI module and dont give all the
details.

Thanks,
kishore


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

Date: 09 Jan 2003 08:52:21 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: How to upload a file with content-type=multipart/form-data in PERL/LWP module
Message-Id: <u9bs2qofom.fsf@wcl-l.bham.ac.uk>

kishore_kiran_75@hotmail.com (kishore kiran) writes:

> I'm trying to simulate an user-agent, and I need to POST a form which
> allows an user to upload a file from his machine and user e-mail
> address. I was told that I should be using content-type as
> multipart/form-data instead of application/x-www-form-urlencoded.

perldoc HTTP::Request::Common

>     $UA_request->content_type('multipart/form-data');
>     $params_of_post =
> "email_addrs=good@yahoo.com&file_to_be_uploaded=C:\\picture.gif";
>     $UA_request->content($params_of_post);

Not that this has anything to do with Perl, but do you have any idea
what a valid multipart/form-data entity looks like?

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


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

Date: Thu, 09 Jan 2003 06:34:58 GMT
From: "Alan Hamlett" <calc83p@yahoo.com>
Subject: Re: Internet chat CGI script
Message-Id: <mK8T9.34460$p_6.2907200@bgtnsc04-news.ops.worldnet.att.net>

I do use irc but my school has too much money so they spend it on network
securtiy for our lan. We go to different schools and cant communicate much
cus im grounded from the computer(i can only get on after midnight when my
parents are asleep) and hes grounded from the phone. Our school blocks every
chat site, blocks downloading any exe or almost anything thats not
 .htm/.html/.txt etc. stuff u can view in a browser. We can get around that
with perl's get("url"); but they are monotoring my account because my friend
got expelled(thats why he is at a diff school) for hacking and i helped him
but didnt get caught cus they didnt have evidence. Thats why i dont even use
my account at school, i use other peoples accounts and i am in the process
of getting admin and hopefully root so i can make my own accounts. well ive
said too much cus the point is i made a cgi chat at
http://83p.tigalaxy.com/anthem/nt and i am trying to make it better with
suggestions from other programmers.

"David K. Wall" <usenet@dwall.fastmail.fm> wrote in message
news:Xns92FD6AE56DF9Bdkwwashere@216.168.3.30...
> Alan Hamlett <calc83p@yahoo.com> wrote on 08 Jan 2003:
>
> > I am taking on the task of making an internet chat room using perl
> > at http://83p.tigalaxy.com/anthem/nt/ so that i can talk to my
> > programmer friends and my chat room is rather bad.
>
> Chat using CGI?  Yecch.  What's wrong with IRC?
>
> --
> David K. Wall - usenet@dwall.fastmail.fm
> "Oook."




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

Date: Thu, 9 Jan 2003 09:41:27 +0000
From: news@ttvenn.net (Matt Venn)
Subject: Re: nested try blocks causing problems
Message-Id: <slrnb1qgu7.lbg.news@flop.localnet>

>The problem is not the circular reference of *objects*.  The problem is
>the circular references amongst the anonymous coderefs that the 'try'
>and 'otherwise' keywords create.

ok, that makes more sense.

>I believe that this type of problem is mostly fixed with perl 5.8, but
>I'm not entirely sure.

I got 5.8 and tried it, with the same results; so no.

>I do know, with certainty, that you can solve
>the problem if you were to eliminate your use of 'use Error', and change
>the 'try' blocks to 'eval' blocks.  That is:

Thanks, this works nicely. I'm still using Error elsewhere, but in
parts of the code I've switched to using eval blocks instead.

>Also, to avoid the problems caused by circular references amongst
>objects, try use the weaken() function from Scalar::Util (which comes
>with perl 5.8, or which you can get from CPAN).

Great! I was going to ask this question later but you've already
answered for me,

Thanks for your help,

Matt


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

Date: Thu, 9 Jan 2003 16:10:23 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: Net::Ping issue 
Message-Id: <rocT9.9$L43.69@news.oracle.com>

All,
    I am trying to create a perl ping utility which can be used in both unix
and windows boxes.

    I am seeing an issue where if I use
            Net::Ping->new();
        I am not able to check windows hosts

    If I use Net::Ping->new("icmp");
        it works fine in my windows box but not in unix as I cannot run as
root.

    Net::Ping->new("tcp", 2); does not work on my windows machines.

    Is there any way I can have a common script which runs on both windows
and unix and checks successfully for hosts on both unix and windows.


Thanks,
Sunil.







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

Date: Thu, 09 Jan 2003 10:57:29 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Net::Ping issue
Message-Id: <3e1d556b.460407621@news.cis.dfn.de>

On Thu, 9 Jan 2003 16:10:23 +0530, "Sunil"
<sunil_franklin@hotmail.com> wrote:

> Is there any way I can have a common script which runs on both 
> windows and unix and checks successfully for hosts on both 
> unix and windows.

Here is one way:
if ($^O =~ /win/i)
   { print "OS is Windows of some sort:$^O\n"; } 
elsif ($^O =~ /x$/i)
   { print "OS Unix type:$^O\n"; }
else
   { print "OS is neither Windows nor Unix:$^O\n"; }
-- 
Regards, Helgi Briem
helgi AT decode DOT is


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

Date: 8 Jan 2003 21:36:48 -0800
From: fmmpd@hotmail.com (Rondoggung)
Subject: Re: No such file or directory error
Message-Id: <f0eaf5d1.0301082136.2ca58177@posting.google.com>

> Were you unable to get help from the program's author or vendor?
> Did you try to get help from them?

I wrote to the author but receive no replies so far.

> Does the directory /var/www/cgi-bin/track/data exist?

Yes, the directory exist.

Rondoggung


tiltonj@erols.com (Jay Tilton) wrote in message news:<3e1c8796.272665072@news.erols.com>...
> fmmpd@hotmail.com (Rondoggung) wrote:
> 
> : I am setting up a click tracking script (Ultimate Ad Tracker). The
> : script used to work on all my previous servers but not on my new
> : server.
> 
> Were you unable to get help from the program's author or vendor?
> Did you try to get help from them?
> 
> : I can actually access the admin.cgi login page but it wouldn't let me
> : set the admin password on first installation. It produces this error
> : 
> : Cant open /var/www/cgi-bin/track/data/adps.txt(No such file or
> : directory)!
> 
> If it's trying to open the file in '>' mode, which creates a new file
> if necessary, you'd get that error if the directory does not exist.
> 
> Does the directory /var/www/cgi-bin/track/data exist?


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

Date: Thu, 09 Jan 2003 09:27:04 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: OO primer, please!
Message-Id: <licq1vgdktsuh81k88k2d58u313lr5l1fn@4ax.com>

On 8 Jan 2003 09:46:39 GMT, "Tassilo v. Parseval"
<tassilo.parseval@post.rwth-aachen.de> wrote:

>The whole book is useful when you are very serious about OO-Perl. It
>demonstrates some nifty techniques (especially the usage of closures to
>achieve very strong encapsulation). But the later chapters on multiple
>dispatch etc. are a little bit too in-depth for me.

if they are "too in-depth" for you I guess they will be *far* too
in-depth for me. However I'm looking forward to seeing the whole book.

>> unluckily it can't be that simple since we cannot be sure that the
>> table is filled completely. For its current purpose, the most simple
>> variation (that yields a satisfactory result for me) I could devise
>> is:
>> 
>>     sub print {
>>         my $self = shift;
>>         local ($^W, $\, $,) = (0, "\n", "\t");
>>         defined $_ and print @$_ for @$self;
>>     }
>
>More flexible would be using the warnings pragma:

I thank you for the advice (that I will take into account for the
future) but...

>    #! /usr/bin/perl
>    #               ^^ no -w switch
>    use warnings;
>    ...
>
>And:
>
>    sub print {
>        my $self = shift;
>        local ($\, $,) = ("\n", "\t");
>        no warnings 'uninitialized';
>        print @$_ for @$self;
>    }

 ...in this case I have to disagree with you: no doubt your
modification traps warnings reliably when trying to print 'undef'
entries, but the problem is that $_ might be undefined and thus trying
to dereference it generates an error, not a warning (this is why I
used both $^W=0 and the 'defined $_ and' piece).

[...]

>> (i) should I switch the internal order of storage, thus making the
>> underlying logic a little clumsier (hey, I do know what comments are
>> for!) or should I change the printing method? This also naturally
>> leads to the next point:
>
>Switching the order internally should even be clear without a comment.
>'$self->[$x][$y]' would become '$self->[$y][$x]'. It would have one

This is exactly what I meant and what I used myself. As for wether
this is a "natural format", it depends on one's own psycological
approach to the issue: possibly changing the names ot the variables to
$col, $row, whould help.

>Making things robust is never wrong. You could add a private method that
>normalizes your table before printing it out:

Again, this is what I meant. But I also took into account recording
the "size" of the table with each added entry... however, at first
sight this seems impossible with the lvalue form of the entry method.

>> charachteristics of the application one is developing: the
>> psychological feeling is that at least in some cases one will have to
>> give up with tecniques commonly used for "casual programming", but
>> then it is my understanding that OO philosophy in general is
>> especially aimed at supporting programming in large.
>
>Quite so. Fortunately, OO in Perl doesn't require very verbose
>preparations and imposes low overhead (on the programmer!) so its
>benefits come quite cheap.

That's also my impression, but for sure I have to experiment further
and a lot to learn too.


Michele
-- 
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth.  See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel on sci.math, thread "Why numbers?"


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

Date: Thu, 09 Jan 2003 08:19:47 +0100
From: henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se>
Subject: Re: Taint check question
Message-Id: <3E1D2293.7000607@mdstud.DIESPAMchalmers.se>

Again a big thanks for your valuable comments. Yes, I use external 
programs in my script, and yes, I have probably misunderstood how to use 
PATH. When at the top of my script, I do not yet know the complete path 
leading to the directory where my external programs will be run (it is 
given a random but unique names later on). At the end of the script, I 
remove the temp directory and obviously all its files.

I was under the imporession that you shouldn't set PATH under these 
circumstances. Should I take it that whatever I set PATH to, it only 
matters to the very instance of the script, and not to the system in 
general? (If I run 5 simultaneous instances of the script, they would 
all have different PATHs due to the name of the temp dir, but this 
would, then, be OK?)

Thanks for your patience,

Henrik N



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

Date: Thu, 09 Jan 2003 10:18:41 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Taint check question
Message-Id: <3e1d4aee.457722450@news.cis.dfn.de>

On Thu, 09 Jan 2003 08:19:47 +0100, henrik nilsson
<md0nilhe@mdstud.DIESPAMchalmers.se> wrote:

>Again a big thanks for your valuable comments. Yes, I use external 
>programs in my script, and yes, I have probably misunderstood how to use 
>PATH. When at the top of my script, I do not yet know the complete path 
>leading to the directory where my external programs will be run (it is 
>given a random but unique names later on). At the end of the script, I 
>remove the temp directory and obviously all its files.

PATH has nothing to do witjh where the external programs 
will be run, it has to do with where they *are*.

For example, if you wished to use the program 'gunzip', the
which command might tell you that it resides in /usr/bin 
In that case,  you could either:

- set PATH to /usr/bin using:

$ENV{PATH} = '/usr/bin';

- or give the path when you use it:

system ("/usr/bin/gunzip $file") == 0 or die $?;

- or add it to the name of the program before using it:

my $gunzip = "/usr/bin/gunzip";
system ("$gunzip $file") == 0 or die $?;

>I was under the imporession that you shouldn't set PATH under these 
>circumstances. Should I take it that whatever I set PATH to, it only 
>matters to the very instance of the script, and not to the system in 
>general? 

Correct.
>(If I run 5 simultaneous instances of the script, they would 
>all have different PATHs due to the name of the temp dir, but this 
>would, then, be OK?)

No, temp dirs would only be put in PATH in the *extremely* 
unlikely event that you wanted to somehow build programs
dynamically in the temp dir.  But yes, if you set different
PATHs in different instances of a script, they would be
different and not affect each other.

-- 
Regards, Helgi Briem
helgi AT decode DOT is


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

Date: Thu, 09 Jan 2003 08:16:23 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: using subroutines defined in other scripts
Message-Id: <newscache$bvqf8h$uq6$1@news.emea.compuware.com>

Tad McClellan wrote (Wednesday 08 January 2003 17:50):

> joeri <jvandervloet@hotmail.com> wrote:

>> Forgive me for my ignorance.

> Read all about it:
> 
>     http://www.geocities.com/nnqweb/nquote.html


That pages doesn't run anymore. It has been moved to
http://members.fortunecity.com/nnqweb/nquote.html

-- 
KP



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

Date: Thu, 09 Jan 2003 08:28:43 GMT
From: "joeri" <jvandervloet@hotmail.com>
Subject: Re: using subroutines defined in other scripts
Message-Id: <%oaT9.2923$ym5.493@afrodite.telenet-ops.be>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb1olnd.ld7.tadmc@magna.augustmail.com...
> joeri <jvandervloet@hotmail.com> wrote:

> Now you've got it!

Finally!

> Read all about it:
>
>     http://www.geocities.com/nnqweb/nquote.html
>

Will do...

J.




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

Date: Thu, 09 Jan 2003 07:02:23 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: What is a simple way to read and write zip files?
Message-Id: <389T9.617003$WL3.192086@rwcrnsc54>

I am working with something that is close to an odd mailmerge.  I need to 
open a file, modify it, then close it.  The only problem is the files I 
have to modify are OpenOffice.org files, which are compressed zip files and 
contain more than one file.

I don't want to mess with temp files, since I have to read in a master file 
and produce a very large number of files from it.  The easiest thing for me 
to do would be to read the entire file into a scalar and then uncompress it 
(or read it directly to an uncompressed scalar), make my changes to the 
content, then re-compress it and write it back out to a new file.  I 
realize this may not work, due to offset pointers that point to the data 
for each file.  If not, I was hoping to read the file titles in as keys in 
a hash, and the data for each key would be the file data for that file 
name.

I have been going through a number of CPAN modules, but, having learned 
programming with assembler, I find all the OO methods confusing and am 
still trying to understand all the different file handles.

I would rather not use temp files, so I'd like to read in the data, make my 
changes, and write it back out.

Is there something out there that will let me just read the data in and 
write it out without using temp files?  And is there something that will 
let me do it simply?  Maybe a module that simple uncompresses a zip 
compressed string (and compresses it as well)?

Thanks for any help on this!

Hal



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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


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