[25327] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7572 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 25 18:05:48 2004

Date: Sat, 25 Dec 2004 15:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 25 Dec 2004     Volume: 10 Number: 7572

Today's topics:
    Re: Can I run perl under windows line by line? <joe@inwap.com>
    Re: Is zero even or odd? <torkel@sm.luth.se>
    Re: Is zero even or odd? <matternc@comcast.net>
    Re: Is zero even or odd? <nospam@nospam.com>
        MLWP::Simple errors (Jimmy)
    Re: MLWP::Simple errors <jeanpierre.vidal@free.fr>
    Re: Perl and pm path question. <matthew.garrish@sympatico.ca>
    Re: return truely random number? <joe@inwap.com>
        Returned wrong Year <sam.wun@authtec.com>
    Re: Returned wrong Year <lv@aol.com>
    Re: Returned wrong Year <matthew.garrish@sympatico.ca>
    Re: Returned wrong Year <jurgenex@hotmail.com>
        run Perl under windows (wld)
    Re: run Perl under windows <jeanpierre.vidal@free.fr>
        save & restore cursor position in perl (someone92)
    Re: save & restore cursor position in perl <jurgenex@hotmail.com>
        XML::SAX::ExpatXS on Windows. Have mercy on me! <apollock11@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 25 Dec 2004 12:01:47 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Can I run perl under windows line by line?
Message-Id: <_M2dnS6g8N6wWlDcRVn-tw@comcast.com>

wld wrote:
> I have installed Activeperl 5.8.6  MSI.
> Is it possible enter "perl mode" prompt then I can run a perl command

C:\>perl -d -e 1
Enter h or `h h' for help, or `perldoc perldebug' for more help.

main::(-e:1):   1
   DB<1> print "$_ = '$ENV{$_}'\n" for sort keys %ENV
[lots of output here]
   DB<2> x @ARGV
   empty array
   DB<3> q
C:\>


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

Date: 25 Dec 2004 08:12:31 +0100
From: Torkel Franzen <torkel@sm.luth.se>
Subject: Re: Is zero even or odd?
Message-Id: <vcb7jn66ecg.fsf@beta19.sm.ltu.se>

Fred Bloggs <nospam@nospam.com> writes:

> I don't think you mean well-ordered in the algebraic sense- you mean a 
> total ordering on the cardinals.

  Seaman's statement "every set can be well ordered" naturally uses
"well ordered" in the standard set-theoretical sense.



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

Date: Sat, 25 Dec 2004 08:09:24 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Is zero even or odd?
Message-Id: <zfydnVQjBugZ-1DcRVn-oQ@comcast.com>

Matthew Russotto wrote:

> In article <tYieQTBX$6yBFwru@jmwa.demon.co.uk>,
> John Woodgate  <noone@yuk.yuk> wrote:
>>I read in sci.electronics.design that Matthew Russotto
>><russotto@grace.speakeasy.net> wrote (in <EZOdnaqXBOVFPVbcRVn-
>>hA@speakeasy.net>) about 'Is zero even or odd?', on Thu, 23 Dec 2004:
>>>
>>>I'm not sure what you mean by 'squeezed'; it's piecewise continuous.
>>>
>>Squeezed: if the limits are equal, the value of the function at the
>>limit point cannot differ from the limit value.
> 
> Certainly not a valid theorem.

He's stated it imprecisely and without all the necessary preconditions,
but it certainly *is* a valid theorem; I learned it in freshman
Calculus.

Squeeze Theorem:

If there are three functions, f(x), g(x) and h(x) such that
f(x) >= g(x) >= h(x) over some interval containing a (except
possibly at a itself), and the limit as x goes to a of
f(x) and h(x) are both L, then the limit as x goes to a of
g(x) is L.

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Sat, 25 Dec 2004 14:05:15 GMT
From: Fred Bloggs <nospam@nospam.com>
Subject: Re: Is zero even or odd?
Message-Id: <41CD7383.3010204@nospam.com>



Torkel Franzen wrote:
> Fred Bloggs <nospam@nospam.com> writes:
> 
> 
>>I don't think you mean well-ordered in the algebraic sense- you mean a 
>>total ordering on the cardinals.
> 
> 
>   Seaman's statement "every set can be well ordered" naturally uses
> "well ordered" in the standard set-theoretical sense.
> 

As you can surmise- set theory is one subject area I never studied at 
the graduate level- only a few snippets included in the analysis and 
general topology curriculum- it is not relevant to applications. I have 
been trying to recall ( from a few decades past ) the exact passage from 
Halmos in the Springer reprint of his General Topology about the belief 
at the time that CH hinged on AC- and that would have been included from 
the much earlier Van Nostrand edition which may have pre-dated Cohen's 
paper. But it was irrelevant to that context- the main set theoretic 
result of *supreme* importance in that field being Zorn's lemma- cannot 
tell you how many times that one is invoked to establish fundamentally 
important results.



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

Date: 25 Dec 2004 01:25:55 -0800
From: lcheeming@yahoo.com (Jimmy)
Subject: MLWP::Simple errors
Message-Id: <f91c2d19.0412250125.11dacce1@posting.google.com>

Hi :

    When I use  perl -MLWP::Simple -e 'getprint
"http://www.google.com";' . I got the error below :

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

   I have no clue problem is that. Could anybody help.


regards
Jimmy


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

Date: Sat, 25 Dec 2004 10:15:36 +0000
From: Jean-Pierre Vidal <jeanpierre.vidal@free.fr>
Subject: Re: MLWP::Simple errors
Message-Id: <pan.2004.12.25.10.15.35.850477@free.fr>

Le Sat, 25 Dec 2004 01:25:55 -0800, Jimmy a écrit :

> Hi :
> 
>     When I use  perl -MLWP::Simple -e 'getprint
> "http://www.google.com";' . I got the error below :
> 
> Can't find string terminator "'" anywhere before EOF at -e line 1.
> 
>    I have no clue problem is that. Could anybody help.
> 
> 
> regards
> Jimmy

Are you on a Windows system ? if yes, try :
perl -MLWP::Simple -e "getprint 'http://www.google.com';"
or
perl -MLWP::Simple -e "getprint \"http://www.google.com\";"

(tested on linux box, I have not a win machine connected at home)
Jean-Pierre


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

Date: Sat, 25 Dec 2004 00:41:51 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Perl and pm path question.
Message-Id: <r47zd.25333$Z%3.1183254@news20.bellglobal.com>


"Tom Wiley" <tmwilspamnot@png.com> wrote in message 
news:pan.2004.12.25.00.56.37.498819@png.com...
>I am making pretty good progress with learning perl and am trying both
> PerlQt and Perl/TK.  Tk works fine but PerlQt doesnt.
>
> I think this is more of a straight perl question rather than a problem on
> one of the above rads.
>
> Here is the start of a very simple PerlQt tutorial...
>
> #!/usr/bin/perl -w
> use strict;
> use blib;
> use Qt;
> (snip)
>

From the documentation for blib.pm:

<quote>
Looks for MakeMaker-like 'blib' directory structure starting in dir (or 
current directory) and working back up to five levels of '..'.

Intended for use on command line with -M option as a way of testing arbitary 
scripts against an uninstalled version of a package.

However it is possible to :
 use blib;
 or
 use blib '..';
etc. if you really must.
</quote>

It's not a problem finding blib.pm (that's where the error is being 
generated!), but a problem finding /blib. In other words, you probably need 
to do something like:

use blib '/path/to/blib';

Matt 




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

Date: Sat, 25 Dec 2004 12:19:29 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: return truely random number?
Message-Id: <uc2dneSIuubLVlDcRVn-qg@comcast.com>

sam wrote:

> Another question is how can I generate a gmt time in the format 92783456 
> instead of "Thu Dec 23 15:02:08 2004"?

Familiarize yourself with the arguments to gmtime and its return value.

	$seconds_since_the_epoch = time;
	@time_array = gmtime($seconds_since_the_epoch);
	$time_scalar = gmtime($seconds_since_the_epoch);
	print "time=$seconds_since_the_epoch time_array=(@time_array) 
time_scalar='$time_scalar'\n";


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

Date: Sat, 25 Dec 2004 11:15:01 +0800
From: sam <sam.wun@authtec.com>
Subject: Returned wrong Year
Message-Id: <cqinh9$2ied$1@news.hgc.com.hk>

Hi,

I used the following perl code display date , month and year, but the 
year is shown as 104 instead of 2004:

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;
print "Month: ".$mon."\n";
print "Year: ".$year."\n";

Result:
It is now Sat Dec 25 11:11:01 2004
Month: 11
Year: 104

What is the correct way to retrieve the value of the year?

Thanks
Sam


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

Date: Fri, 24 Dec 2004 21:28:04 -0600
From: l v <lv@aol.com>
Subject: Re: Returned wrong Year
Message-Id: <41ccddb3_4@127.0.0.1>

sam wrote:
> Hi,
> 
> I used the following perl code display date , month and year, but the 
> year is shown as 104 instead of 2004:
> 
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;
> print "Month: ".$mon."\n";
> print "Year: ".$year."\n";
> 
> Result:
> It is now Sat Dec 25 11:11:01 2004
> Month: 11
> Year: 104
> 
> What is the correct way to retrieve the value of the year?
> 
> Thanks
> Sam

The year is correct, you just need to read the docs a bit closer:

      #  0    1    2     3     4    5     6     7     8
      ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                  localtime(time);

  All list elements are numeric, and come straight out of the C
  `struct tm'. $sec, $min, and $hour are the seconds, minutes, and
  hours of the specified time. $mday is the day of the month, and
  $mon is the month itself, in the range "0..11" with 0 indicating
  January and 11 indicating December. $year is the number of years
  since 1900. That is, $year is "123" in year 2023. $wday is the
  day of the week, with 0 indicating Sunday and 3 indicating
  Wednesday. $yday is the day of the year, in the range "0..364"
  (or "0..365" in leap years.) $isdst is true if the specified
  time occurs during daylight savings time, false otherwise.

  Note that the $year element is *not* simply the last two digits
  of the year. If you assume it is, then you create
  non-Y2K-compliant programs--and you wouldn't want to do that,
  would you?

  The proper way to get a complete 4-digit year is simply:

          $year += 1900;



Len


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

Date: Fri, 24 Dec 2004 22:31:18 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Returned wrong Year
Message-Id: <6a5zd.41590$GK5.1988407@news20.bellglobal.com>


"sam" <sam.wun@authtec.com> wrote in message 
news:cqinh9$2ied$1@news.hgc.com.hk...
> Hi,
>
> I used the following perl code display date , month and year, but the year 
> is shown as 104 instead of 2004:
>
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;
> print "Month: ".$mon."\n";
> print "Year: ".$year."\n";
>

[snip expected results]

>
> What is the correct way to retrieve the value of the year?
>

Please read the documentation for the function you're using. It explains the 
behaviour you're witnessing.

http://www.perldoc.com/perl5.8.4/pod/func/localtime.html

Matt 




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

Date: Sat, 25 Dec 2004 06:57:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Returned wrong Year
Message-Id: <mb8zd.5919$h.3510@trnddc04>

sam wrote:
> I used the following perl code display date , month and year, but the
> year is shown as 104 instead of 2004:

Your code has a well-known y2k problem. You may want to read the 
documentation for the functions you are using.

> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime
> time; print "Month: ".$mon."\n";
> print "Year: ".$year."\n";
>
> Result:
> It is now Sat Dec 25 11:11:01 2004
> Month: 11
> Year: 104
>
> What is the correct way to retrieve the value of the year?

This is described _AT_LENGTH_WITH_SAMPLE_CODE_ in the documentation of the 
localtime() function.

jue 




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

Date: 25 Dec 2004 06:07:24 -0800
From: aaabbb16@hotmail.com (wld)
Subject: run Perl under windows
Message-Id: <dc998cfd.0412250607.a5132c9@posting.google.com>

Thanks Paul and Henry.
What I like to do is that from a windows xp to connect to Unix and
router via
tcp/ip (telnet)and control the unix and the router(send some commands
to both of them).
What packages do i need to install and how to do it?

Thanks in adavance,

Steven


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

Date: Sat, 25 Dec 2004 17:22:17 +0000
From: Jean-Pierre Vidal <jeanpierre.vidal@free.fr>
Subject: Re: run Perl under windows
Message-Id: <pan.2004.12.25.17.22.17.51588@free.fr>

Le Sat, 25 Dec 2004 06:07:24 -0800, wld a écrit :

> Thanks Paul and Henry.
> What I like to do is that from a windows xp to connect to Unix and
> router via
> tcp/ip (telnet)and control the unix and the router(send some commands
> to both of them).
> What packages do i need to install and how to do it?
> 
> Thanks in adavance,
> 
> Steven

Without Perl, there is no difficulties to join unix through telnet.
Did you had a look at Net::Telnet? (not tested)
regards
Jean-Pierre


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

Date: 25 Dec 2004 11:44:14 -0800
From: someone92@hotmail.com (someone92)
Subject: save & restore cursor position in perl
Message-Id: <f458cae2.0412251144.78000626@posting.google.com>

I'm trying to save and restore the current position of the console's
cursor in perl on FreeBSD 4.10 using the escape sequences without
success, FreeBSD do not seems to support it.

sub savecursorpos
{
print "\x1B[sm";
}

sub restorecusorpos
{
print "\x1B[um";
}

I also tried:

sub savecursorpos
{
print "\x1B7m";
}

sub restorecusorpos
{
print "\x1B8m";
}

even tput do not work:

print `tput sc`;    # Get the code to save the current cursor position
print `tput rc`; 

Is there a way to do this using termcap or terminfo ? or any other
functions?


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

Date: Sat, 25 Dec 2004 20:04:18 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: save & restore cursor position in perl
Message-Id: <6Jjzd.10633$2X6.3017@trnddc07>

someone92 wrote:
> I'm trying to save and restore the current position of the console's
> cursor in perl on FreeBSD 4.10 using the escape sequences without
> success, FreeBSD do not seems to support it.

When talking about cursor positions usually the Curses module is the answer. 
Did you check it already?

jue 




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

Date: Sat, 25 Dec 2004 11:55:30 -0800
From: Arvin Portlock <apollock11@hotmail.com>
Subject: XML::SAX::ExpatXS on Windows. Have mercy on me!
Message-Id: <cqkgjl$1jni$1@agate.berkeley.edu>

I've been trying to find a good XML parsing solution on Windows
for several days and it's driving me crazy! Nothing seems to work.
I started with XML::Parser but with the latest version of Active
State perl, latest ppm installs, perl crashes with the infamous
"Perl.exe has generated errors" on some XML documents. I then
tried Twig but its lack of support for namespaces didn't work
for me, plus its model wasn't a very convenient one for what I'm
doing. LibXML doesn't seem efficient enough for the really huge
XML documents I'm processing.

Finally I'm trying ExpatXS. The ppm didn't install libexpat.dll,
but I managed to find it, and install it. I got an error about
strict "refs" in Base.pm, fixed that by putting in a no strict "refs"
at the appropriate point. Now I'm getting the error:

No _parse_* routine defined on this driver (if it a filter,
remember to set the Parent property) [XML::SAX::ExpatXS=HASH(0x1ab2764)] 
at D:/apps/perl/site/lib/XML/SAX/Base.pm line 2308.

I tried the code from the few measily examples I could find
(Here's the latest iteration)

use XML::SAX::ExpatXS;
use strict 'vars';

my $xmlfile = 'test.xml';

my $handler = new MyHandler;
my $parser = new XML::SAX::ExpatXS ( Handler => $handler );
$parser->parse($xmlfile);

package MyHandler;

sub new {
   my $type = shift;
   return bless {}, $type;
}

__END__

Someone please have mercy on me! I thought parsing XML was
supposed to be easy with perl. I've been using perl to parse
SGML on Windows for years and years. But trying to modernize
to XML is a nightmare on Windows. Perl crashes, ppms don't
work, nobody's supposed to use XML::Parser anymore but trying
to pick a better event-based parser is confusing to say the
least. What am I doing wrong? What is the best event-based XML
parsing method that's the fastest and works with huge XML
documents and supports namespaces and entity management?

Help via private email is more than welcome please:

rodent at gmail.com

(replace 'at' with '@'))




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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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