[22150] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4371 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 9 11:05:47 2003

Date: Thu, 9 Jan 2003 08:05:09 -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: 4371

Today's topics:
    Re: A Good Perl Book <sjcole@no_spam.hotmail.com>
        A tar utility written in Perl <mzawadzk@man.poznan.pl>
        Activeperl : ppm and GD (Jan)
    Re: Activeperl : ppm and GD <simon.andrews@bbsrc.ac.uk>
    Re: Another string matching question. (Anno Siegel)
    Re: Another string matching question. <mpattWINDOZE@bigfoot.com>
    Re: Another string matching question. (Anno Siegel)
    Re: Another string matching question. <krahnj@acm.org>
        Arrays. What don't I get? <spikey-wan@bigfoot.com>
    Re: Arrays. What don't I get? <usenet@tinita.de>
    Re: Arrays. What don't I get? <Graham.T.Wood@oracle.com>
    Re: Arrays. What don't I get? (Anno Siegel)
    Re: Arrays. What don't I get? <usenet@tinita.de>
    Re: Arrays. What don't I get? <Graham.T.Wood@oracle.com>
        Dates in the filename <jon@nospam.org>
    Re: Dates in the filename <jurgenex@hotmail.com>
    Re: Dealing with split() and quotes <me@privacy.net>
    Re: Dealing with split() and quotes (Tad McClellan)
        exporting data <g-preston1@ti.com>
    Re: exporting data <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: exporting data (Anno Siegel)
    Re: finding files older than a given date (Charles)
    Re: How to install mod locally? LIB=./foo fails <usenet@tinita.de>
    Re: Net::Ping issue <sunil_franklin@hotmail.com>
    Re: Net::Ping issue <nospam_artd@speakeasy.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 9 Jan 2003 12:56:46 -0000
From: "Steve C" <sjcole@no_spam.hotmail.com>
Subject: Re: A Good Perl Book
Message-Id: <v1qsbh3ggea50e@corp.supernews.com>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb1pk14.mf5.tadmc@magna.augustmail.com...

> Now if we could just get you to quote followups properly as well...
>
>
>     http://www.geocities.com/nnqweb/nquote.html
>
OK. I apologise again.
All followups will be quoted properly from now on.

For information (and this is *not* a gripe!)- the information is no longer
available at Geocities.
It's now:-
http://nnqweb.tripod.com/nquote.html

Cheers.
Steve.




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

Date: Thu, 9 Jan 2003 16:25:32 +0100
From: Marek Zawadzki <mzawadzk@man.poznan.pl>
Subject: A tar utility written in Perl
Message-Id: <Pine.GSO.4.44.0301091620580.3701-100000@rose.man.poznan.pl>

Hello,

Is there a stable tar utility written in Perl? (possibly with
Archive::Tar)
I need tar with up to 255-characters-long pathnames support, and GNU
tar doesn't compile there (Cray).
I do have Perl though...

-marek



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

Date: 9 Jan 2003 04:52:49 -0800
From: jan_buys@hotmail.com (Jan)
Subject: Activeperl : ppm and GD
Message-Id: <11971c2c.0301090452.44135fae@posting.google.com>

Hello,

I had some scripts using the GD and Date modules.  Last I had to
reinstall ActivePerl and since then (or since earlier ?) when I start
ppm and do a search on GD I get only three modules.  That used to be
much more.  Now even the GD module itself doesn't turn up.

Are other people experiencing the same or did I something wrong upon
install ?

Thanks for any reply,
Jan


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

Date: Thu, 09 Jan 2003 15:50:23 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Activeperl : ppm and GD
Message-Id: <3E1D9A3F.3578376F@bbsrc.ac.uk>

Jan wrote:
> 
> Hello,
> 
> I had some scripts using the GD and Date modules.  Last I had to
> reinstall ActivePerl and since then (or since earlier ?) when I start
> ppm and do a search on GD I get only three modules.  That used to be
> much more.  Now even the GD module itself doesn't turn up.

If you're using the new 5.8 builds then Activestate have started
including more modules in the default install, meaning that you may have
GD there already.  Try running "ppm query GD" on your system and see
what turns up.

Simon.


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

Date: 9 Jan 2003 11:26:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Another string matching question.
Message-Id: <avjm9d$7kc$1@mamenchi.zrz.TU-Berlin.DE>

Martyn  <mpattWINDOZE@bigfoot.com> wrote in comp.lang.perl.misc:
> 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;

These regexes could use some streamlining.  /.*$_.*/ matches the same
strings as /$_/.  Further, you need the /i modifier only once, either
here or later when you use the pattern.  On the other hand, your
strings could contain characters that must be escaped in a regex,
so /\Q$_/ would be safer.

You may want to replace "[ ]" with \s.  Besides being shorter, it
also matches tabs and other (rarer) whitespace characters.  Again,
".*" in the second regex does nothing.  The line would be better
written as (untested)

    @matchmap = map qr/\Q$_/, grep !/^\s*$|^#/, @matchstrings;

> 
> for $string (@textstrings)
> {
>         for $stringobj (@matchmap) {
>          	$a=$string=~/$stringobj/i;
                ^^
"$a" (and "$b") are best avoided as variable names because they have
an internal meaning in Perl (see sort()).

>          }
> }
> 
> 
> 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)

This is a bit awkward to do with a regex (though certainly possible),
but since you are only looking for substrings, an approach using the
index() function suggests itself: (again, untested)

    my @matchmap = map lc, grep !/^\s*$|^#/, @matchstrings;

    for my $string (map lc, @textstrings) {
        for $stringobj ( @matchmap ) {
            my $x = index( $string, $stringobj) != -1 and
                $string ne $stringobj;
        }
    }

Note that I declare my variables with my().  It looks like you are
running without strictures.

Anno


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

Date: Thu, 09 Jan 2003 12:02:08 +0000
From: Martyn <mpattWINDOZE@bigfoot.com>
Subject: Re: Another string matching question.
Message-Id: <3E1D64C0.2000800@bigfoot.com>

Anno Siegel wrote:
> Martyn  <mpattWINDOZE@bigfoot.com> wrote in comp.lang.perl.misc:
> 
>>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;
> 
> 
> These regexes could use some streamlining.  /.*$_.*/ matches the same
> strings as /$_/.  Further, you need the /i modifier only once, either
> here or later when you use the pattern.  On the other hand, your
> strings could contain characters that must be escaped in a regex,
> so /\Q$_/ would be safer.
> 
> You may want to replace "[ ]" with \s.  Besides being shorter, it
> also matches tabs and other (rarer) whitespace characters.  Again,
> ".*" in the second regex does nothing.  The line would be better
> written as (untested)
> 
>     @matchmap = map qr/\Q$_/, grep !/^\s*$|^#/, @matchstrings;
> 
> 
>>for $string (@textstrings)
>>{
>>        for $stringobj (@matchmap) {
>>         	$a=$string=~/$stringobj/i;
> 
>                 ^^
> "$a" (and "$b") are best avoided as variable names because they have
> an internal meaning in Perl (see sort()).
> 
> 
>>         }
>>}
>>
>>
>>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)
> 
> 
> This is a bit awkward to do with a regex (though certainly possible),
> but since you are only looking for substrings, an approach using the
> index() function suggests itself: (again, untested)
> 
>     my @matchmap = map lc, grep !/^\s*$|^#/, @matchstrings;
> 
>     for my $string (map lc, @textstrings) {
>         for $stringobj ( @matchmap ) {
>             my $x = index( $string, $stringobj) != -1 and
>                 $string ne $stringobj;
>         }
>     }
> 
> Note that I declare my variables with my().  It looks like you are
> running without strictures.
> 
> Anno

Thanks for the tips, I'll look at the things  you've suggested. I had 
just worked out a way of doing it with regexps and doing 2 tests:

                 $a=$string=~/.+$stringobj/;
                 $b=$string=~/$stringobj.+/;
                 $removeit=1 if $removeit or  ($a or $b);


I am aware of using my () and stricts - I guess I should get into the 
habbit of using them now before it's too late!.



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

Remove WINDOZE before replying by Email



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

Date: 9 Jan 2003 12:35:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Another string matching question.
Message-Id: <avjqb1$eq0$1@mamenchi.zrz.TU-Berlin.DE>

Martyn  <mpattWINDOZE@bigfoot.com> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> > Martyn  <mpattWINDOZE@bigfoot.com> wrote in comp.lang.perl.misc:

[matching proper substrings]

> > This is a bit awkward to do with a regex (though certainly possible),
> > but since you are only looking for substrings, an approach using the
> > index() function suggests itself: (again, untested)
> > 
> >     my @matchmap = map lc, grep !/^\s*$|^#/, @matchstrings;
> > 
> >     for my $string (map lc, @textstrings) {
> >         for $stringobj ( @matchmap ) {
> >             my $x = index( $string, $stringobj) != -1 and
> >                 $string ne $stringobj;
> >         }
> >     }
> > 
> > Note that I declare my variables with my().  It looks like you are
> > running without strictures.
> > 
> > Anno
> 
> Thanks for the tips, I'll look at the things  you've suggested. I had 
> just worked out a way of doing it with regexps and doing 2 tests:
> 
>                  $a=$string=~/.+$stringobj/;
>                  $b=$string=~/$stringobj.+/;
>                  $removeit=1 if $removeit or  ($a or $b);

Yes, that's a possiblity.  Your regexes still work harder than they
have to.  /.$stringobj/ matches the same strings as /.+$stringobj/,
the same goes for /$stringobj./ and /$stringobj.+/.  By default,
patterns are not anchored, so there is no need to allow matches to
extend to the beginning or the end of the string.

Another possible problem with this approach is that you lose the
advantage of precompiling the regexes in qr//.  Once you add something
in the actual regex, it must be recompiled.

> I am aware of using my () and stricts - I guess I should get into the 
> habbit of using them now before it's too late!.

It's never too late, but then, it's also never too early :)

Anno


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

Date: Thu, 09 Jan 2003 14:05:06 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Another string matching question.
Message-Id: <3E1D80FB.F3E8DAB@acm.org>

Martyn wrote:
> 
> 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.

Here is one way to do it:

my @matchmap = grep !/^[ ]*$|^#.*/, @matchstrings;

my @keep = map { my $key = $_; grep { lc $_ eq lc $key } @matchmap } @textstrings;



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 9 Jan 2003 11:22:12 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Arrays. What don't I get?
Message-Id: <avjm2e$c5e$1@newshost.mot.com>

I'm missing something here...

I start with
$one = 1; $two = 2; $three = 3; $four = 4;
and want to end with
 $one = 2; $two = 4; $three = 6; $four = 8;

What don't I understand?

Thanks.

R.

use strict;
use warnings;
our $one = 1; our $two = 2; our $three = 3; our $four = 4;
our $value; our $print;
our @values = ($one, $two, $three, $four);
print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";
foreach $value (@values) {
 $value *= 2;
}
foreach $print (@values) {
 print "$print\n";
}
print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";






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

Date: 9 Jan 2003 11:53:10 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Arrays. What don't I get?
Message-Id: <tinh8g4rh$11c$tina@news01.tinita.de>

Richard S Beckett <spikey-wan@bigfoot.com> wrote:

> I start with
> $one = 1; $two = 2; $three = 3; $four = 4;
> and want to end with
>  $one = 2; $two = 4; $three = 6; $four = 8;

$_ *= 2 for $one, $two, $three, $four;

> What don't I understand?

> use strict;
> use warnings;
> our $one = 1; our $two = 2; our $three = 3; our $four = 4;

why our() and not my()?

> our $value; our $print;

what is that for?

> our @values = ($one, $two, $three, $four);
> print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";
> foreach $value (@values) {

so you want to change the values in @values?
and here should be the point where to declare $value:
foreach my $value (@values) {...}

>  $value *= 2;
> }
> foreach $print (@values) {
>  print "$print\n";
> }

well, here you get 2,4,6,8 which is what you wanted.
and here should also be the point where to declare $print:
foreach my $print (@values) {...}

> print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";

they haven't changed. you've only changed @values.
see my example at the top for changing them.

hth, tina

-- 
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Thu, 09 Jan 2003 11:53:32 +0000
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: Arrays. What don't I get?
Message-Id: <3E1D62BC.AD2F02F5@oracle.com>

Richard S Beckett wrote:

> I'm missing something here...
>
> I start with
> $one = 1; $two = 2; $three = 3; $four = 4;
> and want to end with
>  $one = 2; $two = 4; $three = 6; $four = 8;
>
> What don't I understand?
>
> Thanks.
>
> R.
>
> use strict;
> use warnings;
> our $one = 1; our $two = 2; our $three = 3; our $four = 4;
> our $value; our $print;
> our @values = ($one, $two, $three, $four);
> print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";

> foreach $value (@values) {
>  $value *= 2;
> }

This is where you are going astray.

    foreach $value (@values)

will take each element in your @values array and assign it's value to
$value.  Whatever changes you make to $value after the initial assignment
will not affect the value in the array element.  The value in $value does
not get copied back to the array after you have doubled it.  If you print
"$value" after the *=2 in your first loop you will see the numbers have
been doubled but after this loop completes you still haven't made changes
to @values.

To double all the values in @values you need to assign the doubled values
back into the array.

foreach $value (@values){
    push(@newvalues,$value * 2);
}
@values=@newvalues;

or

@values = map {$_ * 2} @values;


> foreach $print (@values) {
>  print "$print\n";
> }

Changing the values in @values will also not affect the values in $one,
$two, $three and $four.  The connection between them ends with the
assignment of the values in $one .. $four into the array.

>
> print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";

Hope this helps

Graham



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

Date: 9 Jan 2003 11:58:59 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Arrays. What don't I get?
Message-Id: <avjo63$dbb$1@mamenchi.zrz.TU-Berlin.DE>

Richard S Beckett <spikey-wan@bigfoot.com> wrote in comp.lang.perl.misc:
> I'm missing something here...
> 
> I start with
> $one = 1; $two = 2; $three = 3; $four = 4;
> and want to end with
>  $one = 2; $two = 4; $three = 6; $four = 8;
> 
> What don't I understand?
> 
> Thanks.
> 
> R.
> 
> use strict;
> use warnings;
> our $one = 1; our $two = 2; our $three = 3; our $four = 4;

Is there any reason why these must be package variables?  Use my()
instead of our().

> our $value; our $print;
> our @values = ($one, $two, $three, $four);

This *copies* the values from $one, $two, ... into @values.  What
happens to @values has no bearing upon the original variables.

> print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";
> foreach $value (@values) {
>  $value *= 2;
> }
> foreach $print (@values) {
>  print "$print\n";
> }
> print "\$one = $one\n\$two = $two\n\$three = $three\n\$four = $four\n";

If you want to change a bunch of scalars in one go, list them directly:

    $_ *= 2 for $one, $two, $three, $four;

This makes $_ an alias for $one, then $two, etc, so the originals are
changed.

If you must collect the variables into a list for some reason, use
references:

    my @refs = ( \ $one, \ $two, \ $three, \ $four);
    $$_ *= 2 for @refs;

The first line could also be "my @refs = \ ( $one, $two, $three, $four)",
but I don't like that.

Anno


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

Date: 9 Jan 2003 12:02:58 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Arrays. What don't I get?
Message-Id: <tinh8g57u$11y$tina@news01.tinita.de>

Graham Wood <Graham.T.Wood@oracle.com> wrote:
> Richard S Beckett wrote:
>> I start with
>> $one = 1; $two = 2; $three = 3; $four = 4;
>> and want to end with
>>  $one = 2; $two = 4; $three = 6; $four = 8;

>> foreach $value (@values) {
>>  $value *= 2;
>> }

> This is where you are going astray.

>     foreach $value (@values)

> will take each element in your @values array and assign it's value to
> $value.

right so far. but i wouldn't call it "assign".

>  Whatever changes you make to $value after the initial assignment
> will not affect the value in the array element.

it will, because $value is an alias to the array element.

>  The value in $value does
> not get copied back to the array after you have doubled it.  If you print
> "$value" after the *=2 in your first loop you will see the numbers have
> been doubled but after this loop completes you still haven't made changes
> to @values.

well, if i try it out, it prints 2, 4, 6 and 8.

> Changing the values in @values will also not affect the values in $one,
> $two, $three and $four.  The connection between them ends with the
> assignment of the values in $one .. $four into the array.

that's correct, though.

regards, tina

-- 
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Thu, 09 Jan 2003 13:15:22 +0000
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: Arrays. What don't I get?
Message-Id: <3E1D75EA.8181404E@oracle.com>

> well, if i try it out, it prints 2, 4, 6 and 8.

Thanks for sweeping up behind me Tina.  That's what I get for not testing it.

Graham



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

Date: Thu, 09 Jan 2003 10:50:26 -0500
From: Jon Zero <jon@nospam.org>
Subject: Dates in the filename
Message-Id: <3E0CCC8349DB3069.18797EBD0756632D.E666C002EB19BB0E@lp.airnews.net>

All-
   Im not sure how to approach this problem, any help would be great.  I
have a list of files, and the files are in the following format:

MMDDYY-{randomnumber}.jjp

I want to delete files older then 11 days based on the MMDDYY in the file
names.  What would be the best way to go about doing this?

Thanks in advance,
Jon


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

Date: Thu, 09 Jan 2003 16:04:36 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Dates in the filename
Message-Id: <o4hT9.34170$xb.9539@nwrddc02.gnilink.net>

Jon Zero wrote:
> All-
>    Im not sure how to approach this problem, any help would be great.
> I have a list of files, and the files are in the following format:
>
> MMDDYY-{randomnumber}.jjp
>
> I want to delete files older then 11 days based on the MMDDYY in the
> file names.  What would be the best way to go about doing this?

The best(!) way would be to persuade the tool that generates those file
names to use ISO date format: YYYYMMDD. Then all you have to do is a simple
comparison on the first 8 characters of the file name. And you don't have a
Y2100 problem, either ;-)

Now, if this is the easiest way in your org I do not know.

jue




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

Date: Thu, 9 Jan 2003 23:57:18 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Dealing with split() and quotes
Message-Id: <avjrjd$g3t0n$1@ID-172104.news.dfncis.de>


"Marshall Dudley" <mdudley@execonn.com> wrote in message
news: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.

Even before SGML?




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

Date: Thu, 9 Jan 2003 09:43:52 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Dealing with split() and quotes
Message-Id: <slrnb1r65o.oh7.tadmc@magna.augustmail.com>

Marshall Dudley <mdudley@execonn.com> wrote:
> 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 >.


And some things that start and end with those characters are not tags.

   <!-- this is not a tag either -->


>> That is an "entity reference".


Actually a "general entity reference".


> OK, call it entity reference.  


Precise terminology is important when discussing technical topics.


> I was using the words tags and tokens
> decades before html was invented.


Then you will understand what you meant. That would be fine
if you were writing to yourself.

When you are writing to others, what matters is what the others
think it means.

Even if we go with a colloquial meaning for "tag":

   a tag marks something

it is not correct.

&quot; does not mark anything.

If we agree that "token" has a colloquial meaning of:

   stands for something else

then we could call &quot; a token.


&quot; is not a tag.


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


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

Date: Thu, 9 Jan 2003 07:37:59 -0600
From: "Jerry Preston" <g-preston1@ti.com>
Subject: exporting data
Message-Id: <avjtvr$da1$1@tilde.itg.ti.com>

Hi!,

I do not understand what I am doing wrong.  I can pass an hash this way and
not an array using the following:

   require Exporter;

   our @ISA = qw(Exporter);
   our @EXPORT = qw();
   our @EXPORT_OK = qw( @T_AREA );
   our @EXPORT_OK = qw( %T_IDS );

where

  @T_AREA = ( "", "NORTH", "SOUTH" );

  %T_IDS = (
                     NORTH=> [ qw/KT201 KT202 KT203 KT210 KT211 KT212 KT215
KT216 KT217 KT218 KT219 KT220 KT221/ ],

                     SOUTH=> [ qw/PT211 PT212 PT213 PT214 PT215 PT216 PT217
PT218/ ],

                  );


This does not work!!
  print $query->popup_menu( -name    => 'fab_area',
                            -values  => \@TABLES::T_DMOS5,
                            -default => '',
                          );

This does work!!
  print "<br>\n";
  print $query->popup_menu( -name=>'test_area',
                            -values  => \@{$TABLES::T_ID{ "\L$area"."L" }},
                            -default=>  ''
                          );


Why can I not export the array T_AREA ?

Thanks,

Jerry




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

Date: Thu, 09 Jan 2003 14:59:49 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: exporting data
Message-Id: <newscache$pj9g8h$ru6$1@news.emea.compuware.com>

Jerry Preston wrote (Thursday 09 January 2003 14:37):

> Hi!,
> 
> I do not understand what I am doing wrong.  I can pass an hash this way
> and not an array using the following:
> 
>    require Exporter;
> 
>    our @ISA = qw(Exporter);
>    our @EXPORT = qw();
>    our @EXPORT_OK = qw( @T_AREA );
>    our @EXPORT_OK = qw( %T_IDS );


Is this last line a typo? You are overwriting the previous contents of 
@EXPORT_OK. Me thinks you want:

    our @EXPORT_OK = qw( @T_AREA, %T_IDS );

-- 
KP



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

Date: 9 Jan 2003 14:40:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: exporting data
Message-Id: <avk1lm$kes$1@mamenchi.zrz.TU-Berlin.DE>

Jerry Preston <g-preston1@ti.com> wrote in comp.lang.perl.misc:
> Hi!,
> 
> I do not understand what I am doing wrong.  I can pass an hash this way and
> not an array using the following:
> 
>    require Exporter;
> 
>    our @ISA = qw(Exporter);
>    our @EXPORT = qw();
>    our @EXPORT_OK = qw( @T_AREA );
>    our @EXPORT_OK = qw( %T_IDS );

You're running without warnings.  Declaring the same variable (@EXPORT_OK)
twice with our() doesn't make much sense.  Warnings would have told
you that something's amiss.

But even without the second our(), the second assignment to @EXPORT_OK
overwrites the first one, which is lost without a trace, so it's no
wonder that @T_AREA is not exportable.

> 
> where
> 
>   @T_AREA = ( "", "NORTH", "SOUTH" );
> 
>   %T_IDS = (
>                      NORTH=> [ qw/KT201 KT202 KT203 KT210 KT211 KT212 KT215
> KT216 KT217 KT218 KT219 KT220 KT221/ ],
> 
>                      SOUTH=> [ qw/PT211 PT212 PT213 PT214 PT215 PT216 PT217
> PT218/ ],
> 
>                   );
> 
> 
> This does not work!!
>   print $query->popup_menu( -name    => 'fab_area',
>                             -values  => \@TABLES::T_DMOS5,
>                             -default => '',
>                           );

This accesses @TABLES::T_DMOS5 without making use of a possible import.
Since @T_DMOS5 is not exported, this says nothing about whether or not
export worked.

> This does work!!
>   print "<br>\n";
>   print $query->popup_menu( -name=>'test_area',
>                             -values  => \@{$TABLES::T_ID{ "\L$area"."L" }},
>                             -default=>  ''
>                           );

It does?  What you exported above was %T_IDS, what you are using here
is %T_ID.  Different things.
> 
> 
> Why can I not export the array T_AREA ?

Put everything you want to export into @EXPORT_OK:

    our @EXPORT_OK = qw( @T_AREA %T_IDS);

However, you must also explicitly import those variables (your code
doesn't show whether you did that):

    use TABLES qw( @T_AREA %T_IDS); # assuming the module is TABLES.pm

This will import the two variables into your current name space, so
there is no need to qualify them with "TABLES::".  This is the point
of importing.

Anno


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

Date: 9 Jan 2003 06:50:21 -0800
From: schittdip@hotmail.com (Charles)
Subject: Re: finding files older than a given date
Message-Id: <c6e8de31.0301090650.4a0eae88@posting.google.com>

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb1oq2n.lkd.tadmc@magna.augustmail.com>...
> Charles <schittdip@hotmail.com> 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.
> 
> 
> I suggest making a very good backup before trying this code!
> 
> (or, change the unlink() to a print():
> 
>       print "I would have deleted the '$File::Find::name' file\n";
> )
> 
> 
> ----------------------------------
>    # untested!
>    use File::Find;
> 
>    my $days = 14;
>    find( \&unwanted, 'd:/stuff');
> 
>    sub unwanted {
>       return unless -f;          # delete only plain files
>       return unless -M > $days;
>       unlink or warn "could not delete '$File::Find::name' file\n";
>    }
> ----------------------------------
> 
> 
> You can view the module's docs with:
> 
>    perldoc File::Find

Thank you so much.  This works like a charm.  I was to focused on
traversing the directory tree and didn't even think about a global
search.  Being very new to Perl I have a lot to learn.


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

Date: 9 Jan 2003 12:57:38 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: How to install mod locally? LIB=./foo fails
Message-Id: <tinh8g7qg$14h$tina@news01.tinita.de>

Chas Friedman <friedman@math.utexas.edu> wrote:
> I don't think ${HOME} means anything to the perl interpreter; it is a shell
> variable.

and the shell will replace it by its appropriate value
*before* perl sees it.
02:19pm tina@lux:tina 505> perl -wle'print shift' $HOME
/home/tina

regards, tina

-- 
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Thu, 9 Jan 2003 19:10:05 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: Re: Net::Ping issue
Message-Id: <Q0fT9.12$L43.77@news.oracle.com>

> > 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"; }


This does not help as the onky way i am able to ping windows hosts from my
unix box is to use "icmp"

How can I check for the existance od a NT host from a unix host without
using "icmp"


Thanks,
Sunil.





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

Date: Thu, 9 Jan 2003 09:53:08 -0500
From: "speakeasy" <nospam_artd@speakeasy.net>
Subject: Re: Net::Ping issue
Message-Id: <Jqqcna_2sI96EYCjXTWcqw@speakeasy.net>

This is a question for outside this group, as this is an O/S or services
issue not a perl or module problem... The unix boxes can run echo on TCP or
UDP ports through inetd, which would then respond to TCP or UDP echo
requests, the standard ping program both on unix and windows sends ICMP
packets, and is more universal..

"Sunil" <sunil_franklin@hotmail.com> wrote in message
news:Q0fT9.12$L43.77@news.oracle.com...
> > > 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"; }
>
>
> This does not help as the onky way i am able to ping windows hosts from my
> unix box is to use "icmp"
>
> How can I check for the existance od a NT host from a unix host without
> using "icmp"
>
>
> Thanks,
> Sunil.
>
>
>




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

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


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