[17865] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 25 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 9 14:05:58 2001

Date: Tue, 9 Jan 2001 11:05:20 -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: <979067120-v10-i25@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 Jan 2001     Volume: 10 Number: 25

Today's topics:
    Re: - Seeking Online Content Management program... jeffrhysjones@my-deja.com
    Re: - Seeking Online Content Management program... webtipzcom@my-deja.com
    Re: ASCII to integer conversion (Peter L. Berghold)
    Re: ASCII to integer conversion (Helgi Briem)
    Re: ASCII to integer conversion (Abigail)
    Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
    Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
    Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
    Re: ASCII to integer conversion <juex@deja.com>
        building all together (Michael P. Soulier)
    Re: Connect to WIN2K via perl (Honza Pazdziora)
    Re: File I/O giving weird results (Honza Pazdziora)
        Fork lots of children <wbuchan@uk.noha-systems.com>
    Re: Fork lots of children (Randal L. Schwartz)
    Re: getting bash output to a perl variable. (Tad McClellan)
        HELP subroutines <ng@fnmail.com>
    Re: HELP subroutines <ng@fnmail.com>
    Re: How do I pass an object to a sub-routine (Tad McClellan)
    Re: How do I pass an object to a sub-routine (Tad McClellan)
    Re: How to humor a bad habit...? <jdrumm@blazenetme.net>
    Re: How to humor a bad habit...? <veshi@my-deja.com>
    Re: how to use a perl module outside /lib (Honza Pazdziora)
    Re: Is Perl dying? <peb@bms.umist.ac.uk>
    Re: Is Perl dying? (Anno Siegel)
        Jobs: Senior Software Engineer jatgal@my-deja.com
        List Results <jhall@ifxonline.com>
    Re: Microsoft access <graham.wood@iona.com>
        Networking with Win98 mferguson@ap.org
        Prototype mismatch: ? <fike@cs.utk.edu>
    Re: recursive directory copy?!? <adhariwal@idcrm.com>
    Re: regular expression for csv <bart.lateur@skynet.be>
    Re: Reset HTML::TokeParser <gisle@ActiveState.com>
    Re: Reset HTML::TokeParser <bart.lateur@skynet.be>
    Re: RTF e-mail attachment (Reto Hersiczky)
    Re: Shall use a reference instead? <joe+usenet@sunstarsys.com>
    Re: Shall use a reference instead? (Tad McClellan)
    Re: Shall use a reference instead? <joe+usenet@sunstarsys.com>
        String length jos_hunter_9@my-deja.com
    Re: trying to count words - not working <joe+usenet@sunstarsys.com>
    Re: Using C code in Perl (Cameron Laird)
    Re: What do you call the => operator? (Anno Siegel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 09 Jan 2001 14:00:17 GMT
From: jeffrhysjones@my-deja.com
Subject: Re: - Seeking Online Content Management program...
Message-Id: <93f5he$lje$1@nnrp1.deja.com>

Maybe we can help out? Affino is our content management product, it's
coldfusion based - but you don't need any programming skills to change
any part of your site.

Full list of modules at

http://www.emojo.com/Products/Index.cfm?ccs=99

Cheers,

Jeff


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


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

Date: Tue, 09 Jan 2001 16:00:53 GMT
From: webtipzcom@my-deja.com
Subject: Re: - Seeking Online Content Management program...
Message-Id: <93fcjh$rep$1@nnrp1.deja.com>

i would recommend cm4all.com,

rgds
markus
http://www.webtipz.com




In article <eqa66.25983$903.93686@weber.videotron.net>,
  "Jon" <vemba72@hotmail.com> wrote:
> Looking for a web content management program... something that will
make
> updating the site a lot easier.
>
> Anyone know anything?
>
>


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


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

Date: Tue, 09 Jan 2001 16:25:42 GMT
From: peter@uboat.berghold.net (Peter L. Berghold)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95mes6.3s1.peter@uboat.berghold.net>

On Mon, 08 Jan 2001 16:30:38 -0600, Michael Carman <mjcarman@home.com> wrote:
>#!/usr/local/bin/perl5 -w
>use strict;
>my $x = 'A';
>print "$x\n";
>$x++;
>print "$x\n";
>

Careful! You might make his head explode! ;-)


-- 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold                        Peter@Berghold.Net
"Linux renders ships                     http://www.berghold.net
 NT renders ships useless...."           


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

Date: Tue, 09 Jan 2001 16:38:27 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: ASCII to integer conversion
Message-Id: <3a5b3cd4.10962082@news.itn.is>

On Tue, 09 Jan 2001 11:28:14 +0100, Clifford Pennock
<cliff@*MYLASTNAMEHERE*.nl> wrote:

>Abigail wrote:
>> 
>> If you would know the very basics of Perl, you'd know how silly the
>> question is.
>
>An why is this silly? I've just started programming in Perl and I have
>encountered the exact same "problem" numerous times.
>
>For instance, suppose we have a string that contains an important value
>we need for some other stuff. The only thing we know and can be certain
>of, is that this value can be found directly *after* a fixed delimiter
>(in this case a ","). Now everything directly following this number can
>be literally anything, except numbers:
>
>    $a_string = "Random string with a value from somewhere,1234m/s";
>    $a_number = substr( $a_string, index( $a_string, "," ) );

What's wrong with the more Perlish way of doing things:
($a_number = $a_string) =~ s/.*,(\d+).*/$1/; 

Abigail may be able to come up with something
more elegant, but this at least works within
the parameters of what you specified.

Your solution won't return a number in this
particula case but the string ',1234m/s' which is not
easily useable as a number.

If you wish to allow floating point numbers it gets
a little trickier, or:
($a_number = $a_string) =~ s/.*,(\d+\.?\d*).*/$1/;

Perl is not C and shouldn't be approached as such.

Regards,
Helgi Briem




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

Date: 9 Jan 2001 17:28:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95mihe.ioc.abigail@tsathoggua.rlyeh.net>

Helgi Briem (helgi@NOSPAMdecode.is) wrote on MMDCLXXXVIII September
MCMXCIII in <URL:news:3a5b3cd4.10962082@news.itn.is>:
// 
// What's wrong with the more Perlish way of doing things:
// ($a_number = $a_string) =~ s/.*,(\d+).*/$1/; 


It's doing a substitution while all you want is a match:

    ($a_number) = $a_string =~ /\d+/g;

or:

    ($a_number) = $a_string =~ /(\d+)/;


Abigail
-- 
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'


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

Date: Tue, 09 Jan 2001 18:56:17 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93fk4p$n7o$1@news.news-service.com>

Rafael Garcia-Suarez wrote:
> 
> > For instance, suppose we have a string that contains an important value
> > we need for some other stuff. The only thing we know and can be certain
> > of, is that this value can be found directly *after* a fixed delimiter
> > (in this case a ","). Now everything directly following this number can
> > be literally anything, except numbers:
> >
> >     $a_string = "Random string with a value from somewhere,1234m/s";
> >     $a_number = substr( $a_string, index( $a_string, "," ) );
> >
> > Now we need to pass this number to another program:
> >
> >     `a_program $a_string`;
> 
> You should probably worry for security here (as each time a shell is
> spawned).
> 
> > See the problem? Now this of course can be easily fixed, the easiest
> > (afaik) being by just adding the line (which also would be the answer to
> > his question):
> >
> >     $a_number += 0;
> 
> The easiest fix is to do nothing, because there is no difference between
> strings and numbers in Perl, and it is _very_ important to understand

And that's exactly the problem. If you do nothing, Perl interprets it as
a string an will send "1234m/s" to the program you are shelling. Perhaps
in this case it's not a problem and the shelled program will simply
generate an error message of some sorts. But what if the string
contained something like "1234 -whatever" or anything else that the
shelled program would consider a command-line parameter?


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

Date: Tue, 09 Jan 2001 18:57:47 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93fk7i$n7o$2@news.news-service.com>

Martien Verbruggen wrote:
> 
> On Tue, 09 Jan 2001 11:28:14 +0100,
>         Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl> wrote:
> > Abigail wrote:
> >>
> >> If you would know the very basics of Perl, you'd know how silly the
> >> question is.
> >
> > An why is this silly? I've just started programming in Perl and I have
> > encountered the exact same "problem" numerous times.
> >
> > For instance, suppose we have a string that contains an important value
> > we need for some other stuff. The only thing we know and can be certain
> > of, is that this value can be found directly *after* a fixed delimiter
> > (in this case a ","). Now everything directly following this number can
> > be literally anything, except numbers:
> >
> >     $a_string = "Random string with a value from somewhere,1234m/s";
> >     $a_number = substr( $a_string, index( $a_string, "," ) );
> >
> > Now we need to pass this number to another program:
> >
> >     `a_program $a_string`;
> >
> > See the problem? Now this of course can be easily fixed, the easiest
> > (afaik) being by just adding the line (which also would be the answer to
> > his question):
> >
> >     $a_number += 0;
> 
> Unfortunately, perl isn't quite _that_ smart. You'll have to extract the
> number yourself. Watch:

Actually, it works perfectly. It would converts the scalar "1234m/s" to
the scalar "1234".


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

Date: Tue, 09 Jan 2001 19:00:28 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93fkcb$n7o$3@news.news-service.com>

Helgi Briem wrote:
> 
> Your solution won't return a number in this
> particula case but the string ',1234m/s' which is not
> easily useable as a number.

I forgot "Skinner's constant". ;)

    $a_number = substr( $a_string, index( $a_string, "," ) );

should of course be:

    $a_number = substr( $a_string, index( $a_string, "," ) + 1 );


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

Date: Tue, 9 Jan 2001 10:26:18 -0800
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: ASCII to integer conversion
Message-Id: <3a5b57ca$1@news.microsoft.com>


"Clifford Pennock" <cliff@*MYLASTNAMEHERE*.nl> wrote in message
news:93epse$54e$1@news.news-service.com...
> Abigail wrote:
> >
> > If you would know the very basics of Perl, you'd know how silly the
> > question is.
>
> An why is this silly? I've just started programming in Perl and I have
> encountered the exact same "problem" numerous times.
>
> For instance, suppose we have a string that contains an important value
> we need for some other stuff. The only thing we know and can be certain
> of, is that this value can be found directly *after* a fixed delimiter
> (in this case a ","). Now everything directly following this number can
> be literally anything, except numbers:
>
>     $a_string = "Random string with a value from somewhere,1234m/s";
>     $a_number = substr( $a_string, index( $a_string, "," ) );
>
> Now we need to pass this number to another program:
>
>     `a_program $a_string`;
>
> See the problem?

Yes, I do see the problem. You are assuming that a_program would expect a
number.
However, there are no numbers in a shell command line argument to begin
with. If you type
    a_program 1234
at a command prompt, then this "1234" is a text, not a number. And it is
passed to a_program as a text, not as a number. a_program is responsible for
converting this text "1234" into the number "1234". And it is up to
a_program what to do in case it finds non-digits in the argument.

And this is exactly what happens here. In your example the substring
$a_number contains the scalar value "1234m" and this is being passed to
a_program.
If you want to pass a number then you need a scalar which contains only
digits to begin with.

> Now this of course can be easily fixed, the easiest
> (afaik) being by just adding the line (which also would be the answer to
> his question):
>
>     $a_number += 0;

Well, this is a rather odd way that works by chance because the numerical
value of a scalar happens to be the value of the leading digits of the
scalar (somewhat simplified).
The correct way would be to extract exactly the number, i.e. dicsard the
trailing "m" with e.g. chop or something similar, depending on your data.

> But if you have a background in C (or almost any other programming
> language), this is pretty weird stuff.

Don't quite agree. Even in C the substring function (regardless if you use
the library function or do some weird pointer arithmetic of your own) would
still yield a string "1234m" and if you pass it on to the next program it
will still be a string.

jue




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

Date: 9 Jan 2001 17:56:13 GMT
From: msoulier@nortelnetworks.com (Michael P. Soulier)
Subject: building all together
Message-Id: <93fjbt$pml$1@bmerhc5e.ca.nortel.com>

    Hey guys. I maintain the Perl distribution for my group, and it's also
used on other sites. I was hoping to make my life easy by taking all of the
Perl source, plus the source for all CPAN modules that we're using, and
setting it up so that you can just untar it, cvs co it, whatever, configure
and make. 
    Now, extension modules placed in the ext subdirectory seem to get picked
up, for the most part. I'm having problems with some however, and I think it
might be due to prerequisities on other modules. Is there a way to make sure
that these extension modules are built in the correct order, and that all
include and @INC paths are correct?

    Has anyone tried this?

    Mike

-- 
Michael P. Soulier, TD12, SKY  Tel: 613-765-4699 (ESN: 39-54699)
Optical Networks, Nortel Networks, SDE Pegasus
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to UNIX
Nortel Linux User's Group Ottawa: (internal) http://nlug.ca.nortel.com


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

Date: Mon, 8 Jan 2001 10:57:25 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Connect to WIN2K via perl
Message-Id: <G6uBrq.Exp@news.muni.cz>

On Sun, 7 Jan 2001 18:34:22 +0100, Rudi Runkel <rudi_runkel@gmx.de> wrote:
> > is there a possibility to connect myself to a windows NT or 2K box from my
> > linux server to check, if a process is still running or if there is still
> > enough diskspace?
> 
> of course by using perl

Use SNMP if that Win* box supports it. If not, you can setup
a RPC::PlServer on the Win* and connect to it from the Linux using
RPC::PlClient.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Mon, 8 Jan 2001 10:55:56 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: File I/O giving weird results
Message-Id: <G6uBp8.DLo@news.muni.cz>

On Sun, 07 Jan 2001 16:57:00 GMT, fenderstratocaster@my-deja.com <fenderstratocaster@my-deja.com> wrote:
> 
> 1. #!/usr/bin/perl -w
> 
> 3. open(FREECELL, ">>C:/My Documents/freecell.txt") || die "$!";
> 
> 5. print "Enter the game number here: ";
> 6. $gamenumber = <STDIN>;
> 7. chomp $gamenumber;
> 
> 9. print FREECELL "$gamenumber";
> 10.print FREECELL ", ";
> 11.$text = <FREECELL>;

No good idea, you didn't open the file for reading.

> And sometimes I'll even see #!usr/bin/perl -w written in there as
> well...seems very weird to me. Can anyone help me find out what is
> wrong with my script?

Buffering mixed with work with unopenned handles?

BTW, it's probably not a good idea to number the lines the way you did
-- that is not correct Perl script and it will not compile.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Tue, 09 Jan 2001 18:25:21 GMT
From: Bill Buchan <wbuchan@uk.noha-systems.com>
Subject: Fork lots of children
Message-Id: <93fl2a$2d0$1@nnrp1.deja.com>

I'd like to run a number of processes at the same time (unix).

I've been using fork but I seem to have to create a child process, then
spawn a child from the child, and a child from this child etc. until I
have a whole heirarchy of children.  This works but the code is a real
mess.

All I want is one parent and multiple children all at the same level in
the process heirarchy.  Is this possible?  Or is there a better way to
go about it - ie. other than fork?  Or does somebody have a tidier bit
of code to do this!?

Many thanks for any information
- Bill.


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


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

Date: 09 Jan 2001 10:47:15 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Fork lots of children
Message-Id: <m1zoh08swc.fsf@halfdome.holdit.com>

>>>>> "Bill" == Bill Buchan <wbuchan@uk.noha-systems.com> writes:

Bill> I'd like to run a number of processes at the same time (unix).
Bill> I've been using fork but I seem to have to create a child process, then
Bill> spawn a child from the child, and a child from this child etc. until I
Bill> have a whole heirarchy of children.  This works but the code is a real
Bill> mess.

Bill> All I want is one parent and multiple children all at the same level in
Bill> the process heirarchy.  Is this possible?  Or is there a better way to
Bill> go about it - ie. other than fork?  Or does somebody have a tidier bit
Bill> of code to do this!?

  http://www.stonehenge.com/merlyn/LinuxMag/col15.html
  http://www.stonehenge.com/merlyn/LinuxMag/col16.html

-- 
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: Tue, 9 Jan 2001 11:20:08 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: getting bash output to a perl variable.
Message-Id: <slrn95meho.321.tadmc@tadmc26.august.net>

Aaron!@# <aaron@SPAM-O-RAMA.smalltime.com> wrote:
>Hey there.  I'm having trouble getting a file from a linksys router on my
>LAN (so I can get a .  Here's what I have so far:
>
>--------------------
>------- snip -------
>
>#!/usr/bin/perl


Enable warnings. Warnings can find many common mistakes for you.

It will find the common mistake that you have made!

   #!/usr/bin/perl -w

You should also enable strictures, that too would have avoided
your problem:

   use strict;


>$StatusPage ==
>`wget --http-user=$RouterUserName --http-passwd=$RouterPassword
>\"$RouterURL\" -O -`;


You are using an incorrect operator somewhere on that line,
as warnings will point out...


>I also tried:
> - doing "-O /dev/stout" instead of "-O -".
> - doing "$StatusPage eq" instead of "$StatusPage =="
                       ^^                          ^^

Do you know what those operators do?

It doesn't look like it.  Do you already have something in $StatusPage?
It is silly to compare it to anything if you have never put anything
into it.


> - inhaling massive amounts of caffiene
>but nothing seemed to do the trick.


Errr, try asking perl itself to help you. It will be more than
happy to, but only if you ask it.

Also try reading the applicable parts of the documentation for the
software that you are using. For info on Perl's operators:


   perldoc perlop


>Perhaps you can help?
         ^^^


No, I'm not even going to try. 

It is silly to spend brain cycles finding problems that
CPU cycles can find for you.

It is demeaning to be asked to do a machine's job. Please
don't ask us to do a machine's job anymore.

Thank you.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 9 Jan 2001 11:12:04 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: HELP subroutines
Message-Id: <93fgp4$55q$1@newsx.cc.uic.edu>

How do I call a subroutine form another subroutine.

I have a sub called load_file
and another called schedule

from the main program, it calls schedule
from inside schedule, it calls load_file
when I do this is gives me a Malformed prototype error

if I called load_file from the main program directly, it works fine.

--
Enrico Ng <ng@fnmail.com>




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

Date: Tue, 9 Jan 2001 11:14:19 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: Re: HELP subroutines
Message-Id: <93fgvo$563$1@newsx.cc.uic.edu>

also, these three subroutines are in different files
schedule is in a file called schedule
load_file is in a file called file
in the main program I use require for schedule and file
do I need another require statement in schedule for file?

--
Enrico Ng <ng@fnmail.com>
"Enrico Ng" <ng@fnmail.com> wrote in message
news:93fgp4$55q$1@newsx.cc.uic.edu...
> How do I call a subroutine form another subroutine.
>
> I have a sub called load_file
> and another called schedule
>
> from the main program, it calls schedule
> from inside schedule, it calls load_file
> when I do this is gives me a Malformed prototype error
>
> if I called load_file from the main program directly, it works fine.
>
> --
> Enrico Ng <ng@fnmail.com>
>
>




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

Date: Tue, 9 Jan 2001 11:35:55 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How do I pass an object to a sub-routine
Message-Id: <slrn95mffb.333.tadmc@tadmc26.august.net>

Rocky Raccoon <rrocky@bigfoot.com> wrote:
>
>I want to pass $p as parameter to my own sub-routine
>
>$a = get_next_tag($p); 
>
>sub get_next_tag
>{
>    $src = @_;
>    $x = $src->get_token; ### Line X

>What am I doing wrong ?


Using the name of an array variable in scalar context when
you want list context.


   my($src) = @_;   # you better have "use strict" turned on if
                    # you want people here to help you
or

   my $src = shift;

or

   my $src = $_[0];


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 9 Jan 2001 11:49:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How do I pass an object to a sub-routine
Message-Id: <slrn95mg91.34g.tadmc@tadmc26.august.net>

Rocky Raccoon <rrocky@bigfoot.com> wrote:

>$src = shift;
>[ which I assume takes @_ as the default ]
         ^^^^^^^^

Why are you doing that?

Why not read the documentation for the software that you are
using and *know* ?

   perldoc -f shift


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 08 Jan 2001 20:17:24 -0500
From: Jeffrey Drumm <jdrumm@blazenetme.net>
Subject: Re: How to humor a bad habit...?
Message-Id: <ehpk5t0pv65jrvapalltdou4r3e8vk3hoq@4ax.com>

[posted to comp.lang.perl.misc]

On Tue, 09 Jan 2001 00:28:55 GMT, stefan@borgia.com wrote:

>  $ini{'a'}{'a1'}='1';
>  $ini{'a'}{'a2'}='2';

foreach (sort keys %{$ini{'a'}})
{
    print "$_,\n";
}

see perldoc perlref and perllol.

-- 
 - Jeff Drumm

   "They misunderestimated me." - Dubya


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

Date: Tue, 09 Jan 2001 18:20:22 GMT
From: Adrian <veshi@my-deja.com>
Subject: Re: How to humor a bad habit...?
Message-Id: <93fkp1$28j$1@nnrp1.deja.com>

$ini{'a'}{'a1'}='1';
$ini{'a'}{'a2'}='2';


foreach $i ( keys(%ini) ) {
	foreach ( keys(%{$ini{$i}}) ) {
		print "$_\n";
	}
}

-Adrian

In article <93dlvu$jac$1@nnrp1.deja.com>,
  stefan@borgia.com wrote:
> Hi all!
>
> If I have some code like this:
>
>   $ini{'a1'}='1';
>   $ini{'a2'}='2';
>
> and then do:
>
>   foreach ( keys(%ini) ) { print "$_\n" }
>
> I get this:
>
>   a1
>   a2
>
> If I have some code like this:
>
>   $ini{'a'}{'a1'}='1';
>   $ini{'a'}{'a2'}='2';
>
> How do I get:
>
>   a1
>   a2
>
> Know what I am asking about?  I don't know how to determine the "sub-
> keys" in those 2 declarations, but I can determine the keys...
>
> Any suggestions?
>
> Thanks!
>
> Stefan Adams
>
> Sent via Deja.com
> http://www.deja.com/
>


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


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

Date: Mon, 8 Jan 2001 11:00:42 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: how to use a perl module outside /lib
Message-Id: <G6uBx6.I4J@news.muni.cz>

On Mon, 08 Jan 2001 10:07:55 GMT, marjou@my-deja.com <marjou@my-deja.com> wrote:
> 
> I would like to use a perl module (foo.pm) that is not located into the
> directory ~perl/lib/ . Is it possible ? If yes what is the syntax of
> the directive line "use ..." (or "require ...") to be able to use it in
> my perl files ?

	use lib '/dirctory';
	use foo;

	require '/full/path/foo.pm';

Check the documentation about these (perldoc -f use, perldoc -f
require, perldoc lib).

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Tue, 09 Jan 2001 17:17:56 +0000
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: Is Perl dying?
Message-Id: <3A5B47C4.C4364150@bms.umist.ac.uk>

Bart Lateur wrote:
> 
> Randal L. Schwartz wrote:
> 
> >Not as pretty, but more efficient, would be:
> >
> >  ($x, $y)[ $x <= $y ]
> 
>    ($x => $y)[ $x <= $y ]
> 
> --
>         Bart.

and the difference is what exactly?

I never could tell the difference between ',' and '=>'

Paul


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

Date: 9 Jan 2001 17:17:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is Perl dying?
Message-Id: <93fh2s$jdb$1@mamenchi.zrz.TU-Berlin.DE>

Paul Boardman  <peb@bms.umist.ac.uk> wrote in comp.lang.perl.misc:
>Bart Lateur wrote:
>> 
>> Randal L. Schwartz wrote:
>> 
>> >Not as pretty, but more efficient, would be:
>> >
>> >  ($x, $y)[ $x <= $y ]
>> 
>>    ($x => $y)[ $x <= $y ]
>> 
>> --
>>         Bart.
>
>and the difference is what exactly?
>
>I never could tell the difference between ',' and '=>'

No difference in this case, just the looks of it.  In general,
'=>' works exactly like ',', except that it auto-quotes its left
operand if it looks like a perl identifier (just like $hash{ ...}
does).

Anno


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

Date: Tue, 09 Jan 2001 17:58:14 GMT
From: jatgal@my-deja.com
Subject: Jobs: Senior Software Engineer
Message-Id: <93fjfj$179$1@nnrp1.deja.com>

Title: Senior Software Engineer / Software Architect

Req. #: IMI-2001-2345

Availability: Immediate

Location: Seattle, WA

Position Type: Permanent with a Leading Internet Infrastructure firm

Salary: DOE, competitive compensation packages including base salary,
stock options, 401(k) and more.

Please send resume and cover letter to resumes@intelimine.com

Qualifications:

·         Three years minimum experience programming Perl in a Unix
environment (including module design & implementation, OO Perl, CPAN).

·         Two years experience working with databases using ANSI SQL
(Transact-SQL is a big plus).

·         Two years nontrivial programming experience related to Unix
issues (signals, daemons, concurrency/locking/threads, shell, file IO,
NFS, sockets, IPC, POSIX).

·         Two years experience using revision control systems (CVS is a
plus).

·         Two years nontrivial programming experience with standard
Internet protocols (e.g., TCP/IP, DNS, HTTP, NNTP, SMTP, FTP).

·         Big pluses: expertise with Apache, mod_perl, DBI/DBD, LWP, C,
C++, Debian, other packaging systems.

·         Experience in other, similar or varied technologies can meet
the qualifications if it shows that the candidate can adapt quickly in
a leading edge Internet content categorization technology environment.







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


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

Date: Tue, 09 Jan 2001 19:01:45 GMT
From: "John Hall" <jhall@ifxonline.com>
Subject: List Results
Message-Id: <teJ66.156922$I5.3852754@news1.rdc1.sdca.home.com>


Thanks to the aid of this list i've trimmed over 20 lines of code from my
first project to achieve the same functionality. [The project is now a total
of ~260 lines of code in several scripts]

I have no doubt that over the next few weeks I'll have an infinitely more
functional suite of tools while shrinking the code-base continually.

In a few months I won't even need to come into work.. :)

Thanks all!


http://moron.shutdown.com






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

Date: Tue, 9 Jan 2001 13:52:52 -0000
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: Microsoft access
Message-Id: <93f5n7$1am$1@bvweb.iona.com>

> I think the salient part of this question is "how do I connect to a M$
> Access database file and scan through it?"  or better yet "How do I
> connect to a M$ Access database and make queries and updates to it?"
>
> I don't know if there's a DBI module for it, which would be useful to
> have if it exists.  I haven't seen one in CPAN.

There is a DBI module. DBD::ODBC will work with Access databases.  I got as
far as communicating with the database from a perl script on Windows NT
using ActiveState Perl  and DBD::ODBC.  The book Programming the Perl DBI
explicitly explains how to contact an Access database.

Graham Wood




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

Date: Tue, 09 Jan 2001 16:27:29 GMT
From: mferguson@ap.org
Subject: Networking with Win98
Message-Id: <93fe5a$sr4$1@nnrp1.deja.com>

I have a .cgi script on a web server that calls another computer using
the IO::Socket module. I need to pass variables to the receiver
computer and then let the server computer finish the script which send
information out the receiver's COM 1 serial port.

I am going to install Perl on a company LAN and map a computer to the
install location of Perl.

The computer however is running Windows 98. Will I be able to pass the
variables to a script running on Windows 98? The web server is UNIX.

Thanks for the help.

Mindy


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


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

Date: Tue, 09 Jan 2001 10:08:42 -0500
From: Don <fike@cs.utk.edu>
Subject: Prototype mismatch: ?
Message-Id: <iv9m5tghm5l00k4hv3kcm9jp5tqc5o2cr8@4ax.com>

Hello,  I have a recurring error in my logs that I don't understand. 
The script does run but I would like to know what is going on here.

When my script runs this error is generated;

Prototype mismatch: sub
Apache::ROOTicl_2ecs_2eutk_2eedu::internal::news::rss::view_5flocal_5fchannels_2eapl::head
vs ($) at /home/icl/www-home/internal/news/rss/view_local_channels.apl
line 12

Line 12 in the script is;   use LWP::Simple;

My env;

Apache 1.3.1
Perl 5.004
mod_perl 1.15

Thanks,

fike @ cs.utk.edu


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

Date: Tue, 09 Jan 2001 16:13:30 GMT
From: Aman <adhariwal@idcrm.com>
Subject: Re: recursive directory copy?!?
Message-Id: <3A5B4726.1CD039C0@idcrm.com>

Suppose we have to Directories - Nov and Dec. You want everything from
Nov to be copied to Dec... You can say
cp -r Nov/*  Dec


djinni wrote:

> Does anyone know how to recursively copy a directory?
> thanks,
>
> -dj



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

Date: Tue, 09 Jan 2001 14:40:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: regular expression for csv
Message-Id: <bk8m5tgm55gpn9mc6nmjnmohnl9lra45nl@4ax.com>

Alex Hart wrote:

>I know that there are modules out there to do comma separated values,
>but how about this regular expresssion for separating values. I am
>working with email addresses, so values can be partly in quotes, and
>partly outside of quotes.
>
>Can anyone find data that will break this regular expression.

You should at least take a look at this entry in the FAQ:

  How can I split a [character] delimited string except when inside
  [character]? (Comma-separated files)

(perlfaq4)

(Or do: perldoc -q split)

-- 
	Bart.


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

Date: Tue, 09 Jan 2001 16:27:59 GMT
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: Reset HTML::TokeParser
Message-Id: <m33deslmf4.fsf@ActiveState.com>

Rocky Raccoon <rrocky@bigfoot.com> writes:

> I parse a string containing HTML with the TokeParser.
> 
> $source = HTML::TokeParser->new(\$str_html);
> # I do operations on it like get_tag, get_token etc
> ....
> Now I want to reset the parser to the beginning.
> 
> Is reopening the Parser object i.e.
> $source = HTML::TokeParser->new(\$str_html);
> Is this the only way to reset the parser or are there any other
> methods for that.

You would have to create a new HTML::TokeParser object for that.

-- 
Gisle Aas


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

Date: Tue, 09 Jan 2001 18:05:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Reset HTML::TokeParser
Message-Id: <6okm5t8bjb11mfrn7f24bmiupq2f0h79iu@4ax.com>

Gisle Aas wrote:

>> Is reopening the Parser object i.e.
>> $source = HTML::TokeParser->new(\$str_html);
>> Is this the only way to reset the parser or are there any other
>> methods for that.
>
>You would have to create a new HTML::TokeParser object for that.

Which is exactly what he did. Duh...

-- 
	Bart.


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

Date: 9 Jan 2001 16:04:41 GMT
From: fight_against_spam_cut_here_retoh@dplanet.ch (Reto Hersiczky)
Subject: Re: RTF e-mail attachment
Message-Id: <Xns9024A984Dfightagainstspamcuth@195.141.200.222>


Try to tell MIME::Lite to apply 8-bit encoding to attach
your document. This would be saver to transmit any escape
characters correctly a RTF structure might have.

--Reto




Adrian <veshi@my-deja.com> wrote in <93d8lf$7kb$1@nnrp1.deja.com>:

>I'm using RTF::Document in conjunction with the MIME::Lite module to
>attach a RTF file to an e-mail.  The original document appears fine,
>but the e-mailed version of it contains exclamation marks in various
>places throughout the document.  Any idea what could be causing this?
>Is there another way to attach a file to an e-mail?
>Any help is greatly appreciated.
>-Adrian


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

Date: 09 Jan 2001 10:07:44 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Shall use a reference instead?
Message-Id: <m3ofxgyda7.fsf@mumonkan.sunstarsys.com>

Uri Guttman <uri@sysarch.com> writes:

> >>>>> "JS" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
> 
>   JS> "Michael Mayo" <michael-a-mayo@worldnet.att.net> writes:
>   >> Please show me how to:
>   >> 1) create a new object of this class
>   >> 2) access the object's color value
>   >> 3) call the object's doThingamabob method
>   >> all without using references.
> 
>   JS> tie %hash, "Doohickie";     #1 create a new object
>   JS> print $hash{color};         #2 access color value
>   JS> tied(%hash)->doThingamabob; #3 call doThingamabob
> 
> well, you are using references, you just hide them under tie's
> skirts. read the chapter on tied objects in OOP. very
> enlightening. tying is just wrapping an object with a standard set of
> methods that get called by the generated code. there is still a blessed
> reference that is created. rather referent as damian calls it. the bless
> is done on the actual hash (the referent) and you have a reference to
> that.

Very interesting. (You know I just got OOP for x-mas; looks like it's 
time to dig into it :).  Thanks for the pointer to Ch.9!  Here's more 
code that hopefully illustrates your comments: (same Doohickie class)

#!/usr/bin/perl -wl
use Doohickie;

my $finger;
{
  my %hash;
  $finger = tie %hash => "Doohickie";
  print $hash{color};        
  tied(%hash)->doThingamabob;    # same as $finger->doThingamabob
  untie %hash;                   # generates a useful warning
  print %hash;                   # untied %hash is empty
}
print $finger->{color};          # moon still exists

__END__


% try.pl
red
untie attempted while 1 inner references still exist at /tmp/try.pl line 32.

black
%

Commenting out the "untie %hash;" line above outputs

red
colorblack
black


-- 
Joe Schaefer



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

Date: Tue, 9 Jan 2001 11:39:30 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Shall use a reference instead?
Message-Id: <slrn95mfm2.333.tadmc@tadmc26.august.net>

Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
>"Michael Mayo" <michael-a-mayo@worldnet.att.net> writes:
>
>> Please show me how to:
>> 1) create a new object of this class
>> 2) access the object's color value
>> 3) call the object's doThingamabob method
>> all without using references.
>

>sub new {
>   bless { color => "red" } , shift;
>}


I thought he wanted it without references?

I see a reference (to an anon hash) there.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 09 Jan 2001 13:54:58 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Shall use a reference instead?
Message-Id: <m37l44y2rh.fsf@mumonkan.sunstarsys.com>

tadmc@augustmail.com (Tad McClellan) writes:

> Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> >"Michael Mayo" <michael-a-mayo@worldnet.att.net> writes:
> >
> >> Please show me how to:
> >> 1) create a new object of this class
> >> 2) access the object's color value
> >> 3) call the object's doThingamabob method
> >> all without using references.
> >
> 
> >sub new {
> >   bless { color => "red" } , shift;
> >}
> 
> 
> I thought he wanted it without references?
> 
> I see a reference (to an anon hash) there.

*He* defined the "new" sub in the Doohickey package; 
I just reduced it a bit. In the context of his question, 
I didn't think it was OK to redefine the subs he provided.
I thought he wanted to know how to use the Doohickey package 
in an OO way w/o introducing a reference variable in his 
main code. tieing a hash to the object is one way to do it,
but IMHO it's clumsier (and slower) than using a reference
in this case.

-- 
Joe Schaefer


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

Date: Tue, 09 Jan 2001 18:47:54 GMT
From: jos_hunter_9@my-deja.com
Subject: String length
Message-Id: <93fmco$3l4$1@nnrp1.deja.com>

Hi All,
Here is a basic newbie qs.
Is there a direct way of finding the string
length of a string in Perl? I can understand that
you can use substr to count the chars but its
inefficient.
Eg:
while (1) {
   $str_new = substr ($str_got, 0, $i);
   if ($str_got eq $str_new) {
      return $i;
   } else {
      ++$i;
   }
}
Thanks in advance,
Jos


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


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

Date: 09 Jan 2001 10:12:37 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: trying to count words - not working
Message-Id: <m3k884yd22.fsf@mumonkan.sunstarsys.com>

mgjv@tradingpost.com.au (Martien Verbruggen) writes:

> On 08 Jan 2001 17:22:03 -0500,
> 	Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> > cberry@cinenet.net (Craig Berry) writes:
> > 
> >> This is my prefered solution in terms of elegance of expression.  Others
> >> object that it needlessly builds and throws away an intermediate list; 
> > 
> > [...]
> > 
> >>   $leftcnt = 0; $leftcnt++ while $body =~ m/<left>/g;
> >> 
> >> is good enough.
> > 
> > Where do you see a list? I see m//g in the scalar context 
> > provided by while().
> 
> I think Bart was talking about the code that Ala submitted, and that he
> quoted, but you snipped:
> 
>  $leftcnt = () = $body =~ /<left>/g;
> 
> That does build a list, and then discards it.

s/Bart/Craig/.  I realized that I misunderstood him (i.e. "This") 
after rereading his post and canceled my reply.  Unfortunately 
not in time- sorry about that.

-- 
Joe Schaefer


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

Date: 9 Jan 2001 10:12:35 -0600
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Using C code in Perl
Message-Id: <7DE1850AEA59280C.584BFBBA9A2C23AD.8FF934B72A7735E7@lp.airnews.net>

In article <902e5t0cesjc94frfl6q7gn2i1m4b2uh62@4ax.com>,
Bart Lateur  <bart.lateur@skynet.be> wrote:
>ruittenb wrote:
>
>>I've got a little problem which is the following :
>>I've got some C/C++ functions that I want to use in a perl program, but
>>I can't figure out how and if this is possible.
>
>Yes it's possible and in more than one way. You need a C compiler
>(duh!).
>
>Then, check out the module Inline on CPAN.
><http://search.cpan.org/search?dist=Inline>
>
>-- 
>	Bart.

 ... and yet another way is to create a conventional command-line
C-coded program--or, better yet, reuse one already lying around,
without any changes--and manage it from Perl.  I do this so often
that I've written about it in, for example,
<URL:http://www.sunworld.com/unixinsideronline/swol-01-2001/swol-0105-regex.html>

Inline remains, of course, a lovely achievement which deserves
our applause.
-- 

Cameron Laird <claird@NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html


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

Date: 9 Jan 2001 14:50:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: What do you call the => operator?
Message-Id: <93f8eo$adp$2@mamenchi.zrz.TU-Berlin.DE>

Bart Lateur  <bart.lateur@skynet.be> wrote in comp.lang.perl.misc:
>Jerome O'Neil wrote:
>
>>I think it's real name is Earl.
>
>???

I don't know either, but if anything it's got to be "Erl".

Anno



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

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


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