[23661] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5868 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 28 00:10:46 2003

Date: Thu, 27 Nov 2003 21:10:13 -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           Thu, 27 Nov 2003     Volume: 10 Number: 5868

Today's topics:
        Problem while installing through PPM. (SK)
    Re: Problem while installing through PPM. <invalid-email@rochester.rr.com>
    Re: Problem while installing through PPM. Default@IO_Error_1011101.xyz [JDM]
        problem (aditya)
    Re: regexp: \x0a => \x0d\x0a <usenet@morrow.me.uk>
    Re: regexp: \x0a => \x0d\x0a <flavell@ph.gla.ac.uk>
    Re: regexp: \x0a => \x0d\x0a (Malcolm Dew-Jones)
    Re: regexp: \x0a => \x0d\x0a <usenet@morrow.me.uk>
    Re: regexp: \x0a => \x0d\x0a <krahnj@acm.org>
    Re: rename hash-key ? <rgarciasuarez@free.fr>
    Re: Socket Problem... (Hobbit HK)
    Re: Socket Problem... <usenet@morrow.me.uk>
    Re: store  password  in a module ? ctcgag@hotmail.com
    Re: Uri is mean <sbryce@singlepoint.net>
    Re: use strick & hash ref <tom@nosleep.net>
    Re: use strick & hash ref <noreply@gunnar.cc>
    Re: use strick & hash ref <tom@nosleep.net>
    Re: use strick & hash ref <usenet@morrow.me.uk>
    Re: use strick & hash ref <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 27 Nov 2003 19:54:49 -0800
From: sk_ind12@rediffmail.com (SK)
Subject: Problem while installing through PPM.
Message-Id: <83dee709.0311271954.c3ae923@posting.google.com>

Hello,

I am facing a problem while installing DateTime module through PPM.
when i do a
ppm> search DateTime

i get the following result

 1. Bundle-DateTime        [0.11] Bundle with all DateTime related modules
 2. DateTime             [0.1701] DateTime base objects
 3. DateTime-Calendar-C~   [0.02] Coptic Calendar System.
 .................
 ...................
 ..................
Which indiactes it can find DateTime module. But  now when i try to install
using

ppm> install DateTime

I get a message
 Error: no suitable installation target found for package DateTime.

the repositories in which PPM is searching are

ppm> rep
Repositories:
[1] ActiveState Package Repository
[2] ActiveState PPM2 Repository

I have installed other modules from the ppm but this specific module is
createing some problems.

Kindly suggest.

BTW: i am using ActivePerl 5.6.1

thanks and regards
SK


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

Date: Fri, 28 Nov 2003 04:05:23 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Problem while installing through PPM.
Message-Id: <3FC6C7FC.9020302@rochester.rr.com>

SK wrote:

> Hello,
> 
> I am facing a problem while installing DateTime module through PPM.
> when i do a
> ppm> search DateTime
> 
> i get the following result
> 
>  1. Bundle-DateTime        [0.11] Bundle with all DateTime related modules
>  2. DateTime             [0.1701] DateTime base objects
>  3. DateTime-Calendar-C~   [0.02] Coptic Calendar System.
>  .................
> ...................
> ..................
> Which indiactes it can find DateTime module. But  now when i try to install
> using
> 
> ppm> install DateTime
> 
> I get a message
>  Error: no suitable installation target found for package DateTime.
> 
> the repositories in which PPM is searching are
> 
> ppm> rep
> Repositories:
> [1] ActiveState Package Repository
> [2] ActiveState PPM2 Repository
> 
> I have installed other modules from the ppm but this specific module is
> createing some problems.
> 
> Kindly suggest.
> 
> BTW: i am using ActivePerl 5.6.1
> 
> thanks and regards
> SK
> 

In the past, I have run into the same problem if I installed a newer 
version of ActiveState Perl on top of an older version.  Any chance you 
did that?  Uninstalling the old version and getting rid of the entire 
Perl file hierarchy, then installing the newer version of Perl got rid 
of that problem 100%.

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: Fri, 28 Nov 2003 04:09:34 GMT
From: Default@IO_Error_1011101.xyz [JDM]
Subject: Re: Problem while installing through PPM.
Message-Id: <2Uzxb.8198$lF6.3583@nwrdny01.gnilink.net>

> Hello,
> 
> I am facing a problem while installing DateTime module through PPM.
> when i do a
> ppm> search DateTime
> 
> i get the following result
> 
>  1. Bundle-DateTime        [0.11] Bundle with all DateTime related modules
>  2. DateTime             [0.1701] DateTime base objects
>  3. DateTime-Calendar-C~   [0.02] Coptic Calendar System.
>  .................
> ....................
> ...................
> Which indiactes it can find DateTime module. But  now when i try to install
> using
> 
> ppm> install DateTime
> 
> I get a message
>  Error: no suitable installation target found for package DateTime.
> 
> the repositories in which PPM is searching are
> 
> ppm> rep
> Repositories:
> [1] ActiveState Package Repository
> [2] ActiveState PPM2 Repository
> 
> I have installed other modules from the ppm but this specific module is
> createing some problems.
> 
> Kindly suggest.
> 
> BTW: i am using ActivePerl 5.6.1
> 
> thanks and regards
> SK
> 

You might like using tk-ppm.. its pretty allright :-)

Also here is a list of repositories that comes from a cool module called
PPM::Repositories

 location => 'http://log4perl.sourceforge.net/ppm',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'log4perl (pure perl)',
        PerlV     => [ ],
        PerlO     => ['perl'],
    },
    esoft  => {
        location  => 'ftp://ftp.esoftmatic.com/outgoing/DBI',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'DBI, DBD-Oracle, DBD-ODBC for 5.8',
        PerlV     => [ 5.8 ],
        PerlO     => ['MSWin32'],
    },
    savage => {
        location  => 'http://savage.net.au/Perl-modules/ppm',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'CGI::Explorer, DBIx::*, etc',
        PerlV     => [ 5.8 ],
        PerlO     => ['MSWin32'],
    },
    spurkis => {
        location  => 'http://www.epn.ml.org/~spurkis/Agent/repository',
        Type      => '??',
        Active    => 0,
        Notes     => 'GONE FOREVER',
        PerlV     => [],
        PerlO     => [],
    },
    crazy => {
        location  => 'http://crazyinsomniac.perlmonk.org/perl/ppm',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Maintainer takes requests',
        PerlV     => [ 5.6 ],
        PerlO     => ['MSWin32'],
    },
    crazy58 => {
        Name      => 'crazy',
        location  => 'http://crazyinsomniac.perlmonk.org/perl/ppm/5.8',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Maintainer takes requests',
        PerlV     => [ 5.8 ],
        PerlO     => ['MSWin32'],
    },
    theory => {
        location  => 'http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer',
        Type      => 'PPMServer',
        Active    => 1,
        Notes     => 'Get your mod_perl(s) here',
        PerlV     => [ 5.6 ],
        PerlO     => ['MSWin32'],
    },
    theoryS => {
        location  => 'http://theoryx5.uwinnipeg.ca/ppmpackages',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your mod_perl(s) here(SLOWER)',
        PerlV     => [ 5.6 ],
        PerlO     => ['MSWin32'],
    },
    theory58 => {
        location  => 'http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58',
        Type      => 'PPMServer',
        Active    => 1,
        Notes     => 'Get your mod_perl(s) here',
        PerlV     => [ 5.8 ],
        PerlO     => ['MSWin32'],
    },
    theory58S => {
        location  => 'http://theoryx5.uwinnipeg.ca/ppms',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your mod_perl(s) here(SLOWER)',
        PerlV     => [ 5.8 ],
        PerlO     => ['MSWin32'],
    },
    devhelp => {
        location  => 'http://ppd.develop-help.com/ppd',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your Apache::Session here',
        PerlV     => [ 5.6 ],
        PerlO     => ['MSWin32'],
    },
    dada => {
        location  => 'http://dada.perl.it/PPM',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your Win32::API here',
        PerlV     => [ 5.5, 5.6 ],
        PerlO     => ['MSWin32'],
    },
    rto => {
        location  => 'http://rto.dk/packages',
        Type      => 'Webpage',
        Active    => 0,
        Notes     => 'GONE (forget what was there)',
        PerlV     => [ 5.6 ],
        PerlO     => [],
    },
    jenda => {
        location  => 'http://jenda.krynicky.cz/perl',
        Type      => 'Webpage or PPMServer?',
        Active    => 1,
        Notes     => 'AWSOME (tons of Win32 related stuff by him)',
        PerlV     => [ 5.6, 5.8 ],
        PerlO     => ['MSWin32'],
    },
    xray => {
        location  => 'http://www.xray.mpe.mpg.de/~ach/ptk/ppm',
        Type      => '??',
        Active    => 0,
        Notes     => 'long gone',
        PerlV     => [ 5.6 ],
        PerlO     => [],
    },
    openi => {
        location  => 'http://openinteract.sourceforge.net/ppmpackages',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Template Toolkit!!!',
        PerlV     => [ 5.6, 5.8 ],
        PerlO     => ['MSWin32'],
    },
    
    roth => {
        location  => 'http://www.roth.net/perl/packages',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'More Win32:: stuff',
        PerlV     => [ 5.5, 5.6, 5.8],
        PerlO     => ['MSWin32'],
    },

    sablot => {
        location  => 'http://ppm.gingerall.cz',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your XML::Sablotron here',
        PerlV     => [ 5.5, 5.6, 5.8 ],
        PerlO     => ['MSWin32'],
    },
    perlxml => {
        location  => 'http://www.perlxml.net/PPM',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your libxml-perl here. Please note that this is known to disappear for a few days and come back.',
        PerlV     => [ 5.6, 5.8 ],
        PerlO     => ['MSWin32'],
    },
    datetime => {
        location  => 'http://datetime.perl.org/download',
        Type      => 'Webpage',
        Active    => 1,
        Notes     => 'Get your DateTime modules here',
        PerlV     => [ 5.6, 5.8 ],
        PerlO     => ['MSWin32'],
    },
);

with tk-ppm it is very easy to add these urls and install packages.


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

Date: 27 Nov 2003 20:48:32 -0800
From: truman@rediffmail.com (aditya)
Subject: problem
Message-Id: <a9c1fb1f.0311272048.1ccca814@posting.google.com>

Hi,
I am new to perl and I belive the following code has a problem. Can
someone tell me what? The stuff I want to add in the html page (inside
the 'if' condition below), it doesnt come at all!

Please help!

Aditya


##############################################################################
package App::Dialog::Field::Scheduling::ReoccuringAppts;
##############################################################################

use strict;
use base qw{CGI::Dialog::ContentItem};
use CGI::Dialog;
use CGI::Validator::Field;
use base qw{CGI::Dialog::MultiField};

sub new
{
	my ($type, %params) = @_;
	
	#added
	
	my $temp=$params{val};
	
	if ($temp eq '1')
	{
			return CGI::Dialog::MultiField::new($type, %params,
			fields => [
			new CGI::Dialog::Field(caption => "Appointments Interval",
					name => "appt_Interval",
					choiceDelim =>',',
					selOptions => q{Day:0, Week:1, 2 Weeks:2, Month:3, 2 Months:4, 6
Months:5, Year:6},
					type => 'select',
					),
					
					new App::Dialog::Field::Scheduling::Date(caption => "Termination
Date",
					name => "Term_date",
					options => FLDFLAG_REQUIRED,
					),
			],		
		);
	}
}


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

Date: Thu, 27 Nov 2003 20:26:04 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: regexp: \x0a => \x0d\x0a
Message-Id: <bq5mks$nqq$1@wisteria.csv.warwick.ac.uk>


=?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@monaco377.com> wrote:
> In a file, I have \x0a characters and I'd like to replace them by the couple
> \x0d\x0a
> 
> How can I do ?
> 
> Note: If I have already \x0d\x0a, I don't want to replace \x0a of course.

If you have 5.8, you can use

  perl -Mopen=IN,:raw,OUT,:crlf -pi -e1 <file>

You may need 5.8.1 to avoid double "\r\r\n"s... IIRC this was one of
the bugfixes.

Ben

-- 
       .  |  .
    \           /           The clueometer is reading zero.
  .               .
 __ <-----@       __                                           ben@morrow.me.uk


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

Date: Thu, 27 Nov 2003 21:41:14 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: regexp: \x0a => \x0d\x0a
Message-Id: <Pine.LNX.4.53.0311272124300.4202@ppepc56.ph.gla.ac.uk>

On Thu, 27 Nov 2003, Ben Morrow wrote:

> You may need 5.8.1 to avoid double "\r\r\n"s... IIRC this was one of
> the bugfixes.

Yes, it's mentioned in the perldelta

Apropos of which, I suppose I ought at some point to repeat with
5.8.1 the tests that I had reported for 5.8.0 in
http://www.google.com/groups?selm=Pine.LNX.4.53.0308170139110.6451%40lxplus005.cern.ch
(message Pine.LNX.4.53.0308170139110.6451@lxplus005.cern.ch )
and related thread, about apparently broken newlines handling with
utf-16LE

Or could you perhaps throw any light, if you're interested, on what I
was seeing there and the subsequent followup?

I don't see anything clearly mentioned in the perldelta for 5.8.1
about *this* particular issue.

cheers


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

Date: 27 Nov 2003 15:24:24 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: regexp: \x0a => \x0d\x0a
Message-Id: <3fc687a8@news.victoria.tc.ca>

=?ISO-8859-15?Q?S=E9bastien?= Cottalorda (sppNOSPAM@monaco377.com) wrote:
: Hi,

: In a file, I have \x0a characters and I'd like to replace them by the couple
: \x0d\x0a

: How can I do ?

: Note: If I have already \x0d\x0a, I don't want to replace \x0a of course.

What would you do with \x0d\x0a\x0a?

In addition to other techniques, you could

	s/\x0a\x0a/\x0a/g; # reduce pairs to singles
	s/\x0a/\x0a\x0a/g; # expand singles to pairs



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

Date: Fri, 28 Nov 2003 04:01:44 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: regexp: \x0a => \x0d\x0a
Message-Id: <bq6hb8$bla$1@wisteria.csv.warwick.ac.uk>

"Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote:
> Apropos of which, I suppose I ought at some point to repeat with
> 5.8.1 the tests that I had reported for 5.8.0 in
> http://www.google.com/groups?selm=Pine.LNX.4.53.0308170139110.
> 6451%40lxplus005.cern.ch
> (message Pine.LNX.4.53.0308170139110.6451@lxplus005.cern.ch )
> and related thread, about apparently broken newlines handling with
> utf-16LE
> 
> Or could you perhaps throw any light, if you're interested, on what I
> was seeing there and the subsequent followup?

Right... I've some some testing on this, and I would say it's
definitely a bug... Also that it has nothing to do with utf16le,
specifically; rather that it is a problem with the :crlf layer.

Please excuse the rather long post.

All the tests below have exactly the same results with 5.8.0 and
5.8.2. All tests have been run on i686-linux-thread-multi, but as of
5.8 they ought to give the same results on all platforms, given that
all filehandles are explicitly binmode()d. (I could be wrong: if Win32
systems have :crlf pushed by default then it's *definitely* worth
pushing :raw before you do anything else if you're dealing with utf16)

First, input. This is a modified version of your script/test file from
the above post. The output has been line-wrapped for posting.

% od -x utf16
0000000 feff 004e 004f 0054 0045 0053 0020 0046
        ^^^^ BOM (le)
0000020 004f 0052 4120 0041 0044 0044 0049 0054
                  ^^^^ a char >FF
0000040 0049 004f 004e 0041 004c 0020 0041 00a0
                            a char >7F <FF ^^^^
0000060 0055 004e 0044 002e 000d 000a 000d 000a
            DOSish newlines ^^^^-^^^^
0000100

% cat read
#!/usr/bin/perl

use strict;
use warnings;
use Encode qw/:fallbacks is_utf8 _utf8_on/;
use PerlIO::encoding;

my $bom = "\x{feff}";

# just so we know what's what
$PerlIO::encoding::fallback = FB_PERLQQ;
binmode STDOUT, ":encoding(ascii)";

# the first argument is the list of layers to use
open my $IN, "<$ARGV[0]", "utf16" or die $!;

$\ = "\n"; $, = " ";
$_ = <$IN>;

print "utf8 flag is", is_utf8($_) ? "on" : "off";

# force utf8 flag on if we were given two arguments
$ARGV[1] and _utf8_on($_), print "forcing utf8"; 

s/^$bom// and print "snipped BOM";
chomp;

# this is a slightly clearer display format
print map {sprintf "%04x", $_} unpack '(U)*', $_;
print;

__END__

% ./read ":encoding(utf16le)"
utf8 flag is on
snipped BOM
004e 004f 0054 0045 0053 0020 0046 004f 0052 4120 0041 0044 0044 0049
0054 0049 004f 004e 0041 004c 0020 0041 00a0 0055 004e 0044 002e 000d
                                     DOSish newline not stripped ^^^^
NOTES FOR\x{4120}ADDITIONAL A\x{00a0}UND.

% ./read ":encoding(utf16le):crlf"
utf8 flag is off
00ef 00bb 00bf 004e 004f 0054 0045 0053 0020 0046 004f 0052
^^^^-^^^^-^^^^ this is \x{feff} in utf8
00e4 0084 00a0 0041 0044 0044 0049 0054 0049 004f 004e 0041
^^^^-^^^^-^^^^ ditto \x{4120}
004c 0020 0041 00c2 00a0 0055 004e 0044 002e
         DOSish newline is stripped, however ^^
\x{00ef}\x{00bb}\x{00bf}NOTES FOR\x{00e4}\x{0084}\x{00a0}ADDITIONAL
A\x{00c2}\x{00a0}UND.

% ./read ":encoding(utf16le):crlf" 1
utf8 flag is off
forcing utf8
snipped BOM
004e 004f 0054 0045 0053 0020 0046 004f 0052 4120 0041 0044 0044 0049
0054 0049 004f 004e 0041 004c 0020 0041 00a0 0055 004e 0044 002e
NOTES FOR\x{4120}ADDITIONAL A\x{00a0}UND.

So the problem here is that :crlf fails to set the utf8 flag on the
data when it should. Now, output.

% perl -e'binmode STDOUT, ":encoding(utf16le)"; 
          print "\xa0hello\n\n"' > out
% od -x out
0000000 00a0 0068 0065 006c 006c 006f 000a 000a
0000020

% perl -e'binmode STDOUT, ":crlf:encoding(utf16le)"; 
          print "\xa0hello\n\n"' > out
% od -x out
0000000 00a0 0068 0065 006c 006c 006f 0a0d 0d00
0000020 000a
0000022

This is not actually quite such nonsense as it seems: because 'od -x'
byteswaps everything, the file actually ends '6f 00 0d 0a 00 0d 0a 00',
which is the perfectly reasonable result of treating the binary
UTF16 data as text. So we do the :crlf before the UTF16:

% perl -e'binmode STDOUT, ":encoding(utf16le):crlf"; 
          print "\xa0hello\n\n"' > out
Malformed UTF-8 character (unexpected continuation byte 0xa0, with no
preceding start byte) in null operation.
% od -x out
0000000 0000 0068 0065 006c 006c 006f 000d 000a
0000020 000d 000a
0000024

This last would give the desired result, but seems to have the
converse problem from above: that it is trying to treat as utf8 data
that should be treated as bytes.

Having a look at perlio.c suggests to me (though I can't entirely
follow it) that a :crlf layer always has PERLIO_F_UTF8 off, when in
fact it should check the state of the layer below and set itself
accordingly. Having a think about the issued involved suggests to me
that Microsoft should *really* have taken to opportunity of changing
to utf16 to ditch using \r\n... but there we go.

I would seriously consider not using :crlf at all, but instead writing
a :nl layer that maps any of \n, \r, \r\n to \n on input and any of
\n, \r, \r\n to \r\n on output... seems to me that'd be more use, in
general. I guess it would probably be slower.

Ben

-- 
Musica Dei donum optimi, trahit homines, trahit deos.    |
Musica truces mollit animos, tristesque mentes erigit.   |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |


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

Date: Fri, 28 Nov 2003 04:58:06 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: regexp: \x0a => \x0d\x0a
Message-Id: <3FC6D5A8.18036FD@acm.org>

Sébastien Cottalorda wrote:
> 
> In a file, I have \x0a characters and I'd like to replace them by the couple
> \x0d\x0a
> 
> How can I do ?
> 
> Note: If I have already \x0d\x0a, I don't want to replace \x0a of course.

perl -i~ -lpe'BEGIN{$/=$\="\x0d\x0a"}s/(?=\x0a)/\x0d/g' yourfile



John
-- 
use Perl;
program
fulfillment


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

Date: 27 Nov 2003 23:25:19 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: rename hash-key ?
Message-Id: <slrnbscthj.2ag.rgarciasuarez@dat.local>

Abigail wrote in comp.lang.perl.misc :
> While the order of hash keys is unpredictable, it's *documented* to
> be *repeatable* if you don't modify the hash.

That's right ; my previous post was misled.


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

Date: 27 Nov 2003 12:32:33 -0800
From: hobbit_hk@hotmail.com (Hobbit HK)
Subject: Re: Socket Problem...
Message-Id: <22ee5d47.0311271232.747bab88@posting.google.com>

I'm not using <$sock> because I want to also get messages that doesn't
end with a newline, any didn't want to play with $/...
print "$byte" - I know I don't have to quote this, but it looks better
:)
Oh and about that "print $msg" instead of "print $sock $msg", I tried
this to see if the program stucks (it doesn't) and forgot to replace
it back...

BTW I'll check about the kill thing, thanks :)


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

Date: Thu, 27 Nov 2003 20:47:39 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Socket Problem...
Message-Id: <bq5ntb$nqq$3@wisteria.csv.warwick.ac.uk>

[please quote (with attribution) so people have some idea of what you
are replying to]

hobbit_hk@hotmail.com (Hobbit HK) wrote:
> Ben Morrow wrote:
> > hobbit_hk@hotmail.com wrote:
> > > [something using sysread]
> >
> > Why not just use <$sock>?
>
> I'm not using <$sock> because I want to also get messages that doesn't
> end with a newline, any didn't want to play with $/...

That is not a good reason. Reading a byte at a time, *espscially* with
sysread, is very inefficient. Learn how to use $/ (and $\).

You presumably have some way of delimiting messages?

> > > print "$byte";
> >
> > You don't need to quote that.
>
> print "$byte" - I know I don't have to quote this, but it looks better
> :)

No it doesn't. It looks more confusing, and leads the reader to think
that either you don't know what you're doing or there's something
clever going on that he hasn't noticed. Both waste our time: don't do
it.

> > > print $msg;
> >
> > Don't you mean 'print $sock $msg;'?
>
> Oh and about that "print $msg" instead of "print $sock $msg", I tried
> this to see if the program stucks (it doesn't) and forgot to replace
> it back...

Again, wasting our time. People do not take kindly to having their
time wasted by those asking for help.

> BTW I'll check about the kill thing, thanks :)

I suspect it may not help you... have you tried connecting to the
relevant port with telnet, or with PuTTY in 'raw' mode, to check if
you actually get anything echoed back?

Ben

-- 
Musica Dei donum optimi, trahit homines, trahit deos.    |
Musica truces mollit animos, tristesque mentes erigit.   |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |


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

Date: 27 Nov 2003 21:50:15 GMT
From: ctcgag@hotmail.com
Subject: Re: store  password  in a module ?
Message-Id: <20031127165015.796$CX@newsreader.com>

shijialee@hotmail.com (Qiang) wrote:
> hello,
>
> i have a module connect to a database and return some information for
> user. the database name and password are stored in it.
>
> now the user will run another perl file which use the module. however,
> i don't know how do i pretect the database password from user?

Make a database account that only has the priviledge to get the information
(not to change it or do anything else you don't want the user to do).
Then make the module use that account, and who cares if they can get its
password?  Sometimes that is easier said than done, but I think it's the
best solution.


> i heard about setuid, but it seems to have it's own security problem.
>
> can anyone recommend elegant way to solve this problem ?

I think it would pretty elegant if there were a variant of "use", let's
call it "abuse", which instead of loading and compiling the abused module
into the original executing interpreter, would instead fire up a setuid
interpreter for the module, acting as a server, and connect the abusing
module to it as a client.  Then it would do all the necessary shenanigans
to make it (mostly) transparent.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: Thu, 27 Nov 2003 19:44:56 -0700
From: Scott Bryce <sbryce@singlepoint.net>
Subject: Re: Uri is mean
Message-Id: <3FC6B6A8.10207@singlepoint.net>

Default@IO_Error_1011101.xyz wrote:

> btw what you just posted is completly useless and mean uri or norman or
> whoever you are. :p

So was that.

You haven't been lurking long have you? Posts that say nothing more than 
"Uri is mean," or "Tad is mean," or "{name your favorite Perl guru} is 
mean" serve only to insure that your questions will not be answered in 
the future.

I have made some pretty silly posts on this NG in the past. In all but 
one case I got "mean" replies. Every one of then was very helpful. Learn 
from them, and post smarter in the future.

-- 
Scott





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

Date: Thu, 27 Nov 2003 17:16:05 -0800
From: "Tom" <tom@nosleep.net>
Subject: Re: use strick & hash ref
Message-Id: <3fc6af08$1@nntp0.pdx.net>

This is too much.

One time (or even several runs) I run the program, it runs fine.
The next time, ater no changes, it gets this:

Can't use string ("") as a HASH ref while "strict refs" in use at ./fs.pl
line 2288.

Thus is plain BS.
I have searched documentation and the net for two weeks now and nothing that
devuldges what is causing this.

I have followed eample code to the tee.

Any ideas at all?

Thanks,
Tom



> use strict;
>
>   my %ndbhsh;
> #  my %nasstk    = ();
> my $nasstk;
>
> my @dailty;
> my $val1 = 1;
> my $val2 = 2;
>
> # Tie Database
>   tie(%ndbhsh,"MLDBM",$ndbfile,O_RDWR | O_CREAT) || die "Can't tie junk:
> $!";
>
> $nasstk = $ndbhsh{$keyval};
>
> # Build Hash Entry
>     @daily = ();
>     push(@daily,$val1,$va2);
>
>
> $nasstk->{DAILY} = join(":",@daily);
>
> $ndbhsh{$keyval} = \%$nasstk;
>
> untie %ndbhsh;






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

Date: Fri, 28 Nov 2003 02:32:45 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: use strick & hash ref
Message-Id: <bq68md$1ts8nu$1@ID-184292.news.uni-berlin.de>

Tom wrote:
> One time (or even several runs) I run the program, it runs fine. 
> The next time, ater no changes, it gets this:
> 
> Can't use string ("") as a HASH ref while "strict refs" in use at
> ./fs.pl line 2288.

Would you mind letting us know which of the lines you posted is line 2288?

> Thus is plain BS.

No comments at this time.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Thu, 27 Nov 2003 18:03:52 -0800
From: "Tom" <tom@nosleep.net>
Subject: Re: use strick & hash ref
Message-Id: <3fc6ba39$1@nntp0.pdx.net>


"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x765h8vonh.fsf@mail.sysarch.com...
> >>>>> "T" == Tom  <tom@nosleep.net> writes:
>
>   T> I only wish I knew what the hell I keep doing to make this work, then
not
>   T> work, then work again, when "use strict" is included.
>   T> It works all the time with it off.
>   T> Too strange.
>   T> I have diffed files during working and non, and nothing is different.
>
> is this mod_perl? if so, it may be running cached versions which have
> strict off. have you tested your code with perl -c? that is always a
> good thing to do when cleaning up strict errors.


Everything checks OK.
I'm following examples to a tee, as well.
>
> uri
>
> -- 
> Uri Guttman  ------  uri@stemsystems.com  -------- 
http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and
Coding-
> Search or Offer Perl Jobs  ---------------------------- 
http://jobs.perl.org




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

Date: Fri, 28 Nov 2003 04:17:21 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: use strick & hash ref
Message-Id: <bq6i8h$bla$3@wisteria.csv.warwick.ac.uk>


"Tom" <tom@nosleep.net> wrote:
> Can't use string ("") as a HASH ref while "strict refs" in use at ./fs.pl
> line 2288.
> 
> Thus is plain BS.

Err... no. The Computer Is Always Right. ;)

> > use strict;
> >
> >   my %ndbhsh;
> > #  my %nasstk    = ();
> > my $nasstk;
<snip>
> > # Tie Database
> >   tie(%ndbhsh,"MLDBM",$ndbfile,O_RDWR | O_CREAT) || die "Can't tie junk:
> > $!";
> >
> > $nasstk = $ndbhsh{$keyval};
<snip>
> > $nasstk->{DAILY} = join(":",@daily);

Assumming this is line 2288, replace it with
  $nasstk     or die "No entry for $keyval";
  ref $nasstk or die "Weird entry for $keyval: $nasstk";
  $nasstk->{DAILY} = join ":", @daily;

Ben

-- 
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based 
on the strictest morality.  [Samuel Butler, paraphrased]       ben@morrow.me.uk


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

Date: Fri, 28 Nov 2003 04:29:14 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: use strick & hash ref
Message-Id: <x7k75lnmjp.fsf@mail.sysarch.com>

>>>>> "T" == Tom  <tom@nosleep.net> writes:

  T> "Uri Guttman" <uri@stemsystems.com> wrote in message
  T> news:x765h8vonh.fsf@mail.sysarch.com...

  >> >>>>> "T" == Tom  <tom@nosleep.net> writes:
  T> I only wish I knew what the hell I keep doing to make this work,
  T> then not work, then work again, when "use strict" is included.  It
  T> works all the time with it off.  Too strange.  I have diffed files
  T> during working and non, and nothing is different.

  >> is this mod_perl? if so, it may be running cached versions which have
  >> strict off. have you tested your code with perl -c? that is always a
  >> good thing to do when cleaning up strict errors.

  T> Everything checks OK.
  T> I'm following examples to a tee, as well.

and can you answer my questions? and examples are not always correct.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

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


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