[13362] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 772 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 12 18:07:28 1999

Date: Sun, 12 Sep 1999 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 12 Sep 1999     Volume: 9 Number: 772

Today's topics:
    Re: baffle about flock() please help! <collin.starkweather@colorado.edu>
        extracting text and images from a postgres DB !!! <rdd48254@mail.telepac.pt>
        how to tag a pattern match from a filehandle <tom.kralidis@ccrs.nrcanDOTgc.ca>
        Idea for extracting name from city? <kevin@zippy.tnet.com>
    Re: Idea for extracting name from city? <bjoern.teegen@gmx.de>
    Re: Perl / C Memory <dan@tuatha.sidhe.org>
    Re: Perl and Threads <dan@tuatha.sidhe.org>
    Re: Perl fails tests <dan@tuatha.sidhe.org>
    Re: Perl Language Reference <nmorison@ozemail.com.au>
        regexp with variables containing unknown data <bbarnett@nospamhere.L8R.net>
    Re: regexp with variables containing unknown data (Benjamin Franz)
    Re: regexp with variables containing unknown data (Benjamin Franz)
        Text::FixedRecField - proposal for new module. (RonaldWS)
    Re: using 'my' and 'required' files <jcokos@ccs.net>
    Re: way to print all variables ? <tchrist@mox.perl.com>
    Re: Will an apology end this mess? <gellyfish@gellyfish.com>
    Re: Y2K bugs on the Internet (alt.china.blue.morose.sad)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sun, 12 Sep 1999 13:28:59 -0600
From: Collin Starkweather <collin.starkweather@colorado.edu>
To: Wyzelli <wyzelli@yahoo.com>
Subject: Re: baffle about flock() please help!
Message-Id: <37DBFEFB.83313880@colorado.edu>

The lock is released when the process terminates.  

That's one of the reasons why Win9x is so hamstrung.  With Unix/WinNT,
if a process terminates abnormally, the locks are released.

With Win9x, there is no real file locking.  And I have yet to see an
ad-hoc file locking algorithm that will guarantee that all locks are
released upon termination of the process.  (Perhaps I'm just not
thinking creatively enough . . . .)

Cheers,

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather                                 (303) 492-4784
University of Colorado            collin.starkweather@colorado.edu
Department of Economics          http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Wyzelli wrote:
> 
> > > sleep(3600);
> > > flock(FILE,LOCK_UN);
> > > close(FILE);
> >
> > And of course that's a waste of at least one line of code. There's very
> > little reason to ever explicitly unlock a file from Perl.
> >
> >
> > Cheers!
> >
> > --
> > Tom Phoenix       Perl Training and Hacking       Esperanto
> > Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
> >
> 
> That's interesting and something I never caught from the docs... is it
> because the lock is released when the file is closed anyway?
> 
> Wyzelli
> It is better to ask a stupid question and learn something than not ask it
> and remain ignorant.


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

Date: Sun, 12 Sep 1999 21:26:29 +0000
From: Antonio Pires <rdd48254@mail.telepac.pt>
Subject: extracting text and images from a postgres DB !!!
Message-Id: <37DC1A85.C3450994@mail.telepac.pt>

Hi there ...

I am trying to make a cgi with  perl that will extract data from a
postgresSQL DB , some fields are text and other fields are gif images
 ... ...so may question is : how can i make a perl cgi script that
generates a html page using text and images from the data base all at
the some time ???



Thank you !!!


Antonio Pires





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

Date: Sun, 12 Sep 1999 14:56:16 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: how to tag a pattern match from a filehandle
Message-Id: <37DBF750.B5BEC08C@ccrs.nrcanDOTgc.ca>

Hi,

This may seem like a simple question, but I can't seem to figure out how
to do this.  I have done the same when the filehandle is STDIN, as in:

while (<>)
{
   $east = $1 if (/origin.*easting\s(\d+.\d)/);
   $north = $1 if (/origin.*northing\s(\d+.\d)/);
   $lines = $1 if (/lines\s(\d+)/);
}

I know the (<>) takes STDIN as 'stuff', but how can I do this if I have
a file represented by a scalar (eg. $file)?

Any advice or suggestions would be greatly appreciated.

Thanks alot

 ..Tom

-----------------------------------------------------------------------------------------
Tom Kralidis                                  Geo-Spatial Technologist 
Canada Centre for Remote Sensing              Tel: (613) 947-1828
588 Booth Street , Room 241                   Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7                     http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------


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

Date: Sun, 12 Sep 1999 18:10:58 GMT
From: Kevin Reed <kevin@zippy.tnet.com>
Subject: Idea for extracting name from city?
Message-Id: <7rgqba$5fs$1@nnrp1.deja.com>

This is not necessarily a perl question although I am using Perl to
deal with the task.

I'm playing around with extracting information from a PDF file and
its been quite a learning experience... a good test of my pattern
matching skills...

However, I've run into a problem that I don't think pattern matching
will solve and I'm curious if anyone has an idea how to deal with it
so that the information extracted would be consistent.

Below are some sample records to show the problem that I am having:

Mrs. Joyce Aab Pittsford, NY
Mrs. Melissa Aab Pittsford, NY
Mr. Elmer Aamodt Grand Prairie, TX
Mr. C. Chester Abell Columbus, OH
Mr. Charles Abercrombe Amarillo, TX
Mr. Denis Abercrombie The Woodlands, TX
Dr. Gary Abercrombie Plainview, TX
LTC Ralph Aguirre Glendale, AZ
Mr. Vikoslav Aguirre Greenwood Village, CO
Mr. C. Willis Adams III Indianapolis, IN
COL Samuel Adams Jr. Alexandria, VA
Mr. Frederick Addison III Dallas, TX

From the full line of text, I am able to extract the above information.
But I can't figure out how to extract it any further. As you can see,
the Name and the City along with the State are together in the same
record as extracted from the full line of text.

Obviously, I can extract the State without any problems since it is
always 2 characters with the city name anchored to the left of it
ending in a comma.

But the city name is a problem since it could be one or more words.

Looking at it from the other side, the name, the problem is the same.
Is the name just 3 sections (most are) or more than that.  Some names
complicate things more by having a Jr. or III like ending as well so
that you can't necessary assume the end of the name is the last name
itself.

The real data has every record in alphabetical order by last name.
So the following record would always have a last name that is
equal in value or greater.

I'm wondering if anyone has an idea on how to deal with this type of
extraction...

--
Kevin Reed


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


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

Date: Sun, 12 Sep 1999 20:58:37 +0200
From: =?iso-8859-1?Q?Bj=F6rn?= Teegen <bjoern.teegen@gmx.de>
To: Kevin Reed <kevin@zippy.tnet.com>
Subject: Re: Idea for extracting name from city?
Message-Id: <37DBF7DC.B9D4036E@gmx.de>

> However, I've run into a problem that I don't think pattern matching
> will solve and I'm curious if anyone has an idea how to deal with it
> so that the information extracted would be consistent.
>
> Below are some sample records to show the problem that I am having:
>
> Mrs. Joyce Aab Pittsford, NY
> Mrs. Melissa Aab Pittsford, NY
> Mr. Elmer Aamodt Grand Prairie, TX
> Mr. C. Chester Abell Columbus, OH
> Mr. Charles Abercrombe Amarillo, TX
> Mr. Denis Abercrombie The Woodlands, TX
> Dr. Gary Abercrombie Plainview, TX
> LTC Ralph Aguirre Glendale, AZ
> Mr. Vikoslav Aguirre Greenwood Village, CO
> Mr. C. Willis Adams III Indianapolis, IN
> COL Samuel Adams Jr. Alexandria, VA
> Mr. Frederick Addison III Dallas, TX
>
> From the full line of text, I am able to extract the above information.
> But I can't figure out how to extract it any further. As you can see,
> the Name and the City along with the State are together in the same
> record as extracted from the full line of text.
>
> Obviously, I can extract the State without any problems since it is
> always 2 characters with the city name anchored to the left of it
> ending in a comma.
>
> But the city name is a problem since it could be one or more words.
>
> Looking at it from the other side, the name, the problem is the same.
> Is the name just 3 sections (most are) or more than that.  Some names
> complicate things more by having a Jr. or III like ending as well so
> that you can't necessary assume the end of the name is the last name
> itself.

I think you have already understood your problem: There is no special
separator between name and city, only a whitespace like between the parts
of name or city name. Does the line "Mr. Elmer Aamodt Grand Prairie, TX"
mean that there is an Elmar Aamodt Grand who lives in Prairie, or is there
an Elmar Aamodt who lives in Grand Prairie?

The answer can only be found when you KNOW where to insert a separator, for
example when your program KNOWS that Grand Prairie is a city in Texas and
that there is none called Prairie.

Björn



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

Date: Sun, 12 Sep 1999 21:04:13 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl / C Memory
Message-Id: <hzUC3.5897$wW2.8602@news.rdc1.ct.home.com>

Kai Henningsen <kaih=7OhjZZ$mw-B@khms.westfalen.de> wrote:
> dan@tuatha.sidhe.org (Dan Sugalski)  wrote on 04.09.99 in <sf_z3.148$lT.809@news.rdc1.ct.home.com>:

>> Sure it does. Unfortunately just because perl frees memory doesn't mean
>> memory is returned back to the system. With very few exceptions (I think
>> MacOS and, under a few circumstances, VMS) any memory allocated to a
>> process by the OS stays with that process until it exits. This isn't a
>> perl thing--any program that mallocs memory will do it.

> Linux with glibc2 can also, I gather, return free()d memory to the OS.

> The way to do that is to not use brk(), but instead use mmap() to get the  
> memory. Then you can munmap() it again.

Well, OK, you can do that with any OS that implements mmap, but mapping
files to memory just so you can free it later seems a tad weasly. Plus the
memory mapped is usually nonswappable (I think) which would tend to chew
through available RAM pretty quickly...

A better thing to do would be for someone to go ahead and fix the various
C libraries to hand free'd memory back, but it's been 30 years and
nobody's done it yet, so I probably shouldn't hold my breath.

				Dan


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

Date: Sun, 12 Sep 1999 20:52:01 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl and Threads
Message-Id: <RnUC3.5807$wW2.8602@news.rdc1.ct.home.com>

In comp.lang.perl.modules Kai Henningsen <kaih=7OhmO-w1w-B@khms.westfalen.de> wrote:
> dan@tuatha.sidhe.org (Dan Sugalski)  wrote on 09.09.99 in <8dTB3.79$wW2.2668@news.rdc1.ct.home.com>:

>> How threads are implemented depends entirely on the threading library and
>> OS you're using. On Linux, threads are pretty much processes. On VMS they
>> aren't. On NT they're not either.

> That's a distorted view of the Linux version. Understandable, though,  
> because that's how the feature evolved.

Well, they take up slots in the process table, the process scheduler
handles timeslicing, and they get new pids, so they really do look like
special-purpose processes. Though I appreciate the clarification, and I
see the differences.

> However, it's really the other way around. The basic primitive is clone(),  
> and fork is effectively clone() with a special combination of flags. (So  
> is vfork(). Well, plus one wait (for the child to exec()).)

> With clone(), you can specify what should be shared between child and  
> parent, and what should be copied instead. Linuxthreads uses this to  
> implement pthreads - again with a special combination of flags.

> It's a pretty elegant concept.

Yep, definitely. I'm not sure it was the best way to handle pthreads, but
that's a separate issue entirely. And I'm certainly not familiar enough
with the guts of linux to pass judgement.

> It's also not complete yet; pthreads really want some properties which  
> aren't supported just yet, and there is discussion on how best to do it.  
> (Including "if there's no good way to do it, it may be best to just forget  
> about it - pthreads were a commitee invention anyway".)

Hopefully saner heads will rule, since the way linux implements threads
now has a few very serious limitations. Taking up slots in the process
table is the biggest one, and that puts a *huge* damper on some of the
neater things you can do with threads. (Lots of the cool things involve
gobs of threads, and, well, how many folks have process tables large
enough to handle 250k threads? Can you even *have* that many under linux?)

				Dan


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

Date: Sun, 12 Sep 1999 20:54:03 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl fails tests
Message-Id: <LpUC3.5823$wW2.8602@news.rdc1.ct.home.com>

Justin Smith <jsmith@mcs.drexel.edu> wrote:
> Anno Siegel wrote:

>> Justin Smith  <jsmith@mcs.drexel.edu> wrote in comp.lang.perl.misc:
>>
>> >I heard (on another newsgroup) that there's something wrong with the db library in Redhat, so I downloaded
>> >
>> >the REAL Berkeley db implementation (from www.sleepycat.com) and tried to build BerkeleyDB.pm
>> >
>> >(the Perl hook into the current Berkeley DB) and the resulting perl STILL failed the AnyDB test!
>>
>>

> I did that and Perl still fails the test AnyDBM!  I suspect that the problem is more subtle than I
> thought earlier: the DB implementations in Redhat are OK. The problem is in Perl itself --- somehow,
> when it is built on Redhat, the part of it that implemtns tied hashes is broken so any extension that uses
> them
> will fail...

Actually, the problem is partially in the DB library provided with RedHat.
A bigger problem is they stuffed the DB library into libc, so you can't
safely provide your own. Which means you can't easily fix the breakage. :(

					Dan


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

Date: Mon, 13 Sep 1999 08:01:32 +1000
From: "Neale Morison" <nmorison@ozemail.com.au>
Subject: Re: Perl Language Reference
Message-Id: <gpVC3.12882$1E2.89678@ozemail.com.au>


Martin McMahon <icsmc@iafrica.com> wrote in message
news:7rfn5s$24ch$1@nnrp01.ops.uunet.co.za...
> Hi
>
> Does anyone know where I can find a comprehensive Perl language reference?
> Thanks.
>
> Peter
>
>
The O'Reilly Camel book Programming Perl, (Wall, Christiansen and Schwartz)
is a good reference.




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

Date: Sun, 12 Sep 1999 21:15:37 GMT
From: Brad Barnett <bbarnett@nospamhere.L8R.net>
Subject: regexp with variables containing unknown data
Message-Id: <37DC17F4.335158B0@nospamhere.L8R.net>


Heyo,
	I've been writing a script for the last few months, and I've slapped
together some very weird code to deal with some problems I've had with
regexp, or that is, problems in knowing how to use it.  In many cases, I
have to match two unknowns.  For example, I may have :

$a = 'john';
@b = ("\one","{two","][three",four,etc...);

The above is just an example, of course, but shows what I am up
against.  I need to match two unknown variables, and do it with
wildcards as well.  For example, "something" may include any number of
[]{] or whatever in them, so I've designed the "stripn" fuction.  :

$seennick2 = stripn($seenlist[$t]);
$seennick = stripn("something");
$brr[0] = stripn("something");
$brr[1] = stripn("something");

if (" $seennick2 " =~ / $seennick .+ $brr[0] $brr[1] /i) {



sub stripn
{
$line9000 = shift(@_);

$line9000 =~ s/\-/minussign/g;
$line9000 =~ s/\+/plussign/g;
$line9000 =~ s/\|/pipesign/g;
$line9000 =~ s/\[/squareleft/g;
$line9000 =~ s/\]/squareright/g;
$line9000 =~ s/\{/curlyleft/g;
$line9000 =~ s/\}/curlyright/g;
$line9000 =~ s/\(/normalleft/g;
$line9000 =~ s/\)/normalright/g;
$line9000 =~ s/\^/uparrow/g;
$line9000 =~ s/\\/qwerty/g;
# extra  
$line9000 =~ s/\?/questionmark/g;
$line9000 =~ s/\!/exclamationmark/g;
#$line9000 =~ s/\*/star/g;

return $line9000;
 
}


This works well, in as much as I don't get perl barfing at me if
variables end up having any of the above in them, and on top of that it
keeps everything as a unique object.. even though "-" is now
"minussign".  Anyhow, any idea on how to match objects with
metacharacters (or whatever they are called ;) in them?  Without the
pain of the stripn function??

Thanks to any who can help...


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

Date: Sun, 12 Sep 1999 21:31:54 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: regexp with variables containing unknown data
Message-Id: <eZUC3.346$814.20853@typhoon01.swbell.net>

In article <37DC17F4.335158B0@nospamhere.L8R.net>,
Brad Barnett  <bbarnett@nospamhere.L8R.net> wrote:
>
>This works well, in as much as I don't get perl barfing at me if
>variables end up having any of the above in them, and on top of that it
>keeps everything as a unique object.. even though "-" is now
>"minussign".  Anyhow, any idea on how to match objects with
>metacharacters (or whatever they are called ;) in them?  Without the
>pain of the stripn function??

perlddoc -f quotemeta

--
Benjamin Franz


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

Date: Sun, 12 Sep 1999 21:33:03 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: regexp with variables containing unknown data
Message-Id: <j_UC3.347$814.19834@typhoon01.swbell.net>

In article <eZUC3.346$814.20853@typhoon01.swbell.net>,
Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:
>In article <37DC17F4.335158B0@nospamhere.L8R.net>,
>Brad Barnett  <bbarnett@nospamhere.L8R.net> wrote:
>>
>>This works well, in as much as I don't get perl barfing at me if
>>variables end up having any of the above in them, and on top of that it
>>keeps everything as a unique object.. even though "-" is now
>>"minussign".  Anyhow, any idea on how to match objects with
>>metacharacters (or whatever they are called ;) in them?  Without the
>>pain of the stripn function??
>
>perlddoc -f quotemeta

Correction: perldoc -f quotemeta
(No 'double d')

-- 
Benjamin Franz



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

Date: 12 Sep 1999 18:57:37 GMT
From: ronaldws@aol.com (RonaldWS)
Subject: Text::FixedRecField - proposal for new module.
Message-Id: <19990912145737.29234.00002462@ngol04.aol.com>

I am proposing an analog to the DBI capability to return
a record as a hash of fields.  At work I have had need
to process large numbers of fixed length records.  I have not
needed to process each record in its entirety but rather 
selected fields from inside the records.  The "substr" function
is a utilitarian answer to this need but 
	$record_lref->[ PHONE_NUMBER ]
is more self documenting then
	substr($line, 105, 20)
and more readable then
	substr($line, $start_pos[PHONE_NUMBER],
		$field_len[PHONE_NUMBER])
Note that we expect PHONE_NUMBER in the examples above to
be a constant declared with "use constant" or "use enum".

I have found a Text::FixedLength module that sounds like it
should be helpful, but in fact that module seems principally
geared towards converting between fixed length and delimited
text formats.

I am therefore proposing a solution that would allow efficient
access to fields in fixed length records by field name.  I do
module development part time but, if there is interest, I could
probably have something ready for testing sometime in (late) November.

If you are interested please send email to RonaldWS@aol.com.  If
you have an opinion on the general (un)usefulness of this
idea you may wish to post it to the news group.

This idea and its use of the enum.pm module to allow 
efficient access to fields, were partially inspired by
an article in TPJ (The Perl Journal) called
Perl Heresies: Building Objects Out of Arrays by Greg
Bacon (Issue 13, Vol. 4, No. 1, Spring 1997).  The
enum.pm module is available through CPAN.

Ronald Schmidt
The Software Path

A sample follows.  It is intended for illustration and evaluation
only.  It does not yet represent running code.

###########################################################

use enum qw(COMPANY_NUMBER COMPANY_NAME COMPANY_PHONE);
use Text::FixedRecField;

# create cursor for extracting fields from a fixed length record
my $fixed_rec_cursor = new FixedRecField (
	{
	# set start and end positions for fields
	COMPANY_NUMBER 	=> [ 12, 17 ],
	COMPANY_NAME   	=> [ 50, 81 ],
	COMPANY_PHONE  	=> [ 105, 124]
	},
	{
	# configure object to
	# 	a) interpret field positions as start/end position
	#	b) use position 1 rather than 0 as the start of the record	
	#	c) trim leading/trailing blanks off of all fields
	FixedRecord::FIELD_CONSTRAINT	=> 
		FixedRecord::START_END_POS,
	FixedRecord::FIRST_CHAR_POS 	=> 1,
	FixedRecord::TRIM_ALL		=> 1
	}
);

open (FH, "fixed_file") || die "Could not open file: $!";

while (defined($line = <FH>)) {
	my $record_lref = $fixed_rec_cursor->fetchrow($line);
	print "Company ID: ", 
		$record_lref->[COMPANY_NUMBER], "\n",
		"Company Name: ",
		$record_lref->[COMPANY_NAME], "\n",
		"Company Phone: ",
		$record_lref->[COMPANY_PHONE], "\n";
}
close(FH);



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

Date: Fri, 10 Sep 1999 02:05:17 -0700
From: "John Cokos" <jcokos@ccs.net>
Subject: Re: using 'my' and 'required' files
Message-Id: <37daff5f_4@goliath.newsfeeds.com>

In general, then,

When you "require" or "use" a module, can it "see" anything
declared via "my" in the main program, or must you "use vars"

Example:

Program: whatever.pl

#!/usr/local/bin/perl

    BEGIN {push @INC,".";}
    use testmod;
    my $dummyvar;
    &SetVar;
    print "Value: $dummyvar\n";

    exit 0;


Module: testmod.pm

sub SetVar {
     $dummyvar=5;
}
1;


Will whatever.pl report 5 or undef?

Thanks





  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 12 Sep 1999 13:05:59 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: way to print all variables ?
Message-Id: <37dbf997@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    ryanngi@hotmail.com (Ryan Ngi) writes:
:is there any way to print all variable of the language
:
:include
:%SIG,and special variable,%ENV...every variable

I don't imagine the perlvar manpage is what you're
looking for?

In the debugger, there are several commands to help you.
Since there are so many variable, you'll want to prefix each
command with a vertical bar, that is, a pipe symbol.  This 
sends the output through your pager so you can see one page
at a time.

The first command to learn is the "V" command, which prints out all
the global variables (mnemonic: "V" is for "variable"; capitalized is
for global) in a particular namespace.  Here's the simplest use:

    DB1> |V
    [paged output omitted]

That uses your pager, like "more" or "less", to show you all the
(global) variables in the main package (technically: the current package).
But there are other packages (read: namespaces), and the V command accepts
an optional argument specifying which package to look into.  For example:

    DB2> V Carp
    [output omitted]

shows you all the (global) variables in the Carp package.  If you only
want a few, you can list them by name (but not including their leading
type symbol):

    DB<3> V Carp EXPORT Verbose
    $Verbose = 0
    @EXPORT = (
       0  'confess'
       1  'croak'
       2  'carp'
    )

We even have a short-cut for listing a group of variables you don't
know all of, using wild-cards.  Start the variabe with a leading tilde,
and this will be a pattern to be compared against the variable name:

    DB<4> V Carp ~EXPORT
    @EXPORT_FAIL = (
       0  'verbose'
    )
    @EXPORT = (
       0  'confess'
       1  'croak'
       2  'carp'
    )
    @EXPORT_OK = (
       0  'cluck'
       1  'verbose'
    )

There's also a short-cut form of V that assumes the current package.
This is the "X" command, which eXamines the global variables
in your current package.  Therefore, 

    X INC

is like

    V main INC

when you're in the main package.

What packages do you have loaded?  The debugger doesn't have a good
built-in command for this, although it does have a 'v' command that
gives versions of modules.  This isn't the same as all packages, though.

    DB<1> v
    '/home/tchrist/.perldb' => '/home/tchrist/.perldb'
    'AutoLoader.pm' => '5.55 from /usr/local/perl/lib/AutoLoader.pm'
    'Carp.pm' => '/usr/local/perl/lib/Carp.pm'
    'DynaLoader.pm' => '1.03 from /usr/local/perl/lib/i686-linux/DynaLoader.pm'
    'Exporter.pm' => '/usr/local/perl/lib/Exporter.pm'
    'SelfLoader.pm' => '1.08 from /usr/local/perl/lib/SelfLoader.pm'
    'Term/Cap.pm' => '/usr/local/perl/lib/Term/Cap.pm'
    'Term/ReadKey.pm' => '2.14 from /usr/local/site_perl/i686-linux/Term/ReadKey.pm'
    'Term/ReadLine.pm' => '/usr/local/perl/lib/Term/ReadLine.pm'
    'Term/ReadLine/Perl.pm' => '0.99 from /usr/local/site_perl/Term/ReadLine/Perl.pm'
    'Term/ReadLine/readline.pm' => '0.9906 from /usr/local/site_perl/Term/ReadLine/readline.pm'
    'dumpvar.pl' => '/usr/local/perl/lib/dumpvar.pl'
    'perl5db.pl' => '1.0402 from /usr/local/perl/lib/perl5db.pl'
    'vars.pm' => '/usr/local/perl/lib/vars.pm'

Another useful command might be "S", which lists subroutines.  This
lists all known subroutines:

    DB1> |S
    [paged output omitted]

and this lists just those in a particular package:

    DB<2> S Carp 
    Carp::carp
    Carp::cluck
    Carp::confess
    Carp::croak
    Carp::export_fail
    Carp::longmess
    Carp::shortmess

How do you get the other packages?  Well, here's one way:

    DB<3> x grep /::$/, keys %main::      
    0  'AutoLoader::'
    1  'SelfLoader::'
    2  'DB::'
    3  'DynaLoader::'
    4  'dumpvar::'
    5  'Exporter::'
    6  'Term::'
    7  'Tk::'
    8  'readline::'
    9  'VMS::'
    10  'overload::'
    11  'UNIVERSAL::'
    12  'IO::'
    13  'vars::'
    14  'Carp::'
    15  'CORE::'
    16  'main::'

Or, more succinctly:

    DB<4> print join ", ", grep /::$/, keys %main:: 

    AutoLoader::, SelfLoader::, DB::, DynaLoader::, dumpvar::, Exporter::,
    Term::, Tk::, readline::, VMS::, overload::, UNIVERSAL::, IO::,
    vars::, Carp::, CORE::, main::

Or, more nicely:

    DB<5> print join ", ", map { /(.*)::$/ } sort grep /::$/, keys %main::

    AutoLoader, CORE, Carp, DB, DynaLoader, Exporter, IO, SelfLoader,
    Term, Tk, UNIVERSAL, VMS, dumpvar, main, overload, readline, vars

You see, each pakage contains the next one.  %main:: is the hash containing
all of main's (global) names.   That means any key in that hash that
ends in "::" is presumed to be another symbol table.  Symbol tables
can nest.

    DB<1> use IO

    DB<2> print join ", ", grep /::$/, keys %main::
    AutoLoader::, SelfLoader::, DB::, Tie::, DynaLoader::, dumpvar::, Exporter::, Term::, Symbol::, Tk::, strict::, readline::, VMS::, UNIVERSAL::, Fcntl::, SelectSaver::, IO::, Class::, vars::, Carp::, File::, CORE::, Socket::, main::

    DB<3> print join ", ", grep /::$/, keys %main::IO::
    Handle::, Select::, Dir::, Seekable::, Pipe::, Poll::, File::, Socket::

    DB<4> print join ", ", grep /::$/, keys %main::IO::Handle::

    DB<5> print join ", ", grep /::$/, keys %main::IO::Socket::
    UNIX::, INET::

    DB<6> print join ", ", grep /::$/, keys %main::IO::Socket::INET::

    DB<7> V IO::Socket::INET
    @ISA = (
    0  'IO::Socket'
    )
    $VERSION = 1.24

You might also investigate the CPAN module Devel::Symdump.

--tom
-- 
: There may be 2 or three ways to perform a particular task, but there will
: not be 10,000 as there are in perl.
I think you may be exaggerating slightly.  Perl isn't that good yet.
        -- Larry Wall, 5 Jun 91 5:11:004GMT


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

Date: 12 Sep 1999 20:29:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Will an apology end this mess?
Message-Id: <7rh2f5$2uj$1@gellyfish.btinternet.com>

On 11 Sep 1999 20:59:44 -0000 Jonathan Stowe wrote:
> On Sat, 11 Sep 1999 13:16:06 GMT C D wrote:
>> Id Est wrote:
>>> 
>>> geez kid, show some backbone.  who gives a rats ass if Abigoon doesn't like
>>> you?  he/she/it and his/her/its defenders are arrogant bullies who think
>>> they're above the rest of us.  who cares?  f*ck 'em and killfile 'em.
>>> you can learn perl quite well without their "help".
>> Exactly!
> 
> Cool, I get to kill-file two dick-heads for the price of one.
> 
> *plonk* *plonk*
> 

I would like to propose another  prat to the hall of flame:

<QUOTE>
Date: Sun, 12 Sep 1999 13:16:44 -0600
From: Mike Nemeth <mike@bigredrockeater.com>
To: jns@gellyfish.com
Subject: Re: Will an apology end this mess?

In comp.lang.perl.misc, you wrote:
>
>Cool, I get to kill-file two dick-heads for the price of one.
>
>*plonk* *plonk*

Cool, another Abigoon wanna-be for my global permanent killfile.

*plonk* yourself, fuckhead.

p.s.  jellyfish.com, very appropriate for a spineless Abigoon supporter.
</QUOTE>

The hall of flame can be found at <http://www.gellyfish.com/flames>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 12 Sep 1999 13:55:15 -0800
From: saratoga@myremarq.com (alt.china.blue.morose.sad)
Subject: Re: Y2K bugs on the Internet
Message-Id: <saratoga-1209991355150001@ppp-206-170-2-137.sntc01.pacbell.net>

/ >If you want to watch history repeat itself from the beginning, ask people
/ >about the Y2K38 problem, when the Unix clock overflows.
/ 
/ That won't turn out to be a big issue. Long before then systems will
/ have migrated time_t to a 64 bit type, or at the very least an unsigned
/ 32 bit type. The latter won't compromise most existing date data stored as
/ signed long in POSIX format. Only dates prior to 1970 would be
/ corrupted.

And luckily any timestamp in a file will also be expanded.

-- 
Collective Against Consensual Sanity 
v0.1 is sort of up.   http://www.angelfire.com/ca3/cacs
For a free CACS T-shirt send $42 shipping and handling.
pretty?     http://www.geocities.com/SoHo/Studios/5079/


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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