[22073] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4295 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 20 06:05:40 2002

Date: Fri, 20 Dec 2002 03:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 20 Dec 2002     Volume: 10 Number: 4295

Today's topics:
    Re: Can't find unicode character property definition <goldbb2@earthlink.net>
    Re: Can't find unicode character property definition (Helgi Briem)
    Re: comparing mangled times perlistically! (qanda)
    Re: csv file to mysql import <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
        Datum in Epoch Sekunden umrechnen <hans.moser@reflex.com>
    Re: Datum in Epoch Sekunden umrechnen <hans.moser@reflex.com>
    Re: enviroment variable set <palladium@spinn.net>
    Re: getstore not working - please help <bart.lateur@pandora.be>
        incorporating off-site content <bashbrothers@cox.net>
    Re: incorporating off-site content <bashbrothers@cox.net>
    Re: Localising large data structures to a sub <simon.andrews@bbsrc.ac.uk>
    Re: map and s/// on @list <bart.lateur@pandora.be>
    Re: Re: enviroment variable set <happier_tj@hotmail.com>
    Re: Replacing text strings contains more than 1 dot (Eric)
    Re: Replacing text strings contains more than 1 dot (Helgi Briem)
        SFTP: compiltion error from prerequisite Math::GMP (Alain)
    Re: Strange behaviour with windows task scheduler <s.patterson@freeuk.com>
    Re: telnet not waiting for command to finish news@roaima.freeserve.co.uk
    Re: Tied Filehandles <ahamm@mail.com>
    Re: Tied Filehandles <tassilo.parseval@post.rwth-aachen.de>
    Re: Tied Filehandles <ahamm@mail.com>
    Re: Tied Filehandles (Anno Siegel)
    Re: Why does Perl handle "return undef;" differently th (Helgi Briem)
    Re: Wierd loop/chdir behavior (Steve Walker)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Dec 2002 02:30:52 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Can't find unicode character property definition
Message-Id: <3E02C72C.FF8B0325@earthlink.net>

blueice_sg7 wrote:
> 
> Hi,
> 
> I am attempting to install Image-Magick (version 5.5.2) on a Windows
> 98 machine.
> 
> After issuing the following command,
> 
> ppm install c:\ImageMagick\image-magick.ppd
> 
> I receive the error "Can't find unicode character property definition
> via main->e or e.pl at unicode/IS/e.pl line 0".

This type of error occurs whenever you have a regex containing any of
the following \pe, \Pe, \p{e}, \P{E} ... this causes perl to try and
find an 'e' property, to find a character that [doesn't] match it.

Most likely, you've got some file path (c:\foo\bar), in which after one
of the backslashes is a string 'pe' ... this path is being used as a
regex, without having been escaped by quotemeta or \Q.


> Any ideas on how I should go about resolving this issue? I am using
> ActivePerl version 5.6.1 build 633.

Finding out where this is occuring could be quite difficult...  Insert a
couple lines of code in the ppm program that says:

   use Carp ();
   $SIG{__DIE__}  = \&Carp::croak;
   $SIG{__WARN__} = \&Carp::confess;

[untested]

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Fri, 20 Dec 2002 10:25:02 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Can't find unicode character property definition
Message-Id: <3e02ef7e.1347307185@news.cis.dfn.de>

On Fri, 20 Dec 2002 03:49:38 +0000, blueice_sg7
<member@dbforums.com> wrote:

>I am attempting to install Image-Magick (version 5.5.2) on a 
>Windows 98 machine.
>
>After issuing the following command,
>
>ppm install c:\ImageMagick\image-magick.ppd

Why are you doing that?

Why not simply:
ppm install Image::Magick

If that is not working for you, I suggest that your
proxy settings are wrong.  Read perldoc PPM 
under "ENVIRONMENT VARIABLES" for details.
-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: 20 Dec 2002 02:58:41 -0800
From: fumail@freeuk.com (qanda)
Subject: Re: comparing mangled times perlistically!
Message-Id: <62b4710f.0212200258.5427cf49@posting.google.com>

> > > Where do people learn this stuff?  :-)
> > Sorry, I'm not sure what you mean (spaces?), can you explain.
> 
> Using a negative number for the third argument to split is probably not
> what you need.

Thanks for the reply Johh, as you said, in the example I gave limit
would not be needed, however the example was shortened for the
posting.  In reality I must maintain field numbers and position to tie
up with external field maps.

Thanks again for the help.


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

Date: Fri, 20 Dec 2002 07:28:51 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: csv file to mysql import
Message-Id: <newscache$3cne7h$9em$1@news.emea.compuware.com>

Brian McCauley wrote (Thursday 19 December 2002 18:42):

> Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> writes:
> 
>> Arunav Mandal wrote (Thursday 19 December 2002 14:55):
> 
>> > use vars qw(
>> >             $q
>> >             );
>> > 
>> > $q = CGI->new;
>> 
>>     I don't see any global use/need of $g. Instead, use:
>>     
>>     my $q = $CGI->new;
> 
> Note: most of the objections raised to global variables are objections
> to the programming style that uses them.  For these purposes lexical
> variables declared at file scope still count as global variables so
> just chaning 'use vars' or 'our' to 'my' doesn't address the concerns
> that prompted the original objections.


This is an interesting observation. But is does raise another question:
Is *file* scoping then something magic? If I declare a "my" three subs deep, 
is that any different than declaring the "my" at the top level -- that is 
the file? Doesn't it have the same purpose? Hmmm...

-- 
KP



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

Date: Fri, 20 Dec 2002 11:22:24 +0100
From: Hans Moser <hans.moser@reflex.com>
Subject: Datum in Epoch Sekunden umrechnen
Message-Id: <3E02EF60.2030208@reflex.com>

Hallo,

habt Ihr wahrscheinlich schon 200x
hier durchgekaut.

Ich moechte ein Datum tt-mm-jj in
Epoch Sekunden umrechnen.

Perl FAQ sagt:
How can I take a string and turn it into epoch seconds?

If it's a regular enough string that it always has the same format, you 
can split it up and pass the parts to timelocal in the standard 
Time::Local module. Otherwise, you should look into the Date::Calc and 
Date::Manip modules from CPAN.

Ok, aufsplitten ist soweit kein Problem.

z.B. 4 Tage, 5 Monte, 2002 Jahre
Das ganze jetzt mal die Anzahl der Sekunden,
wobei die Jahreszahl von 1973 abgezogen wird?

Das geht doch bestimmt eleganter, oder?

Gruesse
Hans Moser



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

Date: Fri, 20 Dec 2002 11:24:13 +0100
From: Hans Moser <hans.moser@reflex.com>
Subject: Re: Datum in Epoch Sekunden umrechnen
Message-Id: <3E02EFCD.608@reflex.com>

Ups, i am sorry for the written language,
wrong newsgroup!

please ignore.


Hans Moser schrieb:
> Hallo,
> 
> habt Ihr wahrscheinlich schon 200x
> hier durchgekaut.
> 
> Ich moechte ein Datum tt-mm-jj in
> Epoch Sekunden umrechnen.
> 
> Perl FAQ sagt:
> How can I take a string and turn it into epoch seconds?
> 
> If it's a regular enough string that it always has the same format, you 
> can split it up and pass the parts to timelocal in the standard 
> Time::Local module. Otherwise, you should look into the Date::Calc and 
> Date::Manip modules from CPAN.
> 
> Ok, aufsplitten ist soweit kein Problem.
> 
> z.B. 4 Tage, 5 Monte, 2002 Jahre
> Das ganze jetzt mal die Anzahl der Sekunden,
> wobei die Jahreszahl von 1973 abgezogen wird?
> 
> Das geht doch bestimmt eleganter, oder?
> 
> Gruesse
> Hans Moser
> 




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

Date: Thu, 19 Dec 2002 23:41:59 -0700
From: "Rod" <palladium@spinn.net>
Subject: Re: enviroment variable set
Message-Id: <v05f3fhqrgsb31@corp.supernews.com>

"happier" <happier_tj@hotmail.com> wrote in message
news:atu2em$2q2ep$1@ID-137585.news.dfncis.de...
> I need to run my perl program in cron job and before running it must set
> some enviroment variable,so I write a shell script as following.I add the
> shell script into cron job.But
> I get error messages when cron job finished.My perl program running
> correctly if I set enviromen variable in command line.I make a EnvTest
> variable to check if the shell script does work.After I run SetPerlEnv
shell
> script in command line,type env but found the EnvTest enviroment variable
> doesn't exists.How can I set enviroment variable through shell script.
>
> Thanks in advance
> James Hou
>
this should do it inline for you.

grep(do{chop;s/(.*)=(.*)/$ENV{$1}=$2/e;},`. /etc/setup/setupperlenv.sh;
env`);

If anyone see's anthing wrong with this approach, I would appreciate a
propper flogging because I have it running in production scripts.

Thanks,
Rod





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

Date: Fri, 20 Dec 2002 10:09:54 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: getstore not working - please help
Message-Id: <bbq50vovcui0171tsiierc9risrifm7u2r@4ax.com>

Dennis Macdonald wrote:

>I'm running on a server and want to download to the user. Similar
>effect to them linking on a file link and the browser asking to
>download and requesting the file name.

You want to remotely fetch a file from another server and then forward
is to the browser? Are you sure you don't just want to use getprint? Or
get, and then print? Add a proper content-type header, print an empty
line, and then just print what your receive? And, why not simply link to
the remote file? 

-- 
	Bart.


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

Date: Fri, 20 Dec 2002 08:12:52 GMT
From: "bashbrothers" <bashbrothers@cox.net>
Subject: incorporating off-site content
Message-Id: <8iAM9.61954$Y86.54047@news2.central.cox.net>


"bashbrothers" <bashbrothers@cox.net> wrote in message news:...
> If you are using a linux machine and have lynx installed (a command line
> browser), you can grab content from a page like this :
> my $page = "http://www.showbizdata.com/";
>
> my $command = "/usr/bin/lynx -dump $page";
>
> my $pageFile = `$command`;
>
> Then you can take the $pageFile and use regexes, whatever to pull out what
> you need from it.  This only works for text as far as I know.  You can
dump
> to a file too in your directory and look at it so you can see what it
looks
> like.
>
> Late,
> Jake
>
>
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnavdgs3.4sd.tadmc@magna.augustmail.com...
> > zathras <moo@cow.com> wrote:
> >
> > > I vaguely remember reading
> >
> >
> > Perhaps in the Perl FAQ?
> >
> >
> > > about some perl functionality
> > > that would allow code to reach out over the internet to a site and
> > > pull down content and be able to manipulate it for use.
> >
> >
> >    How do I fetch an HTML file?
> >
> >
> > --
> >     Tad McClellan                          SGML consulting
> >     tadmc@augustmail.com                   Perl programming
> >     Fort Worth, Texas
>
>




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

Date: Fri, 20 Dec 2002 05:08:32 GMT
From: "bashbrothers" <bashbrothers@cox.net>
Subject: Re: incorporating off-site content
Message-Id: <kBxM9.61618$Y86.34465@news2.central.cox.net>

If you are using a linux machine and have lynx installed (a command line
browser), you can grab content from a page like this :
my $page = "http://www.showbizdata.com/";

my $command = "/usr/bin/lynx -dump $page";

my $pageFile = `$command`;

Then you can take the $pageFile and use regexes, whatever to pull out what
you need from it.  This only works for text as far as I know.  You can dump
to a file too in your directory and look at it so you can see what it looks
like.

Late,
Jake


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnavdgs3.4sd.tadmc@magna.augustmail.com...
> zathras <moo@cow.com> wrote:
>
> > I vaguely remember reading
>
>
> Perhaps in the Perl FAQ?
>
>
> > about some perl functionality
> > that would allow code to reach out over the internet to a site and
> > pull down content and be able to manipulate it for use.
>
>
>    How do I fetch an HTML file?
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Fri, 20 Dec 2002 09:47:44 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Localising large data structures to a sub
Message-Id: <3E02E740.24A9F700@bbsrc.ac.uk>

Brian McCauley wrote:
> 
> Simon Andrews <simon.andrews@bbsrc.ac.uk> writes:
> 
> > I've had this situation crop up a couple of times...
> 
> So, you might guess it's likely to be a FAQ.

Really? - and I'd looked as well.  Sorry about that.
 
> Yep, this is FAQ: "How do I create a static variable?"

Ah.  I didn't realise that that was what I was trying to do :-)

Finding the right FAQ is difficult if you don't recognise the
terminology it uses as applying to the problem you're having.  I
couldn't have told you what a "static variable" was if you'd asked me!
 
> That said, the answer given in the FAQ is a little unhelpful.
> 
> {
>   my %data;
>   sub whatever {

etc.

>   }
> }

Excellent.  I hadn't thought of using the extra block to do that.  Once
again Perl impresses me with a neat bit of syntax to solve my problem.

	Cheers

	Simon.


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

Date: Fri, 20 Dec 2002 10:11:23 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: map and s/// on @list
Message-Id: <u5r50vsami9v2raiho2etouleoukqmajjl@4ax.com>

Alexander Stremitzer wrote:

>@list =~ s/PSMB/PCHS/;

	s/PSMB/PCHS/ foreach @list;

-- 
	Bart.


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

Date: Sat, 20 Dec 2002 15:28:43 +0800
From: "James Hou" <happier_tj@hotmail.com>
To: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Re: enviroment variable set
Message-Id: <atugug$2v01$1@mail.cn99.com>

> happier wrote:
> > I need to run my perl program in cron job and before running it must
> > set some enviroment variable,so I write a shell script as following.I
> > add the shell script into cron job.But
> 
> Why don't you set those env variables from your Perl script?
You can't change the PERL5LIB in the Perl script, because even with a
BEGIN block the "use" statements happen first.  So I have to set the
variables in a shell script, and then from that shell script call the
Perl script.Can you tell me How can I set enviroment variable in shell script?

> 
> > I get error messages when cron job finished.My perl program running
> > correctly if I set enviromen variable in command line.I make a EnvTest
> > variable to check if the shell script does work.After I run
> > SetPerlEnv shell script in command line,type env but found the
> > EnvTest enviroment variable doesn't exists.How can I set enviroment
> > variable through shell script.
> 
> If you want to do it the hard way please see the Unix FAQ.
> You can find a reference in "perldoc -q environment", too.
> 
> jue
> 
>

-- 
Composed with Newz Crawler 1.3 http://www.newzcrawler.com/



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

Date: 20 Dec 2002 00:44:39 -0800
From: eric.chin@pinnacle.co.uk (Eric)
Subject: Re: Replacing text strings contains more than 1 dot
Message-Id: <d8c847cd.0212200044.568381d2@posting.google.com>

Thanks to all who reply. I've learned something today :)

"John W. Krahn" <krahnj@acm.org> wrote in message news:<3E023587.66F5858D@acm.org>...
> raj wrote:
> > 
> > perl -pi -e 's/oldstring/newstring' filename
> 
> $ perl -pi -e 's/oldstring/newstring' filename
> Substitution replacement not terminated at -e line 1.
> 
> 
> > HTH.
> 
> Not really.
> 
> 
> 
> John


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

Date: Fri, 20 Dec 2002 10:55:51 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Replacing text strings contains more than 1 dot
Message-Id: <3e02f6ad.1349145929@news.cis.dfn.de>

On 20 Dec 2002 00:44:39 -0800, eric.chin@pinnacle.co.uk
(Eric) wrote:

>Thanks to all who reply. I've learned something today :)

Well, you certainly didn't learn not to top-post.

It is rude, annoys the regulars and severely damages
your chances of receiving useful answers to your
questions.

If you don't know what top-posting is, read:
http://www.dickalba.demon.co.uk/usenet/guide/faq_topp.html
-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: 20 Dec 2002 01:51:17 -0800
From: alain-clement@fr.ibm.com (Alain)
Subject: SFTP: compiltion error from prerequisite Math::GMP
Message-Id: <9ce18d3d.0212200151.5db269d3@posting.google.com>

Hi,
I try to install SFTP and SSH packages.
There is several prerequisites like Math::GMP.
Before install Math::GMP, we have to install gmp-4.1.
My workstation:
  gcc version 2.95.2 19991024 (release)
  AIX jacque 3 4 002049369400

Installation of gmp-4.1 was a success.
But Math::GMP gave  an error:
>> Running Mkbootstrap for Math::GMP ()
>>         chmod 644 GMP.bs
>>         LD_RUN_PATH="" ld -o blib/arch/auto/Math/GMP/GMP.so 
-bhalt:4 -bM:SRE -bI:/usr/lpp/perl/lib/
>> 5.00502/aix/CORE/perl.exp -bE:GMP.exp -b noentry -lc
-L/home/alain/Tst/Perl5/lib GMP.o
>> ld: 0711-317 ERROR: Undefined symbol: .__gmpz_init_set_str
>> ld: 0711-317 ERROR: Undefined symbol: .__gmpz_clear
>> ld: 0711-317 ERROR: Undefined symbol: .__gmpz_sizeinbase
>> ...

I change directory to blib/arch/auto/Math/GMP but I don't find the
file GMP.so.
Why ?

Thanks in advance.

Alain


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

Date: 20 Dec 2002 08:48:54 GMT
From: Stephen Patterson <s.patterson@freeuk.com>
Subject: Re: Strange behaviour with windows task scheduler
Message-Id: <slrnb05mbl.lvk.s.patterson@seagoon.localdomain>

On Thu, 19 Dec 2002 22:35:35 GMT, w i l l wrote:
> is the script running as you?
> does you script need your password? is it up to date?
> 
> On 18 Dec 2002 20:57:38 GMT, Stephen Patterson
><s.patterson@freeuk.com> wrote:
> 
>>I have a couple of scripts which are invoked by the task scheduler on
>>windows 2000, and which occasionally fail to run for no apparent reason
>>(i.e. it works fine if I run it myself).

I've fixed it - set the password again and moved the scripts onto the hard
drive as this pc has a habit of randomly dropping network shares.

-- 
Stephen Patterson http://www.lexx.uklinux.net http://patter.mine.nu
steve@SPAM.lexx.uklinux.net  remove SPAM to reply        
Linux Counter No: 142831 GPG Public key: 252B8B37        
Last one down the pub's an MCSE


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

Date: Fri, 20 Dec 2002 09:04:35 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: telnet not waiting for command to finish
Message-Id: <3fmuta.cu5.ln@moldev.cmagroup.co.uk>

Ponzie B. Pogie <ponzie_b_pogie@hotmail.com> wrote:
> $t->cmd("$some_perl_script");
> print "Finished $some_perl_script.\n";

Does $some_perl_script have the value you expect? (How do you know?)

> with
> $some_perl_script, it doesn't wait for it before going to the next
> line. Actually, when I check the host it telnets to, $some_perl_script
> isn't even running.

This really sounds like you have not managed even to /start/ running
$some_perl_script on your remote host.

Does $some_perl_script have an absolute path (e.g. "/some/perl/script"),
and if not, are you *sure* it's in your current PATH? (How do you know?)

By the way, you shouldn't quote simple scalars; just use this:
    $t->cmd($some_perl_script);

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Fri, 20 Dec 2002 18:39:52 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Tied Filehandles
Message-Id: <atuhgv$2rd2n$1@ID-79573.news.dfncis.de>

Andrew Hamm wrote:
>
> I'm thinking it might be best to sub-class IO::File for the work. I'm
> fairly happy with my garnishing algorithm (it's as simple as you
> might expect) but I can't test it because at the moment I can't even
> seem to get my class called instead of IO::File methods.
>

Anyway, back on thread;

I've just realised why merely inheriting from IO::File doesn't let me write

print $myhandle "foo", "bar";

becaue this is *NOT* synonymous with

$myhandle->print("foo", "bar");

Dammit.

I had this idea that I've read somewhere that objects may be slipped in as
if they were ordinary file handles. Now I'm reading furiously to find
evidence either way. Must I use a tieing class?

At this stage, the "Filtered" and "IO::Filtered" packages from Damian
Conway's book Object Oriented Perl (pages 256-262 and pages 268-270) is
looking like the solution.

I'm a bit surprised I cannot find a standard module for this. Amongst the
IO::Filter::* set of modules, I see IO::Filter::External but nothing to
filter via code. hmmm. Sounds like a project. IO::Filter::lc looks
particularly inviting.

thanks in advance for any tips or directions.




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

Date: 20 Dec 2002 08:18:30 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Tied Filehandles
Message-Id: <atujom$bkh$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Andrew Hamm:

> Andrew Hamm wrote:
>>
>> I'm thinking it might be best to sub-class IO::File for the work. I'm
>> fairly happy with my garnishing algorithm (it's as simple as you
>> might expect) but I can't test it because at the moment I can't even
>> seem to get my class called instead of IO::File methods.
>>
> 
> Anyway, back on thread;
> 
> I've just realised why merely inheriting from IO::File doesn't let me write
> 
> print $myhandle "foo", "bar";
> 
> becaue this is *NOT* synonymous with
> 
> $myhandle->print("foo", "bar");
> 
> Dammit.
> 
> I had this idea that I've read somewhere that objects may be slipped in as
> if they were ordinary file handles. Now I'm reading furiously to find
> evidence either way. Must I use a tieing class?

No, you don't actually need tieing. You inherit from IO::File which
means that your object is a blessed glob that you can use as an ordinary
filehandle. Just changes the methods you overwrite slightly:

    sub write  { &garnish; shift->SUPER::write  (@_) }
    sub print  { &garnish; shift->SUPER::print  (@_) }
    sub printf { &garnish; shift->SUPER::printf (@_) }

Now both

    print $myhandle @list

as well as

    $myhandle->print(@list)

will work as expected.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Fri, 20 Dec 2002 19:50:42 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Tied Filehandles
Message-Id: <atullp$2s4re$1@ID-79573.news.dfncis.de>

Tassilo v. Parseval wrote:
>
> No, you don't actually need tieing. You inherit from IO::File which
> means that your object is a blessed glob that you can use as an
> ordinary filehandle. Just changes the methods you overwrite slightly:
>
>     sub write  { &garnish; shift->SUPER::write  (@_) }
>     sub print  { &garnish; shift->SUPER::print  (@_) }
>     sub printf { &garnish; shift->SUPER::printf (@_) }
>
> Now both
>
>     print $myhandle @list
>
> as well as
>
>     $myhandle->print(@list)
>
> will work as expected.
>
> Tassilo

Thanks for the confident answer, but, but, but, *splutter* it isn't working
here! That's what I thought should happen from some dim memory of a piece of
long-forgotten doco, but it's clearly not working for me. Now cut-n-pasted
to guarantee you are looking at my actual code:

<file name="FileTS.pm">

package FileTS;

use strict;
use warnings;

use base qw(IO::File);

our @EXPORT = @IO::File::EXPORT;
our @EXPORT_OK = @IO::File::EXPORT_OK;
our $VERSION = 0.01;

my $n = 0;
sub garnish {
    ++$n;
    print "garnish $n\n";
}   # garnish

# NOTE: shifting off self because the real garnish will mess with @_
sub write  { my $self = shift; &garnish; $self->SUPER::write(@_) }
sub print  { my $self = shift; &garnish; $self->SUPER::print(@_) }
sub printf { my $self = shift; &garnish; $self->SUPER::printf(@_) }

1;
</file>

<script name="recv2">

use strict;
use warnings;

use lib "lib/Perl";
use FileTS;

my $fd = FileTS->new('junk', '>');

print $fd "This is the first line\n";
print $fd "This is the second line\n";

$fd->print("This is the third line\n");
$fd->print("This is the fourth line\n");

$fd->close;
</script>

And I'm only seeing the method calls work - ie i get only

garnish 1
garnish 2

on stdout, and in file junk:

This is the first line
This is the second line
This is the third line
This is the fourth line

Perhaps the Perl version is relevant at this point? Maybe this is sorted out
in 5.8 ?

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=sco, osvers=3.2v5.0.6, archname=i386-sco
    uname='sco_sv develbox 3.2 5.0.6 i386 '
    config_args='-Dmksymlinks -Dinstallprefix=/usr -Dprefix=/usr'
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-U M_XENIX -D PERL_SCO -D PERL_SCO5 -D
HAS_FSYNC -w0 -belf -I/usr/local/include',
    optimize='-O0',
    cppflags='-U M_XENIX -D PERL_SCO -D PERL_SCO5 -D
HAS_FSYNC -w0 -belf -I/usr/local/include'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib




libs=-lintl -lsocket -lnsl -lndbm -ldbm -lld -lm -lc -lcrypt -lsec -lPW -lx 
-lc
    perllibs=-lintl -lsocket -lnsl -lld -lm -lc -lcrypt -lsec -lPW -lx
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Bexport -L/usr/local/lib'
    cccdlflags='-Kpic', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under sco
  Compiled at Jun  6 2002 11:36:24
  %ENV:
    PERLDOC="-t"
  @INC:
    /usr/lib/perl5/5.6.1/i386-sco
    /usr/lib/perl5/5.6.1
    /usr/lib/perl5/site_perl/5.6.1/i386-sco
    /usr/lib/perl5/site_perl/5.6.1
    /usr/lib/perl5/site_perl/5.6.0/i386-sco
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl
    .




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

Date: 20 Dec 2002 10:53:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Tied Filehandles
Message-Id: <atusqk$i7k$1@mamenchi.zrz.TU-Berlin.DE>

According to Andrew Hamm <ahamm@mail.com>:
> Tassilo v. Parseval wrote:
> >
> > No, you don't actually need tieing. You inherit from IO::File which
> > means that your object is a blessed glob that you can use as an
> > ordinary filehandle. Just changes the methods you overwrite slightly:
> >
> >     sub write  { &garnish; shift->SUPER::write  (@_) }
> >     sub print  { &garnish; shift->SUPER::print  (@_) }
> >     sub printf { &garnish; shift->SUPER::printf (@_) }
> >
> > Now both
> >
> >     print $myhandle @list
> >
> > as well as
> >
> >     $myhandle->print(@list)
> >
> > will work as expected.
> >
> > Tassilo
> 
> Thanks for the confident answer, but, but, but, *splutter* it isn't working
> here! That's what I thought should happen from some dim memory of a piece of
> long-forgotten doco, but it's clearly not working for me. Now cut-n-pasted
> to guarantee you are looking at my actual code:
> 
> <file name="FileTS.pm">
> 
> package FileTS;
> 
> use strict;
> use warnings;
> 
> use base qw(IO::File);
> 
> our @EXPORT = @IO::File::EXPORT;
> our @EXPORT_OK = @IO::File::EXPORT_OK;
> our $VERSION = 0.01;
> 
> my $n = 0;
> sub garnish {
>     ++$n;
>     print "garnish $n\n";

Umm...  What makes you think printing something to STDOUT would make it
appear in the output to the tied filehande?  "Tie" is magic, but not *that*
magic.  As you have seen, the output appears on STDOUT.  Change garnish()
to simply return a string:

    my $n = 0;
    sub garnish {
        ++$n;
        "garnish $n: ";
    }   # garnish


> }   # garnish
> 
> # NOTE: shifting off self because the real garnish will mess with @_
> sub write  { my $self = shift; &garnish; $self->SUPER::write(@_) }
> sub print  { my $self = shift; &garnish; $self->SUPER::print(@_) }
> sub printf { my $self = shift; &garnish; $self->SUPER::printf(@_) }

(Don't use a leading ampersand in a sub call unless you want the
associated effect.  It won't hurt here, but it may elsewhere.  See
"perldoc perlsub" for more.)

These routines must add the garnish to the output, e.g.

    sub print  { my $self = shift; $self->SUPER::print(garnish(), @_) }

This simply forces the return value of garnish() onto the argument list
of SUPER::print, which is all you have to do.

[test script snipped, should work now as is]

Anno


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

Date: Fri, 20 Dec 2002 10:08:26 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Why does Perl handle "return undef;" differently then "return;"
Message-Id: <3e02ebcc.1346360844@news.cis.dfn.de>

On Thu, 19 Dec 2002 21:04:29 GMT, Martien Verbruggen
<mgjv@tradingpost.com.au> wrote:

>On Thu, 19 Dec 2002 15:31:22 -0500,
>	Aaron Simmons <asimmons@mitre.org> wrote:
>> 
>> I know understand it.  Thanks!
>
>Good.
>
>> By the way what exactly is "TOP POSTING"?
>
>If you had followed the URL that Ben Kennedy posted in the message you
>replied to, you would have known. For your convenvience, because we're
>so helpful, here it is again:
>
>http://www.dickalba.demon.co.uk/usenet/guide/faq_topp.html

It won't help.  Aaron has probably been killfiled by
80% of the people who read this group by now.

He's had top-posting explained at least 5 times
in this thread already.  He doesn't actually 
read the replies, he just pretends he does.
-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: 19 Dec 2002 22:19:12 -0800
From: J_Steven_Walker@hotmail.com (Steve Walker)
Subject: Re: Wierd loop/chdir behavior
Message-Id: <534c971c.0212192219.d92e716@posting.google.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3E0251FA.4D602AA1@earthlink.net>...
> Steve Walker wrote:
> [snip]
> [snip]
> > The weirdness is that the chdir to the target directory fails EVERY
> > OTHER pass of the loop.
>  [snip]
> > if (chdir(glob "$ddir"))
> 
>    perldoc -f glob
> 
> Read about what happens in scalar context.

Benjamin,

   Many thanks.  I am still not clear why the scalar behavior of glob
manifests as it does in a loop, especially since the serialized items
don't behave the same way.  I shall think on it some more and maybe it
will come to me. In any case, after a little thought it was clear that
this really should never be used in a scalar context anyway, so I
won't.  I appreciate the nudge off center.  For anyone else who may be
scratching their heads over this the proper code (or at least
something that actually works) should look like:

foreach $ddir (@newdata)
{
   print "New Scan data at $ddir\n";
   @gdir=glob ($ddir);

# glob may return multiple names - process them all.
   foreach $dir (@gdir)
   {
      chdir $work_dir ;
      if (defined($dir))
      {
          chdir $dir;
          chop($pwd=`/usr/bin/pwd`);
          print "now in $dir ($pwd)\n" ;
          $dp .= " $pwd" ;
      }
   }
}


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

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


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