[17173] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4585 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 11 14:10:35 2000

Date: Wed, 11 Oct 2000 11:10:20 -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: <971287820-v9-i4585@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 11 Oct 2000     Volume: 9 Number: 4585

Today's topics:
    Re: included files: missing one important concept... <jeff@vpservices.com>
    Re: included files: missing one important concept... <jeff@vpservices.com>
    Re: included files: missing one important concept... <mcdonabNO@SPAMyahoo.com>
    Re: Is perl object oriented? (Randal L. Schwartz)
    Re: Is perl object oriented? <rmore1@my-deja.com>
    Re: Is perl object oriented? <uri@sysarch.com>
    Re: MacPerl's unlink: Where do files go? <jasonh_/dev/null_autonomy.com>
    Re: MacPerl's unlink: Where do files go? (Kevin Reid)
    Re: mod_perl variables <khera@kciLink.com>
    Re: OPEN file efficiancy issue, <nico@monnet.to>
    Re: open without die?? <michael_roper@hotmail.com>
        passing info with POST <pleduc@ca.ibm.com>
    Re: passing info with POST <jeff@vpservices.com>
        Pattern matching <phamel@logisil.com>
    Re: Pattern matching (Rafael Garcia-Suarez)
    Re: Pattern matching (Clay Irving)
    Re: Pattern matching <rmore1@my-deja.com>
    Re: Pattern matching <phamel@logisil.com>
    Re: Perl Books! <someone@world.earth>
        Please help with simple regexp. <svp011467@yahoo.com>
    Re: Please help with simple regexp. <godzilla@stomp.stomp.tokyo>
    Re: Processing a MS access DB file <bkennedy99@home.com>
    Re: Reading a whole file into a string mexicanmeatballs@my-deja.com
    Re: Reading a whole file into a string <godzilla@stomp.stomp.tokyo>
        reading/writing binary data dstorrs@my-deja.com
    Re: reading/writing binary data <rmore1@my-deja.com>
    Re: Reg exp help <stephenk@cc.gatech.edu>
    Re: save blob from database (Jay)
        Solved: Don't ignore a SIGCHLD! <haertig@avaya.com>
        Starting batch file from Perl that interacts with Windo jgunnip@my-deja.com
    Re: Template modules (Mark-Jason Dominus)
        will perl 5 work w/o server on my PC <ericio@pd.jaring.my>
    Re: will perl 5 work w/o server on my PC <jeff@vpservices.com>
        Writing to a file... boulemann@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 11 Oct 2000 08:03:15 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: included files: missing one important concept...
Message-Id: <39E48133.CFA607BA@vpservices.com>

Brian McDonald wrote:
> 
> I am writing a text-to-XML parser that operates on a CSV raw data file. 

Uh, in that case, why don't you just use DBD::RAM which can read and
write both CSV and XML using DBI methods?

-- 
Jeff
perl -MDBI -e "$d=DBI->connect('dbi:RAM:');$d->func({data_type=>'XML',
data_source=>'<phrase><w1>Just</w1><w2>Another</w2><w3>Perl</w3><w4>
Hacker</w4></phrase>',record_tag=>'phrase',col_names=>'w1,w2,w3,w4'},
'import');print join ' ',$d->selectrow_array('SELECT * FROM table1')"


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

Date: Wed, 11 Oct 2000 08:10:49 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: included files: missing one important concept...
Message-Id: <39E482F9.6D0934B7@vpservices.com>

Brian McDonald wrote:
> 
> Just a comment: I am, in fact, using ActiveState. Am I right in concluding
> that there is no perldoc utility in this Windows port? 

You are wrong in two ways.  1. You can run perldoc at the DOS command
prompt; 2. ActivePerl comes with HTMLified versions of all the perldoc
documents so you can browse them at will by going to the start-menu /
programs / activePerl / documentation.

-- 
Jeff


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

Date: Wed, 11 Oct 2000 10:20:03 -0700
From: "Brian McDonald" <mcdonabNO@SPAMyahoo.com>
Subject: Re: included files: missing one important concept...
Message-Id: <Cj1F5.12$t74.19027@news.pacbell.net>


"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn8u8m89.78n.tjla@thislove.dyndns.org...
> I was shocked! How could Brian McDonald <mcdonabNO@SPAMyahoo.com>
> say such a terrible thing:
> >Hi. I believe that I am something of a dunce here. I've read perlfunc...
> >perlfaq8... perlmod; I've combed through HUNDREDS of posts at deja; I've
> >read dozens of replies to my (same) question, where the perl
intelligentsia
> >say "check perldoc do;perldoc require;perldoc use"... as if that is all
that
> >is needed for comprehension; I've seen many posters driven into the
ground
> >for asking this very question.
> >
> >And my post is sitting here... unresponded to... perhaps laughed at...
(or
> >silently and universally mocked???)
>
> Hardly, give us all some ime to react. The time difference between your
> first post and this one was barely 3 hours, maybe you need to be a
> little more patience. Oh and if you've combed through hundreds of posts
> at deja, how come you never read anyone saying you should always post
> replies *below* the thing you are replying to?
>

Here you go... the response below the "thing" I am replying to. :-)

I think that my response--namely this one--was inspired by a very
frustrating visit at deja. Can you imagine what it is like to just want to
do a C-style #include on a file of variable defs, and spend over half a day
trying to find out how to do it? (I'm still figuring it out.) Can you
imagine what it is like to find the same question asked... and the same
question answered in the same RTFM way... over and over again? One would
think that with all the people asking this question someone would get the
hint that file inclusion in Perl (or at least the documentation describing
the process behind it) is harder than it needs to be.

But all of this could just be due to my relative inexperience... and
probably is.

humbly,
brian




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

Date: 11 Oct 2000 08:30:03 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Is perl object oriented?
Message-Id: <m1wvffpf9g.fsf@halfdome.holdit.com>

>>>>> "nobull" == nobull  <nobull@mail.com> writes:

nobull> "Mark" <mark@mediamasters.net> writes:
>> Is perl a object oriented language?

nobull> No, not like Java or Smalltalk, but like many languages it has some
nobull> facilities to allow an object oriented programming approach.

Perl *is* pseudo-OO like Java, but not pure OO like Smalltalk.

Please keep the categories straight.  Didn't you get the handout? :)

nobull> perldoc perltoot

and perldoc perlboot, for a gentler introduction.

-- 
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: Wed, 11 Oct 2000 15:16:51 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: Is perl object oriented?
Message-Id: <8s208r$c2d$1@nnrp1.deja.com>

In article <qVSE5.65768$Sr.64584@newsfeed.slurp.net>,
  "Mark" <mark@mediamasters.net> wrote:
> Is perl a object oriented language?
>
> and
>
> What is an object oriented language?
There is a whole book about OO Perl by Damian Conway ;-)

http://www.amazon.com/exec/obidos/ASIN/1884777791/richmoressuperwe



--
=============================
Richard More
http://www.richmore.com/


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


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

Date: Wed, 11 Oct 2000 15:49:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Is perl object oriented?
Message-Id: <x7em1nz8bm.fsf@home.sysarch.com>

>>>>> "RM" == Rich More <rmore1@my-deja.com> writes:

  RM> http://www.amazon.com/exec/obidos/ASIN/1884777791/XXXXXXXXXXXXXXXXX

when you mention a book here, it is VERY impolite to use your kickback
link. keep that to your website and private email.

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: Wed, 11 Oct 2000 16:34:41 +0100
From: "Jason Holland" <jasonh_/dev/null_autonomy.com>
Subject: Re: MacPerl's unlink: Where do files go?
Message-Id: <39e488b5$1_2@nnrp1.news.uk.psi.net>

Kaput!

The files are instantly erased. I used this feature as a "droplet" when I
wanted to delete many files with the same name. For instance, when you use
the Mac's Find command to locate, say index.html files in a directory, when
you drag them to the Trash the Finder says it cannot delete files with the
same name; notwithstanding the pathnames being different. Perl's unlink()
doesn't give a monkey's what the file's called, it scrubs it immediately;
same as any other platform.

Remember that the Trashcan is a feature of the Finder, not MacOS itself.

Jason

<juump@my-deja.com> wrote in message news:8s0p33$dja$1@nnrp1.deja.com...
> When I use "unlink" with MacPerl5, the unlinked file doesn't go into the
> trash as I expected, it simply disappears! Is the file available
> anywhere, or is it just instantly erased?
>
>
> Steve
>
> P.S. - No, I didn't unlink anything important, just wondering....
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Wed, 11 Oct 2000 13:15:03 -0400
From: kpreid@attglobal.net (Kevin Reid)
Subject: Re: MacPerl's unlink: Where do files go?
Message-Id: <1eic17t.exyca3sc54u8N%kpreid@attglobal.net>

<juump@my-deja.com> wrote:

> When I use "unlink" with MacPerl5, the unlinked file doesn't go into the
> trash as I expected, it simply disappears! Is the file available
> anywhere, or is it just instantly erased?

It's just erased. unlink() uses the OS's deletion function. If you want
to put something in the trash, use this:

rename("$path:$file", "Hard Disk:Trash:$file") or die $!;

(with appropriate values for $path and $file;

Also, you can usually get more help with MacPerl-specific questions by
posting to the MacPerl mailing list (see <http://www.macperl.com> ).

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.


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

Date: 11 Oct 2000 11:22:12 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: mod_perl variables
Message-Id: <x7vguziesb.fsf@onceler.kciLink.com>

>>>>> "a" == apacheproblems  <apacheproblems@my-deja.com> writes:

a> I notice when using %ARRAYS in mod_perl that for new requests previous
a> data stored in the %ARRAY are still present. I have declared the
a> veriables with my(%ARRAY) = () and still causing problems.Any ideas?
a> -a

Yes; this is a mod_perl FAQ even.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
GPG & MIME spoken here            http://www.khera.org/~vivek/


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

Date: Wed, 11 Oct 2000 17:54:28 +0100
From: "Nicolas MONNET" <nico@monnet.to>
Subject: Re: OPEN file efficiancy issue,
Message-Id: <i%0F5.979$N3.36210@tengri.easynet.fr>

What the fuck was Michael Carman <mjcarman@home.com> trying to say:

> Instead of closing and reopening (even implicitly) I'd use seek():
> 
> seek(IN, 0, 0);
> 
> That's due to my stylistic preferences rather than efficiency, though.
> I'd expect it to be faster, but I've never benchmarked it.

Most likely faster due to the OS not having to reparse the
file path and walk the nodes to find it back, but most
certainly extremely negligeable but in the most wacked
out situations.

-- 
perl -e 'print `echo Just a Lame Perl Luser | gzip -9 | cat | gzip -cd`'



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

Date: Thu, 12 Oct 2000 02:25:18 +1000
From: "Michael Roper" <michael_roper@hotmail.com>
Subject: Re: open without die??
Message-Id: <8s20e3$6gi$1@spacebar.ucc.usyd.edu.au>

Thanks for all the quick replies!

I guess what I was really curious about was why there seemed to be so many
waiting processes. My guess was that it had something to do with the lack of
|| die after opens.
I just didnt want to have to do a massive substitution of
s/open(\w+?\,\".+?\")\s+\;/ in all the perl scripts to find out ... for a
start I dont even know where they all are as I didnt write them ...

As an aside, and at the risk of being flamed for not posting a new post, is
it possible to determine if you have a string of matching brackets using
Perl's 'super' (not regular) expressions?

Thanks again,
Michael.


> > Hi,
> >     Does anyone know what problems can arise by using open without the
> > standard 'or die' catch? ie
> >     open(FOO, ">$foo");
> > vs
> >     open(BAR, ">$bar") || die $!;
> >
> > The reason I ask is that I have a large number of inherited Perl
programs
> > running as CGI processes which end up WAITing on some thread which never
> > seem to give control back.
> > (Had a Netscape Fasttrack 3.01 daemon at 72 Megabytes with 475 active
> > threads (all from **100** broken Perl scripts hanging around in process
> > table) on a site with only a reasonably small number of hits before
> someone
> > restarted it!!
> >
>
> The point is not so much that you should have the program 'die' but that
you
> should check for the success or otherwise of the open and make use of the
> special variable $! to report why the open failed.  'die' is used to
> illustrate the point simply.
>
> I have seen the syntax:-
>
> open (IN, "$filename") or &error ("failed to open $filename because $!");
>
> and the error sub defined appropriately for the environment (print some
html
> advising the user to contact the webmaster?)
>
> A program that does not check for the success of the open and then handle
> the error condition can trundle on blindly and do a whole bunch of nothing
> forever (which you seem to have experienced) or do really bad stuff or
> unexpected stuff.





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

Date: Wed, 11 Oct 2000 13:38:48 -0400
From: Paul Leduc <pleduc@ca.ibm.com>
Subject: passing info with POST
Message-Id: <39E4A5A8.918B6756@ca.ibm.com>

I am trying to use the same CGI for several buttons in a form, by
specifying different information for each call.. for example:
    <form method="POST" action="/cgi-bin/sample.cgi?name=value1">
    <form method="POST" action="/cgi-bin/sample.cgi?name=value2">

when I try to capture this information using the following, $myvalue is
blank:
    use CGI;
    $q = new CGI;
    $myvalue = $q->param('name');

Should this work, or am I doing something wrong?

Thanks.. Paul



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

Date: Wed, 11 Oct 2000 10:54:01 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: passing info with POST
Message-Id: <39E4A939.496D7985@vpservices.com>

Paul Leduc wrote:
> 
> I am trying to use the same CGI for several buttons in a form,

Post? Buttons? Forms?  Those words have nothing to do with Perl and
neither does your question.  Next time, please ask in a group about CGI
or HTML.  But see the answer to your question below.

> specifying different information for each call.. for example:
>     <form method="POST" action="/cgi-bin/sample.cgi?name=value1">
>     <form method="POST" action="/cgi-bin/sample.cgi?name=value2">

That is not several buttons, that is several forms.  And it confuses the
POST method used for forms and the GET method used for query strings.

If you want several buttons, use something like this:

     <input type='submit' name='name' value='value1'>
     <input type='submit' name='name' value='value2'>

>     use CGI;
>     $q = new CGI;
>     $myvalue = $q->param('name');

That will work as expected with the two submit buttons I showed above.

-- 
Jeff


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

Date: Wed, 11 Oct 2000 15:14:13 GMT
From: Philippe Hamel <phamel@logisil.com>
Subject: Pattern matching
Message-Id: <8s203t$bod$1@nnrp1.deja.com>

Hi!  Please help this here C/C++ programmer learn to do things the Perl
way. :-)

I'm going thru the Camel's chapter on pattern matching and I can't seem
to figure out how to do what I want to do. I want to do something like
the following :

I have a string (let's say 'howdy'), and if it is equal to one of the
string in a group then do what is in the if block.  Here it is in
pseudo.

if ("howdy" is in ("hello", "howdy", "howyadoin", "hi") )
{
   print "string is a greeting.";
}
else
{
   print "whatever";
}

I know I could do this with a bunch of if ( (string eq string2) || ...
but I'd like to have it more compact and clean.  I'm pretty sure that I
should be able to in Perl.

Thank you!

--
Philippe Hamel
Bureau :
Courriel : phamel@logisil.com
Tel : (514)866-5493 poste 419
Maison :
Courriel : philippe.hamel@apiiq.qc.ca


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


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

Date: Wed, 11 Oct 2000 15:37:35 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Pattern matching
Message-Id: <slrn8u92n1.joh.rgarciasuarez@rafael.kazibao.net>

Philippe Hamel wrote in comp.lang.perl.misc:
>Hi!  Please help this here C/C++ programmer learn to do things the Perl
>way. :-)
>
>I'm going thru the Camel's chapter on pattern matching and I can't seem
>to figure out how to do what I want to do. I want to do something like
>the following :
>
>I have a string (let's say 'howdy'), and if it is equal to one of the
>string in a group then do what is in the if block.  Here it is in
>pseudo.
>
>if ("howdy" is in ("hello", "howdy", "howyadoin", "hi") )
>{
>   print "string is a greeting.";
>}
>else
>{
>   print "whatever";
>}

There's 2 methods. Depends on what is variable in your test.
If "howdy" is variable, but the list of words is fixed, you can do :

  $str = "howdy";
  if ($str =~ /^(hello|howdy|howyadoin|hi)$/) { ... }

If the list of words is variable, the better way is to use a hash :

  $str = "howdy";
  %list = ( hello => 1 , howdy => 1 , howyadoin => 1 , hi => 1 );
  if ($list{$str)) { ... }

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 11 Oct 2000 15:45:32 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Pattern matching
Message-Id: <slrn8u92os.ahu.clay@panix2.panix.com>

On Wed, 11 Oct 2000 15:14:13 GMT, Philippe Hamel <phamel@logisil.com> wrote:

>I'm going thru the Camel's chapter on pattern matching and I can't seem
>to figure out how to do what I want to do. I want to do something like
>the following :
>
>I have a string (let's say 'howdy'), and if it is equal to one of the
>string in a group then do what is in the if block.  Here it is in
>pseudo.
>
>if ("howdy" is in ("hello", "howdy", "howyadoin", "hi") )
>{
>   print "string is a greeting.";
>}
>else
>{
>   print "whatever";
>}
>
>I know I could do this with a bunch of if ( (string eq string2) || ...
>but I'd like to have it more compact and clean.  I'm pretty sure that I
>should be able to in Perl.

In the FAQ (perldoc perlfaq3):

       How can I tell whether a list or array contains a certain
       element?

-- 
Clay Irving <clay@panix.com>
To be sure of hitting the target, shoot first, and call whatever you hit
the target. 
- Ashleigh Brilliant 



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

Date: Wed, 11 Oct 2000 15:56:11 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: Pattern matching
Message-Id: <8s22in$e82$1@nnrp1.deja.com>

In article <8s203t$bod$1@nnrp1.deja.com>,
  Philippe Hamel <phamel@logisil.com> wrote:
> Hi!  Please help this here C/C++ programmer learn to do things the
Perl
> way. :-)
>
> I'm going thru the Camel's chapter on pattern matching and I can't
seem
> to figure out how to do what I want to do. I want to do something like
> the following :
>
> I have a string (let's say 'howdy'), and if it is equal to one of the
> string in a group then do what is in the if block.  Here it is in
> pseudo.
>
> if ("howdy" is in ("hello", "howdy", "howyadoin", "hi") )
> {
>    print "string is a greeting.";
> }
> else
> {
>    print "whatever";
> }
>
> I know I could do this with a bunch of if ( (string eq string2) || ...
> but I'd like to have it more compact and clean.  I'm pretty sure that
I
> should be able to in Perl.

=================================
#!/usr/local/bin/perl -w

use strict;

my $str = $ARGV[0];

if ( $str =~ /^(hello|howdy|howyadoin|hi)$/i ) {
    print "string is a greeting.\n";
}
else {
    print "whatever\n";
}
=========================
For more info on Perl's regexs try the online documentation tool
perldoc. Example: perldoc perlfaq6
Note:
  ^ $ = match at the beginning and end of string ( no partial matches )
  /i = case insenstive match
  -w = turn on warnings
  use strict = perldoc strict for more info
Also a good a good on regexps is "Mastering Regular Expressions" by
Jeffrey Friedl

http://www.amazon.com/exec/obidos/ASIN/1565922573/richmoressuperwe


=============================
Richard More
http://www.richmore.com/


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


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

Date: Wed, 11 Oct 2000 16:54:23 GMT
From: Philippe Hamel <phamel@logisil.com>
Subject: Re: Pattern matching
Message-Id: <8s25vs$h78$1@nnrp1.deja.com>

Cool!!!

Thanks everyone for the quick replies!
:-)

--
Philippe Hamel
Bureau :
Courriel : phamel@logisil.com
Tel : (514)866-5493 poste 419
Maison :
Courriel : philippe.hamel@apiiq.qc.ca


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


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

Date: Wed, 11 Oct 2000 13:53:21 -0400
From: "JS/PL" <someone@world.earth>
Subject: Re: Perl Books!
Message-Id: <su9af07sr3u57@corp.supernews.com>


"Ilya Zakharevich" <ilya@math.ohio-state.edu> wrote in message

>
> I'm amazed that you miss the point that what somebody puts on Internet
> is *a single* copy.  All the other copies are created by those who
> view them, not by the guy who put it.

They are not created by the person viewing them. It's created by the content
providers server.
>
> It is quite similar to putting an instruction how to blow up the White
> House on Internet.  This may be legal.  (Even reading it may be
> legal.  ;-)  Implementing this instruction is not legal...

Duplication of copyrighted material by placing it on a file server is not
similar to blowing up buildings in any way, except maybe that they are
illegal in specific instances.

>
> By the nature of US laws, of course it is a judge who decides which
> analogy actually holds!  But consider this example:
>
>   Click on the link below to read an online copy of PP III.
>   By clicking on this button you agree that you own a legal copy of PP
III.
>
>   "I agree"    "I do not agree"

Doesn't wash. The act of placing on the public server is illegal.
See here for more details:
http://www.nopiracy.org/warezfaq_c.html





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

Date: Wed, 11 Oct 2000 11:14:13 -0400
From: "Sanjay" <svp011467@yahoo.com>
Subject: Please help with simple regexp.
Message-Id: <8s202p$cf4$1@bob.news.rcn.net>

Hello,

I would like to schedule reports with our statistics
software (which uses regular expressions) with the following format
could you please help me?

I just want
http://myserver.com/client1/Oct00
http://myserver.com/client2/Oct00
http://myserver.com/client3/Oct00
etc.

We run these reports on November 1, but
I want it to show the previous month(e.g. oct for
the scheduled nov run)...
%mon% pulls the current system month (nov)
but how can i subtract 1 to get the previous month?
is there a way to do %mm%-1 then convert back to letters
(i.e. Oct) ALL IN ONE LINE.
Since this is in a stats package, I have to do everything inline.

Thank you,
Sanjay
please cc me if you can.
svp011467@yahoo.com





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

Date: Wed, 11 Oct 2000 09:04:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Please help with simple regexp.
Message-Id: <39E48F9F.9A86DC88@stomp.stomp.tokyo>

Sanjay wrote:

> I would like to schedule reports with our statistics
> software (which uses regular expressions) with the 
> following format

> I just want

> http://myserver.com/client1/Oct00
> http://myserver.com/client2/Oct00
> http://myserver.com/client3/Oct00

This is nice. What is the format of your
input data? How can you expect help without
stating clear parameters? Is this your input
data or extracted information?

 
> We run these reports on November 1, but
> I want it to show the previous month
> (e.g. oct for the scheduled nov run)...

Run your program a few minutes before midnight
on October 31. Your problems vanish instantly
with no effort on your part.


> %mon% pulls the current system month (nov)
> but how can i subtract 1 to get the previous month?
> is there a way to do %mm%-1 then convert back to letters

$your_data =~ s/Nov/Oct/g;

This is certainly a simple solution, yes?

I am curious. Why are your month days not
effected? Perhaps magic, you think? Has
to be magic if your month days are correct
but your program plugs in Nov instead of Oct.


> (i.e. Oct) ALL IN ONE LINE.
> Since this is in a stats package, 
> I have to do everything inline.

No. You don't have to do everything inline
nor one line at a time. You can do this any
ol' way you want.

I would suggest you engage in a bit of simple
thinking and use simple logic to resolve these
ever so simple problems and, work on your clear
contradictions in what few parameters you have
stated.


Godzilla!


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

Date: Wed, 11 Oct 2000 15:08:11 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Processing a MS access DB file
Message-Id: <vn%E5.35970$td5.6205671@news1.rdc2.pa.home.com>


"matt venn" <matt@nospamcipherdesign.com> wrote in message
news:39e44f71.12243865@news.ntlworld.com...
> Hey all,
>
> I'm having difficulty wading my way through the documentation
> regarding DBI, DBD::ODBC etc. I was wondering if someone could set me
> off in the right direction so I waste less time.

It sounds like you are looking for the ability to do positioned updates,
that is make edits to one record, then move on the next one throughout the
entire database.  ADO may be your best bet, but I don't think DBD::ADO
supports it yet.  You may need to use OLE to invoke ADO directly, there is
an example of this at

http://www.geocities.com/SiliconValley/Way/6278/perl-win32-database.html

hope this helps --

--Ben Kennedy






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

Date: Wed, 11 Oct 2000 17:25:06 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: Reading a whole file into a string
Message-Id: <8s27p7$iun$1@nnrp1.deja.com>

In article <39E468CC.F7DCE00D@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> mexicanmeatballs@my-deja.com wrote:
>  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> > >    undef local ($/);
> > All this undef combined with local thing is pointless,
> > localising will undef the value:
> Why are you repeating what I have already said
> with example, repeating what clearly none of you
> boys are capable of understanding, even when
> written in your own Geek Language?
> Polly want a cracker?

You wrote
'undef local ($/);'
Which has a superfluous undef and brackets.
I wrote
'local $/;'
Which, to the trained eye is clearly different.
How stupid are you?

--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'


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


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

Date: Wed, 11 Oct 2000 10:46:38 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Reading a whole file into a string
Message-Id: <39E4A77E.85EAFF3F@stomp.stomp.tokyo>

mexican "Frank" noballs wrote:

> Godzilla! wrote:
> > mexican "Frank" meathead wrote:
> > >  Godzilla! wrote:

> How stupid are you?

Certainly not as stupid as you. As always
and always will, I own your mind. You are
my funny little puppet and, myself, your
talented puppet mistress pulling your
strings so very artistically, Frank.

Godzilla!


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

Date: Wed, 11 Oct 2000 16:47:24 GMT
From: dstorrs@my-deja.com
Subject: reading/writing binary data
Message-Id: <8s25ip$h1e$1@nnrp1.deja.com>

I'm writing a resource manager.  I'd much rather do it in Perl than C++,
but I'm not familiar with the care and feeding of binary data in Perl
(e.g., how to ensure that you write out the number of bits that you
intend to, etc).  I've read the docs on vec, but I don't quite grok it.
 Can anyone point me to a good tutorial anywhere?

              Dave Storrs


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


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

Date: Wed, 11 Oct 2000 17:49:14 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: reading/writing binary data
Message-Id: <8s296m$kf1$1@nnrp1.deja.com>

In article <8s25ip$h1e$1@nnrp1.deja.com>,
  dstorrs@my-deja.com wrote:
> I'm writing a resource manager.  I'd much rather do it in Perl than
C++,
> but I'm not familiar with the care and feeding of binary data in Perl
> (e.g., how to ensure that you write out the number of bits that you
> intend to, etc).  I've read the docs on vec, but I don't quite grok
it.
>  Can anyone point me to a good tutorial anywhere?
try the online docs for:
perldoc -f pack
perldoc -f unpack
perldoc -f bin ( for dos/unix )

Also take a look at the Bit::Vector library:
http://search.cpan.org/search?module=Bit::Vector

--
=============================
Richard More
http://www.richmore.com/


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


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

Date: Wed, 11 Oct 2000 11:26:19 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: Reg exp help
Message-Id: <39E4869B.B6BB012A@cc.gatech.edu>

a94eribe@my-deja.com wrote:

> Hi
>
> I´m new to regular expressions and I would like some help.
>
> I need to check that the user submitted a correct quantity.
>
> A correct quantity is numeral and can contain one comma (,).
>
> How would the notation for that be?
>
> Thanks for your help
>

/^\d*,?\d*$/
Change *'s to +'s to restrict comma locations (e.g. change both *'s if
comma can only be between 2 digits).

perldoc perlre
--
Stephen Kloder               |   "I say what it occurs to me to say.
stephenk@cc.gatech.edu       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.




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

Date: 11 Oct 2000 15:10:08 GMT
From: jay@castlelink.co.uk (Jay)
Subject: Re: save blob from database
Message-Id: <8FCAA1E5Ajabrealprogrammercom@158.43.128.9>

pilsl@goldfisch.atat.at (peter pilsl) wrote in
<MPG.144e748b468950459898d7@news.chello.at>: 

>
>I have a bunch of files stored in a sql-database and process them
>using the dbi-modules. My problem is: when I save this files, I cant
>assign them an individual filename. All the files are named by the
>script. 
>
>this is what I do (highly simplified)
>
><a href="download.pl?id=xxxx">
>
>and then download.pl:
>
>syswrite STDOUT, "Content-Type: ".$contenttype."\n";
>syswrite STDOUT, $buf, $length;
>
>when downloading the file it gets named download.extension, where 
>extension depends on the contenttype. But I want to set funny, 
>descriptional and individual filenames.
>Any idea ?
>
>thanx,
>peter
>

This is kind of off topic (should be in a cgi group or somethin') 
but...

With *most* web servers you can try something like:

<a href="download.pl/xxxx/filename.gif">

Then in your CGI script look at the $q->path_info method of the CGI.pm 
module to decide which file to return. (read perldoc CGI)

I've not tried it but if this works you could also try:

<a href="download.pl/filename.gif?id=xxxx">

But unfortunatly I don't have time/resources to try this out at the 
moment.

Jay


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

Date: Wed, 11 Oct 2000 09:37:13 -0600
From: David Haertig <haertig@avaya.com>
Subject: Solved: Don't ignore a SIGCHLD!
Message-Id: <39E48929.A7816F33@avaya.com>

Hi -

Figured it out.  The program in question was setting SIGCHLD
to IGNORE prior to the system call.  Don't know why anyone would
want to do this, but the person who originally wrote the program
felt a need to, I guess.

I would have thought that an ignored SIGCHLD would cause a system()
call to hang, not return -1, but real life tests prove otherwise.
Maybe someday I'll analyze what's happening and increase my knowledge
in the process.

Thanks,
--
Dave Haertig
haertig@avaya.com


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

Date: Wed, 11 Oct 2000 16:29:16 GMT
From: jgunnip@my-deja.com
Subject: Starting batch file from Perl that interacts with Windows desktop
Message-Id: <8s24gh$fv8$1@nnrp1.deja.com>

Hi,

I'm trying to start a batch file from Perl that will interact with the
Windows Desktop (i.e I want to see the DOS window created by the batch
file on the Desktop of the user that is currently logged in.)

I've tried both system() and Win32::Process:

$START_FILE = 'C:\\Winnt\\Profiles\\jon\\Start
Menu\\Programs\\Startup\\setup.bat';

############FIRST TRY#######################
system("cmd /c $START_FILE") == 0
   or die "Couldn't start $START_FILE: $!";
############################################

############SECOND TRY######################
use Win32::Process;
use Win32;
my $process;
Win32::Process::Create($process, "C:\\Winnt\\System32\\cmd.exe",
                      "cmd.exe /c \"$START_FILE\"",
                      0, CREATE_NEW_CONSOLE, ".")
                      || die "Create: " .
                      Win32::FormatMessage(Win32::GetLastError() ) .
                      ": $!";
############################################

Both of these attemps run the batch file but they start it in the
background.  No DOS window appears on my desktop.

Does anyone have an idea how I can get run this batch file from Perl
and get to see its window on the Desktop?

Thanks,
Jon


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


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

Date: Wed, 11 Oct 2000 16:08:53 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Template modules
Message-Id: <39e49091.41bb$25a@news.op.net>
Keywords: amaze, hardware, moribund, oint

In article <4QZE5.38056$Z2.574096@nnrp1.uunet.ca>,
Daniel Riquier <driquier@speedware.com> wrote:
> there seems to be more than one Perl Template Module available on the WEB.

There are at least twenty-nine.

> I'd like to know which one is the most often used. 

I don't think anyone can possibly know that.

> I'd like some comments regarding its advantages over other Perl
> template modules.

There seem to be two basic approaches to templating:

1. The 'embedded Perl code' approach

   These embed Perl code into a file and simply evaluate the Perl
   code.  Advantages include flexibility (because you have access to
   all of Perl) and ease of learning (because you already know Perl).
   Disadvantages include poor security (because the template might
   invoke 'system("rm -rf /")') and a difficult interface for the
   nonprogrammers (who have to see Perl in the template files).

   Text::Template and Apache::EmbPerl are examples of this approach.
   So is the old

        s/%%([^%]|%[^%])*%%/$1/eg;

   trick which executes %%CODE%% when it appears in the template file.

1. The 'little language' approach

   This approach makes up a new 'little language' with a few features
   like conditional expressions, variable substitutions, and soforth.
   The advantages and disadvantages are pretty much the opposite of
   the 'embedded Perl code' approach.  (Less flexible, and there may
   not be an escape if you need to do something not provided for;
   safer, because the language does not provide any way to do things
   like 'system("rm -rf /")' in a template; harder to learn (because
   you don't already know it); easier for the nonprogrammers to use
   (because it's much simpler than Perl.)

   Examples of this approach include HTML::Template and Text::MetaText.

Andy Wardley's Template Toolkit is highly thought of and may provide a
hybrid approach.  (Andy, you really need to get a better name for the
Toolkit.)

Using the 'most popular' system is not a good strategy.  When I
surveyed the 29 templating systems, I discovered that each one was a
little different from the others and each had its strengths and
weaknesses.  Each one was designed to solve a slightly different
problem.  

Suppose module A solves problem A, and module B solves problem B.  60%
of people have problem A and use module A to solve it; 40% have
problem B and use module B.  If you have problem B, and you use module
A because it is the 'most popular', you have made a mistake.  The
templating systems are not all interchangeable; you have to look at
several and find the one that suits what you are trying to do.

(Also, popularity is not a good basis for technical decisions because
people are stupid and use all sorts of crap.)

> I'd also appreciate if someone was able to give me a URL that shows
> statistics about Perl module utilization.

I would too!  But I believe no such thing exists.  How could it?  Who
would make it?  How could they find out?

> Also, I'd like to know if there's any Perl Template Module for Phone.com's
> HDML and for WAP/WML.

Text::Template was designed be used as a templating system in any
context.  For example, some people use it input to the TeX typesetting
system, which has nothing to do with HTML at all.  But probably the
same is true for many other templating systems.





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

Date: Thu, 12 Oct 2000 00:21:47 +0800
From: "ericio" <ericio@pd.jaring.my>
Subject: will perl 5 work w/o server on my PC
Message-Id: <8s23m5$fi5$1@news4.jaring.my>

im using WinME...i manage to install the activeperl 5.005
can i ask whether i can develop the CGI using perl without any web server on
my terminal???
can i learn the perl with just in client way(using PC alone)?
TQ in advance...




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

Date: Wed, 11 Oct 2000 09:26:28 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: will perl 5 work w/o server on my PC
Message-Id: <39E494B4.EA04AE73@vpservices.com>

ericio wrote:
> 
> im using WinME...i manage to install the activeperl 5.005
> can i ask whether i can develop the CGI using perl without any web server on
> my terminal???

Sure, as long as you don't mind viewing the output of the CGI in a DOS
box, rather than in a browser. (or jump through various hoops to save
the output to a file before viewing or using CGI.pm's debug mode, etc.)

> can i learn the perl with just in client way(using PC alone)?

Yes, Perl itself is fine with just the client.  But that is Perl, not
CGI, there is a big difference between the two.  If CGI is your main
reason for learning Perl, then you are probably much better off just
biting the bullet and installing a web server. Apache and many other web
servers are free, avaialable for the PC, and easily installable.

-- 
Jeff


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

Date: Wed, 11 Oct 2000 15:00:11 GMT
From: boulemann@my-deja.com
Subject: Writing to a file...
Message-Id: <8s1v9l$b3c$1@nnrp1.deja.com>

Please look at the script below. Everything seems to work except for
the "print OUT $line;" line. The out file is created but it remains
empty.  When i remove the "OUT" (i.e. "print $line;") it prints the
lines properly on the screen...
Any ideas?

Thanks!

opendir(DIR,'.');
@files = grep(/\.log$/, readdir(DIR));
closedir DIR;

$j = 0;

while ($files[$j]) {
        $i=1;
/ 	open (IN, "$files[$j]") || die "Couldn't open read file.";
	$outfile = $files[$j];
	$outfile =~ s/ex/mo/;

	open (OUT, "> $outfile")  || die "Couldn't open write file";
	while (defined($line = <IN>)) {
		if ($i == 3) {
			$date = substr($line,7,10);
		} elsif ($i == 4) {
			$line =~ s/time/date time/;
		} elsif ($i > 4) {
			$line =~ s/^/$date /;
		}
		print OUT $line;
		$i = $i+1;
        }
        close (IN) || die "Couldn't close read file";
	close (OUT) || die "Couldn't close write file";
	$j = $j + 1;
}


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


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