[28796] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 40 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 17 03:05:57 2007

Date: Wed, 17 Jan 2007 00:05:06 -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           Wed, 17 Jan 2007     Volume: 11 Number: 40

Today's topics:
        [ANNOUNCE] Emacs modules for Perl programming (Jari Aalto+mail.perl)
    Re: convert Vbscript to Perl code <spamtrap@dot-app.org>
    Re: convert Vbscript to Perl code <uri@stemsystems.com>
    Re: convert Vbscript to Perl code <cwilbur@chromatico.net>
    Re: convert Vbscript to Perl code <anonymous@127.0.0.1>
    Re: I can't figure this regex out, Help please. <mritty@gmail.com>
    Re: I can't figure this regex out, Help please. <mritty@gmail.com>
    Re: I can't figure this regex out, Help please. <jurgenex@hotmail.com>
        imager sample for text jcharth@hotmail.com
    Re: imager sample for text <spamtrap@dot-app.org>
    Re: Map Windows from Unix <spamtrap@dot-app.org>
    Re: Map Windows from Unix <m@remove.this.part.rtij.nl>
        new CPAN modules on Wed Jan 17 2007 (Randal Schwartz)
    Re: package mail::message anyone heard of it? <spamtrap@dot-app.org>
    Re: Piping from perl to C <spamtrap@dot-app.org>
    Re: Postscript-Wizzards? How to set the background for  <spamtrap@dot-app.org>
    Re: Question on SIGTERM wing328hk@gmail.com
    Re: Question on SIGTERM <ced@blv-sam-01.ca.boeing.com>
    Re: Question on SIGTERM wing328hk@gmail.com
        Silly Newbie questions <kkjunk123@yahoo.com>
    Re: Silly Newbie questions usenet@DavidFilmer.com
    Re: Silly Newbie questions (NOSPAM)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 17 Jan 2007 05:28:39 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: [ANNOUNCE] Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1169011682@rtfm.mit.edu>

Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
Maintainer: Jari Aalto A T cante net

Announcement: "What Emacs lisp modules can help with programming Perl"

    Preface

        Emacs is your friend if you have to do anything comcerning software
        development: It offers plug-in modules, written in Emacs lisp
        (elisp) language, that makes all your programmings wishes come
        true. Please introduce yourself to Emacs and your programming era
        will get a new light.

    Where to find Emacs/XEmacs

        o   Unix:
            http://www.gnu.org/software/emacs/emacs.html
            http://www.xemacs.org/

        o   Unix Windows port (for Unix die-hards):
            install http://www.cygwin.com/  which includes native Emacs 21.x.
            and XEmacs port

        o   Pure Native Windows port
            http://www.gnu.org/software/emacs/windows/ntemacs.html
            ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe

        o   More Emacs resources at
            http://tiny-tools.sourceforge.net/  => Emacs resource page

Emacs Perl Modules

    Cperl -- Perl programming mode

        http://math.berkeley.edu/~ilya/software/emacs/
        by Ilya Zakharevich

        CPerl is major mode for editing perl files. Also included in
        latest Emacs, but newest version is at Ilya's site. Note that
        the directrory at CPAN is out of date:
        http://www.cpan.org/modules/by-authors/id/ILYAZ/cperl-mode/

        Compared to default `perl-mode' that comes with Emacs, this
        one has more features.

    TinyPerl -- Perl related utilities

        http://tiny-tools.sourceforge.net/

        If you ever wonder how to deal with Perl POD pages or how to find
        documentation from all perl manpages, this package is for you.
        Couple of keystrokes and all the documentaion is in your hands.

        o   Instant function help: See documentation of `shift', `pop'...
        o   Show Perl manual pages in *pod* buffer
        o   Grep through all Perl manpages (.pod)
        o   Follow POD references e.g. [perlre] to next pod with RETURN
        o   Coloured pod pages with `font-lock'
        o   Separate `tiperl-pod-view-mode' for jumping topics and pages
            forward and backward in *pod* buffer.

        o   Update `$VERSION' variable with YYYY.MMDD on save.
        o   Load source code into Emacs, like Devel::DProf.pm
        o   Prepare script (version numbering) and Upload it to PAUSE
        o   Generate autoload STUBS (Devel::SelfStubber) for you
            Perl Module (.pm)

    TinyIgrep -- Perl Code browsing and easy grepping

        [TinyIgrep is included in Tiny Tools Kit]

        To grep from all installed Perl modules, define database to
        TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
        how to set up dattabases for Perl5, Perl4 whatever you have
        installed

        TinyIgrep calls Igrep.el to to do the search, You can adjust
        recursive grep options, set search case sensitivity, add user grep
        options etc.

        You can find latest `igrep.el' module at
        <http://groups.google.com/groups?group=gnu.emacs.sources> The
        maintainer is Jefin Rodgers <kevinr@ihs.com>.

    TinyCompile -- To Browse grep results in Emacs *compile* buffer

        TinyCompile is a minor mode for *compile* buffer from where
        you can collapse unwanted lines or shorten file URLs:

            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT

            -->

            cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
            file1:NNN: MATCHED TEXT
            file1:NNN: MATCHED TEXT

End



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

Date: Tue, 16 Jan 2007 21:38:29 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: convert Vbscript to Perl code
Message-Id: <m2vej65qe2.fsf@Sherm-Pendleys-Computer.local>

RedGrittyBrick <RedGrittyBrick@SpamWeary.foo> writes:

> Tad is pointing out that if you want help with Perl, it is a good idea
> to make an attempt and post your code. The Posting Guidelines which
> are posted to this newsgroup twice a week also make this point.

It's also important to realize that this isn't just a power trip, or rules
for their own sake. Once you've been programming for long enough, you learn
that the very process of trimming down a question as suggested in the group
guidelines quite often leads directly to the answer itself.

Focusing the problem domain is a difficult skill to master, but well worth
the effort it takes.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Tue, 16 Jan 2007 22:06:27 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: convert Vbscript to Perl code
Message-Id: <x7wt3ml5cc.fsf@mail.sysarch.com>

>>>>> "T" == Thrill5  <nospam@somewhere.com> writes:

  T> Not as foolish as you have made yourself out to be.

  T> Scott 

the big difference is that i was doing it on purpose to make a point. he
(and you) can't seem to help it. and do you help with perl here? if not,
please take the same advice as i gave before. you don't help, you have
no right to comment on how others help. i will await your perl help. 

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: 17 Jan 2007 01:24:09 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: convert Vbscript to Perl code
Message-Id: <873b6a6uie.fsf@mithril.chromatico.net>

>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:

    SP> It's also important to realize that this isn't just a power
    SP> trip, or rules for their own sake. Once you've been
    SP> programming for long enough, you learn that the very process
    SP> of trimming down a question as suggested in the group
    SP> guidelines quite often leads directly to the answer itself.

Indeed; I have a stuffed toy tiger that I explain Objective-C
programming problems to, and the act of explaining them solves them
most of the time.  I don't see why the same tactic wouldn't work in
Perl, except that I rarely have Perl problems that require deep
thought.  Domain problems that need to be expressed in Perl, yes....

I expect the tiger will go on strike when 10.5 is released.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Wed, 17 Jan 2007 02:25:08 -0500
From: "Jim Carlock" <anonymous@127.0.0.1>
Subject: Re: convert Vbscript to Perl code
Message-Id: <45adcf5c$0$9628$4c368faf@roadrunner.com>

"Boris Skoblo" <borsk@technion.ac.il> posted...
: strLDAP = "LDAP://CN=test,OU=users,DC=tech,DC=com"
: set usr = GetObject(strLDAP)
:
: Wscript.echo usr.TerminalServicesWorkDirectory
: Wscript.echo usr.TerminalServicesInitialProgram
:
: usr.TerminalServicesInitialProgram= "cmd.exe"
: usr.TerminalServicesWorkDirectory= "D:\path"
:
: usr.SetInfo
:
: WScript.echo usr.TerminalServicesInitialProgram
: Wscript.echo usr.TerminalServicesWorkDirectory
:

Not sure what the CN is for. But the OU I believe equates to
"organization unit" and possibly ends up a part of the two DC
items => users.tech.com, where users is probably the name of
the server getting connected to.

In what I've read, CN turns out to identify a username, and/or
possibly other types of information.

TerminalServices indicates the Terminal Services service runs
on the domain controller/client system.

And both,
  TerminalServicesInitialProgram and
  TerminalServicesWorkDirectory
appear to be properties of Terminal Services. I'm not all that
familiar with Terminal Services.

GetInfo() reads the information into a class object variable.
SetInfo() writes the information in the class object variable to
the system.

Wscript.echo tends to do the same thing as the Perl print()
or echo() functions.

From the Microsoft site:

Dim cont As IADsContainer
Dim usr As IADsUser
Set cont = GetObject("LDAP://OU=Sales,DC=Fabrikam,DC=com")
Set usr = cont.GetObject("user", "CN=jeffsmith")

is equivalent to...

Dim usr As IADsUser
Set usr=GetObject("LDAP://CN=jeffsmith,OU=Sales,DC=Fabrikam,DC=com")

And then from another page at the Microsoft site...

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")

strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)

Wscript.Echo objUser.AdsPath

So IF there's a way to duplicate the CreateObject() inside of
Perl (which I believe is the standard way of creating any COM
object) it should be fairly easy to convert the script to Perl.

The following should be fairly close to what the OP wants.

use Win32::OLE;
$sLDAP = "LDAP://CN=test,OU=users,DC=tech,DC=com";
Win32::OLE::CreateObject($sLDAP, $oUsr) ||
 die "CreateObject: $!";

print $oUsr->TerminalServicesWorkDirectory;
print $oUsr->TerminalServicesInitialProgram;

$oUsr->TerminalServicesInitialProgram = "cmd.exe";
$oUsr->TerminalServicesWorkDirectory = "D:\path";

$oUsr->SetInfo

print $oUsr->TerminalServicesWorkDirectory;
print $oUsr->TerminalServicesInitialProgram;

I'm not a vbscript expert nor and definitely not Perl expert.

I hope I'm pretty close in what I've provided.

And I hope the OP comes back to let me know how close.

-- 
Jim Carlock
Post replies to the group.




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

Date: 16 Jan 2007 18:23:51 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: I can't figure this regex out, Help please.
Message-Id: <1169000630.734284.191380@38g2000cwa.googlegroups.com>

Charlie White wrote:
> I have a string that has been excaped with "\"
>
> eg.   "This is charlie\'s company\'s  May\\June"

That is a bad "eg.".  In Perl code, a double quoted string
interpolates, so the above is equivalent to the string:
q{This is charlie's company's May\June}

So I have no idea if that's the actual string you have, or if your real
string actually has a total of four slashes in it.  And I have
absolutely no intention of guessing.  This is why the Posting
Guidelines tell you to post a short but complete script, rather than
pseudo-code snippets, so we can see exactly what you're dealing with.

> Everything I tried drops out the \ between MayJune also

And how can we help you understand what you're doing wrong if you won't
show us any of these attempts?

> Anyhelp in this regex would be gratefully appreciated

And putting a little care into your post would be appreciated by those
from whom you're seeking help.

Paul Lalli



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

Date: 16 Jan 2007 18:30:30 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: I can't figure this regex out, Help please.
Message-Id: <1169001029.956606.201350@q2g2000cwa.googlegroups.com>

J=FCrgen Exner wrote:
> Charlie White wrote:
> > I have a string that has been excaped with "\"
> >
> > eg.   "This is charlie\'s company\'s  May\\June"
> >
> > what I would like to end up with is
> >
> > "This is charlie's company's  May\June"
>
> Sorry for being dense, but those two strings are identical already.

I beg to differ.

$ cat clpm.pl
$x =3D "This is charlie\'s company\'s  May\\June";
$y =3D "This is charlie's company's  May\June";
print $x eq $y ? "Yes\n" : "No\n";

$ perl clpm.pl
No

"\'" is the same as "'", but "\\J" is not the same as "\J"

Paul Lalli



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

Date: Wed, 17 Jan 2007 02:42:43 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: I can't figure this regex out, Help please.
Message-Id: <D2grh.12116$wq.1232@trndny07>

Paul Lalli wrote:
> Jürgen Exner wrote:
>> Charlie White wrote:
>>> I have a string that has been excaped with "\"
>>>
>>> eg.   "This is charlie\'s company\'s  May\\June"
>>>
>>> what I would like to end up with is
>>>
>>> "This is charlie's company's  May\June"
>>
>> Sorry for being dense, but those two strings are identical already.
>
> I beg to differ.
> "\'" is the same as "'", but "\\J" is not the same as "\J"

Ooops, you are right, of course.

jue 




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

Date: 16 Jan 2007 21:13:54 -0800
From: jcharth@hotmail.com
Subject: imager sample for text
Message-Id: <1169010834.094553.43260@l53g2000cwa.googlegroups.com>

hello anyone has a sample of rendering text in to a jpg using imager. I
installed imager in my box but the code seems to show only a black
patch

my $font = Imager::Font->new(file=>"foo.ttf");

$img->string(x => 50, y => 30,
               string => "$randstr",
               font => $font,
               size => 10,
               aa => 1,
               color => 'white');



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

Date: Wed, 17 Jan 2007 01:48:55 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: imager sample for text
Message-Id: <m2ejpu5eso.fsf@Sherm-Pendleys-Computer.local>

jcharth@hotmail.com writes:

> hello anyone has a sample of rendering text in to a jpg using imager. I
> installed imager in my box but the code seems to show only a black
> patch
>
> my $font = Imager::Font->new(file=>"foo.ttf");
>
> $img->string(x => 50, y => 30,
>                string => "$randstr",
>                font => $font,
>                size => 10,
>                aa => 1,
>                color => 'white');

Is this running under a web server, by any chance, either as a CGI or
mod_perl app?

If so, try specifying the full path to the ttf file - the current directory
may not be the same as the one that file is in.

Also, you should check to see if $font is undef - if it is, that would almost
certainly mean a problem finding and/or loading the .ttf file.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Tue, 16 Jan 2007 21:25:57 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Map Windows from Unix
Message-Id: <m2ac0i75je.fsf@Sherm-Pendleys-Computer.local>

Andrew DeFaria <Andrew@DeFaria.com> writes:

> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>
>
>   
>   
>
>
> Sherm Pendley wrote:
> "Please stop posting HTML" is not telling you how to post,
> Actually, yes... it is...

Is English your first language? I'm guessing not, so I'll explain: A state-
ment beginning with "please" is a request, not as a command.

> Yes, it's a free country. You're free to be as rude as
> you'd like to be. 
> I see it doesn't stop you!

Yes, I'm being quite rude to you, because you were rude to the group first.
You reap what you sow.

> And the rest of us are free to think you're acting like a
> spoiled brat when you do.
>
> And I am as free to think the same to you.

Think whatever you want - My own posts are formatted in plain text and use
the accepted standard ">"s in the first column(s) of quoted material. You're
the one demanding that special allowances be made for your nonstandard
message formatting. I'm doing nothing of the sort.

Notice already how confused the OP is - because of the malformatting in your
posts, which disguises quotes in HTML markup instead of delimiting them
properly according to common usenet practice, he has no idea who's replying
to whom at this point.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Wed, 17 Jan 2007 09:03:24 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Map Windows from Unix
Message-Id: <pan.2007.01.17.08.03.23.939491@remove.this.part.rtij.nl>

On Tue, 16 Jan 2007 19:27:27 -0600, Andrew DeFaria wrote:

> It's pretty funny that you don't recognize that that's pretty much the 
> same thing!

Well, there is a slight difference. Samba exports smb mounts, a cifs
capable kernel imports smb mounts. Small difference. Big impact.

Please try to follow your own advice, install samba on a non cifs capable
kernel and try to mount a remote share from a Windows PC. Now try the same
without samba on a cifs capable kernel. The first won't work, the second
will.

> Damn it's great to know that these ASCII only experts are so well
> informed!

Please think before you post, especially when you are utterly wrong.

> If you want to bone up on the subject:
> http://en.wikipedia.org/wiki/Server_message_block

I probably know more about CIFS/SMB in my pinky then you will in your
lifetime, thank you. Not that I want to, but I have to debug the stuff.

Oh, and please don't post in HTML and put some whitespace in your posts.
As you may notice, you are the *only* one posting html here. It's anti
social. It's hard to read.

M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: Wed, 17 Jan 2007 05:42:09 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jan 17 2007
Message-Id: <JBzzu9.zI2@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Audio-TagLib-1.43
http://search.cpan.org/~dongxu/Audio-TagLib-1.43/
a library for reading and editing audio meta data, commonly known as *tags*.
----
AutoLoader-5.62
http://search.cpan.org/~smueller/AutoLoader-5.62/
load subroutines only on demand
----
BSD-Sysctl-0.08
http://search.cpan.org/~dland/BSD-Sysctl-0.08/
Manipulate kernel sysctl variables on BSD-like systems
----
Convert-Cisco-0.05
http://search.cpan.org/~marko/Convert-Cisco-0.05/
Module for converting Cisco billing records
----
DateTime-Format-Natural-0.23
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.23/
Create machine readable date/time with natural parsing logic
----
Email-Find-0.10
http://search.cpan.org/~miyagawa/Email-Find-0.10/
Find RFC 822 email addresses in plain text
----
HTML-Template-Extension-0.26
http://search.cpan.org/~ebruni/HTML-Template-Extension-0.26/
Module support extension for HTML::Template
----
HTML-Tested-JavaScript-0.03
http://search.cpan.org/~bosu/HTML-Tested-JavaScript-0.03/
JavaScript enabled HTML::Tested widgets.
----
IO-Socket-ByteCounter-v0.0.2
http://search.cpan.org/~dmuey/IO-Socket-ByteCounter-v0.0.2/
Perl extension to track the byte sizes of data in and out of a socket
----
Inline-Java-0.52
http://search.cpan.org/~patl/Inline-Java-0.52/
Write Perl classes in Java.
----
Mail-Karmasphere-Client-2.05
http://search.cpan.org/~shevek/Mail-Karmasphere-Client-2.05/
Client for Karmasphere Reputation Server
----
MooseX-Object-Pluggable-0.0001
http://search.cpan.org/~groditi/MooseX-Object-Pluggable-0.0001/
Make your classes pluggable
----
MooseX-Object-Pluggable-0.0002
http://search.cpan.org/~groditi/MooseX-Object-Pluggable-0.0002/
Make your classes pluggable
----
Mozilla-SourceViewer-0.02
http://search.cpan.org/~bosu/Mozilla-SourceViewer-0.02/
Perl extension to get current page source.
----
Net-Radius-1.52
http://search.cpan.org/~luismunoz/Net-Radius-1.52/
----
PAR-0.972
http://search.cpan.org/~smueller/PAR-0.972/
Perl Archive Toolkit
----
POE-Component-CPAN-YACSmoke-0.10
http://search.cpan.org/~bingos/POE-Component-CPAN-YACSmoke-0.10/
bringing the power of POE to CPAN smoke testing.
----
POE-Component-CPAN-YACSmoke-0.11
http://search.cpan.org/~bingos/POE-Component-CPAN-YACSmoke-0.11/
bringing the power of POE to CPAN smoke testing.
----
PX-API-v0.0.3
http://search.cpan.org/~mindhack/PX-API-v0.0.3/
Perl interface to the Peekshows Web Services API.
----
Pod-POM-View-HTML-Filter-0.07
http://search.cpan.org/~book/Pod-POM-View-HTML-Filter-0.07/
Use filters on sections of your pod documents
----
Rose-DB-Object-0.760
http://search.cpan.org/~jsiracusa/Rose-DB-Object-0.760/
Extensible, high performance RDBMS-OO mapper.
----
SWISH-API-Object-0.07
http://search.cpan.org/~karman/SWISH-API-Object-0.07/
return SWISH::API results as objects
----
Template-Declare-0.01_01
http://search.cpan.org/~jesse/Template-Declare-0.01_01/
----
URI-Template-0.02
http://search.cpan.org/~bricas/URI-Template-0.02/
Object for handling URI templates
----
URI-Template-0.03
http://search.cpan.org/~bricas/URI-Template-0.03/
Object for handling URI templates
----
Win32-PowerPoint-0.04
http://search.cpan.org/~ishigaki/Win32-PowerPoint-0.04/
helps to convert texts to PP slides
----
Yahoo-Marketing-0.09
http://search.cpan.org/~jlavallee/Yahoo-Marketing-0.09/
an interface for Yahoo! Search Marketing's Web Services.
----
mogilefs-server-2.00_05
http://search.cpan.org/~bradfitz/mogilefs-server-2.00_05/
----
parrot-0.4.8
http://search.cpan.org/~particle/parrot-0.4.8/
----
parrot-0.4.8_01
http://search.cpan.org/~particle/parrot-0.4.8_01/
----
parrot-0.4.8a
http://search.cpan.org/~particle/parrot-0.4.8a/
----
parrot-0.4.8b
http://search.cpan.org/~particle/parrot-0.4.8b/


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Tue, 16 Jan 2007 21:52:35 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: package mail::message anyone heard of it?
Message-Id: <m2mz4i5pqk.fsf@Sherm-Pendleys-Computer.local>

"jga.socal" <jganders@gmail.com> writes:

> Hi.
> I'm trying to use some perl code in the app found at (
> http://www.jmbfree.com/software/ts ) 'incoming.pl'.
> It calls out:
> use Mail::Message and
> use Mail::Address
>
> Unfortunately there is no Message.pm in any of the libs in my perl
> dist.
> The closest I get is /usr/lib/perl5/site_perl/5.8.7/Mail which has a
> Mailer.pm and an Address.pm
> Can anyone know where a mail package containing a Message.pm can be
> found?

Try looking for the full name of the module - i.e. Mail::Message, not just
the file name - at http://search.cpan.org.

To install it, since you seem to be using a *nix relative, I'd suggest using
the CPAN shell. Have a look at "perldoc cpan" for details about that, and at
"perldoc perlmodinstall" to understand what it's doing for you.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Tue, 16 Jan 2007 21:29:55 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Piping from perl to C
Message-Id: <m23b6a75cs.fsf@Sherm-Pendleys-Computer.local>

"Igna" <ignleotta@gmail.com> writes:

> Hello. I have to write a pipe to joint a GUI in perl and a simulation
> program in c. I have read  all the docs found in perl.com and now I am
> trying to make a test with this simple program. It seems working but it
> does not write "bonjour" at the end. Can anybody tell me where my
> mistake is? I will be happy for any sample of code for a pipe between c
> and perl sent to me too.
> Thanks in advance,
>                             Ignazio

 ... C code snipped ...

You'd write the C code the same way you'd write it if the gui were in Python,
Ruby, or anything else. There's nothing about Perl that would require the C
program to be written any differently.

If you have a question about how to write the C code, this isn't really the
group for that - I suggest comp.lang.c instead.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Tue, 16 Jan 2007 21:45:32 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Postscript-Wizzards? How to set the background for each letter?
Message-Id: <m2r6tu5q2b.fsf@Sherm-Pendleys-Computer.local>

Michael Hagedorn <mic01@uni-muenster.de> writes:

> Does anyone know how to realise a setting like this: When i.e. a red
> letter appears the background of this letter should also set to a
> darker red. This should increase contrast and brightness?

Key question here: Is the PostScript being produced by a CPAN module? That
is, does the script in question call methods or functions in a CPAN module
which in turn produce PostScript output? If so, we'd need to know what module
is being used and how its methods are being called to help you.

Alternatively, is the PostScript being produced directly by print() state-
ments in the script, or in a homemade module? If that's the case, then your
question has to do with PostScript, not Perl - you're asking *what to print*,
which has nothing at all to do with the language you happen to be using to
print it; you'd want to print the same PostScript you would print if your
script were in Python or Ruby, for example.

In the latter case, I'd suggest a postscript group.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: 16 Jan 2007 20:03:56 -0800
From: wing328hk@gmail.com
Subject: Re: Question on SIGTERM
Message-Id: <1169006636.512912.204870@38g2000cwa.googlegroups.com>

Hi,

Thanks for the prompt reply. Sorry that I should have provided more
information about the scenario.

The data stream I was talking about is a mail pipe, so my question
becomes would the mail program gets the SIGPIPE? I think yes based on
the reply below.

My next question is would it be possible to close the data stream from
the client side (basicaly my script below that aims to read the first
line or the mail header only) without reading all the data and without
sending an SIGPIPE back to the mail program?

Thanks,
wing328hk


xhoster@gmail.com wrote:
> wing328hk@gmail.com wrote:
> > Hi,
> >
> > I need to pipe a data stream to STDIN and I'm only interesting in the
> > first line so I do
> >
> > my $header = <STDIN>;
> >
> > To read the rest of the data stream, I do
> >
> >     do {
> >         my $buf = "";
> >         1 while (read(STDIN, $buf, 1024));
> >     };
> >
> > Would I get SIGPIPE if I don't use the do loop to get the rest of the
> > message?
>
> "You" (i.e. the process (not) doing the reading) wouldn't get a SIGPIPE.
> The process writing to "you" might get a SIGPIPE.
>
> > Basically, how can I discard the rest of the message from STDIN?
>
> Don't read it.  Either close the filehandle without reading the rest, or
> just exit the program without reading the rest.
>
> > The
> > data stream can be huge (30MB...) and that's why I don't want to waste
> > CPU time in reading something I don't need.
>
> Why waste time *writing* something you don't need?  If you have control
> over the writing process (which it seems you do, as you call the
> reading process a child), fix it.
>
> > Would it make a different to above questions if the above code is part
> > of a child process and there will be several child processes running
> > simultaneously reading from different data stream from pipe??
>
> Where do they get these different data streams from?  Do you care whether
> the writing process gets a SIGPIPE?  If so, why?
>
> Xho
>
> --
> -------------------- http://NewsReader.Com/ --------------------
> Usenet Newsgroup Service                        $9.95/Month 30GB



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

Date: 16 Jan 2007 21:02:57 -0800
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Question on SIGTERM
Message-Id: <1169010176.942563.300110@s34g2000cwa.googlegroups.com>


wing328hk@gmail.com wrote:
> xhoster@gmail.com wrote:
> > wing328hk@gmail.com wrote:
> > > Hi,
> > >
> > > I need to pipe a data stream to STDIN and I'm only interesting in the
> > > first line so I do
> > >
> > > my $header = <STDIN>;
> > >
> > > To read the rest of the data stream, I do
> > >
> > >     do {
> > >         my $buf = "";
> > >         1 while (read(STDIN, $buf, 1024));
> > >     };
> > >
> > > Would I get SIGPIPE if I don't use the do loop to get the rest of the
> > > message?
> >
> > "You" (i.e. the process (not) doing the reading) wouldn't get a SIGPIPE.
> > The process writing to "you" might get a SIGPIPE.
> >
> > > Basically, how can I discard the rest of the message from STDIN?
> >
> > Don't read it.  Either close the filehandle without reading the rest, or
> > just exit the program without reading the rest.
> >
> > > The
> > > data stream can be huge (30MB...) and that's why I don't want to waste
> > > CPU time in reading something I don't need.
> >
> > Why waste time *writing* something you don't need?  If you have control
> > over the writing process (which it seems you do, as you call the
> > reading process a child), fix it.
> >
> > > Would it make a different to above questions if the above code is part
> > > of a child process and there will be several child processes running
> > > simultaneously reading from different data stream from pipe??
> >
> > Where do they get these different data streams from?  Do you care whether
> > the writing process gets a SIGPIPE?  If so, why?
> >

>
> Thanks for the prompt reply. Sorry that I should have provided more
> information about the scenario.
>
> The data stream I was talking about is a mail pipe, so my question
> becomes would the mail program gets the SIGPIPE? I think yes based on
> the reply below.
>
> My next question is would it be possible to close the data stream from
> the client side (basicaly my script below that aims to read the first
> line or the mail header only) without reading all the data and without
> sending an SIGPIPE back to the mail program?
>

You could cause the rest of the stream to be discarded:

 my(  $header ) =  <STDIN>;        # instead of:   my $header = <STDIN>

this'll avoid  the SIGPIPE.

-- 
Charles DeRykus



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

Date: 16 Jan 2007 22:19:44 -0800
From: wing328hk@gmail.com
Subject: Re: Question on SIGTERM
Message-Id: <1169014783.919557.101270@51g2000cwl.googlegroups.com>


comp.llang.perl.moderated wrote:
> wing328hk@gmail.com wrote:
> > xhoster@gmail.com wrote:
> > > wing328hk@gmail.com wrote:
> > > > Hi,
> > > >
> > > > I need to pipe a data stream to STDIN and I'm only interesting in the
> > > > first line so I do
> > > >
> > > > my $header = <STDIN>;
> > > >
> > > > To read the rest of the data stream, I do
> > > >
> > > >     do {
> > > >         my $buf = "";
> > > >         1 while (read(STDIN, $buf, 1024));
> > > >     };
> > > >
> > > > Would I get SIGPIPE if I don't use the do loop to get the rest of the
> > > > message?
> > >
> > > "You" (i.e. the process (not) doing the reading) wouldn't get a SIGPIPE.
> > > The process writing to "you" might get a SIGPIPE.
> > >
> > > > Basically, how can I discard the rest of the message from STDIN?
> > >
> > > Don't read it.  Either close the filehandle without reading the rest, or
> > > just exit the program without reading the rest.
> > >
> > > > The
> > > > data stream can be huge (30MB...) and that's why I don't want to waste
> > > > CPU time in reading something I don't need.
> > >
> > > Why waste time *writing* something you don't need?  If you have control
> > > over the writing process (which it seems you do, as you call the
> > > reading process a child), fix it.
> > >
> > > > Would it make a different to above questions if the above code is part
> > > > of a child process and there will be several child processes running
> > > > simultaneously reading from different data stream from pipe??
> > >
> > > Where do they get these different data streams from?  Do you care whether
> > > the writing process gets a SIGPIPE?  If so, why?
> > >
>
> >
> > Thanks for the prompt reply. Sorry that I should have provided more
> > information about the scenario.
> >
> > The data stream I was talking about is a mail pipe, so my question
> > becomes would the mail program gets the SIGPIPE? I think yes based on
> > the reply below.
> >
> > My next question is would it be possible to close the data stream from
> > the client side (basicaly my script below that aims to read the first
> > line or the mail header only) without reading all the data and without
> > sending an SIGPIPE back to the mail program?
> >
>
> You could cause the rest of the stream to be discarded:
>
>  my(  $header ) =  <STDIN>;        # instead of:   my $header = <STDIN>
>
> this'll avoid  the SIGPIPE.
>
> --
> Charles DeRykus

But using
my(  $header ) =  <STDIN>;
would still read all the data from the pipe, and then assign first line
to $header, right? or it has the intelligence to read only the first
line into $header and discard the rest.

I want to avoid reading all the data from the pipe, which can be huge
(~3MB). I'm only interested in email headers (ie the first few lines of
data).

Thanks,
wing328hk



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

Date: 16 Jan 2007 21:31:02 -0800
From: "Cerveza Mas Fina" <kkjunk123@yahoo.com>
Subject: Silly Newbie questions
Message-Id: <1169011862.475978.61500@s34g2000cwa.googlegroups.com>

Hi
I have two questions
1)  I found this line of code in a book
      foreach $item ( @{ $rss->{ 'items'} })
      {
          print $item->{'title'}
      }

      I cant quite figure out what the @{ blah }  is doing to a hash
reference,

2) I have seen a lot of perl code like $xx = shift;
    What does this mean ? what purpose does that server ?

I shall appreciate any answers.



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

Date: 16 Jan 2007 21:42:34 -0800
From: usenet@DavidFilmer.com
Subject: Re: Silly Newbie questions
Message-Id: <1169012554.188746.67410@v45g2000cwv.googlegroups.com>

Cerveza Mas Fina wrote:
>       foreach $item ( @{ $rss->{ 'items'} })

The value of $rss{'items'} is (apparently) an array reference (not a
hash reference - it's a hash value but it's an array reference).  This
would be a "hash of arrays" (HoA).

Consider:

   $hash{'numbers'} = [1, 2, 3];
   print "$_\n" for @{ $hash{'numbers'} };

is really the same as:

   my $array_ref = [1, 2, 3];
   print "$_\n" for @{ $array_ref };

> 2) I have seen a lot of perl code like $xx = shift;
>     What does this mean ? what purpose does that server ?

perldoc -f shift

-- 
David Filmer (http://DavidFilmer.com)



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

Date: Wed, 17 Jan 2007 00:18:50 -0600
From: "Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Silly Newbie questions
Message-Id: <eoki4q$d45$1@aioe.org>

On 01/16/2007 11:31 PM, Cerveza Mas Fina wrote:
> Hi
> I have two questions
> 1)  I found this line of code in a book
>       foreach $item ( @{ $rss->{ 'items'} })
>       {
>           print $item->{'title'}
>       }
> 
>       I cant quite figure out what the @{ blah }  is doing to a hash
> reference,
> 

Evidently, $rss->{items} is a hash entry that contains an array 
reference. Consider this example:

     my $item;
     my $rss = { items => ['orange', 'banana', 'apricot'] };
     foreach $item ( @{ $rss->{items} } ) {
         print "\$item = $item\n";
     }

You should learn to read the Perl documentation:
Start->Run->"perldoc perl"
Start->Run->"perldoc perldsc"

> 2) I have seen a lot of perl code like $xx = shift;
>     What does this mean ? what purpose does that server ?
> 
> I shall appreciate any answers.
> 

Start->Run->"perldoc -f shift"
Start->Run->"perldoc perldoc"


HTH


-- 
Windows Vista and your freedom in conflict:
http://techdirt.com/articles/20061019/102225.shtml


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

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


Administrivia:

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

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

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

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

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


------------------------------
End of Perl-Users Digest V11 Issue 40
*************************************


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