SPUG: SPUG Project Ideas

Andy Jacobs andyj at microsoft.com
Fri Aug 11 16:31:27 CDT 2000


On Win32 there are problems quoting command-line programs.  The shell
doesn't recognize single quotes as anything special, so it thinks the single
quote is just an apostrophe in the first parameter, etc., and stops at the
first space (usually not what you want if you're using the single quotes in
the first place).  It does recognize double-quotes (similar to Unix's single
quotes), but this creates problems for scripts that contain double quotes.
Personally, I translate any double quotes I use in one-liners into qq{} type
syntax.  But I just discovered that Windows 2000 allows the double quotes to
be escaped with a backslash, so:
	perl -e "print \"\\\"Hi\\\"\""
printed
	"Hi"

So, TMTOWTDI, but neither of them are very pretty.  Also, I don't remember
if previous versions of Windows allowed escaped double-quotes (and seem to
remember an old version didn't, but I'm not positive).

 - Andy

> -----Original Message-----
> From: owner-spug-list at pm.org 
> [mailto:owner-spug-list at pm.org]On Behalf Of
> B.Ingerson at epixtech.com
> Sent: Friday, August 11, 2000 12:14 PM
> To: Andy Jacobs
> Cc: 'B.Ingerson at epixtech.com'; 'SPUG at cpan.org'
> Subject: RE: SPUG: SPUG Project Ideas
> 
> 
> 
> 
> Andy,
> 
> I actually played with this concept a while ago. I found that 
> the best way
> to do it is to open a pipe to the shell and pass the 
> one-liner in verbatim.
> (perl -le 'print "That";') Actually, not quite verbatim. You 
> tack on the
> extra args to '1_r' as extra args to the one-liner. This 
> works great on
> Unix. Haven't tried it on Win32.
> 
> Wrapping in a system() call is bad because perl might 
> interpolate syntax
> meant for the shell.
> 
> Brian
> 
> 
> 
> 
> Andy Jacobs <andyj at microsoft.com> on 08/11/2000 10:42:34 AM
> 
> To:   "'B.Ingerson at epixtech.com'" <B.Ingerson at epixtech.com>
> cc:   "'SPUG at cpan.org'" <SPUG at cpan.org>
> 
> Subject:  RE: SPUG: SPUG Project Ideas
> 
> 
> I like both ideas.  One thought about the one-liner, though, 
> is that many
> one-liners actually include the Perl command, with -e, so 
> they can include
> other flags (such as -n, -l, etc.).  Do you have an idea how 
> this could be
> accommodated?  One solution might be to wrap it in a system() 
> call.  But I
> don't know how portable that would be.  Or, since they'd all 
> be one-liners,
> maybe assume they all have the form of "perl -e".
> 
>  - Andy Jacobs
> 
> > -----Original Message-----
> > From: owner-spug-list at pm.org
> > [mailto:owner-spug-list at pm.org]On Behalf Of
> > B.Ingerson at epixtech.com
> > Sent: Thursday, August 10, 2000 1:34 PM
> > To: SPUG at cpan.org
> > Subject: SPUG: SPUG Project Ideas
> >
> >
> >
> > SPUG,
> >
> > OK. Well its time for me to start planning for next Tuesday's
> > meeting. I'm
> > sending out a series of posts, starting with this one.
> >
> > A lot of people have proposed ideas for projects. I'll give a
> > summary in
> > another post. For now I want to present two of my own 
> ideas. They are:
> >
> > One::Liner.pm
> > Bug.pm
> >
> > Both of these modules fit nicely into my criterion of a good
> > first project.
> > Which are:
> >    General purpose (Not specific to Web, mod_perl, Tk or
> > other Perl niches)
> >    Easily accomplished (Could easily get to CPAN in 1 month)
> >    Cross-platform (Unix/Win32)
> >    Useful (Will get us some popularity in the community)
> >    Is a module (One::Liner has a script as well)
> >
> >
> > One::Liner
> > The basic idea is that there are a whole lot of very useful
> > Perl one-liners
> > out there, but usually you have to go look them up when you
> > want to use
> > one. One::Liner stores a bunch of them and lets you access them with
> > mnemonics. It also ships with a command line script called
> > '1' or 'one' or
> > '1_r' (pronounced "one-line-R"). To use ABIGAIL's famous
> > regex prime number
> > generator, you would type:
> >
> > one prime_number
> > or
> > 1 pn
> >
> > To just print the one-liner, use:
> >
> > 1_r -p pn
> >
> > To see the author, use:
> >
> > one -a primes
> >
> > Each one-liner can have a few mnemonics (long, medium,
> > short). One liner
> > would deal with MSDOS command line sytax as well.
> >
> > Also, one-liners come in 2 categories: those that you can 
> use from the
> > command line, and everything else (like perl poetry for example).
> > One::Liner would do whatever was useful for that one-liner.
> >
> > _____________________________________________
> >
> > Bug or Report::Bug
> > In my new module Inline.pm there is a feature that allows 
> someone who
> > encounters a bug, to report it to me using the syntax:
> >
> > perl -MInline=REPORTBUG myscript.pl
> >
> > where myscript.pl is a script using Inline.pm. This causes a
> > machine (Perl)
> > readable bug report to be produced, and prints instructions
> > on where to
> > send it. The report contains all kinds of useful info, including:
> >
> > Other modules used and their version numbers
> > The complete configuration of Perl on that machine
> > The internal state of Inline.pm at the time.
> > ,etc
> >
> > I would like to this made into a general purpose module that
> > any module
> > writer can use. Later, we could develop tools for processing
> > these reports
> > as well.
> >
> > Choosing a short name like Bug.pm allows a syntax like this
> > for the module
> > user:
> >
> > perl -MBug yourscript.pl
> >
> > _____________________________________________
> >
> >
> > These are just my ideas. We will vote on all of the proposals at the
> > meeting.
> >
> > Brian
> >
> >
> >
> >  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > - - - - - - -
> >      POST TO: spug-list at pm.org       PROBLEMS: 
> owner-spug-list at pm.org
> >       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
> >   Replace ACTION by subscribe or unsubscribe, EMAIL by your
> > Email-address
> >  For full traffic, use spug-list for LIST ; otherwise use
> > spug-list-digest
> >   Seattle Perl Users Group (SPUG) Home Page:
> > http://www.halcyon.com/spug/
> >
> >
> >
> 
> 
> 
> 
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your 
> Email-address
>  For full traffic, use spug-list for LIST ; otherwise use 
> spug-list-digest
>   Seattle Perl Users Group (SPUG) Home Page: 
http://www.halcyon.com/spug/



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list