[23053] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5274 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 26 03:06:08 2003

Date: Sat, 26 Jul 2003 00:05:09 -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           Sat, 26 Jul 2003     Volume: 10 Number: 5274

Today's topics:
    Re: "theory vs practice" ceases power <dave@3dex.com>
    Re: Called as method or subroutine? <tassilo.parseval@rwth-aachen.de>
    Re: Data::Dumper vs perl -d (Tad McClellan)
        DBI: oralce DBD drivers  <julie.spicer@verizon.net>
    Re: delete directory files from a list.  Help Please <mbudash@sonic.net>
    Re: delete directory files from a list.  Help Please <jwillmore@cyberia.com>
        FTP in ASCII mode from UNIX to NT (jiju)
    Re: FTP in ASCII mode from UNIX to NT <jwillmore@cyberia.com>
    Re: How to find out installed packages on Unix <dtorreblanca0205@rogers.com>
    Re: Killing IE via win32::ole ?? <asu1@c-o-r-n-e-l-l.edu>
    Re: Looking for  Perl school <senior_citizen@alaska.com>
    Re: module and $ARGV help <jwillmore@cyberia.com>
    Re: mysql load data infile error from inside a perl pro <mbudash@sonic.net>
    Re: mysql load data infile error from inside a perl pro <NOSPAM@bigpond.com>
    Re: need help-how to parse references (Sam Holden)
    Re: need help-how to parse references (Tad McClellan)
    Re: Newbie: Problems with a CPAN installation <jbritain@cox.net>
        Pesky added line <nospam@xx.com>
    Re: pod2usage verbose problem <jwillmore@cyberia.com>
    Re: Tracking Number <asu1@c-o-r-n-e-l-l.edu>
    Re: Unappropriate ioctl for device <tassilo.parseval@rwth-aachen.de>
        Where to hitch the <<EOF to plaster input file? <jidanni@jidanni.org>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 26 Jul 2003 02:08:54 GMT
From: "Dave Benjamin" <dave@3dex.com>
Subject: Re: "theory vs practice" ceases power
Message-Id: <WolUa.110527$o86.84853@news1.central.cox.net>

"Xah Lee" <xah@xahlee.org> wrote in message
news:7fe97cc4.0307220519.69630c7a@posting.google.com...
> Dear functional programing comrades,

Whatever...

> Among the community of automatons of the IT industry, there is a
> popular quote about "theory vs practice" that goes something along the
> lines of "in theory this, but in practice that", which is often quoted
> by automatons to slight at computer science principles or
> practice. (especially by perl or unix advocates)

I find this to be a useful distinction. A lot of ideas sound good on paper
but don't work out too well when actually applied to a real problem.
Perhaps this is a misuse of the word "theory", but it's a common usage
that is easy to decipher given the context of the phrase.

By automotons, I assume you mean robot-like humans, people who
do not think for themselves? And as a subclass of this genre, you are
indicating advocates of Perl and UNIX? I find this odd. Perhaps you
believe that Perl and UNIX fans are not enlightened enough by
computer science theory, but both Perl and UNIX cultures seem to
encourage creative thought, not automata-like behavior.

> i'm posting the following in hope that "theory vs practice" can cease
> its misleading power. I seek your support in the education of IT
> automatons. Thanks.

I'm sure your caustic and hateful rhetoric will do bounds of good to
enlighten the ignorant to the wonders of computer science theory.
Nothing makes me want to learn more than being told I'm a moron.

> merlyn@stonehenge.com (Randal L. Schwartz) quoted:
> | The difference between theory and practice in theory is much less
> | than the difference between theory and practice in practice.
>
> Popular quotes have attributes of equivocal interpretation and
> theatrical display. When interpreted and pondered by the wise, it
> lights up a wisdom, but dullards quote them equally, and delight in
> their drama. (the latter happens a lot in Perl and unix communities.)

Yes, and Mr. Schwartz has clearly done those Perl dullards a disservice
by provoking their sense of humor. Fortunately, most Perl programmers
I know are not dullards, and in fact, they know how to take a joke.

> For example, in the above usage, 'theory' is used twice. In the first
> instance, it is used for a purpose but not for its meaning. It is part
> of a construction in a language that discuss the language itself. In
> theory it does not come up, but in practice it does all the time. In
> practice, we can say that the first instance of usage of the word
> 'theory' has no meaning given the context. In the second appearance of
> the word, it has myriad of interpretations due to the construction of
> the phrase.

Look, if you're trying to elucidate, it's downright silly to continue using
Schwartz's clever wordplay throughout your entire argument. Start over,
and this time, try not to define either word in terms of the other. His
epigram is an amusing tounge-twister. Your essay gives me cottonmouth.

We can argue all day and night about semantics and vocabulary abuse,
but the plain fact is that there is a mismatch between the ideas and
concepts
that colleges and researchers preach about and the actual implementations
that get projects done and help us get through our day at work. You can
pretend that this problem does not exist, and perhaps a good dictionary
will assist in your denial, but in the meantime people are busy trying to
write
code that works. Maybe you should be, too.

> ...snip...
> Larry Wall likes to mention how he had a linguistics background, and
> how he utilized the (good) human qualities of English to create
> Perl. To the Perl folks of beady eyes, they are sold a grand advance
> in computer science, but to discerning eyes, it's artful garbage.

Larry Wall introduced a lot of English-like constructs with Perl, and
indeed he often uses natural languages as justification for Perl's syntax.
Examples include context-sensitivity, noun and verb tags, conditionals
that can be rearranged (do this unless that, open this or die, etc.). I
don't hear anyone claiming this is a "grand advance" in computer
science. It's an attempt at making coding more like writing, and maybe
a bit less like cold, hard mathematics. You don't like it? Fine! Don't
use Perl. What's the problem?

Perl has received plenty of flak already for looking like "executable
line noise". The argument is old and tired, Perl is still Perl, people
are still using it, and useful tools and applications are being written
that perhaps otherwise wouldn't exist. Perl enables programmers to
have fun. Maybe not all programmers, but Perl lovers really love
Perl. Why rain on their parade?

> Sorry i don't have time to address the above points of Wall's, but
> this will definitely be another lesson for you folks down the road.
> The perl folks with their beads of little eyes, cannot see beyond
> imperative languages.

This is just silly. Perl supports anonymous subrotines, closures,
map/filter, currying, UNIX-style pipes and filters, and other functional
techniques. I don't know much about Perl's support for other non-imperative
programming styles like logic programming, but there's no reason Perl has to
be an "imperative language", at least no more than OCaml is, since it
provides
imperative features as well. If you want to take a shot at imperative
languages,
why not try one like Java that actually makes it *difficult* to do
functional
programming?

I think that you have some kind of personal vendetta against Perl
programmers,
as can be inferred by the material at your web site. Perhaps you've
attempted
to convince Perl programmers that their language sucks because it does not
have a strong enough foundation in computer science "theory". Perhaps
they've
replied that they don't care, because their language stands up well in
"practice".
This would, of course, piss you off rightly, since you're smarter than they
are,
and they would in turn refuse to care, seeing you as an arrogant academic
prick.

Maybe you're both right. But instead of acting like a pompous fool with your
wizard speak, why not just sit down and write some code? Maybe it'll help
you
understand why people feel like computer science theory falls short when it
comes to application, and why people reach for Perl and not Haskell when
they're trying to automate their DNS server configuration.

Instead of telling people how moronic they are, and trying to start yet
another
language war, why not do something constructive with your time? Write some
code. Demonstrate the computer theory you love so dearly. Maybe even write
some referencially transparent, higher-order Perl to solve some real-world
problems and enlighten the masses. Because all of this ranting just sounds
like
sour grapes to me.

Happily living with Python, Perl, PHP, OCaml, Haskell, Java, C++, and LISP,
(and trying not to complain *too* much,)
Dave





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

Date: 26 Jul 2003 06:13:12 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Called as method or subroutine?
Message-Id: <bft65o$1fq$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Martien Verbruggen:

> On 24 Jul 2003 06:21:58 GMT,
> 	Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
>> Also sprach Martien Verbruggen:

>>> The notation MyClass::mySub() is not subject to inheritance in any
>>> way. In other words, the above two calls cannot be equivalent, because
>>> of Perl's magical treatment of that arrow. If you use that arrow, Perl
>>> will search through @ISA. If you don't, then it won't.
>> 
>> Which, as far as I understand, was Eric's point.
> 
> The point that I was trying to make is that with a call like
> MyClass::mySub() it is not even really possible to talk about
> inheritance, since it's not a method call, but rather a regular
> subroutine call, and therefore never subject to Perl's inheritance
> mechanisms.  You do need the arrow for that. 

Hmmh, just a sec. Plain functions are subject to inheritance in Perl
(they also trigger AUTOLOAD if it exists):

    ethan@ethan:~$ perl -l
    package t;
    require CGI;
    @ISA = qw/CGI/;
    package main;
    print t::h1("test");
    __END__
    <h1>test</h1>

That makes class-methods and function look even more indistinguishable.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Fri, 25 Jul 2003 20:57:31 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Data::Dumper vs perl -d
Message-Id: <slrnbi3o0b.c3o.tadmc@magna.augustmail.com>

Bill Smith <wksmith@optonline.net> wrote:

> I have noticed that many of the frequent posters recommend Data::Dumper
> for debugging


You seen them _recommend_ it, or you've seen them _use_ it?


> The debugger offers several advantages.

[snip]

> What advantages of the module approach am I overlooking?


Adding a line or two of code is easy to do on Usenet.

Showing a debugger session on Usenet is not as easy.


Maybe your observations are skewed by the forum that you are 
observing in...


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


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

Date: Sat, 26 Jul 2003 05:56:38 GMT
From: Vespasian <julie.spicer@verizon.net>
Subject: DBI: oralce DBD drivers 
Message-Id: <lt54ivk7ij0a0dop1soljqeu335fd8jb7k@4ax.com>

When using DBI, will the latest oracle DBD drivers from cpan work with
oracle 9i? Looks like the drivers only support oracle 7 and 8

TIA,

Ves


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

Date: Sat, 26 Jul 2003 01:04:28 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: delete directory files from a list.  Help Please
Message-Id: <mbudash-FC61EB.18042825072003@typhoon.sonic.net>

In article <slrnbi3836.bov.tadmc@magna.augustmail.com>,
 tadmc@augustmail.com (Tad McClellan) wrote:

> Michael Budash <mbudash@sonic.net> wrote:
> > In article 
> ><YW50aWdvbmU=.c73a024b0bd0031b4a02e7db26d72084@1059165484.cotse.net>,
> >  "DieSpammersDie" <DieSpammersDie-no-spam@antigone.cotse.net> wrote:
> 
> 
> [snip 50 lines of quoted text]
> 
> 
> >> this does not work either.
> 
> > we 
> > need more than just "not work"!!
> 
> 
> And we need less than 50 quoted lines for a 2 line comment that
> makes reference to half of 1 quoted line.

good point, sorry. you don't miss a byte, do you?

-- 
Michael Budash


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

Date: Sat, 26 Jul 2003 03:28:55 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: delete directory files from a list.  Help Please
Message-Id: <20030725232729.7741f2bf.jwillmore@cyberia.com>

> Good point.  No, I don't get a message.  The program runs, but the
> files are not deleted.  The files are still in the directory.  No
> messages or anything.  I am going to add some error checking
> comments to direct the ouput to a log file so I can see exactly what
> is happening.  Basically, the program runs but does not delete the
> files from the filelist.  It's killing me.

Some things to think about:

(Goes without saying, but hey, can't be said often enough).
Run the script with warnings enabled (#!/usr/bin/perl -w -or-
#c:\perl\bin\perl -w -or- some other variation with '-w' at the end)..

Check the 'unlink' function (ie die "Can not unlink $file\n$!\n unless
unlink $file;)

Check your regex(s) -or- since you don't care deeply about anything
other than the file name contains a string, consider using 'index'
instead.

I know you might be insulted by this, but I often have this problem
and it still causes me some pain - check your spelling.  I once spent
hours trying to figure out what I did wrong, tearing apart code, etc.
- someone came by, looked over my shoulder, and said "You mis-spelled
variables" (The language was SPSS in case any one wants to know - run
on a Digital VAX/VMS system many moons ago).  You may think you have
the right directory in your code, but you may want to re-type it just
to make sure.

HTH

Jim


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

Date: 25 Jul 2003 18:13:36 -0700
From: jmkuruvilla@yahoo.com (jiju)
Subject: FTP in ASCII mode from UNIX to NT
Message-Id: <c396a971.0307251713.79ca8790@posting.google.com>

hi,

I can't open up a text file that I FTP'd from UNIX to Windows 2000
even though I set the type to ASCII mode ($ftp->ascii();). I guess it
has to do with carriage return character not encoding correctly on
2000 machine. Is there any work around to fix this problem so I could
open this file up in Notepad?? Need to have it in Notepad to use with
MS Access

thanks,
jju


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

Date: Sat, 26 Jul 2003 03:16:00 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: FTP in ASCII mode from UNIX to NT
Message-Id: <20030725231434.6139f839.jwillmore@cyberia.com>

> I can't open up a text file that I FTP'd from UNIX to Windows 2000
> even though I set the type to ASCII mode ($ftp->ascii();). I guess
> it has to do with carriage return character not encoding correctly
> on 2000 machine. Is there any work around to fix this problem so I
> could open this file up in Notepad?? Need to have it in Notepad to
> use with MS Access

I'm not sure if this will help you or not.  I had a script that took a
file and sent it from a Windows machine to our S/390.  When we
upgraded the Windows machine from 98 to 2000, the line ending
characters were fouled.  

Now, the usual approach is to either use tr or a regex to change the
line ending characters to what is needed.  Guess what?  It didn't
work.  The issue always arose AFTER the file was created on the file
system.  The actual scalar value involved was correct BEFORE writing
to file.

So, I decided that, since the file system didn't want to play nice,
I'll avoid writing the file to it.  You may want to write the file to
an IO::Scalar object first, do any line ending substitution on the
IO::Scalar object, then write the IO::Scalar object to file. 
Not elegant or efficent, but it did the trick for me.  

HOWEVER, I know the size of the file is small (always less than a few
kilobytes), so memory is not really an issue.  Depending on the size
of the file you're dealing with, you may have to take a different
approach.

HTH

Jim


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

Date: Sat, 26 Jul 2003 06:29:29 GMT
From: "dtorreblanca0205" <dtorreblanca0205@rogers.com>
Subject: Re: How to find out installed packages on Unix
Message-Id: <ddpUa.86706$zwL.84758@news04.bloor.is.net.cable.rogers.com>

"Wang, Vincent" <viwang@nortelnetworks.com> wrote in message
news:3EA9A873.EA35E48C@nortelnetworks.com...
> How are you?
>
> Do you know how to find out the Perl packages that already installed on
> my UNIX or Linux, like "ppm query" does on win32?
>
> Thanks,
> Vincent
>
>

Try this (you'll need ExtUtils::Installed, obviously):

#!/usr/local/bin/perl

use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();

foreach my $module ($instmod->modules())
{
       my $version = $instmod->version($module) || "???";
       print "$module -- $version\n";
}




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

Date: 26 Jul 2003 02:04:46 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Killing IE via win32::ole ??
Message-Id: <Xns93C3E09B4E9E8asu1cornelledu@132.236.56.8>

icebeing1@dslextreme.com (C. Martin) wrote in
news:2e873c65.0307251454.2507b5f2@posting.google.com: 

> Hi,
> 
> I found this little code snippet while trying to figure out
> how to bring up Internet Explorer with Perl:
> 
> +++++++++++
> use Win32::OLE;
> use strict;

use warnings;

> use Time::HiRes;
> 
> my $browser = Win32::OLE->new('InternetExplorer.Application') or die
> "Aiee \n"; 

$browser->{'Visible'} = 1;
 
> $browser->Navigate('http://www.gellyfish.com',1,'_BLANK');
> +++++++
> 
> According to the docs, the 'Quit()' method should kill the browser I
> just created, so this statement should work...
> 
> $browser->Quit();


-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Sat, 26 Jul 2003 03:22:41 GMT
From: "Gerald Newton" <senior_citizen@alaska.com>
Subject: Re: Looking for  Perl school
Message-Id: <1059189761.516038@prawn>


"Michael P. Broida" <michael.p.broida@boeing.com> wrote in message
news:3F217214.D67662EF@boeing.com...
> Gerald Newton wrote:
> >
> > I am looking for an onsite Perl school of 4 to 5 weeks.  This school
would
> > be for computer literate people who have previous programming
experience,
> > but are not professional programmers.  The school would have about 4
hours
> > in class and a daily workshop where students would use their own laptops
or
> > school machines to practice with an instructor on hand.  The cost would
be
> > about $3 to $5 thousand not including board and room.  Does anyone know
of
> > such a program?
>
> Look at "ed2go.com".  You can see a list of courses there,
> but you can't sign up there.  You'll find a list of schools
> (community colleges, high schools, etc) who offer the courses
> (and collect money and give certificates) for them.  Go to
> the website for one of those schools to sign up.
>
> I took two Perl courses (and 7-8 other courses) from them
> through the local community college.  Pretty good courses,
> not too expensive ($59 or $69 for 6 weeks of online lessons).
>
> Mike

Thanks.
I already bought several books, including the Perl Cookbook, Learning Perl,
Programming Perl, and CGI Programming 101.
I will look into ed2go.com.




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

Date: Sat, 26 Jul 2003 03:32:51 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: module and $ARGV help
Message-Id: <20030725233416.4c9447b7.jwillmore@cyberia.com>

<snip>
	#	$t1 =3D $t1->add($ARGV); }
<snip>
> I actually tried doing the above but it hung because of the while.
> What is the terminating condition for the loop? Or, is there a
> better way of doing this?
> When my script moves from one file to the next does it update the
> value of $ARGV?

$ARGV[0] or what every position is applicable. =20
@ARGV (an array) is what holds the command line parameters.

(from perldoc perlvar)

      @ARGV   The array @ARGV contains the command-line argu=AD
               ments intended for the script.  $#ARGV is gener=AD
               ally the number of arguments minus one, because
               $ARGV[0] is the first argument, not the program's
               command name itself.  See $0 for the command name.

HTH

Jim


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

Date: Sat, 26 Jul 2003 01:15:41 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: mysql load data infile error from inside a perl program
Message-Id: <mbudash-1A8E9C.18154125072003@typhoon.sonic.net>

In article <IbiUa.1646$FP5.1071@nwrddc02.gnilink.net>,
 "Balldrew J. Bag" <res03jc6@verizon.net> wrote:

> This is my first attempt at writing something with Perl, so this is 
> beyond a newbie question.
> 
> I'm both creating a table and trying to use the load data infile command 
> from within a perl program.  All the permissions are set right and it 
> actually does create the table and load the data, but it gives the 
> following error and dies:
> 
> DBD::mysql::st execute failed: Access denied for user: 
> 'hightone@localhost' (Using password: YES) at 
> /usr/lib/perl5/site_perl/5.6.0/i386-linux/Mysql.pm line 172.

looks like your login (userid and/or password) is incorrect to me...

> count: Mysql::Statement=HASH(0x8246d4c)
> 
> That second line is me trying to output a variable called count's 
> contents.  It should be an integer since this is what I'm doing:
> 
> $count = $db->query("select count(notes) from $noteList");
> 
> The fact that it prints something weird might be a clue.
> 

nope - per the Mysql.pm docs, its 'query' method doesn't return what you 
think it does - it returns:

       ...a statement handle which lets you further explore 
       what the server has to tell you. On error the return 
       value is undef.

this would work likely for you:

my $sth = $db->query("select count(notes) from $noteList") or die 
("Can't get statement handle: " . $db->errmsg);

my @arr = $sth->fetchrow or die ("Can't retrieve row: " . $db->errmsg);

$count = $arr[0];

hope this helps...

-- 
Michael Budash


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

Date: Sat, 26 Jul 2003 14:07:21 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: mysql load data infile error from inside a perl program
Message-Id: <bfsujb$id3cg$1@ID-202028.news.uni-berlin.de>


"Michael Budash" <mbudash@sonic.net> wrote in message
news:mbudash-1A8E9C.18154125072003@typhoon.sonic.net...
> In article <IbiUa.1646$FP5.1071@nwrddc02.gnilink.net>,
>  "Balldrew J. Bag" <res03jc6@verizon.net> wrote:
>
> > This is my first attempt at writing something with Perl, so this is
> > beyond a newbie question.
> >
> > I'm both creating a table and trying to use the load data infile command
> > from within a perl program.  All the permissions are set right and it
> > actually does create the table and load the data, but it gives the
> > following error and dies:
> >
> > DBD::mysql::st execute failed: Access denied for user:
> > 'hightone@localhost' (Using password: YES) at
> > /usr/lib/perl5/site_perl/5.6.0/i386-linux/Mysql.pm line 172.
>
> looks like your login (userid and/or password) is incorrect to me...

Yes. Make sure you can connect at the command line to mysql, use to see
things are working OK.

Then in Perl you then give a user name, password and database to
DBI->connect.

gtoomey




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

Date: 26 Jul 2003 01:53:16 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: need help-how to parse references
Message-Id: <slrnbi3noc.j71.sholden@flexal.cs.usyd.edu.au>

On 25 Jul 2003 17:36:27 -0700, susan <anzhenli@hotmail.com> wrote:
> Hello friends,
> 
> I am sorry I didn't provide enough information about the input. Here
> is the example of my text file for the references:
> 
> REFERENCES
> Alberts, B., Bray, D., and Lewis, J., Molecular Biology of the
> Cell,2nd edition, Garland Publishing, New York,1989.
> Van Holde.,Chromatic, Springer-Verlag, New York, 1989.
> Bauer, W. R., Crick, F.H.C, and White, J. H., Supercoiled DNA,
> Sci.Am.243, 100-125(1980).
> Zhuang,X.,Ha,T.,Kim,H.D.,Cartner,T.m, Lebeit,S., and Chi,
> S.,Fluorescence Quen-
> ching: A tool for Single-Molecule Protein-Folding Study,
> Natl.Acad.Sci.19,14,41-
> 64(2000).
> 
> I wrote: if (($Line =~/^[A-Z](.*)\d{4}(\))*\.$/)and ($Line =~/(\.,)/))
>              { print "$Line\n"}
> This will keep all the references having a single line. But I don't
> know how to tell the computer to consider from "Alberts..." to "1989."
> is only one citation. Further more, I want to separate the
> inforamtion, output should look like:

The output part should be easy when compared to extracting the data.

For extracting the data I suspect you may be out of luck for a purely
automated system - the data is designed for humans and even then there
are probably cases that are ambigious (for humans, let alone machines).

This is the sort of problem for which the "human in the loop" approach tends
to be best. Parse as best you can, hopefully give a "score" to the parse and
let a human check the results.

References have the nice property of being referenced in multiple places, and
also have things like citeseer, so if you find something you've found before
it's more likely to be correct, and if a citeseer search for your parsed
result is successful you probably got it right too.

Authors have a reasonably consistant format (Lastname, Initials,) publishers
and journals and proceedings and the like can be covered by enumerating the
known ones (which should cover a large majority of posibilities). And a year
reference wil usually end the reference. So it should be easy to get something
which works on the vast majority of references (after all nothing you can
do will make the system work on an incorrect reference - and they exist...)

As an aside:

I'm amazed that academia hasn't worked out an ID system with publishers. Page
numbers suck (and I've seen at least one great study of incorrect references
spreading through a population (that study interpreted it as a symptom of people
giving references they haven't actually read - I interprete it as copying
the reference data of a read paper from another paper (I've done that
more than once)). The actual proceedings, etc have ISBNs. Giving each paper an
ID and then requiring that references have [ISBN.ID] after the human readable
text would make life *so* much easier.

[snip TOFU - please don't do that]

-- 
Sam Holden



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

Date: Fri, 25 Jul 2003 23:01:07 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: need help-how to parse references
Message-Id: <slrnbi3v83.cec.tadmc@magna.augustmail.com>

susan <anzhenli@hotmail.com> wrote:


> Alberts, B., Bray, D., and Lewis, J., Molecular Biology of the
> Cell,2nd edition, Garland Publishing, New York,1989.


Ends with 4 digits and a dot.


> Bauer, W. R., Crick, F.H.C, and White, J. H., Supercoiled DNA,
> Sci.Am.243, 100-125(1980).


Ends with open paren, 4 digits, close paren and a dot.


> I wrote: if (($Line =~/^[A-Z](.*)\d{4}(\))*\.$/)and ($Line =~/(\.,)/))
>              { print "$Line\n"}
> This will keep all the references having a single line. But I don't
> know how to tell the computer to consider from "Alberts..." to "1989."


Do you know how to tell _us_ how to unambiguously determine the
end of a record?

We need to know what must be done before we can write code 
for you that will do it.


> is only one citation. 


If this description fits your data, then you can separate out
the records easily enough:

   Every record ends with either
      5 chars:  4 digits and a dot
   or
      7 chars:  open paren, 4 digits, close paren and a dot


----------------------------------------
#!/usr/bin/perl
use strict;
use warnings;

$_ = '
Alberts, B., Bray, D., and Lewis, J., Molecular Biology of the
Cell,2nd edition, Garland Publishing, New York,1989.
Van Holde.,Chromatic, Springer-Verlag, New York, 1989.
Bauer, W. R., Crick, F.H.C, and White, J. H., Supercoiled DNA,
Sci.Am.243, 100-125(1980).
Zhuang,X.,Ha,T.,Kim,H.D.,Cartner,T.m, Lebeit,S., and Chi,
S.,Fluorescence Quen-
ching: A tool for Single-Molecule Protein-Folding Study,
Natl.Acad.Sci.19,14,41-
64(2000).
';


#while (  /^([A-Z].*?(\d{4}|\(\d{4}\))\.)$/gmsx ) {

while (  /^(                              # start of line, start of memory
             [A-Z].*?                     # starts with upper case letter
             (   \d{4}  |  \(\d{4}\)   )  # 4 digits with or without parens
             \.                           # dot
           )$                             # end of memory, end of line
         /gmsx ) {                        # gym sox (gimsox), according to Damian Conway

   print "$1\n------\n";
}
----------------------------------------


> Further more, I want to separate the
> inforamtion, 


You're on your own with that one.

It is more an Artificial Intelligence question than a Perl question.

The info is already hamburger. You cannot make steak out of it.  :-(


> tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbi2j8o.ahs.tadmc@magna.augustmail.com>...


[ snip a bit of TOFU ]


>> Have you seen the Posting Guidelines that are posted here frequently?


Have you done that yet?

Please do. Thanks.



[ snip some more unlovely TOFU ]

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


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

Date: Fri, 25 Jul 2003 21:45:49 -0700
From: Jim Britain <jbritain@cox.net>
Subject: Re: Newbie: Problems with a CPAN installation
Message-Id: <cl14ivotrfi9vicdtp0r2ee357fichpbv2@4ax.com>

On 25 Jul 2003 01:52:03 -0700, francescomoi@europe.com (Francesco Moi)
wrote:

>Hello.
>
>I'm trying to install 'LWP:Simple' module on my Linux machine.
>
># perl -MCPAN -e shell
>cpan> install LWP:Simple
>Going to read /root/.cpan/sources/modules/03modlist.data.gz
>Warning: Cannot install LWP:Simple, don't know what it is.
>Try the command
>    i /LWP:Simple/
>to find objects with similar identifiers.
>
>I don't have any idea about this error. Any suggestion?

A couple things.

1.  Between a module name and it's components, there's two colons, not
one as you used above.

2. Google is your friend.

http://www.google.com/search?q=LWP+Simple

And it would have caught the small mistake that became a roadblock.



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

Date: Fri, 25 Jul 2003 21:55:56 -0700
From: Eric <nospam@xx.com>
Subject: Pesky added line
Message-Id: <3F2209DC.5320A25B@xx.com>

I have a Pesky added line I just can't figure out how to get rid of in
the following simple conversion script (substitutes a number for text
status).  It would make more sense for the new blank line to come
*after* the substituted line, but it comes before...and is driving me
nuts.

Here's a few lines from the original file (right at the end of the
header/field designators):

FOOT","SiteCode","LocalModifyDate","LocalPhoto","RemotePhoto"
"1","251536","01","Active","3435","ROCK","CT","1050000","5","3","0"
"Morgan Hill","0","95037","9/24/2002","1/1/1900","0","9/24/2002","3639"

Here's the way it comes out: (an unwanted blank line right-BEFORE the
substitution line):

FOOT","SiteCode","LocalModifyDate","LocalPhoto","RemotePhoto"

"1","251536","01","1","3435","ROCK","CT","1050000","5","3","0"
"Morgan Hill","0","95037","9/24/2002","1/1/1900","0","9/24/2002","3639"

 ...i.e, the word "Active" gets replaced with "1" ...

Here's the code:

#!/usr/bin/perl -w    
#
use strict;
use warnings;
#
# RAW DATA FILE ENTRY FORMAT
# $infile will be:  The raw .txt file to change all STATUS fields 
# $outfile will be:  The modified .txt file with STATUS fields changed
#
my $infile = " ";
my $outfile = " ";
my $line = " ";
#
print "Enter File Name To Convert: ";		#Input file
chomp ($infile = <STDIN>);					
print "Enter Output File Name: "; 		#Output file
chomp ($outfile = <STDIN>);  
#
open (INFILE, $infile) || 
     die "could not open '$infile'  $!"; 	#open file for reading or die
open (OUTFILE ,">>$outfile") || 
     die "could not open '$outfile'  $!"; 	#open file for appending or
die
# Loop for Input File to replace STATUS with Numeric Codes
while ($line = <INFILE>) { 
      $line =~ s/"Active\"/\"1\"/g unless $line !~ m/\"Active\"/;
      $line =~ s/"Pending Release\"/\"2\"/g unless $line !~ m/\"Pending
Release\"/;
      $line =~ s/"Pending Show\"/\"3\"/g unless $line !~ m/\"Pending
Show\"/;
      $line =~ s/"Pending\"/\"4\"/g unless $line !~ m/\"Pending\"/;
      $line =~ s/"Sold\"/\"5\"/g unless $line !~ m/\"Sold\"/;
      $line =~ s/"Expired\"/\"6\"/g unless $line !~ m/\"Expired\"/;
      $line =~ s/"Cancel\"/\"7\"/g unless $line !~ m/\"Cancel\"/;
      $line =~ s/"Withdrawn\"/\"8\"/g unless $line !~ m/\"Withdrawn\"/;
      print OUTFILE "$line\n";
}
close (INFILE);					#close raw input file
close (OUTFILE);				#close output file
### END 

Thank you for any assistance in finding out what the problem is.

Eric


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

Date: Sat, 26 Jul 2003 03:47:49 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: pod2usage verbose problem
Message-Id: <20030725234608.7543f607.jwillmore@cyberia.com>

> i cannot get pod2usage to produce the associated output for verbose
> levels 0 or 1 from the embedded pod. it prints nothing for verbose
> level 0 and 1. verbose level 2 does produce a man page output
> though. how can i get pod2uage to output the embedded pod info for
> verbose level 0 and 1? i tested, and got the same problem, on cygwin
> with perl 5.8 and linux using perl 5.6. thanks in advance for any
> help.

Nothing!?!  I ran the script and it worked as expected with no
modification to the code you provided.  (I know -that's not what you
wanted to hear, but it is the truth - sorry).

I'm thinking it won't hurt anything to re-install the module again.  I
used CPAN to install what's on my system.  If you used the same
approach, you may want to use ye old 'by hand' method (perl
Makefile.PL;make;make test;make install.).  The issue MAY reside with
the install of the module -or- perhaps the version of the module
(version on my system is 1.16).  Make sure you keep an eye on the make
test portion to see if everything tested okay.

HTH

Jim


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

Date: 26 Jul 2003 01:45:53 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Tracking Number
Message-Id: <Xns93C3DD67A2914asu1cornelledu@132.236.56.8>

mjeff1@twcny.rr.com (Jeff Mott) wrote in
news:970676ed.0307251550.95d09b1@posting.google.com: 

>> but it turns out someone
>> has already done a lot of this work. Go to search.cpan.org, and look
>> for modules with Fedex and UPS in the name.
> 
> I already had. I found none that had a method for testing the validity
> of each's respective tracking number. If you see one I did not, please
> let me know.

You know, you can search cpan, you do not have to only rely on your eyes.

http://search.cpan.org/search?query=UPS&mode=all

http://search.cpan.org/search?query=fedex&mode=all


-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: 26 Jul 2003 06:01:58 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Unappropriate ioctl for device
Message-Id: <bft5gm$164$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Benoit Guillon:

> I upgraded Perl from 5.6 to 5.8. The software I develop used to work
> fine with Perl 5.6 and now, sometimes, I get the error "Unappropriate
> ioctl for device" when I try to open a file for write.

That would be odd. There is no ioctl(2) involved when opening regular
files (I just checked with strace). Can you give a small example that
exhibits this behaviour?

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sat, 26 Jul 2003 12:45:25 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: Where to hitch the <<EOF to plaster input file?
Message-Id: <87n0f1opzu.fsf@jidanni.org>

Where do I hitch the <<EOF so I can plaster my input file right into
this source file? Yes, saw man perlop. Yes, I am prepared to give up
-anl if that's the price to pay.

#!/usr/bin/perl -anlw
#Input: each line consists of seconds per rotation of electric meter disk followed by
#a note of what appliances were on at the time.
#Output: total watts, appliance list.  The Kh factor is written on the meter.
#Reference: http://www.earth.uni.edu/EECP/elem/mod2_math.html
BEGIN { $Kh = 7.2 };
unless (/^[^#]/) { next }
$p = 3600 * $Kh / $F[0];
shift @F;
print int($p), "\t@F";


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5274
***************************************


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