[19208] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1403 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 30 00:05:49 2001

Date: Sun, 29 Jul 2001 21:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <996465906-v10-i1403@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 29 Jul 2001     Volume: 10 Number: 1403

Today's topics:
        Comma to separate numeric string (thousandth separator) <gbeymk@sgh.com.sg>
    Re: Comma to separate numeric string (thousandth separa <krahnj@acm.org>
        compile the script into binary <maxim68@hotmail.com>
    Re: compile the script into binary <nowhere@dot.com>
    Re: counting <godzilla@stomp.stomp.tokyo>
        How to print a binary string as picture to web page <ctkin@ust.hk>
    Re: How to print a binary string as picture to web page <jeff@vpservices.com>
    Re: Perl & IPC (Alan Barclay)
        Perl Binary <lnc_18@yahoo.com.ar>
    Re: Perl is a c program <NOSPAM.dogansmoobs@ctel.net>
    Re: Perl is a c program <NOSPAM.dogansmoobs@ctel.net>
    Re: Sorting problem <jeff@vpservices.com>
    Re: starting an application and then passing a file to  <james@zephyr.org.uk>
    Re: suid support in Perl <godoy@conectiva.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 30 Jul 2001 11:17:56 +0800
From: YMK <gbeymk@sgh.com.sg>
Subject: Comma to separate numeric string (thousandth separator)
Message-Id: <3B64D1E4.1461BE9D@sgh.com.sg>

Hi !

	I am using Perl version 5.005_03 built for sparc-linux !


I thought   join(",",split(/(\d{1,3}){\d{3})$/))   could do the job.

But I got the following result:

	1       	=>      1
	12      	=>      12
	123     	=>      1231
	1234    	=>      ,1,234
	12345   	=>      ,12,345
	123456  	=>      ,123,456
	1234567 	=>      1,234,567
	12345678        =>      12,345,678
	123456789       =>      123,456,789
	1234567890      =>      1234,567,890 

Could someone enlighten me ?


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

Date: Mon, 30 Jul 2001 03:34:10 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Comma to separate numeric string (thousandth separator)
Message-Id: <3B64D5E9.AEDDB6F3@acm.org>

YMK wrote:
> 
>         I am using Perl version 5.005_03 built for sparc-linux !
> 
> I thought   join(",",split(/(\d{1,3}){\d{3})$/))   could do the job.
> 
> But I got the following result:
> 
>         1               =>      1
>         12              =>      12
>         123             =>      1231
>         1234            =>      ,1,234
>         12345           =>      ,12,345
>         123456          =>      ,123,456
>         1234567         =>      1,234,567
>         12345678        =>      12,345,678
>         123456789       =>      123,456,789
>         1234567890      =>      1234,567,890
> 
> Could someone enlighten me ?

Yes, this is a Frequently Asked Question (perlfaq5)

perldoc -q "numbers with commas"



John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 30 Jul 2001 09:55:49 +0800
From: "meow" <maxim68@hotmail.com>
Subject: compile the script into binary
Message-Id: <9k2er8$ogr@news.or.intel.com>

All,

may i know is there exist a way to compile a perl script into a binary
format(self-executable),  it's becoz i want to hide my source code from
other viewing...


meow




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

Date: Mon, 30 Jul 2001 12:32:59 +1000
From: "Gregory Toomey" <nowhere@dot.com>
Subject: Re: compile the script into binary
Message-Id: <as397.17236$a04.68634@newsfeeds.bigpond.com>


"meow" <maxim68@hotmail.com> wrote in message
news:9k2er8$ogr@news.or.intel.com...
> All,
>
> may i know is there exist a way to compile a perl script into a binary
> format(self-executable),  it's becoz i want to hide my source code from
> other viewing...
 ...
http://www.perlmonks.org/index.pl?node_id=540&lastnode_id=864

gtoomey




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

Date: Sun, 29 Jul 2001 19:26:32 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: counting
Message-Id: <3B64C5D8.CEEA8DDA@stomp.stomp.tokyo>

jtjohnston wrote:

> I have a database text file:
 
> 1¶field1¶field2¶field3¶field4¶field5¶field6¶field7¶field8¶field9¶field10¶
> 
> 2¶field1¶field2¶field3¶field4¶field5¶field6¶john¶field8¶field9¶field10¶
> 3¶field1¶field2¶field3¶field4¶field5¶field6¶mary¶field8¶field9¶field10¶
> 4¶field1¶field2¶field3¶field4¶field5¶field6¶dave¶field8¶field9¶field10¶
 
> I want to parse field7, separate and count occurences of all its
> elements and then output to a text file.

Exceptionally poor parameters leaving a reader having to
make guesses at what you want to do. This is quite rude
and an indicator of a lazy person who cannot be bothered
with writing a coherent article for those whom he expects
to offer help for free or, a red flag indicating a troll.

Your field7, in each case, only contains what would be
considered one element. It is impossible to count
elements as you ask; there is only one element.
Additionally, you display no delimiters for your
elements within field 7. How is a reader to create
code when you fail to provide parameters?

Lines 2, 3, and 4 should be lines 3, 4 and 5, respectively.
Your data base blank line as shown, is line 2. Those numbers
are a line count, are they not? You fail to provide any
parameters regarding blank lines and those line numbers.

It is very illogical to have blank lines in your data base.
This requires coding, if (blank) next; , for efficiency in
not invoking processing when there is only a newline character.


> I have about 2600 records.

Irrelevant.


> I could parse and count the number of times "john" occurs.

Previously you stated you want to count the number of
data elements in each field 7. Now you are stating you
want the number of instances of "john." Why are you
contradicting yourself within the same article? Do
you only want to count the word "john" or tally sum
each instance of repeated words in field 7 for all
lines in your data base? What is it you want to do?


> But in this case, I have no idea what is contained in field 7.

Why is this? Why have you not posted code you have developed,
working or not, to display some effort on your part? Lazy?
Looking for a free ride upon the backs of others? You say
you have no idea what is in field 7 yet show what appears
to be names in each field 7 for each line. Do you know what
is in field 7 for each line or not? You have contradicted
yourself for a second time within your article.


> john¶37¶
> dave¶25¶
> susan¶34¶
> mary¶7¶

What is this? You offer no explanation for what this
incoherent blurb represents.

In the future, rather than coming in here posting incoherent
articles, failing to provide clear and concise parameters,
presenting yourself as a lazy person looking for others to
write his code for him, rather than display those inappropriate
personal attributes, display some pride and effort by posting
articles which are clear, concise and coherent, lest you be
branded something distasteful, such as The CLPM Troll.

My code below my signature is nothing more than a wild guess
at what your blatherings intend. You will find it, as is almost
all of my code, to be relatively quick and efficient. Should my
code not be what you want, glance in a mirror to determine who
lies at fault.


Godzilla!
--
TEST SCRIPT:
____________

#!perl

print "Content-type: text/plain\n\n";

while (<DATA>)
 {
  for ($iterate = 0; $iterate <= 6; $iterate++)
   { substr ($_, 0, index ($_, "¶") + 1, ""); }
  $field_7{substr ($_, 0, index ($_, "¶"))}++;
 }
for (keys %field_7)
 { 
  if ($_)
   { print "$_ - Found: $field_7{$_}\n"; }
 }

__DATA__
1¶field1¶field2¶field3¶field4¶field5¶field6¶William Bonney¶field8¶field9¶field10¶
2¶field1¶field2¶field3¶field4¶field5¶field6¶Pat Garrett¶field8¶field9¶field10¶
3¶field1¶field2¶field3¶field4¶field5¶field6¶Doc Holiday¶field8¶field9¶field10¶
4¶field1¶field2¶field3¶field4¶field5¶field6¶Rio¶field8¶field9¶field10¶
5¶field1¶field2¶field3¶field4¶field5¶field6¶William Bonney¶field8¶field9¶field10¶
6¶field1¶field2¶field3¶field4¶field5¶field6¶Pat Garrett¶field8¶field9¶field10¶


PRINTED RESULTS:
________________
Rio - Found: 1
Pat Garrett - Found: 2
William Bonney - Found: 2
Doc Holiday - Found: 1


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

Date: Mon, 30 Jul 2001 09:52:11 +0800
From: "Kin" <ctkin@ust.hk>
Subject: How to print a binary string as picture to web page
Message-Id: <9k2eji$7je$1@news.ust.hk>

Dear all,
    I store jpeg pictures into Sybase as BLOB type and extract it to a
variable in the CGI program. It is a binary string. How can I print it as a
picture inside a web page directly without saving it to a temporary file
first ? Is there any module that can help me to finish this task ?

Thank in advance

From,
Kin




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

Date: Sun, 29 Jul 2001 19:20:52 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to print a binary string as picture to web page
Message-Id: <3B64C484.FDB87B23@vpservices.com>

Kin wrote:
> 
> Dear all,
>     I store jpeg pictures into Sybase as BLOB type and extract it to a
> variable in the CGI program. It is a binary string. How can I print it as a
> picture inside a web page directly without saving it to a temporary file
> first ? Is there any module that can help me to finish this task ?


Try:

  sub print_blob_to_browser{
      my( $type, $blob ) = @_;
      binmode STDOUT;
      print "Content-type: $type\n\n";
      print $blob;
  }

Called with something like :

  my $blob = get_blob_from_Sybase();
  print_blob_to_browser( 'image/jpeg', $blob );

-- 
Jeff



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

Date: 30 Jul 2001 00:58:27 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Perl & IPC
Message-Id: <996454706.421440@elaine.furryape.com>

In article <3B6409EC.5AAE8A9@centurytel.net>,
mc  <microchip@centurytel.invalid> wrote:
>Can someone point me to a tutorial or howto or something on using IPC
>messaging in perl? I tried IPC::Sysv & IPC::Msg but cant seem to make
>them work ...

perldoc perlipc, it discusses all the various forms of IPC, and
gives example programs for each form.



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

Date: Mon, 30 Jul 2001 00:22:17 -0300
From: "Luciano" <lnc_18@yahoo.com.ar>
Subject: Perl Binary
Message-Id: <9k2ji9$ji0$1@lepsoy.sinectis.com.ar>

I need to find where download the perl binary distro for linux, the last
version if it is posible, beacause i dont know where download in
www.perl.com.. I'm new in perl,  please help me...




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

Date: Sun, 29 Jul 2001 21:26:33 -0400
From: Mik Mifflin <NOSPAM.dogansmoobs@ctel.net>
Subject: Re: Perl is a c program
Message-Id: <tm9dt3muhlnu7e@corp.supernews.com>

Yes, this is what I'm looking at.  The error I encountered is not 
discussed.  I think that the error is related to the glibc-crypt library, 
but I have no idea.  Anyone out there encountered this error before?

 - Mik Mifflin
dogansmoobs at ctel dot net

Gregory Toomey wrote:

> "Mik Mifflin" <NOSPAM.dogansmoobs@ctel.net> wrote in message
> news:tm8ljsikglj74e@corp.supernews.com...
>> I'm trying to embed perl scripts into a C program, and I'm having a bit
>> of
>> trouble.  It seems that I am missing a library or something?  I get the
>> following error when I try to compile:
>>
>> /usr/lib/perl5/5.6.0/i586-linux/CORE/libperl.a(pp.o): In function
>> Perl_pp_crypt:
>> pp.o(.text+0x6483): undefined refrence to crypt.
>>
>> It seems to me like I'm missing a library.  Or maybe part of glibc?  I
> seem
>> to remember there being a package for glibc called glibc-crypt, but I
>> thought that was integrated into the latest release of glibc?  Anyway,
>> any
>> help here would be cool.  Thanks in advance.
>>
>> --
>>  - Mik Mifflin
>> dogansmoobs at ctel dot net
> 
> You may want to look at perlembed
> http://www.perldoc.com/perl5.6/pod/perlembed.html
> 
> gtoomey
> 
> 
> 

-- 
 - Mik Mifflin
dogansmoobs at ctel dot net


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

Date: Sun, 29 Jul 2001 21:29:33 -0400
From: Mik Mifflin <NOSPAM.dogansmoobs@ctel.net>
Subject: Re: Perl is a c program
Message-Id: <tm9e2njd8m261c@corp.supernews.com>

Sorry, minutes after I posted my last reply, I solved my problem.  I simply 
ran ldd `which perl` to see what libs it used, and I say that it used 
libcrypt, I linked with that, and problem solved.  Thanks for the help 
anyway!  :)

 - Mik Mifflin

Gregory Toomey wrote:

> "Mik Mifflin" <NOSPAM.dogansmoobs@ctel.net> wrote in message
> news:tm8ljsikglj74e@corp.supernews.com...
>> I'm trying to embed perl scripts into a C program, and I'm having a bit
>> of
>> trouble.  It seems that I am missing a library or something?  I get the
>> following error when I try to compile:
>>
>> /usr/lib/perl5/5.6.0/i586-linux/CORE/libperl.a(pp.o): In function
>> Perl_pp_crypt:
>> pp.o(.text+0x6483): undefined refrence to crypt.
>>
>> It seems to me like I'm missing a library.  Or maybe part of glibc?  I
> seem
>> to remember there being a package for glibc called glibc-crypt, but I
>> thought that was integrated into the latest release of glibc?  Anyway,
>> any
>> help here would be cool.  Thanks in advance.
>>
>> --
>>  - Mik Mifflin
>> dogansmoobs at ctel dot net
> 
> You may want to look at perlembed
> http://www.perldoc.com/perl5.6/pod/perlembed.html
> 
> gtoomey
> 
> 
> 

-- 
 - Mik Mifflin
dogansmoobs at ctel dot net


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

Date: Sun, 29 Jul 2001 19:28:44 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Sorting problem
Message-Id: <3B64C65C.729212D4@vpservices.com>

Jim Monty wrote:
> 
> Jonathan Sala <jonathan.sala@wichita.boeing.com> wrote:
> > Is there a sort module that will sort the following first by
> > alphanumerically and then the last part numerically.
> >
> > Example:  Sort the following
> >         abc23 abc113 cde34 abc5 cde4 def77 abc1
> >
> > Into the following:
> >         abc1 abc5 abc23 abc113 cde4 cde34 def77
> >
> > Is there some sort module I should use to do this or just create my own
> > own routine to do this?
> 
> As Ilmari Karonen pointed out, there does exist a module for this
> purpose. Depending on your circumstances, however, you may find it
> simpler just to roll your own sort,

[snip nice idiom]

In case you're wondering, use Ilmari or Jim's suggestion rather than the
one I posted earlier.  I was just showing how a very basic sort can work
on your data.  These other suggestions using ST or GRT sorts are much
more robust.

-- 
Jeff



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

Date: Mon, 30 Jul 2001 02:14:25 +0100
From: James Coupe <james@zephyr.org.uk>
Subject: Re: starting an application and then passing a file to it?
Message-Id: <kutZmohxTLZ7EwLY@gratiano.zephyr.org.uk>

In message <y_197.10$OU1.182343@news.interact.net.au>, Tintin
<somewhere@in.paradise.net> writes
>> I want to start an exe file and then pass a binary data file to it.
>>
>> Any guesses on how to do this?
>
>prog.exe file.dat
>
>I suspect this is not really what you wanted, but your question is so vague
>as to be meaningless.

The OP could always try opening the application via a pipe, and then
passing the binary data that way.

        perldoc -f open

As you say, the question is unhelpfully vague.

-- 
James Coupe                                                PGP Key: 0x5D623D5D
                                                                 EBD690ECD7A1F
HEY, MOM! I FOUND SOME OF THOSE PEOPLE ON THE INTERNET           B457CA213D7E6
YOU WERE TELLING ME TO NOT TALK TO!                             68C3695D623D5D


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

Date: Sun, 29 Jul 2001 23:18:45 -0300
From: Jorge Godoy <godoy@conectiva.com>
Subject: Re: suid support in Perl
Message-Id: <m3bsm3p3ay.fsf@dagon.conectiva>

"Tintin" <somewhere@in.paradise.net> writes:

> I'm running Mandrake 8.0 that had a RPM version of Perl 5.6.0 installed.  I
> was using a script that had sgid bit set (to read mail).  I then manually
> installed Perl 5.6.1 and the sgid bit was being ignored.
> 
> What could cause this?

Your perl binary is without the SUID/SGID bit set. 
Please note that there's a 'suidperl' to handle these cases. Don't
make 'perl' SUID/SGID or you might have several security problems. 

-- 
Godoy. <godoy@conectiva.com>

Solutions Developer       - Conectiva Inc. - http://www.conectiva.com
Desenvolvedor de Soluções - Conectiva S.A. - http://www.conectiva.com.br


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

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


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