[23333] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5553 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 24 06:06:03 2003

Date: Wed, 24 Sep 2003 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 24 Sep 2003     Volume: 10 Number: 5553

Today's topics:
    Re: () questions <abigail@abigail.nl>
        add half an hour to all times in file <jidanni@jidanni.org>
    Re: AUTOLOAD plus instance methods <daniel.rawson.take!this!out!@asml.nl>
    Re: class methods <ict@eh.org>
    Re: Determine connection status on Linux (PS) (David Efflandt)
    Re: Determine connection status on Linux (David Efflandt)
    Re: different encoding datastream; if using different ( <udo@lipsia.de>
        Found a way to write modules without package, export (Great Deals)
    Re: Found a way to write modules without package, expor (Anno Siegel)
        Input error handling (MJS)
    Re: Net::POP3->new() fails in PerlApp compiled script <NOSPAM@NOSPAM.COM>
    Re: Session Management:  NO Cookies.... <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Session Management:  NO Cookies.... (Bill)
    Re: some proxies post and some won't with lwp (Villy Kruse)
    Re: some proxies post and some won't with lwp (Anno Siegel)
    Re: string length? (Sam Holden)
    Re: string length? <tcurrey@no.no.i.said.no>
    Re: string length? (Sam Holden)
    Re: string length? <peter@semantico.com>
    Re: string length? (Anno Siegel)
        Trouble with 0 <spikey-wan@bigfoot.com>
    Re: Trouble with 0 <mbudash@sonic.net>
        What is the Simplest way to move Subs to Modules? (Great Deals)
    Re: What is the Simplest way to move Subs to Modules? (Anno Siegel)
    Re: What wrong with my module? (Great Deals)
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 24 Sep 2003 08:14:14 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: () questions
Message-Id: <slrnbn2kim.cne.abigail@alexandra.abigail.nl>

Eric J. Roode (REMOVEsdnCAPS@comcast.net) wrote on MMMDCLXXVI September
MCMXCIII in <URL:news:Xns93FFDEA3F3BE2sdn.comcast@206.127.4.25>:
[]  -----BEGIN xxx SIGNED MESSAGE-----
[]  Hash: SHA1
[]  
[]  Matija Papec <mpapec@yahoo.com> wrote in
[]  news:qkb1nvco5vpa99f6r7tl18b5bpk57mt9k4@4ax.com: 
[]  
[] > Right now I'm tempted to start coding using only map since grep is
[] > obviously redundant in Perl. ;)
[]  
[]  There's some book or documentation example (I've forgotten the source), 
[]  which shows that map and grep can easily be rewritten in terms of the 
[]  other:
[]  
[]      @a = map f($_), @b;    # is the same as
[]      @a = grep {$_ = f($_); 1} @b;

Beside the fact that the latter modifies the elements of @b (and hence
won't work if there are literals as the list to operate on), the two
statements don't even return the same results:

    #!/usr/bin/perl

    use strict;
    use warnings;

    sub f {($_, $_)}

    my @b = (1 .. 10);

    my @a1 = map f ($_), @b;
    my @a2 = grep {$_ = f ($_); 1} @b;

    print "@a1\n";
    print "@a2\n";

    __END__
    1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10
    1 2 3 4 5 6 7 8 9 10


Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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

Date: Wed, 24 Sep 2003 12:56:18 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: add half an hour to all times in file
Message-Id: <87brtazswd.fsf@jidanni.org>

$ cat file
18:25
18:56
$ perl -wlpe 'Please tell me what to write here to get the following' file
18:55
19:26
Maybe perldoc Date::Parse has something to do with this.
In Unix I can do $ date +%H:%M -d '22:22 + 30 minutes'.


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

Date: Wed, 24 Sep 2003 05:57:09 -0400
From: Dan Rawson <daniel.rawson.take!this!out!@asml.nl>
Subject: Re: AUTOLOAD plus instance methods
Message-Id: <bkrppl$52okm$1@ID-122008.news.uni-berlin.de>

OK, thanks . . . .

JS Bangs wrote:
> Dan Rawson sikyal:
> 
> 
>>I have a tiny class (copied almost verbatim from the perltoot pages)
>>which has some AUTOLOAD methods plus one other. When I run the attached,
>>it dies with "Can't access DESTROY field . . . ." at the very end.
>>What am I doing wrong??
> 
> 
> This is a common problem--I've run into it myself.
> 
> Perl calls a method named DESTROY() on all objects when they're garbage
> collected, with special magic to ensure that if this method doesn't exist
> no errors are generated. However, before that happens the DESTROY gets
> caught in the AUTOLOAD method, and so generates this message.
> 
> There's two ways to fix this:
> 
> 
>>sub AUTOLOAD()
>>{
>>     my $self = shift;
>>     my $type = ref($self) || die;
>>     my $name = $AUTOLOAD;
>>     $name =~ s/.*://;
> 
> 
> Here you could add something like:
> 
> return if $name eq 'DESTROY';
> 
> 
>>     unless (exists $self->{_permitted}->{$name})
>>     {
>>         croak "Can't access $name field in object of class $type";
>>     };
>>     if (@_)
>>     {
>>         return $self->{$name} = shift;
>>     }
>>     else
>>     {
>>         return $self->{$name}
>>     }
>>
>>}
> 
> 
> Or you could add
> 
> sub DESTROY {}
> 
> This means that DESTROY does exist (but does nothing), so it never enters
> the AUTOLOAD routine.
> 
> 
> --
> Jesse S. Bangs jaspax@u.washington.edu
> http://students.washington.edu/jaspax/
> http://students.washington.edu/jaspax/blog
> 
> Jesus asked them, "Who do you say that I am?"
> 
> And they answered, "You are the eschatological manifestation of the ground
> of our being, the kerygma in which we find the ultimate meaning of our
> interpersonal relationship."
> 
> And Jesus said, "What?"



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

Date: 24 Sep 2003 14:23:20 +1000
From: Iain Truskett <ict@eh.org>
Subject: Re: class methods
Message-Id: <slrnbn27i7.tad.ict@dellah.org>

* James Willmore <jwillmore@cyberia.com>:
> * Matija Papec <mpapec@yahoo.com> wrote:
> > I have situation where /class method/ can be called inside and
> > outside of package so I have to know when to throw away the first
> > argument. I found that
> > 
> > shift if $_[0] eq __PACKAGE__;
> > 
> > should work, but is there a better way to distinguish inside and
> > outside calls?

>  ==untested==
>  my ($caller, @args) = @_;
>  return unless ref($caller) eq __PACKAGE__;

This is a bad idea. When you subclass your module, your first argument
may end up being something very different from __PACKAGE__ (in
particular, it could be the __PACKAGE__ of a different package).

Personally, I'd not do this method at all. If it's a class method,
use it as a class method. If it's a function, use it as a function.
Don't do both. It just needlessly complicates the code and introduces
room for errors.



cheers,
-- 
Iain.


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

Date: Wed, 24 Sep 2003 04:23:03 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Determine connection status on Linux (PS)
Message-Id: <slrnbn2717.jkd.efflandt@typhoon.xnet.com>

One other note is that if you specifically want to do something whenever 
Linux pppd connects, do it from /etc/ppp/ip-up (or ip-up.local).  This 
runs whever pppd gets an IP address.  But use full paths, because 
environment is minimal (also note that anything there would run as root).

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Wed, 24 Sep 2003 04:15:12 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Determine connection status on Linux
Message-Id: <slrnbn26ig.jkd.efflandt@typhoon.xnet.com>

On Wed, 24 Sep 2003 13:00:30 +1000, Sisyphus <kalinabears@iinet.net.au> wrote:
> Hi,
> 
> Not entirely on-topic, I'm afraid, but how do I determine from a perl 
> script if I'm currently connected to the Internet ?
> 
> A system() command would be satisfactory, if I can just find out which 
> one to use :-)
> 
> I'm having dificulty with Device::Modem - should I persevere ?
> 
> For making the connection manually, I use the kppp dialer on (Mandrake) 
> linux - which connects me through an external dialup modem.

#!/usr/bin/perl -w
if (system '/sbin/ifconfig ppp0 > /dev/null 2>&1') {
    die "we are offline\n";
}
print "we are online\n";
# do something useful

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Wed, 24 Sep 2003 12:02:22 +0200
From: udoline <udo@lipsia.de>
Subject: Re: different encoding datastream; if using different (file/socket) descriptoren
Message-Id: <bkrq3e$565r6$1@ID-26126.news.uni-berlin.de>

the pragmas  "no encoding;"  does'nt help !

the special  trick:

use Encode;
# prepare utf8 default encoding for this string to off   
# perldoc Encode
Encode::_utf8_on( $sql_statement );

wont work with my tests  (DBD/DBI)  =8-(

what can I do ?

please help, ThanX.
--
v.g.,
udoline alias udo@lipsia.de



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

Date: 24 Sep 2003 02:29:34 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: Found a way to write modules without package, export
Message-Id: <cafe07c7.0309240129.57219979@posting.google.com>

First, copy and paste all subs into a file named something.pm then add
1; to the end of something.pm
No need of export or package
Isn't that great? Why would people even use package/export?

In main program something.pl, write use something

something.pm:
sub getit2{
return time;
}

1;

something.pl:
#!/usr/bin/perl -w
use something;

$ab= getit2;
 print "$ab\n";


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

Date: 24 Sep 2003 09:49:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Found a way to write modules without package, export
Message-Id: <bkrpah$2oh$4@mamenchi.zrz.TU-Berlin.DE>

Great Deals <deals@slip-12-64-108-121.mis.prserv.net> wrote in comp.lang.perl.misc:
> First, copy and paste all subs into a file named something.pm then add
> 1; to the end of something.pm
> No need of export or package

What made you think you need "package", or Exporter.pm, to put subs into
another file?  Of course you can do that.  The result is not a Perl module,
however.  That part of your subject is wrong.

> Isn't that great? Why would people even use package/export?

Go ahead and use it for a while.  You'll discover the advantages of
name spaces and their separation quite on your own.

[code snipped]

Anno


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

Date: 23 Sep 2003 22:32:33 -0700
From: tabletdesktop@yahoo.com (MJS)
Subject: Input error handling
Message-Id: <f0171209.0309232132.6032f8fc@posting.google.com>

After the execution of the following, the only value I need in
"number" should be any positive interger(i.e any whole numbers without
zero).

print "Please enter a natural number  = ";
chomp( my $number = <STDIN> );

I need to throw an exception or inform the user when input is anything
(characters, real number, negative number etc.) other the positve
integer. Please help.


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

Date: Wed, 24 Sep 2003 04:22:18 GMT
From: "Eric McDaniel" <NOSPAM@NOSPAM.COM>
Subject: Re: Net::POP3->new() fails in PerlApp compiled script
Message-Id: <_Z8cb.560579$Ho3.100085@sccrnsc03>


"Bart Lateur" <bart.lateur@pandora.be> wrote in message
news:auo1nv40sa73dd6u1eht8qhh17p07rehda@4ax.com...
> Eric McDaniel wrote:
>
> >Any ideas?
>
> Your error message isn't that helpful. See if you can print out a string
> with some more info. See the docs for Net::POP3 -- I'm a bit lazy
> myself.
>
> Anyway, it's rather typical for apps compiled with PerlApp or its
> distant nephew perl2exe, if it fails, that one or more modules were
> overlooked when building the distribution. (= the EXE). At first look I
> see a lot of "use" statements in Net::POP3, so I suggest you try and
> dump the contents of %INC before that call on line 3. Data::Dumper would
> be fine. Let's see if one isn't listed that is listed in the list you
> gave in your post.
>

I would print out a better error message if I knew where to get one. The
Net::POP3 docs say nothing about what happens when the constructor fails.
The observed behaviour is that it returns undef, with no indication of what
the problem was. Even with Debug=>99, I get no debug output when the
constructor fails.

I'll see if I can figure out what are the dependent modules.

-Eric




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

Date: Tue, 23 Sep 2003 21:42:18 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Session Management:  NO Cookies....
Message-Id: <ab7rkb.63d.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

On 2003-09-23, Sucpraran <sucpraran@yahoo.com> wrote:
> Like to get thoughts on maintaining session WITHOUT using Client Side
> Cookies.

You might want to be more specific on what you mean by a session--
there are lots of techniques, but not all applicable to every
situation.

Also, comp.infosystems.www.authoring.cgi or the mod_perl list
might be a better place for your question, since there will be
many methods that are not perl-specific.  (Most, really.)

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj9xIKgACgkQhVcNCxZ5ID9sJwCdFod5UP4utpzlEXfhCsUCw9/Z
ij4Anjht445LcPGoY7co14mPOb65VDps
=52Rp
-----END PGP SIGNATURE-----


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

Date: 23 Sep 2003 22:26:42 -0700
From: wherrera@lynxview.com (Bill)
Subject: Re: Session Management:  NO Cookies....
Message-Id: <239ce42f.0309232126.194d0b0b@posting.google.com>

sucpraran@yahoo.com (Sucpraran) wrote in message news:<938f9bf4.0309230831.796712c3@posting.google.com>...
> New to Perl, Apache world. 
> Like to get thoughts on maintaining session WITHOUT using Client Side
> Cookies.
> Our environment is Perl, Apache, Oracle DB, Unix OS. 
> 
> What are the capabilities of Server side/Database session management
> in this environment? We can't compromise on security and load
> balancing (multiple servers).
> 
> Thanks

Have a look at SOAP (this is usable by Perl but is not language dependent):

http://www.perl.com/pub/a/2001/04/24/soap.html


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

Date: 24 Sep 2003 07:47:00 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: some proxies post and some won't with lwp
Message-Id: <slrnbn2k62.3g5.vek@station02.ohout.pharmapartners.nl>

On 23 Sep 2003 15:13:10 GMT,
    Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

>
>Not required.  You don't have to understand a CGI question to know it's
>off topic.
>

Actualy there weren't any CGI question involved.  Perhaps the question is
wheter the LWP modules should have provided the Content-Length: header
which the server was missing, and if so the question is about the LWP
module rather than a CGI question.

IMHO the LWP modules are pretty much one of the standard tools available
to perl programmers, but you could argue that question about that belongs
in comp.lang.perl.modules


Villy


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

Date: 24 Sep 2003 08:23:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: some proxies post and some won't with lwp
Message-Id: <bkrk9c$2oh$1@mamenchi.zrz.TU-Berlin.DE>

Villy Kruse <nobody> wrote in comp.lang.perl.misc:
> On 23 Sep 2003 15:13:10 GMT,
>     Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> 
> >
> >Not required.  You don't have to understand a CGI question to know it's
> >off topic.
> >
> 
> Actualy there weren't any CGI question involved.

Okay, a www question then.

>                                                  Perhaps the question is
> wheter the LWP modules should have provided the Content-Length: header
> which the server was missing, and if so the question is about the LWP
> module rather than a CGI question.
> 
> IMHO the LWP modules are pretty much one of the standard tools available
> to perl programmers, but you could argue that question about that belongs
> in comp.lang.perl.modules

We can discuss questions of module usage here, but if we admit the
application area of modulesi, we'll be discussing just about everything.

Anno


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

Date: 24 Sep 2003 04:33:43 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: string length?
Message-Id: <slrnbn27l7.20p.sholden@flexal.cs.usyd.edu.au>

On Tue, 23 Sep 2003 19:26:35 -0700, Trent Curry <tcurrey@no.no.i.said.no> wrote:
> Sam Holden wrote:
>> On Tue, 23 Sep 2003 15:53:42 -0700, Trent Curry
>> <tcurrey@no.no.i.said.no> wrote:
[snip]
>>>
>>> I'm sorry, but what real gain is there from publically announcing
>>> additions to one's kill file?
[snip]
>>
>> I consider it of great benefit to know what I should avoid in order to
>> have a chance of knowledgable, experienced perl programmers answering
>> a question I may have in the future.
> 
> So in other words I'm not allowed to have an opinion, lest Abigail be not in
> agreeance? I take pride in being able to think for my self.

You asked if there was any "real gain is there from publically
announcing additions to one's kill file?"

I gave one thing I thought was of great utility from such announcements,
and a couple of silly uses as well.

Somehow, you interprete that as not allowing you to have an opinion?

Your skills at twisting text to fit your presumptions amaze me...

If someone else doesn't want to be killfiled by Abigail then her plonk
post tells them not to post the way you had in the thread. They are still
free to post that way. They have just gained some information allowing
them to make a more informed decision about their actions. If they don't
care about Abigail reading their posts then they can ignore the example,
for example.

It has nothing to do with anyone agreeing with your opinions.

The plonk notice serves *exactly* the same purpose as Abigail
mentioning a week or so ago that top posters are usually plonked on
first offence.

Did your freedom of opinion and expression get oppressed by that post
too?

-- 
Sam Holden



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

Date: Tue, 23 Sep 2003 22:12:39 -0700
From: "Trent Curry" <tcurrey@no.no.i.said.no>
Subject: Re: string length?
Message-Id: <bkr98j$pko$1@news.astound.net>

"Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
news:slrnbn27l7.20p.sholden@flexal.cs.usyd.edu.au...
> On Tue, 23 Sep 2003 19:26:35 -0700, Trent Curry <tcurrey@no.no.i.said.no>
wrote:
> > Sam Holden wrote:
> >> On Tue, 23 Sep 2003 15:53:42 -0700, Trent Curry
> >> <tcurrey@no.no.i.said.no> wrote:

[whole lotta snippage]

> >>
> >> I consider it of great benefit to know what I should avoid in order to
> >> have a chance of knowledgable, experienced perl programmers answering
> >> a question I may have in the future.
> >
> > So in other words I'm not allowed to have an opinion, lest Abigail be
not in
> > agreeance? I take pride in being able to think for my self.
>
> You asked if there was any "real gain is there from publically
> announcing additions to one's kill file?"
>
> I gave one thing I thought was of great utility from such announcements,
> and a couple of silly uses as well.
>
> Somehow, you interprete that as not allowing you to have an opinion?
>
> Your skills at twisting text to fit your presumptions amaze me...

Then you misunderstand me. When someone decides to openly ignore me for just
expressing an opinion, it may certainly seem that I should not voice it.
That is what I was getting at; sorry if I was not clear enough.

> If someone else doesn't want to be killfiled by Abigail then her plonk
> post tells them not to post the way you had in the thread. They are still
> free to post that way. They have just gained some information allowing
> them to make a more informed decision about their actions. If they don't
> care about Abigail reading their posts then they can ignore the example,
> for example.
>
> It has nothing to do with anyone agreeing with your opinions.

Well you imply that just because Abigail "plonk"s someone automatically mean
they are some sort of bad person trying to cause trouble, and I do not think
this to be necessarily true.

If she wants to reply to a code orientated question I may be involved in,
then more power to her; she indeed knows her stuff when it comes to Perl, no
@ARGVs there.

> The plonk notice serves *exactly* the same purpose as Abigail
> mentioning a week or so ago that top posters are usually plonked on
> first offence.

Well I missed that one sorry, but I can understand most people's grief with
top posters.


Ok, obviously we had some misunderstandings. I'm sorry for my part. Would it
not be better to end this in a nice diplomatic way? I'm not solicit enemies
here. I simply apologize for coming out the wrong way in all this, ok.

Peace.

-- 
Trent Curry

perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'




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

Date: 24 Sep 2003 06:08:50 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: string length?
Message-Id: <slrnbn2d7h.3ck.sholden@flexal.cs.usyd.edu.au>

On Tue, 23 Sep 2003 22:12:39 -0700, Trent Curry <tcurrey@no.no.i.said.no> wrote:
> "Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
> 
> Then you misunderstand me. When someone decides to openly ignore me for just
> expressing an opinion, it may certainly seem that I should not voice it.
> That is what I was getting at; sorry if I was not clear enough.

Voicing opinions always has effects, you freedom of expression means you
get to decide if its wortwhile or not.

>> It has nothing to do with anyone agreeing with your opinions.
> 
> Well you imply that just because Abigail "plonk"s someone automatically mean
> they are some sort of bad person trying to cause trouble, and I do not think
> this to be necessarily true.

I implied no such thing.

> Ok, obviously we had some misunderstandings. I'm sorry for my part. Would it
> not be better to end this in a nice diplomatic way? I'm not solicit enemies
> here. I simply apologize for coming out the wrong way in all this, ok.
> 
> Peace.

It's just a discussion to me, I haven't formed any lasting impressions.

But it is off-topic by now, and hence probably worth ending, before we
both get killfiled by everyone :)

I'm not trying to have the last word though, feel free to reply...

-- 
Sam Holden



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

Date: Wed, 24 Sep 2003 09:21:46 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: string length?
Message-Id: <3f71541a$0$10767$afc38c87@news.easynet.co.uk>

Trent Curry wrote:
>>*PLONK*
> 
> 
> I'm sorry, but what real gain is there from publically announcing additions
> to one's kill file?

Much more than replying to it!



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

Date: 24 Sep 2003 09:08:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: string length?
Message-Id: <bkrmv6$2oh$2@mamenchi.zrz.TU-Berlin.DE>

Trent Curry <tcurrey@no.no.i.said.no> wrote in comp.lang.perl.misc:
> Abigail wrote:
> 
> > But more than lazy people, I hate whiners who whine if you don't
> > want to kiss up to people.
> 
> Then you miss understand me and proceed to a false conclusion of my intent.
> I was not trying to be anyone's lawyer. Actually I was poking fun at
> Abigail's "rosting over a fire" gag in my last reply. I was not in any way
> trying to motivate "kissing up" to anyone.
> 
> > *PLONK*
> 
> I'm sorry, but what real gain is there from publically announcing additions
> to one's kill file?

It's very useful to learn, from time to time, what other regulars consider
plonkable.

Anno


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

Date: Tue, 23 Sep 2003 14:19:19 +0100
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Trouble with 0
Message-Id: <bkphbb$4qi$1@newshost.mot.com>

Guys,

I have managed to get this far in my quest to capture data sent into the
serial port with windows...

use strict;
use warnings;
use Win32::SerialPort;
my $port = new Win32::SerialPort ("COM1") || die "can't open COM1\n";
open (FILE, ">file.txt");
foreach (1..100000) {
    my $input;
    if ($input = $port->input) {print FILE "$input\n"}
}
print "Finished\n";
close FILE;

This seems to work OK, unless I get a zero sent into the port. I can't work
out how to trap the zero, and distinguish it from no input.

Can someone help me out, please?

Thanks.
-- 
R.
GPLRank +79.699




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

Date: Wed, 24 Sep 2003 07:36:40 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Trouble with 0
Message-Id: <mbudash-6DA88D.00363924092003@typhoon.sonic.net>

In article <bkphbb$4qi$1@newshost.mot.com>,
 "Richard S Beckett" <spikey-wan@bigfoot.com> wrote:

> Guys,
> 
> I have managed to get this far in my quest to capture data sent into the
> serial port with windows...
> 
> use strict;
> use warnings;
> use Win32::SerialPort;
> my $port = new Win32::SerialPort ("COM1") || die "can't open COM1\n";
> open (FILE, ">file.txt");
> foreach (1..100000) {
>     my $input;
>     if ($input = $port->input) {print FILE "$input\n"}
> }
> print "Finished\n";
> close FILE;
> 
> This seems to work OK, unless I get a zero sent into the port. I can't work
> out how to trap the zero, and distinguish it from no input.
> 
> Can someone help me out, please?


try:

      if (defined($input = $port->input)) {print FILE "$input\n"}

hth-
-- 
Michael Budash


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

Date: 24 Sep 2003 02:06:59 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: What is the Simplest way to move Subs to Modules?
Message-Id: <cafe07c7.0309240106.4809df91@posting.google.com>

I am giving up on writing modules. Too complicated. My only goal is
too many perl programs can use the same subs. Now, I have to copy and
pastes those subs into each perl program. Once I do an update, I have
do re copy paste all over again..

Please show me the easiest/simplest way to move subs to 1 common file
to let many programs to share the same subs.

1 Do I have to include "package" in the pm file?
2 Do I have to return 1; at the end of the module file?
3 What is about __END__ should I put # in front of it?
4 Is there such as include in SSI? so that everytime I run
something.pl, it will automatically include the sub file?


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

Date: 24 Sep 2003 09:14:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: What is the Simplest way to move Subs to Modules?
Message-Id: <bkrn90$2oh$3@mamenchi.zrz.TU-Berlin.DE>

Great Deals <deals@slip-12-64-108-121.mis.prserv.net> wrote in comp.lang.perl.misc:
> I am giving up on writing modules. Too complicated. My only goal is
> too many perl programs can use the same subs. Now, I have to copy and
> pastes those subs into each perl program. Once I do an update, I have
> do re copy paste all over again..
> 
> Please show me the easiest/simplest way to move subs to 1 common file
> to let many programs to share the same subs.
> 
> 1 Do I have to include "package" in the pm file?

No.

> 2 Do I have to return 1; at the end of the module file?

Yes.

> 3 What is about __END__ should I put # in front of it?

No.  You don't need __END__.

> 4 Is there such as include in SSI? so that everytime I run
> something.pl, it will automatically include the sub file?

"use"

Anno


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

Date: 24 Sep 2003 02:13:04 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: Re: What wrong with my module?
Message-Id: <cafe07c7.0309240113.39cae101@posting.google.com>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<bkq5po$4ed53$1@ID-184292.news.uni-berlin.de>...
> Great Deals wrote:
> > secondly i missed the
> > 
> > our @ISA=qw(Exporter); our @EXPORT=qw (getit2);
> 
> That was not necessarily a mistake. An alternative is to fully qualify
> the subroutine name as you did in the first post:
> 
>      $ab = test2::getit2();
> 

I understand now that I don't need our @EXPORT=qw (getit2); if I do
$ab = test2::getit2(); but what is the @ISA for?
in perlmod:
There is no special class syntax in Perl, but a package may act as a
class if it provides subroutines to act as methods. Such a package may
also derive some of its methods from another class (package) by
listing the other package name(s) in its global @ISA array (which must
be a package global, not a lexical).

Does this mean if I don't use subs as methods then I don't need ISA
either? Can you show me the syntax difference between using subs and
using methods?
sub: test2::getit2();
method: test2->getit2();
Am I right?


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

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


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