[12269] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5869 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 3 07:07:25 1999

Date: Thu, 3 Jun 99 04:01:38 -0700
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, 3 Jun 1999     Volume: 8 Number: 5869

Today's topics:
    Re: Perl/Tk <c4jgurney@my-deja.com>
    Re: pipes?? (Sitaram Chamarty)
    Re: Problem with IO::Socket <ppith@my-deja.com>
        Problem with NULLs quanlay@my-deja.com
        Problem with NULLs quanlay@my-deja.com
        Problem with Regexp stuckenbrock@my-deja.com
    Re: read-accessing hash element implicitely defines has (Sitaram Chamarty)
    Re: Return value from an associative array <vincent_vanbiervliet@be.ibm.com>
    Re: Salvaging CPAN installs after Perl upgrade? (Sitaram Chamarty)
    Re: searching HTML files <aahz@writeme.com>
    Re: Time Error <ppith@my-deja.com>
        Transferring string to other Perl program? jrglynn@geocities.com
        Trouble with script output domat6905@my-deja.com
    Re: uninitialized value? what am i doing wrong? <office@asc.nl>
    Re: uninitialized value? what am i doing wrong? <bill@fccj.org>
    Re: uninitialized value? what am i doing wrong? <bill@fccj.org>
    Re: uninitialized value? what am i doing wrong? <office@asc.nl>
        Using isa() with scalars works only sometimes theonlycow@my-deja.com
    Re: Using isa() with scalars works only sometimes <jdporter@min.net>
        Win32 Threads Perl <pkotala@logis.cz>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 01 Jun 1999 10:13:25 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Perl/Tk
Message-Id: <7j0bo5$26k$1@nnrp1.deja.com>

In article <P408rBA9iOU3Ewny@beausys.demon.co.uk>,
  Andrew Fry <andrewf@beausys.demon.co.uk> wrote:
> I cant seem to find much about Perl/Tk on the web.
> Anyone know of any sites with good tutorials
> and/or sample scripts ? Thanks.
>

The first thing to do is run the widget demo (assuming you've got
perl/tk installed - just run widget from the command line).

The perl/tk user guide is at
http://w4.lns.cornell.edu/~pvhp/ptk/pod/UserGuide.html

comp.lang.perl.tk is worth a visit as is their faq at
http://w4.lns.cornell.edu/~pvhp/ptk/ptkFAQ.html

HTH

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 03 Jun 1999 10:38:18 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: pipes??
Message-Id: <slrn7lapl6.gk.sitaram@diac.com>

On Tue, 1 Jun 1999 21:25:51 +0100, James Stevenson <James@linux.home> wrote:
>Hi
>
>i am trying to exec an external program
>am i need to read the data that it prints to the STDOUT
>how can i do this and is it down with pipes??

perldoc -f open
    would be a good starting point.


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

Date: Tue, 01 Jun 1999 23:06:05 GMT
From: Howard Jow <ppith@my-deja.com>
Subject: Re: Problem with IO::Socket
Message-Id: <7j1p0o$3tl$1@nnrp1.deja.com>

In article <7ise04$d20$1@nnrp1.deja.com>,
  lamj@softhome.net wrote:
> I am having a problem with IO::Socket, it seems that no perl script
> that I wrote can work with IO::Socket. It just freeze there.

Check out this Perl script I wrote after reading about IO::Socket by
navigating these links:

http://language.perl.com/info/documentation.html

Click "HTML".  Then click "libraries, extensions, and modules" and
scroll down to IO::Socket.  The following code lets you view my
homepage.  You can change it to do other things like find out the
date on the machine running your script.

#!/usr/local/bin/perl
#
# Program to play around with Perl sockets.
#
# Howard Jow

# Provides an object orientated interface for making sockets.

use IO::Socket;

# Slightly easier to use than messing around with low level binding
# and socket calls.

sub get_stats;  # function prototype

$name = "www.unm.edu";
$data = &get_stats($name);
print $data;

close $remote;

# get_stats function

sub get_stats {

$server = $_[0];
$remote = IO::Socket::INET->new( Proto     => "tcp",
                                         PeerAddr  => "$server",
                                         PeerPort  => "http(80)",
                                );

# error checking provided by the Perl documentation on using IO::Socket

unless ($remote) { die "cannot connect to http daemon on $host" }

# Get/Print the data.

$remote->autoflush(1);
print $remote "GET /~ppith/index.html HTTP/1.0\n\r\n";

# get data into a variable and return it

$answer = "";

while( <$remote> ) {
    $answer .= $_;
}

return $answer;
}


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 01 Jun 1999 05:43:50 GMT
From: quanlay@my-deja.com
Subject: Problem with NULLs
Message-Id: <7ivrum$ua2$1@nnrp1.deja.com>

I've run into a rode block.  Maybe someone can
shed a little light on this for me.

I would like to use a standard routine to write
to a database using a module but I can seem to
write NULLs to a variable and write it to the
database.

The database can accept nulls and in some
instances, other programs accessing the database
expect them.

Currently, an example of my code looks like this:

package testnull;

sub new {
  my $test = shift;
  my $class = ref($test) || $test;
  my $self = {
    String => '',
    Integer => 0,
    Nothing => null
  };
  bless($self, $class);
  return $self;
}

sub Write {
  my $self = shift;
  my $sql = "
    INSERT INTO testtable (
    String, Integer, Nothing
    ) VALUE (
    $self->{String},
    $self->{Integer},
    $self->{Nothing}
    )
  ";
  return $sql;
}

 ...

Anyhow the return SQL statement is written to the
database but the problem is that it chokes.
Nothing could be an Integer or a Null.  I want to
avoid if thening the $self->Nothing for an undef
or null to build a sql statement of
 ... $self->(Integer), null) ...
because I want the full sql in one statement
quote if possible...

Any Suggestions?

Thanks in advance,
Quan


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 01 Jun 1999 05:43:48 GMT
From: quanlay@my-deja.com
Subject: Problem with NULLs
Message-Id: <7ivrul$ua1$1@nnrp1.deja.com>

I've run into a rode block.  Maybe someone can
shed a little light on this for me.

I would like to use a standard routine to write
to a database using a module but I can seem to
write NULLs to a variable and write it to the
database.

The database can accept nulls and in some
instances, other programs accessing the database
expect them.

Currently, an example of my code looks like this:

package testnull;

sub new {
  my $test = shift;
  my $class = ref($test) || $test;
  my $self = {
    String => '',
    Integer => 0,
    Nothing => null
  };
  bless($self, $class);
  return $self;
}

sub Write {
  my $self = shift;
  my $sql = "
    INSERT INTO testtable (
    String, Integer, Nothing
    ) VALUE (
    $self->{String},
    $self->{Integer},
    $self->{Nothing}
    )
  ";
  return $sql;
}

 ...

Anyhow the return SQL statement is written to the
database but the problem is that it chokes.
Nothing could be an Integer or a Null.  I want to
avoid if thening the $self->Nothing for an undef
or null to build a sql statement of
 ... $self->(Integer), null) ...
because I want the full sql in one statement
quote if possible...

Any Suggestions?

Thanks in advance,
Quan


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 01 Jun 1999 21:57:47 GMT
From: stuckenbrock@my-deja.com
Subject: Problem with Regexp
Message-Id: <7j1l0s$75o$1@nnrp2.deja.com>

Hello,

i've got a Problem with Regular Expressions. I want to do the following:

I want to match (for example) "Cake" or "Cookies" (insensitive) but both
have NOT to be leaded by (also for example) "Apple". So that I will
match "Plumcake","Plumcookies", only "Cake",only "Cookies" but not
"Applecake" or "Applecookies".

I tried
/(Apple){0}(Cake|Cookies)/i
but no way. Cake or Cookies are also found if they're leaded by Apple.

Hope someone can help me.

Thanks alot
Soeren


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 03 Jun 1999 10:38:15 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: read-accessing hash element implicitely defines hash, or I found a bug?
Message-Id: <slrn7lalbu.574.sitaram@diac.com>

On 1 Jun 1999 06:41:00 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:

>This does not happen if you don't use the arrow.  Instead,
>it is lvalue sensitive, meaning that read requests don't
>autovivify:
>
>    undef $r;
>    $i = $$r;
>    print "$r\n";
>(empty line)

It seems to me that its more to do with hashref or listref versus
scalar ref than the arrow itself:

[sitaramc@ltsitaram sitaramc]$ perl
undef $r;
$i=$$r[4];
print "$r\n";
^D
ARRAY(0x80ba358)


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

Date: Thu, 3 Jun 1999 11:48:44 +0200
From: "Vincent Vanbiervliet" <vincent_vanbiervliet@be.ibm.com>
Subject: Re: Return value from an associative array
Message-Id: <375640b5@news.uk.ibm.net>

Pat Traynor <pat@ssih.ssih.com> wrote in message
news:slrn7lbffe.r29.pat@ssih.ssih.com...
> Newbie alert...
>
> I'm teaching myself Perl from the Llama and Camel books, and I can't
> find an answer to this question.  Also, depending on which book I'm
> looking in, they call this either an "associative array" or a "hash".
> I'm not sure which is correct in the newsgroup.
>
> I'm trying to find out how to get a true/false value from a hash.  I
> know that this code is incorrect.  But from this, you should get an idea
> of what I'm trying to do:
>
> $age{"bob"} = 35;
> $age{"mary"} = 28;
>
> # This is where I'm lost:
> if( $age{"dave"} ) {
>     print "Dave's age is $age{"dave"}\n";
> }
> else {
>     print "Sorry - Dave's age is not recorded.\n";
> }
>
> That particular statement will always return true.
>
> Thanks in advance for any help.
>
> --pat--
> --
> Pat Traynor
> pat@ssih.com

First : you can call it a hash or an associative array (actually, the Camel
book uses both terms). I like hash, because it's less typing :-)
Second : Your code will always give an error (at least on a win32 platform).
You're using too many double quotes in the following lines:
> if( $age{"dave"} ) {
>     print "Dave's age is $age{"dave"}\n";
            ^                   ^    ^   ^
                                |____| =>Double quotes within double quotes!
> }
To solve that problem, you could use single quotest in $age{'dave'}, or
ommit the quotes completely: $age{dave}.
Take a look at page 41 in the Camel book (2nd Edition).

If you change that line, the code works (on my machine).

Hope this helps,

Vincent




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

Date: Thu, 03 Jun 1999 10:38:14 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Salvaging CPAN installs after Perl upgrade?
Message-Id: <slrn7lahfh.55i.sitaram@diac.com>

On Wed, 02 Jun 1999 10:38:32 GMT, Sitaram Chamarty <sitaram@diac.com> wrote:
>On 30 May 1999 16:54:26 +0000, Lloyd Zusman <ljz@asfast.com> wrote:
>
>>Before any of tell me to write some Perl code to traverse through my
>>current CPAN files and then issue the proper commands to do all the
>>necessary builds, please know that I'm quite able to do this, and also
>>quite willing as a last resort.  Before I do this, however, I'm
>>wondering if an automated or semi-automated procedure for this already
>>exists.
>
>I'd start with "perldoc perllocal".  A very small amount of
>parsing of "/usr/lib/perl5/i386-linux/5.00404/perllocal.pod"
[snip]

Someone else suggested the "autobundle" CPAN command.  Obviously
that's way better than my method!


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

Date: Thu, 03 Jun 1999 10:56:19 +0100
From: Andrew Collington <aahz@writeme.com>
Subject: Re: searching HTML files
Message-Id: <37565143.23390B6D@writeme.com>


Joe Laffey wrote:
> 
> I bet this is a FAQ, but I cannot locate it...
> 
> I'd like to be able to search for text in HTML files (ignoring tags).
> Ideally, I would make an index file and simply do a lookup in that. I
> could do this with a tied hash. However, I do not have shell access to the
> server on which it will run. So I'd have to write a script to do create
> the index.
> 
> Anyone know of any modules, caveats, etc.?


You might want to check out this page:

   http://www.xav.com/scripts/xavatoria/index.html

That comes with 2 scripts. One is to create the index of your pages, and
the other is the actual search engine.  Hope this helps :)

Andy


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

Date: Tue, 01 Jun 1999 23:35:56 GMT
From: Howard Jow <ppith@my-deja.com>
Subject: Re: Time Error
Message-Id: <7j1qos$4g5$1@nnrp1.deja.com>

In article <37541961.81458F7A@xs4all.nl>,
  Frank de Bot <debot@xs4all.nl> wrote:
> I've some little trouble with the time. Today it's 1 june . But my
> script thinks it's 2 june. It has the same problem with other dates at

etc etc.  Please shorten your signature.  You can use the
following script if your box has the "date" command.

#!/usr/local/bin/perl
#
# Program to gather date info.

# Howard Jow

$today = `date`;

$today =~ m/([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\
s+([^\s+]+)\s+/;

$day = $3;
$month = $2;
$year = $6;

@long_months = qw(January February March April May June July Augu
st September October November December);

@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

for($i = 0; $i < 12; $i++) {
    $hash{$months[$i]} = $long_months[$i];
}

print "Today is $hash{$month} $day, $year\n";

# BTW, you can use something similar to what I did for @months to handle
# days of the week.  It's stored in $1 if you want to use it.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 01 Jun 1999 19:19:05 GMT
From: jrglynn@geocities.com
Subject: Transferring string to other Perl program?
Message-Id: <7j1bna$6p9$1@nnrp2.deja.com>

I am very new to Perl, and cannot find a place to pose this question,
so I thought I would attempt here.  If this is the wrong forum, please
accept my apologies.

I have two Perl scripts.  Script1 calls Script2, which receives a
string from the user.  I then want to transfer this string back to
Script1, to be used in other things.  How do I accomplish this?

This is just an example of what I need.  I figured it would be easier
to pose it as real simple, then to try and post my actual code.  I just
need to know the concept, the basic steps of how to do this.

Thanks a lot,

--Jim


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 01 Jun 1999 15:01:30 GMT
From: domat6905@my-deja.com
Subject: Trouble with script output
Message-Id: <7j0ska$77s$1@nnrp1.deja.com>

I'm writing a perl cgi script that executes a Unix-shell program puts
the output into a file and then prints it to the browser, but nothing
appears in the browser window. Any clues?
Here is the source:
#!/usr/bin/perl

use CGI;

$q = new CGI;

print $q->header;
print $q->start_html(-title=>'Account maintenance',
                     -author=>'webadmin@infosys-bank.com',
                     -BGCOLOR=>'white');
print "<center><font size=\"4\">Bzbedere onrpeahrekqjn hle h
leqev:</font></center>\n";
print "<p>&nbsp\;</p>";

print $q->start_multipart_form;
print "<table width=\"39%\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\" align=\"center\" bgcolor=\"#003399\">";
print "<tr><td width=\"13%\"><font color=\"#FFFFFF\">User:</font></td>";
print "<td width=\"36%\"> <font color=\"#000000\">";
print $q->textfield(-name=>'name',
                    -size=>10,
                    -maxlength=>10);
print "</font></td>";
print "<td width=\"20%\"><font color=\"#FFFFFF\">Month:</font></td>";
print "<td width=\"31%\"> <font color=\"#000000\">";
print $q->textfield(-name=>'month',
                    -size=>2,
                    -maxlength=>2);
print "</font></td></tr>";
print "<tr><td width=\"100%\" colspan=\"4\" height=\"49\">";
print "<div align=\"center\">";
print $q->submit(-name=>'submit',
                 -value=>'Submit');
print $q->reset;
print "</div></td></tr></table>";
print $q->endform;
$user = $q->param('name');
$month = $q->param('month');
print $user,"\n";
print $month,"\n";
$res = `radgo $user $month`;
open(RESULT,">>result") ||
        die "Cannot open file!\n";
print RESULT $res;
close(RESULT);
open(RESULT,"<result") ||
        die "Cannot open file!\n";
while (<RESULT>) {
        @fields = split(//);
        print join(':',@fields);
}
close(RESULT);
print $q->end_html;

Lhrjn


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 3 Jun 1999 11:10:39 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: Re: uninitialized value? what am i doing wrong?
Message-Id: <7j5gt5$e92$1@zonnetje.NL.net>

hehe

ok ok ok ....

you have my permission to point me to something

yesterday i placed a question and everyone was posting around it , saying
things like 'gee , that's smart' well , it isn't if it doesn't work , and
the only 'usefull' post didn't tell me what was wrong but only pointed me to
some perlfaq , in which i could find the difference between scalar variables
and arrays and hashes

NOT what i needed..

bwth..

cul8r
buZz

Sam Holden heeft geschreven in bericht ...
>On 3 Jun 1999 09:48:18 +0200, Bastiaan S van den Berg <office@asc.nl>
wrote:
>>does anyone have an idea what i'm doing wrong?
>
>You are using an undefined value....
>
>You shouldn't be testing with 'ne' you should be using a function to
>test if the value is defined. I can't tell you about the function since
>your next post specifically asked me not to tell you to look up
>the documentation and that is where the function you want it documented...




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

Date: Thu, 03 Jun 1999 06:14:02 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: uninitialized value? what am i doing wrong?
Message-Id: <37565582.0@usenet.fccj.cc.fl.us>

In article <7j5c2l$agl$1@zonnetje.NL.net>, "Bastiaan S van den Berg" 
<office@asc.nl> wrote:


> Use of uninitialized value at verwerk.cgi line 99.
> that's all i get back from my majorly simple perl program
> i 'initialize' the scalars with :
> $prijslijst_ap=$forms{"prijslijst_ap"};
> and then i use them with :
> if ($prijslijst_ap ne "") {print "Ik wil een prijslijst van Account
> but then i get the errors you see at the top ..
> does anyone have an idea what i'm doing wrong?
> i'm gone.. going to get some coke :)


This is a CGI joke, right?

Pretty funny,
-Sneex-  :]
______________________________________________________________________
Bill Jones  Data Security Specialist  http://www.fccj.org/cgi/mail?dss

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org

         Running LinuxPPC RedHat 5.0 (Hurricane)
       __ _                     http://www.linuxppc.org
      / /(_)_ __  _   ___  __   http://www.apache.org
     / / | | '_ \| | | \ \/ /   http://www.redhat.com
    / /__| | | | | |_| |>  <    http://www.perl.com
    \____/_|_| |_|\__,_/_/\_\   http://www.gimp.org


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

Date: Thu, 03 Jun 1999 06:16:45 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: uninitialized value? what am i doing wrong?
Message-Id: <37565626.0@usenet.fccj.cc.fl.us>

In article <7j5c89$aip$1@zonnetje.NL.net>, "Bastiaan S van den Berg" 
<office@asc.nl> wrote:


> btw.
>
> plz no replies like 'you should be reading perl faq 18 subsections 4 & 18
> paragraph 12 till 25'
> cause i honestly hate the perldocs.. not so much by form , but more by
> language ..
>
> it reads like the enquirer , like shit..


Hmmm, OK, but I still think it's pretty funny!
Especially the part where you expect a perl program
to be slightly more intelligent .. oh, strike that,
it is more intelligent, that's why all the errors!

Thx for the laff!
-Sneex-  :]
______________________________________________________________________
Bill Jones  Data Security Specialist  http://www.fccj.org/cgi/mail?dss


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

Date: Thu, 3 Jun 1999 12:47:17 +0200
From: "Bastiaan S van den Berg" <office@asc.nl>
Subject: Re: uninitialized value? what am i doing wrong?
Message-Id: <7j5mi8$hk9$1@zonnetje.NL.net>


Bill Jones heeft geschreven in bericht <37565582.0@usenet.fccj.cc.fl.us>...
>In article <7j5c2l$agl$1@zonnetje.NL.net>, "Bastiaan S van den Berg"
><office@asc.nl> wrote:
>
>
>> Use of uninitialized value at verwerk.cgi line 99.
>> that's all i get back from my majorly simple perl program
>> i 'initialize' the scalars with :
>> $prijslijst_ap=$forms{"prijslijst_ap"};
>> and then i use them with :
>> if ($prijslijst_ap ne "") {print "Ik wil een prijslijst van Account
>> but then i get the errors you see at the top ..
>> does anyone have an idea what i'm doing wrong?
>> i'm gone.. going to get some coke :)
>
>
>This is a CGI joke, right?

what , about the coke?
no man , i'm working now , and our coke supply was gone .. coca cola you
know..


but i !really! don't have a clue what i should do ..
hell , i picked up perl last week , and this is one of my first programs..

>Pretty funny,

well , u2 :)

>         Running LinuxPPC RedHat 5.0 (Hurricane)

that's pretty cewl :)
you still use a powermac even though you say it's operating system sucks :)

hehe

cul8r
buZz





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

Date: Tue, 01 Jun 1999 06:55:02 GMT
From: theonlycow@my-deja.com
Subject: Using isa() with scalars works only sometimes
Message-Id: <7j0047$vc7$1@nnrp1.deja.com>

I'm trying to write a small parser for Douglas Hofstadter's simple TNT
number-theory language.  There are different sorts of objects to parse
in this language, such as theorems, terms, and variables, and there is
a function for parsing each kind of object, ie &parse_term,
&parse_variable, etc..  Each of these functions normally returns an
object which is a subclass of a class TNT_Parse_Tree_Node.

I needed a way to do error checking, so that I could detect whether or
not the object being parsed was valid.  To do this, when the above-
mentioned functions encounter an error, they return not a
TNT_Parse_Tree_Node but a scalar error string (ie 'return "invalid
variable letter"').  The functions which call &parse_term,
&parse_variable, etc., then check whether or not the input was parsed
properly in the following way:

$foo = &parse_variable();
if( $foo->isa( 'TNT_Parse_Tree_Node' ) ) {
     ; # all went well.  $foo is a node.
} else {
     ; # there was a parse error.  The explanation is in the
       # string $foo
}

Since &parse_theorem calls itself and/or &parse_term, depending on the
context, and &parse_term calls &parse_variable, these functions
incorporate the same error-checking algorithm.

This error-detection works properly for some input strings to the
program.  However, for others, I get a perl runtime error which very
much resembles "Cannot apply isa without a package or object
reference", which points to a seemingly random line in the code.
Whether or not I get an error, $foo always contains either a
TNT_Parse_Tree_Node or a string.  (I've checked this in the debugger.)

Unfortunately, I cannot get a good sense for which input strings
generate the run-time error and which do not.  Moreover, it seems that
there shouldn't be variety -- either this particular error-checking
algorithm should work always, or it should never work.  But, in my
program, perl sometimes seems willing to pass the isa() method to a
scalar (and of course return false because a scalar isn't a
TNT_Parse_Tree_Node), and sometimes unwilling.

Is there some explanation for this?  Is there something fundamentally
flawed with my technique here?

-Chris


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 01 Jun 1999 14:21:05 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Using isa() with scalars works only sometimes
Message-Id: <7j0q8h$6av$1@nnrp1.deja.com>

In article <7j0047$vc7$1@nnrp1.deja.com>,
  theonlycow@my-deja.com wrote:
>
> if ( $foo->isa( 'TNT_Parse_Tree_Node' ) ) {
>
> This error-detection works properly for some input strings to the
> program.  However, for others, I get a perl runtime error which very
> much resembles "Cannot apply isa without a package or object
> reference", which points to a seemingly random line in the code.

To avoid this error, you should call isa like this:

	if ( UNIVERSAL::isa( $foo, 'TNT_Parse_Tree_Node' ) ) {

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 3 Jun 1999 12:09:26 +0200
From: "Pavel Kotala" <pkotala@logis.cz>
Subject: Win32 Threads Perl
Message-Id: <928404683.623785@gate.logis.cz>

Can I download thread-stable installation of Perl for Winddows NT 4.0
anywhere? Or must I build it myself?

Thank You

Pavel Kotala





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5869
**************************************

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