[24789] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6942 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 1 14:06:14 2004

Date: Wed, 1 Sep 2004 11: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           Wed, 1 Sep 2004     Volume: 10 Number: 6942

Today's topics:
        Assistance parsing text file using Text::CSV_XS <domenico_discepola@quadrachemicals.com>
    Re: Assistance parsing text file using Text::CSV_XS <gifford@umich.edu>
    Re: Assistance parsing text file using Text::CSV_XS <tadmc@augustmail.com>
        Can a path to a dir contain '.'? (Michael Petersen)
    Re: Can a path to a dir contain '.'? <1usa@llenroc.ude.invalid>
    Re: Can a path to a dir contain '.'? <gifford@umich.edu>
    Re: Can a path to a dir contain '.'? <nobull@mail.com>
    Re: Can a path to a dir contain '.'? <dwall@fastmail.fm>
    Re: Complex Records help <karel@e-tunity.com>
    Re: Complex Records help <tadmc@augustmail.com>
    Re: current time in different timezones incl DST <ddunham@redwood.taos.com>
    Re: HomeFree Script <tadmc@augustmail.com>
        How to emit signals in Glib::Object derived modules? <newsgroups@debain.org>
    Re: Larry Wall & Cults <sholden@holdenweb.com>
    Re: Larry Wall & Cults <mru@mru.ath.cx>
    Re: Open an URL an keep reading from it, non-blocking <postmaster@castleamber.com>
        Perl printer help <joericochuyt@msn.com>
    Re: Perl printer help <1usa@llenroc.ude.invalid>
    Re: PERL5LIB - @INC - machine dependant subdirs <nobull@mail.com>
    Re: Reading UTF-8 string from file with read() function <tadmc@augustmail.com>
    Re: Reading UTF-8 string from file with read() function nobull@mail.com
        When using system() to invoke lynx; connect_timeout ign <booner@hfx.eastlink.ca>
    Re: Write files to a USB device (Bill)
    Re: Xah Lee's Unixism jmfbahciv@aol.com
    Re: Xah Lee's Unixism jmfbahciv@aol.com
    Re: Xah Lee's Unixism jmfbahciv@aol.com
    Re: Xah Lee's Unixism <flavell@ph.gla.ac.uk>
    Re: Xah Lee's Unixism <sholden@holdenweb.com>
    Re: Xah Lee's Unixism joe@invalid.address
    Re: Xah Lee's Unixism (Stan Barr)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 1 Sep 2004 09:47:09 -0400
From: "Domenico Discepola" <domenico_discepola@quadrachemicals.com>
Subject: Assistance parsing text file using Text::CSV_XS
Message-Id: <8nkZc.57417$vO1.308548@nnrp1.uunet.ca>

Hello.  I'm trying to parse a text file into a 2-d array using Text::CSV_XS.
The input file is structured as follows.  "Fields" are separated with a
"\x0d\x0a" (CRLF) and are enclosed in double-quotes.  "Records" are
separated with a "\x0c" (FF).  My fields can contain embedded CRLF's hence
the need for double-quoting.  How can I use Text::CSV_XS to solve my
problem?  My code below only outputs the first line in the input file.
Thanks in advance.


#!perl
use strict;
use warnings;
use diagnostics;
use Text::CSV_XS;

our $g_file_input = shift @ARGV;
die "Usage: $0 filename\n" unless $g_file_input;

######
my (  @arr01 );

#Record seperator - I tried using this and commenting this out
# local $/ = "\x0c";

my $csv = Text::CSV_XS->new( {'sep_char' => "\x0d\x0a", 'binary' => 1,
'always_quote' => 1 } );

open(TFILE, "< ${g_file_input}") || die "$!";
while (<TFILE>) {

 my $line = $_;
 my $status = $csv->parse($line) || print "Cannot parse\n";
 my @arr_temp = $csv->fields();
 push ( @arr01, [@arr_temp]);
 print join('|', $_), "\n" for @arr_temp;

#exiting here for debugging only
 exit;
}
close (TFILE) || die "$!\n";




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

Date: Wed, 01 Sep 2004 11:06:29 -0400
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: Assistance parsing text file using Text::CSV_XS
Message-Id: <qszpt56m3ka.fsf@mspacman.gpcc.itd.umich.edu>

"Domenico Discepola" <domenico_discepola@quadrachemicals.com> writes:

> Hello.  I'm trying to parse a text file into a 2-d array using Text::CSV_XS.
> The input file is structured as follows.  "Fields" are separated with a
> "\x0d\x0a" (CRLF) and are enclosed in double-quotes.  "Records" are
> separated with a "\x0c" (FF).  My fields can contain embedded CRLF's hence
> the need for double-quoting.  How can I use Text::CSV_XS to solve my
> problem?  My code below only outputs the first line in the input file.
> Thanks in advance.

Text::CSV_XS assumes that it's handed a full record at a time, and
expects you to independently figure out where one record ends and the
next one begins.

So you have three choices.

The easiest is to use Text::xSV instead of Text::CSV_XS.  This handles
embedded newlines as you'd expect, and in general works quite well.
Unfortunately I've found it's about 6 times slower than Text::CSV_XS.
If you can't afford that kind of slowdown, read on.

The next easiest thing to do is find record boundaries on your own.
In one application I wrote, I found this worked well; the file I had
always had lines ending in a quote followed by a newline, so I just
kept appending lines to a buffer until I found a quote at the end of a
line that wasn't preceded by an escape character, then passed it on to
Text::CSV_XS.  This won't work with all data files, so it might not be
for you.

The third option is to take each line, ask Text::CSV_XS to parse it,
and if it fails, append the next line and try again.  This should work
with properly formed CSV files, but will behave poorly in the face of
an error; if there's some corruption on the first line, you may not
read anything, since it will keep appending and finding the same
error.

Good luck!

----ScottG.


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

Date: Wed, 1 Sep 2004 10:32:26 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Assistance parsing text file using Text::CSV_XS
Message-Id: <slrncjbqsa.5oh.tadmc@magna.augustmail.com>

Domenico Discepola <domenico_discepola@quadrachemicals.com> wrote:

> I'm trying to parse a text file 


We need the data as well as the code if we are to be able
to test the code...


> "Records" are
> separated with a "\x0c" (FF).  My fields can contain embedded CRLF's hence
> the need for double-quoting.


> our $g_file_input = shift @ARGV;


   You should always prefer lexical (my) variables over package (our)
   variables, except when you can't.


And you can, so make that:

   my $g_file_input = shift @ARGV;


> #Record seperator - I tried using this and commenting this out
> # local $/ = "\x0c";


If you leave it commented out, then you are reading 1 line at
a time rather than 1 record at a time.

I don't see how it would not be working if uncommented...

 ... if I had data to run it against I could try it and see.

But I don't, so I can't.  (hint)


> open(TFILE, "< ${g_file_input}") || die "$!";


Why the unnecessary curly braces?


> while (<TFILE>) {
>  my $line = $_;


If you want it in $line then put it there rather than putting
it somewhere else only to copy it to where you really want
it to be.

Calling it a "line" when it is not a line is asking for trouble.

   while ( my $record = <TFILE> ) {  # $record instead of $line


>  my @arr_temp = $csv->fields();
>  push ( @arr01, [@arr_temp]);


No need to copy all that data, just take a reference directly:

    push ( @arr01, \@arr_temp);


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


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

Date: Wed, 1 Sep 2004 17:53:05 +0200
From: micFJERN@reflector.dk (Michael Petersen)
Subject: Can a path to a dir contain '.'?
Message-Id: <1gjg3pb.1z0qu4twwzy9eN%micFJERN@reflector.dk>

I really don't no much about perl or unix stuff so can anyone tell me if
a path in a perlscript to a directory can look like this
/www.domain.com/dir1/dir2 ??

My webhotelhost tells me this but I thought that a path in a perlscript
could not consist of dots and www? Am I wrong?

The reason why I ask is because I just changed webhotel and now my
script doesn't work - and I believe it's a problem with my paths.

Thanks, Michael 


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

Date: 1 Sep 2004 16:24:55 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Can a path to a dir contain '.'?
Message-Id: <Xns95577E4D13159asu1cornelledu@132.236.56.8>

micFJERN@reflector.dk (Michael Petersen) wrote in 
news:1gjg3pb.1z0qu4twwzy9eN%micFJERN@reflector.dk:

> I really don't no much about perl 

Then you might consider learning: http://learn.perl.org/

> a path in a perlscript 

No such thing called perlscript. ITYM Perl script.

> to a directory can look like this /www.domain.com/dir1/dir2 ??

Of course.

> My webhotelhost 

What is a webhotel?

> tells me this but I thought that a path in a perlscript
> could not consist of dots and www? Am I wrong?

Yes.

> The reason why I ask is because I just changed webhotel and now my
> script doesn't work - and I believe it's a problem with my paths.

perldoc -q 500


-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Wed, 01 Sep 2004 12:30:20 -0400
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: Can a path to a dir contain '.'?
Message-Id: <qsz1xhmc5pf.fsf@mspacman.gpcc.itd.umich.edu>

micFJERN@reflector.dk (Michael Petersen) writes:

> I really don't no much about perl or unix stuff so can anyone tell me if
> a path in a perlscript to a directory can look like this
> /www.domain.com/dir1/dir2 ??

That's a perfectly acceptable path.

----ScottG.


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

Date: Wed, 01 Sep 2004 18:24:34 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Can a path to a dir contain '.'?
Message-Id: <ch50ci$m5e$2@sun3.bham.ac.uk>

A. Sinan Unur wrote:

> No such thing called perlscript.

There is something called PerlScript - a Perl plugin for the Windows 
scripting engine.

> ITYM Perl script.

I think he meant Perl script not PerlScript too.



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

Date: Wed, 01 Sep 2004 17:37:28 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Can a path to a dir contain '.'?
Message-Id: <Xns95578A98B7A79dkwwashere@216.168.3.30>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote in message 
<news:Xns95577E4D13159asu1cornelledu@132.236.56.8>:

> micFJERN@reflector.dk (Michael Petersen) wrote in 
> news:1gjg3pb.1z0qu4twwzy9eN%micFJERN@reflector.dk:
> 
>> a path in a perlscript 
> 
> No such thing called perlscript. ITYM Perl script.

Well, there's the PerlScript that comes with Activestate Perl:

"PerlScript is an ActiveX scripting engine that allows you to 
use Perl with any ActiveX scripting host."

I've no idea whether or not that's what the OP meant. (But I 
doubt it. <g>)



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

Date: Wed, 01 Sep 2004 16:00:18 +0200
From: Karel Kubat <karel@e-tunity.com>
Subject: Re: Complex Records help
Message-Id: <4135d5f2$0$29712$e4fe514c@dreader14.news.xs4all.nl>

Hi,

I've looked at your code snippet and here's a slightly alternative form.
Comments are in my code. It's a somewhat different approach to your
program, but I think that it illustrates hash refs and so on. Also, it
parses the full /etc/passwd and not only the root entry.

Luck, Karel

-- SNIP
!/usr/bin/perl -w

# Always do:
use strict;

# We don't need this one.. see below.
# $UserInfoRec = {
#     PASSWDINFO => { LOGINNAME => "",
#                     PASSWORD => "",
#                     USERID => "",
#                     USERGRP => "",
#                     RESERVED => "",
#                     WORKINGDIR=> "",
#                     SHELL => "" },
#     DATABASEINFO   => {%DBEnv}
# };
# Instead we do:
my $UserInfoRec;

# We will use this anonymous hash as follows:
# $userinfo->{root} ==> entry for 'root' and so on, which is a ref to
# another anon hash
# $userinfo->{root}->{home} ==> value of the homedir etc..

# read the passwd db function. Suggested: () to show the prototype
sub readpasswd () {
    open(PASSWD,"/etc/passwd")
        or die "Cannot read passwd file ? ($?)";

    while (<PASSWD>) {
        chomp;
        my ($uname, undef, $uid, $gid, $name, $home, $shell) =
            split (/:/);

        $UserInfoRec->{$uname}->{uid} = $uid;
        $UserInfoRec->{$uname}->{gid} = $gid;
        $UserInfoRec->{$uname}->{name} = $name;
        $UserInfoRec->{$uname}->{home} = $home;
        $UserInfoRec->{$uname}->{shell} = $shell;
    }
    close (PASSWD);
}

# Another function to show traversal
sub printpasswd () {
    foreach my $uname (sort (keys (%$UserInfoRec))) {
        printf ("\n" .
                "User:        %s\n" .
                "Uid / gid:   %s %s\n" .
                "Full name:   %s\n" .
                "Home dir:    %s\n" .
                "Login shell: %s\n",
                $uname,
                $UserInfoRec->{$uname}->{uid},
                $UserInfoRec->{$uname}->{gid},
                $UserInfoRec->{$uname}->{name},
                $UserInfoRec->{$uname}->{home},
                $UserInfoRec->{$uname}->{shell});
    }
}


# Main..
readpasswd();
printpasswd();
-- SNIP

-- 
Karel Kubat <karel@e-tunity.com, karel@qbat.org>
Phone: mobile (+31) 6 2956 4861, office (+31) (0)38 46 06 125
PGP fingerprint: D76E 86EC B457 627A 0A87  0B8D DB71 6BCD 1CF2 6CD5

  What is it that makes a complete stranger dive into an icy river
  to save a solid gold baby?  Maybe we'll never know.



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

Date: Wed, 1 Sep 2004 09:33:41 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Complex Records help
Message-Id: <slrncjbne5.5kd.tadmc@magna.augustmail.com>

Traveller2003 <vavavoom_th14@yahoo.co.uk> wrote:

> open(PASSWD,"/etc/passwd") or die "Cannot read passwd file ? ($?)";
                                                                ^^
                                                                ^^

You have the wrong variable there.

You want "$!" instead.


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


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

Date: Wed, 01 Sep 2004 16:36:51 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: current time in different timezones incl DST
Message-Id: <DUmZc.14095$6D3.11922@newssvr27.news.prodigy.com>

Marcus <mygooglegroupsaccount@yahoo.com> wrote:
> Im currently calculating the current time for cities around the globe,
> based on my servers time, trying to keep track on DST dates in a
> separete file to make it accurate(ish).

> Im sure there are solid solutions out there to do this? Eg, print the
> current time in New York, Berlin, Sydney etc.

I would normally just use the OS's support for this..

my @cities_to_timezone = (
  [ "New York",	       "US/Eastern" ],
  [ "Berlin",	       "Europe/Berlin"],
  [ "Sydney",	       "Australia/NSW"],
                         );

foreach (@cities_to_timezone)
{
  $ENV{'TZ'} = $_->[1];
  print $_->[0], ": ", scalar localtime, "\n";
}

-- 
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: Wed, 1 Sep 2004 09:35:13 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HomeFree Script
Message-Id: <slrncjbnh1.5kd.tadmc@magna.augustmail.com>

tony <tony@dontwrite.invalid> wrote:

> Any suggestions on a Homefree replacement?


That would be somewhat easier to answer if you told us what
it is that Homefree does...


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


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

Date: Wed, 01 Sep 2004 18:34:12 +0200
From: Samuel Abels <newsgroups@debain.org>
Subject: How to emit signals in Glib::Object derived modules?
Message-Id: <pan.2004.09.01.16.34.12.841188@debain.org>

Hello,

I am trying to implement a module derived from Glib::Object. This
works fine, except for when I want my module to emit a self-defined
signal.

I know from the Gtk-Perl documentation that the signal has to be
registered first.
So this is what I figured should be right according to the docs:

------------------------------------------------
#!/usr/bin/env perl
package TestClass;
use strict;
use Gtk2 '-init';
use vars qw(@ISA $VERSION);
@ISA = qw(Glib::Object);

$VERSION = 0.01;

use Glib::Object::Subclass
    TestClass::,
    signals => {
      my_new_signal => {
        class_closure => sub { print "BLA\n" },
        flags         => [qw(run-first)],
        return_type   => undef,
        param_types   => []
      }
    };


sub new {
  [...];
}
------------------------------------------------

Unfortunately, this produces an error message:

Uncaught exception from user code:
        package RouterInterfaceConfig has not been registered with
GPerl at /usr/lib/perl5/Glib/Object/Subclass.pm line 225.
BEGIN failed--compilation aborted at ./test.pl line 11.

Google was not helpful. I'm clueless.

Any hints?

Thanks,
Samuel
-- 
 ------------------------------------------------------
|      Samuel Abels       |   http://www.debain.org    |
| spam ad debain dod org  | knipknap ad jabber dod org |
 ------------------------------------------------------



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

Date: Wed, 01 Sep 2004 11:54:21 -0400
From: Steve Holden <sholden@holdenweb.com>
Subject: Re: Larry Wall & Cults
Message-Id: <3jmZc.17355$ni.11047@okepread01>

Brian {Hamilton Kelly} wrote:

> On Sunday, in article
>      <pan.2004.08.30.00.02.19.911327@bar.net> foo@bar.net "Mac"
>      wrote:
> 
> 
>>Hmm. No explicit comparison was made, but since the post is a cautionary
>>tale (well, the post is a rambling mess, but I think it is trying to be a
>>cautionary tale) I think the comparison is understood.
> 
> 
> "Cautionary tale"????  Cautionary tale, my arse.
> 
> The post was the fuckwitted ramblings of a total raving looney; kill the
> thread (and the original poster) and forget about it.
> 
Snicker. Definitely the most sensible suggestion I've seen so far.

regards
  Steve


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

Date: Wed, 01 Sep 2004 19:04:43 +0200
From: =?iso-8859-1?q?M=E5ns_Rullg=E5rd?= <mru@mru.ath.cx>
Subject: Re: Larry Wall & Cults
Message-Id: <yw1xllft3opg.fsf@mru.ath.cx>

Steve Holden <sholden@holdenweb.com> writes:

> Brian {Hamilton Kelly} wrote:
>
>> On Sunday, in article
>>      <pan.2004.08.30.00.02.19.911327@bar.net> foo@bar.net "Mac"
>>      wrote:
>>
>>>Hmm. No explicit comparison was made, but since the post is a cautionary
>>>tale (well, the post is a rambling mess, but I think it is trying to be a
>>>cautionary tale) I think the comparison is understood.
>> "Cautionary tale"????  Cautionary tale, my arse.
>> The post was the fuckwitted ramblings of a total raving looney; kill
>> the
>> thread (and the original poster) and forget about it.
>>
> Snicker. Definitely the most sensible suggestion I've seen so far.

That would of course make it a cautionary tale.

-- 
Måns Rullgård
mru@mru.ath.cx


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

Date: 1 Sep 2004 15:39:49 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Open an URL an keep reading from it, non-blocking
Message-Id: <Xns95576C74C97A6castleamber@130.133.1.4>

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote in
news:ch3oa1$ue5$1@agate.berkeley.edu: 

> [A complimentary Cc of this posting was sent to
> John Bokma 
> <postmaster@castleamber.com>], who wrote in article
> <Xns9556DF6614453castleamber@130.133.1.4>: 
>> "Uwe Disch" <uwe.disch@gmx.net> wrote in
>> news:fogf02-e87.ln1@news.disch- online.de:
> 
>> Uhm, it has nothing to do with Apache, nor rewriting. I want to read
>> a infinite document and printing each line when it comes in. Can't
>> use the HTTP::Request stuff, since it reads all (which never
>> finishes), and then returns.
> 
> My copy of lwp-rget supports --progress option.  This clearly shows
> that your analysis of "HTTP::Request stuff" is faulty.  Read the docs
> again.

I did, and I am right, and you are right. Thanks for the pointer, grmbl, I 
*should* have read the lwp-cookbook, heading LARGE DOCUMENTS :-(

-- 
John                               MexIT: http://johnbokma.com/mexit/
                           personal page:       http://johnbokma.com/
        Experienced programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html


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

Date: Wed, 01 Sep 2004 11:29:39 -0400
From: "yusufdestina" <joericochuyt@msn.com>
Subject: Perl printer help
Message-Id: <62e9594995cbab90821d5ea3fc506ff8@localhost.talkaboutprogramming.com>

I want to send some data to my printer, but I'm a newbie at this level..
I've installed Win32::Printer and also Printer with ppm.
OS is Win XP
Printername : hp deskjet 920c
Port: USB001
When I execute the examples I get this error...
Can't locate object "new" via package "Win32::Printer"...
The script I use:
-----------------------------------------------------------
#!/usr/bin/perl
use Printer;
use Win32::Printer;
$data = "Test";
$prn = new Printer('MSWin32' => 'USB001',$OSNAME => 'hp deskjet 920c');
$prn->print($data);
-----------------------------------------------------------
Any examples our useful links about this are appreciated!



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

Date: 1 Sep 2004 16:45:11 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl printer help
Message-Id: <Xns955781BC5305Aasu1cornelledu@132.236.56.8>

"yusufdestina" <joericochuyt@msn.com> wrote in
news:62e9594995cbab90821d5ea3fc506ff8@localhost.talkaboutprogramming.com:

> I want to send some data to my printer, but I'm a newbie at this
> level.. I've installed Win32::Printer and also Printer with ppm.
> OS is Win XP
> Printername : hp deskjet 920c
> Port: USB001
> When I execute the examples I get this error...
> Can't locate object "new" via package "Win32::Printer"...
> The script I use:
> -----------------------------------------------------------
> #!/usr/bin/perl

use strict;
use warnings;

> use Printer;
> use Win32::Printer;
> $data = "Test";

my $data = 'Test';

> $prn = new Printer('MSWin32' => 'USB001',$OSNAME => 'hp deskjet
> 920c'); $prn->print($data);

my $prn = Printer->new(
    	MSWin32 => 'USB001',
    	$OSNAME => 'hp deskjet 920c',
);

> -----------------------------------------------------------
> Any examples our useful links about this are appreciated!

The problem is that ppm seems not to actuall install Win32::Printer when 
asked for it. It downloads and save a 45 byte file some place which I 
cannot find upon exiting ppm.

So, head on over to http://search.cpan.org/ and locate the 
Win32::Printer. It turns out the current version is far ahead of the AS 
supplied one. The intstructions for installation can be found at:

http://search.cpan.org/~wasx/Win32-Printer-0.8.3/Printer.pm

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Wed, 01 Sep 2004 18:20:33 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: PERL5LIB - @INC - machine dependant subdirs
Message-Id: <ch5053$m5e$1@sun3.bham.ac.uk>



Koos Pol wrote:

> Is there a common way to construe the machine/architecture
> dependent subdirectries below a lib dir and have them added to
> @INC?

Yes.  Use a sub-directory that matches the archname.

> Background:
> I want to keep a local DBI and DBD with my application. When
> building the Msql-Mysql-modules it says:
> 
> "Using DBI 1.32 installed
> in /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi/auto/DBI"
> 
> This message in spewed
> by /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi/DBI/DBD.pm
> Now to find modules DBD simply greps @INC (which only includes my
> local lib dir /home/koos/my_perl_app/lib (set by PERL5LIB) and
> not the machine dependent subdirs below it.

Hmmm... it works OK for me in 5.6.1 and 5.8.0 on Linux.

Can I just confirm - you are saying that:

   PERL5LIB=/home/koos/my_perl_app/lib

And there is at least one of the directories:

   /home/koos/my_perl_app/lib/5.8.0/i586-linux-thread-multi
   /home/koos/my_perl_app/lib/i586-linux-thread-multi

And you are running perl 5.8.0

But that those directories do not appear in @INC?

One thing I have noticed on my rather buggered-about-with install of 
5.8.0 is that the achitecture name in the /usr/lib/perl5/site_perl/5.8.0 
hierachy is in fact not the true archname as reported by perl -v.

Check that perl -v reports i586-linux-thread-multi as the architecture.

BTW: You really should be using a later 5.8.x!



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

Date: Wed, 1 Sep 2004 09:30:38 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Reading UTF-8 string from file with read() function.
Message-Id: <slrncjbn8e.5kd.tadmc@magna.augustmail.com>

dr@dark.com <dr@dark.com> wrote:
>> Read the string from file as binary and then utf8::decode() it.
> 
> And where would one go to find utf8::decode? I am on page 22 of CPAN
> and still haven't found it. 


I entered "utf8" at search.cpan.org and it was the 1st hit!

I entered "perldoc utf8" at the command line. There it is!


> Just out of curiosity, was the search function on CPAN written by a
> special ed student? Jesus on Prozac, it blows.


Something blows alright, but it is not the _developers_ of the application...


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


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

Date: 1 Sep 2004 10:47:28 -0700
From: nobull@mail.com
Subject: Re: Reading UTF-8 string from file with read() function.
Message-Id: <4dafc536.0409010947.2fe876a7@posting.google.com>

sergeisn-tma@yahoo.com (Sergei) wrote in message news:<1ce4f694.0408311918.29765621@posting.google.com>...
> Brian McCauley <nobull@mail.com> wrote in message 
> > ...
> > Read the string from file as binary and then utf8::decode() it.
>
> use Encode 'decode_utf8';
> $Unicode = decode_utf8($bytes);
> And it works !

Yes, you can use Encode::decode_utf8() instead of the builtin
utf8::decode() if you like.  Note: when called with a single agument
Encode::decode_utf8() is simply a wrapper for utf8::decode().


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

Date: Wed, 01 Sep 2004 13:43:53 -0300
From: Dan Johnson <booner@hfx.eastlink.ca>
Subject: When using system() to invoke lynx; connect_timeout ignored
Message-Id: <4135FC49.1060604@hfx.eastlink.ca>

Hello All.

It has been my habit, for some time now , to use lynx; called through 
the Perl system() command;  to grab web pages for processing. The  LWP 
module would probably do a better job; yet old habits are hard to 
break.  That said; my old habit is not doing the job for me at the 
moment.  The call in the code is as follows:

system ("/bin/lynx -dump -source $url > $work_file2");

The /etc/lynx.cfg is set with:

 .h2 CONNECT_TIMEOUT
# Specifies (in seconds) connect timeout. Not available under DOS (use
# sockdelay parameter of wattcp). Default value is rather huge.
CONNECT_TIMEOUT:60

Yet lynx does not seem to be timing out after 60 seconds.

My question is by using the system() command to summon lynx could that 
be somehow overriding the connect_timeout setting?

Thanks for any help or insights in advance.



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

Date: 1 Sep 2004 11:01:04 -0700
From: wherrera@lynxview.com (Bill)
Subject: Re: Write files to a USB device
Message-Id: <239ce42f.0409011001.2e236d0b@posting.google.com>

"Bob Morton" <bmortonaz@yahoo.com> wrote in message news:<xEbZc.37492$bT1.16373@fed1read07>...
> I have a Dell DJ MP3 player and I've written a Perl script to select music
> from my library to copy to the device.  Now I'm looking for a snippet of
> Perl to open a USB device for writing files.  The problem is that the device
> is not mounted with a drive letter.  It shows up in Windows Explorer as a
> Mobile Device.  Any help is appreciated.


Use the DudeBox add-in web server link, then use LWP to transfer files?


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

Date: Wed, 01 Sep 04 11:56:58 GMT
From: jmfbahciv@aol.com
Subject: Re: Xah Lee's Unixism
Message-Id: <4135cbcd$0$19726$61fed72c@news.rcn.com>

In article <41337FC9.8070902@hotmail.com>,
   Antony Sequeira <usemyfullname@hotmail.com> wrote:
>Andre Majorel wrote:
>> On 2004-08-28, Rob Warnock <rpw3@rpw3.org> wrote:
>> 
>>>Pascal Bourguignon  <spam@mouse-potato.com> wrote:
>>>+---------------
>>>| $ telnet xahlee.org 80;
>>>| Trying 208.186.130.4...
>>>| Connected to xahlee.org.
>>>| Escape character is '^]'.
>>>| GET / HTTP/1.1
>>>| 
>>>| HTTP/1.1 400 Bad Request
>>>| Date: Fri, 27 Aug 2004 01:35:52 GMT
>>>| Server: Apache/2.0.50 (Fedora)
>>>|         ^^^^^^^^^^^^^^^^^^^^^^
>>>+---------------
>>>
>>>So are you complaining about the fact that his hosting provider
>>>preloaded RedHat Fedora with Apache 2.0 for him?
>> 
>> 
>> There is no shortage of Windows-based hosting companies, so why
>> didn't he go there ? Whatever your opinions, it's best to put
>> your money where your mouth is if you expect to be taken
>> seriously.
>> 
>Windows (MS) is not 'Unixism'?

Good bitgod, no.  AAMOF, Windows would be much improved if
it cut off its balls.

/BAH

Subtract a hundred and four for e-mail.


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

Date: Wed, 01 Sep 04 12:07:35 GMT
From: jmfbahciv@aol.com
Subject: Re: Xah Lee's Unixism
Message-Id: <4135ce4a$0$19726$61fed72c@news.rcn.com>

In article <j-OdnS-Q8aADqKjcRVn-tQ@speakeasy.net>,
   rpw3@rpw3.org (Rob Warnock) wrote:
>Craig A. Finseth  <news@finseth.com> wrote:
>+---------------
>| Ville Vainio  <ville@spammers.com> wrote:
>| >... and / as path separator still screws up most of their cmd line
>| >programs (which think / is for command line options).
>| >Microsoft probably thought avoiding compatibility is a good idea, and
>| >have only lately started to have some regrets...
>| 
>| Wrong.  The / was chosen as the command line option separator because
>| whoever wrote MSDOS was looking to CP/M, who modelled their commands
>| after a PDP-11 operating system (RT-11?).
>+---------------
>
>Which, like PS/8 & OS-8 [and "DECsystem-8" from Geordia Tech] for the
>PDP-8, modelled the command syntax after that of the venerable PDP-10!!

You'ld probably get further about who's on first by knowing that
the guy who did OS-8 also did TOPS-10 monitor work.  It was not
unusual for one guy to work on all architectures within DEC.
If he liked to use TECO, he'd carry it over to the next project
and write it up in that computer's machine language.  An even
easier way to transfer functionality back then was to use
a cross-assembler.  For instance, I'd enter a programmer's PDP-11
code and put it into a file on the TOPS-10 system.  Then after
a fast assembler check with the cross-assembler of the coder's
choice, I would either punch the ASCII out of papertape or
run FILEX which would transfer the PDP-10 bits onto the DECtape
in PDP-11 format.

That's how code migrated in the olden days.
>
>+---------------
>| Consider the "PIP" command.
>+---------------
>
>Indeed. And COPY & DEL & DIR, etc.

Well, not quite :-).  COPY and DELETE called PIP via a CCL
command.  DIRECT became its own program.  To do a directory
using PIP required a switch and wasn't a monitor level 
command.

/BAH

Subtract a hundred and four for e-mail.


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

Date: Wed, 01 Sep 04 12:09:01 GMT
From: jmfbahciv@aol.com
Subject: Re: Xah Lee's Unixism
Message-Id: <4135cea1$0$19726$61fed72c@news.rcn.com>

In article <aN2Zc.10226$QJ3.5466@newssvr21.news.prodigy.com>,
   red floyd <no.spam@here.dude> wrote:
>CBFalconer wrote:
>
>> Dump Notepad and get Textpad.  www.textpad.com.  First class.
>> 
>
>Let the editor flame wars begin!
>
>Get gvim!  www.vim.org

You think notepad is an editor?  <snort>  You must be young
and inexperienced in the ways of Real Man's Editing sports.

/BAH

Subtract a hundred and four for e-mail.


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

Date: Wed, 1 Sep 2004 15:19:14 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Xah Lee's Unixism
Message-Id: <Pine.LNX.4.61.0409011503400.4389@ppepc56.ph.gla.ac.uk>

On Wed, 1 Sep 2004 jmfbahciv@aol.com wrote:

> You'ld probably get further about who's on first by knowing that
> the guy who did OS-8 also did TOPS-10 monitor work.

I have here my manual of the "Cambridge Multiple-Access System - 
User's Reference Manual" (that's Cambridge, England) dated 1968.  The 
file system hierarchy separator is "/".

I don't know where -they- got the convention from in the first place, 
admittedly.

ObPDP:  the TITAN system had a PDP7 as a peripheral device, sort-of.


-- 
   "The disc file has a capacity of about 8 million words".


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

Date: Wed, 01 Sep 2004 11:53:13 -0400
From: Steve Holden <sholden@holdenweb.com>
Subject: Re: Xah Lee's Unixism
Message-Id: <%hmZc.17354$ni.569@okepread01>

jmfbahciv@aol.com wrote:

> In article <aN2Zc.10226$QJ3.5466@newssvr21.news.prodigy.com>,
>    red floyd <no.spam@here.dude> wrote:
> 
>>CBFalconer wrote:
>>
>>
>>>Dump Notepad and get Textpad.  www.textpad.com.  First class.
>>>
>>
>>Let the editor flame wars begin!
>>
>>Get gvim!  www.vim.org
> 
> 
> You think notepad is an editor?  <snort>  You must be young
> and inexperienced in the ways of Real Man's Editing sports.
> 
My choice? Definitely TECO, a real programmable editor from the TOPS10 days.

It would create a file if invoked by the "make" command. If you typed 
"make love" it would respond with "...not war?" before beginning the edit.

regards
  Steve


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

Date: Wed, 01 Sep 2004 16:10:26 GMT
From: joe@invalid.address
Subject: Re: Xah Lee's Unixism
Message-Id: <m3vfeyc6mn.fsf@invalid.address>

Steve Holden <sholden@holdenweb.com> writes:

> jmfbahciv@aol.com wrote:
> 
> > In article <aN2Zc.10226$QJ3.5466@newssvr21.news.prodigy.com>,
> >    red floyd <no.spam@here.dude> wrote:
> >
> >>CBFalconer wrote:
> >>
> >>
> >>>Dump Notepad and get Textpad.  www.textpad.com.  First class.
> >>>
> >>
> >>Let the editor flame wars begin!
> >>
> >>Get gvim!  www.vim.org
> > You think notepad is an editor?  <snort>  You must be young
> > and inexperienced in the ways of Real Man's Editing sports.
> >
> My choice? Definitely TECO, a real programmable editor from the
> TOPS10 days.
> 
> It would create a file if invoked by the "make" command. If you
> typed "make love" it would respond with "...not war?" before
> beginning the edit.

But can it quote Zippy the Pinhead?

Joe
-- 
If you don't think too good, don't think too much
  - Ted Williams


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

Date: 01 Sep 2004 17:32:08 GMT
From: stanb45@dial.pipex.com (Stan Barr)
Subject: Re: Xah Lee's Unixism
Message-Id: <slrncjb22a.4rn.stanb45@citadel.metropolis.local>

On Tue, 31 Aug 2004 16:13:36 -0400, Sherm Pendley <spamtrap@dot-app.org> wrote:
>red floyd wrote:
>
>> Let the editor flame wars begin!
>
>Anyone else remember Blackbeard?

Strangely enough I came across a floppy with that on yesterday...
(I've been sorting out my old 5.25-inch floppies with a view to archiving
them all on a spare hard disk...)

I use BBEdit, but you need a Mac for that :-)

-- 
Cheers,
Stan Barr     stanb .at. dial .dot. pipex .dot. com
(Remove any digits from the addresses when mailing me.)

The future was never like this!


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

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

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

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

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


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


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