[17526] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4946 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 22 00:05:50 2000

Date: Tue, 21 Nov 2000 21:05:10 -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: <974869510-v9-i4946@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 21 Nov 2000     Volume: 9 Number: 4946

Today's topics:
    Re: Accessing a WinNT window <lauren_smith13@hotmail.com>
    Re: default perl to execute in current dir ? (Tim Hammerquist)
    Re: FAQ? <jschauma@netmeister.org>
    Re: FAQ? <bwalton@rochester.rr.com>
    Re: FAQ? <peter.sundstrom@eds.com>
    Re: FAQ? (Wyzelli)
        How to make something in list context? <johnlin@chttl.com.tw>
    Re: How to make something in list context? <schmelter_tim@hotmail.com>
    Re: How to make something in list context? <rick.delaney@home.com>
    Re: How to make something in list context? (Tad McClellan)
    Re: Launching Excel2000 or Internet Explorer from Perl <lauren_smith13@hotmail.com>
    Re: looking for PERL GUI debugger for UNIX (Ilya Zakharevich)
    Re: Memory limitation & memory leak (Ilya Zakharevich)
    Re: Memory limitation & memory leak (Ilya Zakharevich)
        need some help with regex metamp@my-deja.com
    Re: need some help with regex (Jon Ericson)
    Re: Perl and Win98 (Tim Hammerquist)
    Re: perlmenu: install question <rick.delaney@home.com>
    Re: Prototype mismatch question. <rick.delaney@home.com>
    Re: prototype mismatch <rick.delaney@home.com>
        quick sorting question fhinchey@my-deja.com
    Re: quick sorting question <uri@sysarch.com>
    Re: Reg Exp Learning? <rick.delaney@home.com>
    Re: REGEXP Help! Trying to parse funky time format... (Wyzelli)
        SNMP agent written in perl? <mikeegg@prodigy.net>
        Sorting question <junk@yada.net>
    Re: Tom Christiansons' 'style' (Tim Hammerquist)
    Re: Tom Christiansons' 'style' (Tim Hammerquist)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 22 Nov 2000 03:17:55 GMT
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Accessing a WinNT window
Message-Id: <DVGS5.1837$Gw3.314207@paloalto-snr1.gtei.net>


"Neil Trenholm" <neil@alaweb.com> wrote in message
news:t1ljf3i9abclb0@corp.supernews.com...
>
> I am in need of a module that I can monitor WinNT with, so that if a
certain
> window pops up, I an interact with it...for example: If app X pops up
a
> window saying "Not enough resources to continue - <OK><CANCEL>", then
I can
> programmatically "click" <OK> and restart the app X service.
>
> I know this is stricly a perl group - so if someone knows of a
> perl.Windows.NT. group - please let me know.
>
> I have looked at many of the CPAN modules - but am a bit perplexed as
to
> which one *may* be the right one to use.

You may want to take a look at Win32::API.  I wanted to do something
like this about a year or so ago, but it turned out to be fairly
difficult.  I ended up writing the utility in C.

Another choice which is completely off-topic here but may make your
problem easier is Visual Test (called Rational Test now).

Lauren
(who doesn't own the code and is prevented from distributing it.  Sorry
:-)




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

Date: Wed, 22 Nov 2000 02:56:34 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: default perl to execute in current dir ?
Message-Id: <slrn91mee4.u4i.tim@degree.ath.cx>

Honza Pazdziora <adelton@fi.muni.cz> wrote:
> dtbaker_dejanews@my-deja.com <dtbaker_dejanews@my-deja.com> wrote:
> > I am having trouble tracking down the difference in the install or
> > configuration of either windows or perl between two windows 98 PCs. One
> > one PC, perl scripts execute with the working directory set to the dir
> > where the script is, and on the other, it defaults to /usr/bin where
> > perl.exe is installed.

We need more details.  Is Perl in the same place?  Is it the same build
of Perl?  How are the scripts being executed?

Although, my first guess, if the scripts are being executed from
Explorer (ie, via double-clicking), is in the association of the files
(similar to Honza's reply).

> > I realize this is probably a windoze issue, but I cant find a solution
> > in the windows help files either....
> 
> May it be a way in which .pl is tied to the interpret? IIRC, #! is not
> supported on Windows and so somehow the extension of the script is
> defined to run the executable. Perhaps it's where the change is
> specified as well?

Since Mr. Baker neglected to mention how the scripts were being
executed, it wouldn't be out of line to mention that the Apache server
_does_ support the #! (shebang) notation, - even on Win32!

-- 
-Tim Hammerquist <timmy@cpan.org>

Of course, that's just my opinion.  I could be wrong.
	-- Dennis Miller


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

Date: Tue, 21 Nov 2000 21:31:23 -0500
From: "Jan Schaumann" <jschauma@netmeister.org>
Subject: Re: FAQ?
Message-Id: <GbGS5.1145$MD4.79548@news-east.usenetserver.com>

* "Smokin' Dave" <smokindave@smokindave.com> wrote:

> Hi, I'm completely new to Perl, and was looking for this group's FAQ, in
> order to avoid asking tired old questions. Can anybody point out a URL
> for this?

comp.lang.perl has a weekly FAQ that will surely help you.

Also, always check http://www.perl.com, http://www.cpan.org and
perldoc (on your system).

-Jan

-- 
Jan Schaumann <http://www.netmeister.org>

Dr. Zoidberg: "A successor to the professor?"


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

Date: Wed, 22 Nov 2000 02:31:10 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: FAQ?
Message-Id: <3A1B30A3.1BAA38FE@rochester.rr.com>

Smokin' Dave wrote:
> 
> Hi, I'm completely new to Perl, and was looking for this group's FAQ, in order to
> avoid asking tired old questions. Can anybody point out a URL for this?
 ...
> Smokin' Dave
 ...
> http://www.smokindave.com
http://www.perl.com then click on FAQs.  Or if you have installed Perl:

   perldoc perldoc

at your command prompt.
-- 
Bob Walton


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

Date: Wed, 22 Nov 2000 15:56:29 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: FAQ?
Message-Id: <8vfcqh$e4h$1@hermes.nz.eds.com>


Smokin' Dave <smokindave@smokindave.com> wrote in message
news:6j9m1tc1jjm69bjnlrin0k23qnbv5k12b3@4ax.com...
> Hi, I'm completely new to Perl, and was looking for this group's FAQ, in
order to
> avoid asking tired old questions. Can anybody point out a URL for this?

There are hundred's of URL's.  A search on google comes back with half a
million.

Try the obvious http://www.perl.com/ and http://www.faqs.org/





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

Date: Wed, 22 Nov 2000 03:17:09 GMT
From: wyzelli@yahoo.com (Wyzelli)
Subject: Re: FAQ?
Message-Id: <Xns8FF486F68wyzelliyahoocom@203.39.3.131>

Smokin' Dave <smokindave@smokindave.com> wrote in
<6j9m1tc1jjm69bjnlrin0k23qnbv5k12b3@4ax.com>: 

>Hi, I'm completely new to Perl, and was looking for this group's FAQ, in
>order to avoid asking tired old questions. Can anybody point out a URL
>for this? 
>
>TIA
>

A quick search of this very newsgroup turns up a post entitled:
'Subject: [Perl] How to find the Perl FAQ'... nuff sed

Wyzelli

-- 
#beer v2
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it 
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";


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

Date: Wed, 22 Nov 2000 10:47:35 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: How to make something in list context?
Message-Id: <8vfcaa$rve@netnews.hinet.net>

Dear all,

I know we can use 'scalar' to make something in scalar context.
But what is the 'keyword' to make list context?  For example:

    my @find = <DATA>;
    print "$_\n" for <@find>;  # file glob

__DATA__
*.txt
*.log

It works.  However, if I replace the @find directly with <DATA> like this:

    print "$_\n" for <<DATA>>;

I got an error:

    Can't find string terminator "DATA" anywhere before EOF at line 1.

I was expecting that the <DATA> in scalar context will only read in one line
and produce partial results.  Actually I was wrong.  It is a syntax error.
(Why?)

Other trials

    print "$_\n" for <(<DATA>)>;  # directly parenthesize
    print "$_\n" for <split(' ',join(' ',<DATA>))>;  # use join's list
context
    ...

all fails.  Could you make the <DATA> here in list context?

Thank you.

John Lin





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

Date: Wed, 22 Nov 2000 03:49:11 GMT
From: "Tim Schmelter" <schmelter_tim@hotmail.com>
Subject: Re: How to make something in list context?
Message-Id: <XmHS5.29337$1o5.1105599@news3.aus1.giganews.com>

"John Lin" <johnlin@chttl.com.tw> wrote in message
news:8vfcaa$rve@netnews.hinet.net...
 ...snip...
>     print "$_\n" for <(<DATA>)>;  # directly parenthesize

Close. You want:
    print "$_\n" for (<DATA>);

However, the (<>) construct is magic... read up on it in "perldoc perlop" --
search for the the section "I/O Operators".

--
Tim Schmelter
schmelter_tim@hotmail.com





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

Date: Wed, 22 Nov 2000 04:28:21 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: How to make something in list context?
Message-Id: <3A1B4EA7.FB54C6E2@home.com>

[posted & mailed]

John Lin wrote:
> 
> Dear all,
> 
> I know we can use 'scalar' to make something in scalar context.
> But what is the 'keyword' to make list context?  For example:

There isn't one.
 
>     my @find = <DATA>;
>     print "$_\n" for <@find>;  # file glob

This only works because of DWIMmery in the <> operator.  The use of this
for file globbing has been pretty much replaced by the glob function,
but for some reason it is not a list op.
  
> __DATA__
> *.txt
> *.log
> 
> It works.  However, if I replace the @find directly with <DATA> like this:
> 
>     print "$_\n" for <<DATA>>;
> 
> I got an error:
> 
>     Can't find string terminator "DATA" anywhere before EOF at line 1.
> 
> I was expecting that the <DATA> in scalar context will only read in one line
> and produce partial results.  Actually I was wrong.  It is a syntax error.
> (Why?)

Because Perl sees <<DATA as a here-doc quote start and never finds the
terminating word DATA.  See perlsyn.  I was a bit surprised at the
error.  It makes more sense when it actually finds DATA:

print "$_\n" for <<DATA>>;
foo
DATA
__END__
syntax error at temp line 4, near ">>;"
  (Might be a runaway multi-line << string starting on line 2)

The main thing to understand here is that Perl operators force context
on their operands.  Imagine that there was an operator called C<list>. 
It wouldn't do what you want here anyway.

    print "$_\n" for glob(list(<DATA>));

Since glob forces scalar context on its argument, and you can't have a
list in scalar context, what would list(<DATA>) return?  It can't return
a list because glob doesn't know what to do with one.  Maybe it could
return the last line read from <DATA> but that wouldn't help you at all.

The solution is to loop over all lines, globbing each in turn.

    print "$_\n" for map {glob} <DATA>;

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Tue, 21 Nov 2000 22:52:52 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to make something in list context?
Message-Id: <slrn91mgok.kej.tadmc@magna.metronet.com>

On Wed, 22 Nov 2000 10:47:35 +0800, John Lin <johnlin@chttl.com.tw> wrote:

>I know we can use 'scalar' to make something in scalar context.
>But what is the 'keyword' to make list context?  


There isn't one.

The operator sets the context.

glob() sets a scalar context on its argument.


>For example:
>
>    my @find = <DATA>;
>    print "$_\n" for <@find>;  # file glob
>
>__DATA__
>*.txt
>*.log
>
>It works.  


Because the elements of @find got interpolated into the glob
with a space between each element:

   print "$_\n" for <*.txt *.log>; 

File globing in documented in the "I/O Operators" section in perlop.pod.

It says that you should use the named version instead of the
angle-brackety version:

   glob "@files";

which also helps see what is going on.


> However, if I replace the @find directly with <DATA> like this:
>
>    print "$_\n" for <<DATA>>;

Because arrays interpolate in double-quotish strings (like a glob)
and operators (like the input operator) do not.


   glob "<DATA>";  # see why that doesn't work?


The angle brackets are _data_ not a Perl operator.


>I got an error:
>
>    Can't find string terminator "DATA" anywhere before EOF at line 1.


Perl's syntax is so loaded with stuff, that sometimes you end
up wandering off into completely unrelated areas.

'<<' introduces a here-doc in Perl. But it cannot find the end
of the here-doc...


>I was expecting that the <DATA> in scalar context will only read in one line
>and produce partial results.  


You are correct.


>Actually I was wrong.  


No, you are correct.

You do not have <DATA> in a scalar context there. You have 
<DATA> as 6 characters in a string.

Here is <DATA> in a scalar context:

   glob <DATA>;


>It is a syntax error.
>(Why?)


I hope that is obvious by now.


>all fails.  Could you make the <DATA> here in list context?


No, because glob() puts scalar context on its argument. That is
how glob() is defined.

When perlfunc says EXPR read "scalar context", when it says
LIST read "list context". It says EXPR for glob().

You can loop to call glob() many times using foreach() or map() though.

    print "$_\n" foreach map { chomp; glob } <DATA>;


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


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

Date: Wed, 22 Nov 2000 03:10:13 GMT
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Launching Excel2000 or Internet Explorer from Perl
Message-Id: <oOGS5.1817$Gw3.308235@paloalto-snr1.gtei.net>


"Stuart Vigne" <vigne@nhamp.net> wrote in message
news:D65FF87A6AE54DAC.6BB1E2BE7FC711A2.37C0B82FFC012455@lp.airnews.net..
 .
> well after much work my Perl Tool is done, but I have one last feature
> I want to include:
>
> My final report is launching via Notepad, but I would like to change
> that to Excel, and sometimes Internet Explorer.  I run in Windows
> 2000, and this is the only platform my Perl script will ever run on.

Find the line that says

exec ("notepad.exe $finalreport") or die "$!";

and change it to

exec ("\"C:\Program Files\Internet Explorer\IEXPLORE.EXE\"
$finalreport") or die "$!";

Lauren





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

Date: 22 Nov 2000 03:44:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: looking for PERL GUI debugger for UNIX
Message-Id: <8vfff7$77n$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Martien Verbruggen
<mgjv@tradingpost.com.au>],
who wrote in article <slrn91i44v.imr.mgjv@martien.heliotrope.home>:
> What's this obsession with GUIs anyway? 

Definitely in a lot of situations a GUI debugger works better than a
command-line one - given sufficient proficiency with both.

Of course, one can debug in Emacs, but I think some fine features of
the debugger are lost in this case.

Anyone with a public-domain perl-written Curses-based file viewer
which allows color/styles support for separate lines?  I put enough
hooks in the standard debugger so that it can drive almost anything
(for example, a file viewer in a separate window).  tchrist made it
drive vi, but I do not think we can inform vi about where are the
breakpoints/actions, which line is current, and which lines are
breakable.

Hmm, we need a back-channel to allow the viewer to set/remove
breakpoints, and "continue until this line".  Term::ReadLine::Perl
(and probably ::Gnu) already supports external event loops, so this
should not be a problem...

Ilya


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

Date: 22 Nov 2000 03:49:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Memory limitation & memory leak
Message-Id: <8vffnv$7ah$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jon
<softcomp@home.com>],
who wrote in article <hHoS5.21732$15.5031516@news1.rdc1.az.home.com>:
>     Does anyone here know if there is a limitation to the amount of memory
> Perl
> can access - assuming that the physical RAM is not the limiting factor?.

With Perl's malloc on a 32-bit systems you cannot allocate anything
more than 2G in one gulp.  With a signed size_t (or a friend) this
goes down to 1G.

>     If I have a localized (my) reference to a hash of hash to an
> array within a function, does all the memory used to build this
> structure gets freed and be made available when Perl exit the
> function?

A reference to an array?  Most probably the array is free()d on exit.
This is required for blessed arrays, and I do not think Perl will cut
corner for implementing a different policy for non-blessed arrays.

Ilya


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

Date: 22 Nov 2000 03:50:42 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Memory limitation & memory leak
Message-Id: <8vffqi$7b1$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jon
<softcomp@home.com>],
who wrote in article <hHoS5.21732$15.5031516@news1.rdc1.az.home.com>:
>     If I have a localized (my) reference to a hash of hash to an array
> within a
> function, does all the memory used to build this structure gets freed and be
> made available when Perl exit the function?. It seems like Perl is not
> freeing
> the memory or if it does, it is not reusing them. I am using Perl 5.X.

  perl -V

See whether it usemymalloc.  If not, rebuild with the Perl's malloc().
(-D usemymalloc during Configure).

Ilya


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

Date: Wed, 22 Nov 2000 03:39:49 GMT
From: metamp@my-deja.com
Subject: need some help with regex
Message-Id: <8vff64$pjb$1@nnrp1.deja.com>

I'm using CGI.pm and trying to check the if the textfield on the form
does not contain ilegal character

if ($query->param('texfield_name') != /[^a-zA-Z]/)
{
print "result a no ilegal characters";
}else{
      print "result b ilegal character detected";
     }

after I type myname into a textfield and submit the form I allways get
the result b "ilegal character" even if I type a siple name lower case

this script works only if I rewrite it like this


if ($query->param('textfield_name') =~ /[^a-zA-Z]/)
{
print "result b ilegal characters detected";
}else { print "result a no ilegas"}

the first case should work too I just can not figure out why it doe's
not.

can anybody help?


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


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

Date: 22 Nov 2000 04:22:36 GMT
From: Jonathan.L.Ericson@jpl.nasa.gov (Jon Ericson)
Subject: Re: need some help with regex
Message-Id: <8FF3C63ADJonathanLEricsonjpln@137.78.50.25>

On 21 Nov 2000, metamp@my-deja.com wrote:

>if ($query->param('texfield_name') != /[^a-zA-Z]/)
                       ^            ^^
[snip]

>if ($query->param('textfield_name') =~ /[^a-zA-Z]/)
                       ^             ^^
[snip]

>the first case should work too I just can not figure out why it doe's
>not.

I see two potential problems.

Jon


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

Date: Wed, 22 Nov 2000 02:59:01 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Perl and Win98
Message-Id: <slrn91mein.u4i.tim@degree.ath.cx>

Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov> wrote:
> On 20 Nov 2000, c.darlington@virgin.net (Chris Darlington) wrote:
> 
> >I have Win 98 and MS PWS and want to test my cgi scripts via the browser
> >window. How do i configure the PWS to use perl?
> 
> Dispite the fact that the string 'perl' is in this question, it isn't a 
> perl question.  It's a PWS (whatever that is) question.  If the PWS 
> documentation is of no help, try a group for which PWS is on-topic.  
> (comp.infosystems.www.servers.ms-windows perhaps?)

I realize that Jon was unaware of what PWS is when this was written, I
couldn't resist mentioning that, as Microsoft Software, PWS (Personal
Web Server/Peer Web Services) _HAS NO DOC_...at least none of any value.

-- 
-Tim Hammerquist <timmy@cpan.org>
I don't want to belong to any club
that would have me as a member.
	-- Groucho Marx


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

Date: Wed, 22 Nov 2000 03:48:30 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: perlmenu: install question
Message-Id: <3A1B4551.DFAE07FD@home.com>

[posted & mailed]

n.paulsen@gmx.net wrote:
> 
> I want install perlmenu.pm. I've got the getcap - thing to run for
> demo files.
> 
> What does "put"  in the following installation instruction mean?
> A copy to /usr/local/lib/perl5 ?

Yep.  Hasn't anyone cleaned up that old thing yet?

> Put "perlmenu.pm" (and "menu.pl" if required) with the rest of your
> Perl  packages (usually in something like "/usr/local/lib/perl5" or
>      "/usr/local/lib/perl".

Type perl -V to see where your libraries are (in @INC) and pick one that
seems appropriate.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 22 Nov 2000 03:15:57 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Prototype mismatch question.
Message-Id: <3A1B3DAF.50F4382A@home.com>

[posted & mailed]

Albert Schueller wrote:
> 
>         use GD;
>         use WebFS::FileCopy;
>         use File::Copy;
> 
> when the script runs (hourly) it spits out the following error message:
> 
>         Prototype mismatch: sub IO::Handle::blocking ($;$) vs none at
>         /usr/lib/perl5/site_perl/5.6.0/LWP/Conn/_Connect.pm line 43.
> 
> This error is non fatal, but it causes crond to mail me the output every
> hour.  I could just suppress the output, but sometimes, like when there's
> an error getting the temperature, I'd like crond to mail me the output.
> I'm not by any stretch a perl guru, so I was wondering if someone could
> explain a way to fix this?

Non-fatal errors, or warnings, can normally be suppressed without you
having to suppress all errors.  See the perllexwarn manpage.  

However, this is a default warning so unless you want to edit
_Connect.pm and put 'no warnings' at the top of it, the warnings pragma
won't help you much.  You can do something like this:

    BEGIN {
        $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /_Connect/ };
    }
    use WebFS::FileCopy;

but that can interfere with any other sigwarn handlers.  To avoid that
you can localize the handler but then you need to move the equivalent of
the use inside the BEGIN block:

    BEGIN {
        local $SIG{__WARN__} = sub { 
            warn @_ unless $_[0] =~ /_Connect/ 
        };
        require WebFS::FileCopy;# or whichever is the culprit
        WebFS::FileCopy->import;
    }

Still, you may want to track down the bug and send the authors a note
(or a patch).  The warning essentially means that IO::Handle::blocking
is first declared with a prototype like:

    sub IO::Handle::blocking ($;$);

and later defined without one as

    sub IO::Handle::blocking {
        #...
    }

or something like that.  See perldiag.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 22 Nov 2000 02:50:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: prototype mismatch
Message-Id: <3A1B37A1.2F1DC9C8@home.com>


du_bing@my-deja.com wrote:
> 
> I got 'Prototype mismatch: sub main::NULL vs () at (eval 58) line 1.'
> when I run my.pl.   No 'sub NULL' is defined in my.pl.

Look up this error in perldiag to see what it means or 'use diagnostics'
to get Perl to look it up for you.
 
> Then I traced down to /usr/freeware/lib/perl5/site_perl/5.005/string.ph
> and found this which I believe the root cause of the problem:
> 
> ----------------------
> unless(defined(&NULL)) {
>         eval 'sub NULL () {0;}' unless defined(&NULL);
>     }
> ----------------------
> 
> Looks to me, no need to have two 'unless' there.  But it does not hurt
> anything.  I just do not understand why 'sub NULL () {0;}' should
> eval'ed if NULL is not defined?

That is just one way of creating a named subroutine conditionally.  But,
as always, TMTOWTDI:

    *NULL = sub () {0} unless defined &NULL;

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 22 Nov 2000 03:11:29 GMT
From: fhinchey@my-deja.com
Subject: quick sorting question
Message-Id: <8vfdgt$og9$1@nnrp1.deja.com>

I have a text file with five tab seperated colums. The first three
columns are numbers, one for year, one for day. The other two contain
text that doesn't need to be sorted. I would like to sort these lines
in ascending order beginning with the first column(year), then second
(month), then third(day). I'm very new to perl and haven't got a hang
of the sorting functions. Does anyone know a quick way to do this? Much
appreciated.

-Frank


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


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

Date: Wed, 22 Nov 2000 05:04:56 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: quick sorting question
Message-Id: <x7wvdwd2br.fsf@home.sysarch.com>

>>>>> "f" == fhinchey  <fhinchey@my-deja.com> writes:

  f> I have a text file with five tab seperated colums. The first three
  f> columns are numbers, one for year, one for day. The other two
  f> contain text that doesn't need to be sorted. I would like to sort
  f> these lines in ascending order beginning with the first
  f> column(year), then second (month), then third(day). I'm very new to
  f> perl and haven't got a hang of the sorting functions. Does anyone
  f> know a quick way to do this? Much appreciated.

this should help some:

http://www.sysarch.com/perl/sort_paper.html

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, 22 Nov 2000 03:35:31 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Reg Exp Learning?
Message-Id: <3A1B4245.52012F20@home.com>


Tad McClellan wrote:
> 
> If you _really_ want to help yourself to write patterns, it helps
> to know how the underlying machine works. It even helps people
> who already know how to use all of the funny characters in
> a regex.
> 
> When a pattern match isn't doing what you expect, walking through
> what the machine would do invariably exposes the problem.
> 
>    How Regexes Work:
> 
>       http://www.plover.com/~mjd/perl/Regex/

And if you _really_ want to _see_ how a pattern is matched, wind it up
and watch it go:

    use re 'debugcolor';

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 22 Nov 2000 02:31:15 GMT
From: wyzelli@yahoo.com (Wyzelli)
Subject: Re: REGEXP Help! Trying to parse funky time format...
Message-Id: <Xns8FF473F77wyzelliyahoocom@203.39.3.131>

"Liam Furniss" <liam@nethelpnow.com> wrote in
<t1lsiaostpnga2@news.supernews.com>: 

>Hello Perlish Types,
>
>I have a some time data in the form XXd,XX:XX.XX (e.g. 5d,23:55.07), and
>I can't seem to craft a regexp the will extract just the numbers into
>variables that will be useful to me. Currently, I'm trying
>/(\d*d,)?(\d*:)?(\d*\.)?(\d*)?/, but it reports the minutes in $4 and $3
>is empty...The other problem of course is making it work when the no day
>or hour data (e.g. 5.23)...Anyone feel kind enough to work their regexp
>mojo for me? This script could help save a struggling dot com! Hehe.
>

Hello yourself

my ($day, $hour, $min, $sec) = ($2, $4, $6,$7) if 
/((\d+)d,)?((\d+):)?((\d+)\.)?(\d+)/; #one line

You could change the second, third and fourth \d+ to \d\d if you know the data 
always has two numbers.

I have made the days, hours and minutes optional, including the separators, but 
since I don't know more about your data, I can't be sure that is right.

Wyzelli

-- 
#beer v2
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it 
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";


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

Date: Tue, 21 Nov 2000 21:17:17 -0600
From: Mike Eggleston <mikeegg@prodigy.net>
Subject: SNMP agent written in perl?
Message-Id: <3A1B3ABD.CF80C569@prodigy.net>

I am looking into a new monitoring agent on my unix boxes. I prefer that
the agent be written in perl so that separate modules can be written for
each monitored area (cpu, disk, filesystem, swap, oracle, notes,
etc..... like bmc's patrol). I know that I can write the management
portion in perl to talk with an agent, but is there any similiar system
that allows the agent to be written in perl?

TIA

Mike



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

Date: Wed, 22 Nov 2000 04:46:49 GMT
From: "Timothy Valis" <junk@yada.net>
Subject: Sorting question
Message-Id: <ZcIS5.222555$g6.103209967@news2.rdc2.tx.home.com>

I have an ASCII text file, (Database output) which I need to sort.  I need
to select entire lines and sort on 2 column sets, numerically first on a 9
digit number in columns 4-12, then on a 2 digit number in columns 1-2.  Any
ideas how to approach this?  I am somewhat new to perl, but have a few
reference books here and working with perl.org/perl.com as well.  Any help
would be greatly appreciated.






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

Date: Wed, 22 Nov 2000 03:08:39 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Tom Christiansons' 'style'
Message-Id: <slrn91mf4p.u4i.tim@degree.ath.cx>

Monte Phillips <montep@hal-pc.org> wrote:
> Tom Christianson loudly and boorishly proclaimed -->
> "
[ snip ]

It's posts like this that keep the people whose advice and knowledge are
truly valuable (such as Tom C.) from finding clpm anything but a waste
of their rarified time.

I find myself wondering who was really preaching.

> My suggestion?

Someone asked?

-- 
-Tim Hammerquist <timmy@cpan.org>
The surest sign that intelligent life exists elsewhere in
the universe is that it has never tried to contact us.
	-- Bill Watterson (Calvin & Hobbes)


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

Date: Wed, 22 Nov 2000 03:11:54 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Tom Christiansons' 'style'
Message-Id: <slrn91mfas.u4i.tim@degree.ath.cx>

John Crowley <crowj@aol.com> wrote:
> You have 2 postings in this newsgroup in the past months and one of
> them refers to a Unix issue.

I fail to see how the platform in question is relevant to Perl?  This
seemed vaguely derogatory toward Unix and I wondered if you have any
quarrels or relevancy issues with Unix - the birthplace of Perl?

-- 
-Tim Hammerquist <timmy@cpan.org>

Big egos are big shields for lots of empty space.
	-- Diana Black


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

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


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