100% found this document useful (10 votes)
24 views

[FREE PDF sample] Extending and Embedding Perl Tim Jenness ebooks

Embedding

Uploaded by

rammahlaller52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (10 votes)
24 views

[FREE PDF sample] Extending and Embedding Perl Tim Jenness ebooks

Embedding

Uploaded by

rammahlaller52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Download the full version of the ebook at ebookname.

com

Extending and Embedding Perl Tim Jenness

https://ebookname.com/product/extending-and-embedding-perl-
tim-jenness/

OR CLICK BUTTON

DOWNLOAD EBOOK

Download more ebook instantly today at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Web Graphics Perl TK Best of the Perl Journal 1st Edition


Jon Orwant Ph.D.

https://ebookname.com/product/web-graphics-perl-tk-best-of-the-perl-
journal-1st-edition-jon-orwant-ph-d/

ebookname.com

Learning Perl 5th Edition Randal Schwartz

https://ebookname.com/product/learning-perl-5th-edition-randal-
schwartz/

ebookname.com

Embedded Android Porting Extending and Customizing 1st


Edition Karim Yaghmour

https://ebookname.com/product/embedded-android-porting-extending-and-
customizing-1st-edition-karim-yaghmour/

ebookname.com

Cultural Tourism and Identity Rethinking Indigeneity 1st


Edition Keyan G. Tomaselli

https://ebookname.com/product/cultural-tourism-and-identity-
rethinking-indigeneity-1st-edition-keyan-g-tomaselli/

ebookname.com
Last House on the Hill BACH Area Reports from Çatalhöyük
Turkey Cotsen Monumenta Archaeologica BACH Area Reports
from Catalhoyuk Turkey 27 Mirjana Stevanovic (Editor)
https://ebookname.com/product/last-house-on-the-hill-bach-area-
reports-from-catalhoyuk-turkey-cotsen-monumenta-archaeologica-bach-
area-reports-from-catalhoyuk-turkey-27-mirjana-stevanovic-editor/
ebookname.com

Macrosociology Four Modern Theorists 1st Edition Frank W.


Elwell

https://ebookname.com/product/macrosociology-four-modern-
theorists-1st-edition-frank-w-elwell/

ebookname.com

Soft Tissue Composition Mechanisms of Injury and Repair


1st Edition Antonio J. Chavez Ruiz

https://ebookname.com/product/soft-tissue-composition-mechanisms-of-
injury-and-repair-1st-edition-antonio-j-chavez-ruiz/

ebookname.com

Roosevelts 1st Edition Robert Grayson

https://ebookname.com/product/roosevelts-1st-edition-robert-grayson/

ebookname.com

Tristan and Isolde A Casebook 1st Edition Joan Tasker


Grimbert (Editor)

https://ebookname.com/product/tristan-and-isolde-a-casebook-1st-
edition-joan-tasker-grimbert-editor/

ebookname.com
Whose Story Translating the Verbal and the Visual in
Literature for Young Readers 1st Edition Riitta Oittinen

https://ebookname.com/product/whose-story-translating-the-verbal-and-
the-visual-in-literature-for-young-readers-1st-edition-riitta-
oittinen/
ebookname.com
Extending and Embedding Perl
Extending and
Embedding Perl

TIM JENNESS
SIMON COZENS

MANNING
Greenwich
(74° w. long.)
For online information and ordering of this and other Manning books,
go to www.manning.com. The publisher offers discounts on this book
when ordered in quantity. For more information, please contact:
Special Sales Department
Manning Publications Co.
209 Bruce Park Avenue Fax: (203) 661-9018
Greenwich, CT 06830 email: [email protected]

©2003 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted,


in any form or by means electronic, mechanical, photocopying, or otherwise, without prior
written permission of the publisher.

Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.

Recognizing the importance of preserving what has been written, it is Manning’s policy to have the
books we publish printed on acid-free paper, and we exert our best efforts to that end.

Manning Publications Co. Copyeditor: Tiffany Taylor


209 Bruce Park Avenue Typesetter: Dottie Marsico
Greenwich, CT 06830 Cover designer: Leslie Haimes

ISBN 1930110820
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – VHG – 06 05 04 03 02
To the Perl open source community
contents
preface xiii
acknowledgments xv
about this book xvi
author online xix
about the cover illustration xx

1 C for Perl programmers 1


1.1 Hello, world 1
1.2 The C compiler 2
1.3 Header files 3
1.4 The main function 4
1.5 Variables and functions 6
Function parameters 6 ✦ Automatic variables 7
Global variables 8 ✦ Static variables 9
1.6 Data types 10
C types 11 ✦ Types defined in Perl 15
1.7 Casting 16
1.8 Control constructs 17
Statements and blocks 17 ✦ The break and continue
statements 18 ✦ The switch statement 19
1.9 Macros and the C preprocessor 20
1.10 Library functions 23
1.11 Summary 23

2 Extending Perl: an introduction 24


2.1 Perl modules 24
Module distributions 26

vii
2.2 Interfacing to another language: C from XS 30
The Perl module 30 ✦ The XS file 31 ✦ Example: “Hello, world” 32
Return values 36 ✦ Arguments and return values 37
2.3 XS and C: taking things further 38
Modifying input variables 38 ✦ Output arguments 39
Compiler constants 40
2.4 What about Makefile.PL? 44
It really is a Perl program 47
2.5 Interface design: part 1 47
Status and multiple return arguments 48 ✦ Don’t supply what is
already known 48 ✦ Don’t export everything 49
Use namespaces 49 ✦ Use double precision 49
2.6 Further reading 50
2.7 Summary 50

3 Advanced C 51
3.1 Arrays 51
3.2 Pointers 53
Pointers and arrays 55 ✦ Pointers to functions 57
3.3 Strings 58
Arrays of strings 59
3.4 Structures 60
3.5 File I/O 62
3.6 Memory management 63
Allocating memory at runtime 64 ✦ Altering the size of memory 65
Manipulating memory 65 ✦ Memory manipulation and Perl 67
3.7 C Traps for the Perl programmer 68
3.8 Further reading 69
3.9 Summary 69

4 Perl’s variable types 70


4.1 General concepts 70
Reference counting 71 ✦ Looking inside:
Devel::Peek 71 ✦ The flag system 72
4.2 Scalar variables 74
The SvNULL type 74 ✦ SvRV: references 76 ✦ SvPV: string
values 76 ✦ SvPVIV: integers 78 ✦ SvPVNV: floating-point
numbers 79 ✦ SvIV and SvNV 80 ✦ SvOOK: offset strings 80
4.3 Magic variables: SvPVMG 81

viii CONTENTS
4.4 Array variables 85
4.5 Hashes 87
4.6 Globs 91
4.7 Namespaces and stashes 94
4.8 Lexical “my” variables 95
4.9 Code blocks 96
Important CV flags 97
4.10 Further reading 99
4.11 Summary 99

5 The Perl 5 API 100


5.1 Sample entry 101
5.2 SV functions 101
Special SVs 101 ✦ Creating SVs 103 ✦ Accessing data 110
Manipulating data 119 ✦ String functions 124 ✦ References 129
5.3 AV functions 132
Creation and destruction 132 ✦ Manipulating elements 136
Testing and changing array size 142
5.4 HV functions 144
Creation and destruction 144 ✦ Manipulating elements 146
5.5 Miscellaneous functions 150
Memory management 150 ✦ Unicode data handling 155
Everything else 158
5.6 Summary 162

6 Advanced XS programming 163


6.1 Pointers and things 164
6.2 Filehandles 166
6.3 Typemaps 167
6.4 The argument stack 169
6.5 C structures 170
C structures as black boxes 170 ✦ C structures as objects 176
C structures as hashes 179
6.6 Arrays 183
Passing numeric arrays from Perl to C 183 ✦ Passing numeric
arrays from C to Perl 190 ✦ The Perl Data Language 192
Benchmarks 198 ✦ Character strings 199

CONTENTS ix
6.7 Callbacks 202
Immediate callbacks 203 ✦ Deferred callbacks 206 ✦ Multiple callbacks 207
6.8 Other languages 209
Linking Perl to C++ 209 ✦ Linking Perl to Fortran 216
Linking Perl to Java 223
6.9 Interface design: part 2 223
6.10 Older Perls 224
6.11 What’s really going on? 225
What does xsubpp generate? 226
6.12 Further reading 230
6.13 Summary 230

7 Alternatives to XS 231
7.1 The h2xs program 232
7.2 SWIG 233
Data structures 236
7.3 The Inline module 238
What is going on? 239 ✦ Additional Inline examples 240
Inline and CPAN 245 ✦ Inline module summary 246
7.4 The PDL::PP module 247
The .pd file 248 ✦ The Makefile.PL file 249 ✦ Pure PDL 251
7.5 Earlier alternatives 251
7.6 Further reading 252
7.7 Summary 253

8 Embedding Perl in C 254


8.1 When to embed 254
8.2 When not to embed 255
8.3 Things to think about 255
8.4 “Hello C” from Perl 255
Compiling embedded programs 257
8.5 Passing data 257
8.6 Calling Perl routines 259
Stack manipulation 261 ✦ Context 263 ✦ Trapping errors with
eval 263 ✦ Calling Perl methods in C 264 ✦ Calling Perl statements 265
8.7 Using C in Perl in C 265
8.8 Embedding wisdom 266
8.9 Summary 267

x CONTENTS
9 Embedding case study 268
9.1 Goals 268
9.2 Preparing the ground 269
9.3 Configuration options 270
9.4 Testing options 273
Binary options 273 ✦ Quad-state options 274 ✦ String options 275
9.5 Summary 276

10 Introduction to Perl internals 277


10.1 The source tree 277
The Perl library 277 ✦ The XS library 278 ✦ The I/O subsystem 278
The Regexp engine 278 ✦ The parser and tokenizer 278 ✦ Variable
handling 279 ✦ Runtime execution 279
10.2 The parser 279
BNF and parsing 279 ✦ Parse actions and token values 281
Parsing some Perl 281
10.3 The tokenizer 282
Basic tokenizing 282 ✦ Sublexing 284 ✦ Tokenizer summary 285
10.4 Op code trees 285
The basic op 285 ✦ The different operations 286 ✦ Different
flavors of ops 286 ✦ Tying it all together 288 ✦ PP Code 290
The opcode table and opcodes.pl 293 ✦ Scratchpads and targets 293
The optimizer 294 ✦ Op code trees summary 294
10.5 Execution 295
10.6 The Perl compiler 295
What is the Perl compiler? 296 ✦ B:: modules 296 ✦ What B and
O provide 299 ✦ Using B for simple tasks 300
10.7 Further reading 303
10.8 Summary 303

11 Hacking Perl 304


11.1 The development process 304
Perl versioning 304 ✦ The development tracks 305 ✦ The perl5-porters
mailing list 305 ✦ Pumpkins and pumpkings 305 ✦ The Perl repository 306
11.2 Debugging aids 306
Debugging modules 307 ✦ The built-in debugger: perl -D 307
Debugging functions 310 ✦ External debuggers 310
11.3 Creating a patch 317
How to solve problems 317 ✦ Autogenerated files 318 ✦ The patch itself 319
Documentation 320 ✦ Testing 320 ✦ Submitting your patch 320

CONTENTS xi
11.4 Perl 6: the future of Perl 321
A history 321 ✦ Design and implementation 322
What happens next 323 ✦ The future for Perl 5 323
11.5 Further reading 323
11.6 Summary 323

A: Perl’s typemaps 324


B: Further reading 348
C: Perl API index 350
index 355

xii CONTENTS
preface
Perl is a wonderful language. We, along with at least a million other programmers, love it dearly.
It’s great for all kinds of applications: text processing, network programming, system administra-
tion, and much more. But there are times when we need to go beyond the core of the language
and do something not provided by Perl.
Sometimes we do this without noticing it: several modules that ship with Perl call out to C
routines to get their work done, as do some of the most commonly used CPAN modules. Other
times, we do it deliberately: the various modules for building graphical applications in Perl almost
all, directly or indirectly, use external C libraries. Either way, writing extensions to Perl has his-
torically been a bit of a black art. We don’t believe this situation is fair, so we’ve written this book
to attempt to demystify the process of relating Perl and C.
That’s not to say we’re fed up with writing modules in Perl. Both of us write many of our mod-
ules in Perl, and although sometimes it might be easier to interface to C, we’ve decided to stick
with Perl. In fact, writing a module in Perl has a number of advantages over using other languages:
• It is far easier to write portable cross-platform code in Perl than in C. One of the successes
of Perl has been its support of varied operating systems. It is unlikely that a module written
in C could be as portable as a Perl version without much more effort on the part of the pro-
grammer, precisely because Perl strives to hide the complexities of differences between
underlying operating systems from the programmer.
• Some problems do not need the speed gain that comes from using a compiled language or
the added complexity of interfacing to another language. For many programmers who are
proficient in Perl (and/or Java), writing a Perl module is much more efficient (in terms of
programming effort) than writing the equivalent in C.
People program in Perl for a reason, and this fact should not be forgotten when it comes to
deciding whether to use Perl for an extension module. These issues were addressed in the devel-
opment of the standard File::Temp module (part of Perl 5.6.1). This module provides a stan-
dard interface for creating temporary files from Perl. The original intention was that this module
would be written in C, but it quickly became apparent that a Perl implementation would be eas-
ier because of portability problems (it was to be a standard module, so it would have to work on
all platforms supported by Perl); in addition, speed would not be an issue unless thousands of
temporary files were required.

xiii
Having addressed why not to use a language other than Perl, we must now present two impor-
tant reasons why another language is sometimes required:
• Speed—In some cases, Perl is simply too slow for a particular program. In this case, the
choice is either to change the algorithm or to use a faster programming language. The Perl
Data Language was created specifically to address the case of processing N-dimensional
arrays, but there are times when another language is required. Similarly, Perl is definitely
too slow for some tasks (for instance, the graphics manipulation functions provided by
Imager and GD).
• Functionality—Many useful libraries have been written in other languages (especially C,
and for numerical applications, Fortran). If new functionality is required that is present in
an external library, then it is usually far better to provide a Perl interface to the library than
to recode the library in Perl. For instance, the XML::Parser module provides a reason-
ably direct mapping onto the underlying functions of the expat library. Functionality is
particularly an issue for things that simply can’t be written in Perl, such as interfaces to cer-
tain system libraries (for instance, the Macintosh Carbon library) or to particular pieces of
hardware.
As well as extending Perl by writing modules in C, sometimes it’s advantageous to go the other
way around: to add the flexibility of a Perl interpreter to an existing C program. Like extending,
this process has a fearsome reputation, and so we provide two chapters on the topic. Chapter 8
introduces embedding Perl, and chapter 9 includes a full working example that explains Perl
embedding.
We also realize that people want to know what’s really going on under the hood, so we con-
clude our study of the interaction between C and Perl by examining the C sources of the perl
interpreter itself, together with details of how to get involved in becoming a developer maintain-
ing perl. Finally, we look ahead to Perl 6 and the Parrot project.

xiv PREFACE
acknowledgments
The authors would like to thank the staff at Manning for their hard work, encouragement, and,
where necessary, coercion. Susan Capparelle first approached us and got us to commit to the book;
Marjan Bace oversaw the project. Ted Kennedy set up reviews and helped get some of the best
people around to give us feedback on the book. Mary Piergies headed up production; Syd Brown
and Dottie Marsico were the poor sods who had to deal with our awkward choice of markup and
file formats. Tiffany Taylor was our eagle-eyed copy editor and Liz Welch our proofreader.
Our reviewers were wonderfully pedantic, catching every mistake from the unintentional slip
to the outright lie. Martien Verbruggen headed up this exercise, and many thanks are also due
to Alasdair Allan, Chuck Bailey, Clinton Pierce, Abhijit Menon-Sen, John Tobey, John Linder-
man, Norman Gray, Bennett Todd, Dan Sugalski, David Zempel, Doug MacEachern, Graham
Barr, James Freeman, Spider Boardman, and Alex Gough.
The perl5-porters have been wonderfully helpful, answering obscure questions about the hid-
den corners of Perl. Particular thanks to Jarkko Hietaniemi, Gurusamy Sarathy, Nick Ing-Sim-
mons, Hugo van der Sanden, Abhijit Menon-Sen, and Arthur Bergman. We hope that our
explorations have been as beneficial to you as they have been intriguing to us.
TIM JENNESS I would also like to thank Frossie for leading me onto the path to becoming a
Perl hacker and for forcing me to write this book. Thanks to my brother, Matt, because he
wanted to be thanked, and to the rabbits, Buns and Neo, for not eating all the draft versions of
this book. Thanks to the Tuesday night movie gang for putting up with my terrible selections—
the book can no longer be used as an excuse! Finally, thanks again to Frossie for expanding my
horizons beyond measure and for being the center of my universe.
SIMON COZENS I would also like to thank the denizens of #perl and That Other IRC Chan-
nel, without whom this book would have been finished much earlier but would have been con-
siderably more boring. Thanks to Ray, pod, and Aaron at Oxford University Computing
Services, who have to put up with me on a daily basis and even seem to try not to mind; and to
Oxford Go Club for providing welcome diversion and keeping me more or less sane. And thanks
to Eiko, who has possibly been told “nearly finished now!” more times than the entirety of the
Manning staff.

xv
about this book
Guide to this book
This book is roughly divided into four sections. The first section covers the groundwork of deal-
ing with C and the basics of XS, the extension language used to communicate between Perl and C:
• Chapter 1 provides an introduction to the C language from a Perl perspective. We explain
the similarities and differences between the languages, and show how to write, compile,
and run programs written in C.
• Chapter 2 presents the basics of the extension language, XS. By the end of this chapter, you
will be able to create Perl modules that call simple C functions.
• Chapter 3 discusses more advanced features of the C language, such as strings, arrays, struc-
tures, and memory handling.
The next section explains XS in more detail:
• Chapter 4 describes how Perl values are stored internally: that is, how scalars, arrays, and
hashes work. This concept is fundamental to doing any advanced work with XS, because
you will be manipulating these types of values.
• Chapter 5 introduces the Perl API—the range of functions you have at your disposal as an
XS programmer for manipulating values and interacting with the perl interpreter. As well
as being a reference guide to the API, it contains many real-world examples of how the API
functions are used in XS situations, including modules such as Tk and DBI, the
mod_perl extension to the Apache web server, and the perl interpreter itself. In other
words, it’s intended to be a hands-on tutorial to using the API functions. (Note that appen-
dix C provides an index of all Perl API references in the book.)
• Chapter 6 describes many more advanced uses of XS, such as how to create Perl arrays,
hashes, and objects based on C structures; how to interface with Fortran; how to deal with
files; how to call back from C to Perl; and much more. We believe this chapter represents,
in a distilled format, the highest levels of XS magic, much of which has never been clearly
written down before.
• Chapter 7 describes alternatives to XS that also help with C-Perl interaction: SWIG,
Inline, and PDL::PP, among others.

xvi
The third section deals with embedding Perl in other projects:
• Chapter 8 describes embedding Perl in generic terms, including why and when you should
consider embedding Perl in a C program, the fundamentals required to embed Perl, and
how to call back from embedded Perl into C.
• Chapter 9 turns the description from chapter 8 into a working example, to help you under-
stand the thought processes and programming involved in embedding Perl in a real-world
application.
The fourth section deals with the internals of the perl interpreter:
• Chapter 10 provides an introduction to perl internals, including the path a Perl program
takes from input to compilation to execution.
• Chapter 11 is a grab-bag of useful information on developing perl: how to debug the
interpreter, how to contribute code back to the maintainers, and how the Perl development
process works. We close by looking into the future at the Perl 6 development effort.
The final section consists of three appendices:
• Appendix A describes all of Perl’s typemap entries used in the book.
• Appendix B lists further reading material.
• Appendix C provides an index of all Perl API references in the book.
Intended audience
We’ve worked hard to make this book the definitive tutorial and reference to all topics involved
in the interaction of Perl and C. This means we’ve had to make some broad assumptions. Natu-
rally, we assume you, the reader, are a competent Perl programmer.
We don’t assume proficiency in C. Although we include an introduction to C at the beginning
of this book, and it should be possible to gain a lot of benefit from this book without any prior
exposure to C, this isn’t intended to be a substitute for a good C tutorial—the idea is to whet your
appetite regarding what can be done while extending Perl with C, and give you what you need
to know to understand the majority of the examples provided. The book is also intended to inspire
those who know the ground rules of C programming but find it hard to translate that knowledge
into practical programs.
If you’re an experienced C programmer, you’ll naturally gain the most from this book, because
you are likely to have practical ideas about how to apply the information in it. To avoid attacks
of boredom, however, we recommend that the experienced C programmer skip chapters 1 and 3.
Source code downloads
The source code for all examples presented in this book is freely available from the publisher’s
web site, http://www.manning.com/jenness. Should errors be discovered after publication, all
code updates will be made availabe via the Web.

ABOU T THIS BO OK xvii


Typographical conventions
In this book we use the following typographical conventions: example code, example output,
variable names, variable types, and function names are all in code font. Examples that demon-
strate user input use bold code font.
For instance, to demonstrate the output of a simple command we would have:
% perl -le 'print "hello"'
hello
%

The % indicates the shell or command prompt (on some systems this may be written as >), the
emboldened text indicates what you would type, and the rest of the text is the output you
would see.
Code annotations accompany many segments of code. Certain annotations are marked with
chronologically ordered bullets such as B . These annotations have further explanations that fol-
low the code.

xviii ABOU T TH IS BOOK


author online
Purchase of Extending and Embedding Perl includes free access to a private web forum run by
Manning Publications where you can make comments about the book, ask technical questions,
and receive help from the authors and from other users. To access the forum and subscribe to it,
point your web browser to http://www.manning.com/jenness. This page provides information
on how to get on the forum once you are registered, what kind of help is available, and the rules
of conduct on the forum.
Manning’s commitment to our readers is to provide a venue where a meaningful dialog
between individual readers and between readers and the authors can take place. It is not a com-
mitment to any specific amount of participation on the part of the authors, whose contribution
to the Author Online forum remains voluntary (and unpaid). We suggest you try asking the
authors some challenging questions lest their interest stray!
The Author Online forum and the archives of previous discussions will be accessible from the
publisher’s web site as long as the book is in print.

xix
about the cover illustration
The figure on the cover of Extending and Embedding Perl is a “Gauro o Larsi,” a man from one of
the many tribes that inhabited the mountainous and ethnically diverse region of the Indus River
between Kashmir and Kabul. This illustration is taken from a Spanish compendium of regional
dress customs first published in Madrid in 1799. The book’s title page informs us:
Coleccion general de los Trages que usan actualmente todas las Nacionas del Mundo desubierto, dibu-
jados y grabados con la mayor exactitud por R.M.V.A.R. Obra muy util y en special para los que
tienen la del viajero universal
which we loosely translate as:
General Collection of Costumes currently used in the Nations of the Known World, designed and
printed with great exactitude by R.M.V.A.R. This work is very useful especially for those who hold
themselves to be universal travelers.
Although nothing is known of the designers, engravers, and artists who colored this illustration
by hand, the “exactitude” of their execution is evident in this drawing. The Gauro o Larsi is just
one of a colorful variety of figures in this collection which reminds us vividly of how distant and
isolated from each other the world’s towns and regions were just 200 years ago. Dress codes have
changed since then and the diversity by region, so rich at the time, has faded away. It is now often
hard to tell the inhabitant of one continent from another. Perhaps we have traded a cultural and
visual diversity for a more varied personal life—certainly a more varied and interesting world of
technology.
At a time when it can be hard to tell one computer book from another, Manning celebrates
the inventiveness and initiative of the computer business with book covers based on the rich diver-
sity of regional life of two centuries ago—brought back to life by the pictures from this collection.

xx
C H A P T E R 1

C for Perl programmers


1.1 Hello, world 1 1.7 Casting 16
1.2 The C compiler 2 1.8 Control constructs 17
1.3 Header files 3 1.9 Macros and the C preprocessor 20
1.4 The main function 4 1.10 Library functions 23
1.5 Variables and functions 6 1.11 Summary 23
1.6 Data types 10

When using C and Perl together, the first thing you need to realize is that they are
very different languages, requiring different styles and different thought patterns. Perl
spoils programmers by doing much of the hard work for you; if you’ve never pro-
grammed in C, the language can feel very barren and empty. C is close to the
machine—Perl is close to the user.
That said, Perl’s syntax borrows heavily from C’s, and so most of the elements of
a C program should be familiar to a competent Perl programmer with a little thought
and a little preparation.

1.1 HELLO, WORLD


The classic book on C programming is Brian Kernighan and Dennis Ritchie’s The C
Programming Language, which begins with a program a little like this:
#include <stdio.h>

int main(int argc, char* argv[])


{
printf("hello, world\n");
return(0);
}

1
The classic book on Perl, on the other hand, is Programming Perl, by Larry Wall, Tom
Christiansen, and Randal Schwartz. It begins with a similar program:
print "Howdy, world!\n";

Notice that Perl is much more compact: there’s no waffle, no housekeeping. We want
to print something, and we tell Perl to print it. C, on the other hand, requires more
support from the programmer.
Let’s first look at how to compile and run the C program, before we discuss how
it’s constructed.

1.2 THE C COMPILER


There’s only one Perl, but a large variety of C compilers and implementations are avail-
able; they can have a graphical front-end, such as the Microsoft Visual Studio, or a
simple command-line interface, such as the Free Software Foundation’s Gnu C Com-
piler (GCC). We’ll talk about GCC here, because it’s the most popular free compiler.
The simplest way to call GCC is to give it the name of a C program to compile.
GCC is particularly quiet; if all is well, it will give no output on the screen:
% gcc hello.c
%

This command produces an executable called a.out1 in the current directory. If we


run it like so
% ./a.out
hello, world!

we get our tired and worn greeting.


Sometimes we don’t want our output called a.out, so we can tell GCC to give it
another name with the -o option:
% gcc -o hello hello.c

Perl encourages programmers to turn on the -w flag for warnings; we encourage C


programmers to turn on the -Wall flag for all warnings:2
% gcc -Wall -o hello hello.c

If we have a collection of C files that make up one program, we can list them all:
% gcc -Wall -o bigproject one.c two.c three.c four.c

1
It has this name for historical reasons; a.out was the name of a particular type of executable file
format.
2 Of course, if you are not using GCC, the particular option will be different. Ironically, -Wall does

not turn on all the warnings in GCC; it only turns on those the GCC programmers feel are important.
See the GCC documentation for the full list of warnings. If you want to make sure your program will
be ANSI compliant and you’re not accidentally slipping in some GCC extensions, consider using the
-ansi -pedantic option.

2 CH AP TE R 1 C FOR PERL PROGRAMMERS


However, it’s more popular to use GCC to convert each one to an object file (extension
.o with GCC, equivalent to .obj files on Windows)—an intermediate stage in com-
pilation—and then link all the object files together; doing so allows you to change
individual files without needing to completely recompile everything. To tell GCC to
produce an object file, use the -c flag:
% gcc -Wall -o one.o -c one.c
% gcc -Wall -o two.o -c two.c
% gcc -Wall -o three.o -c three.c
% gcc -Wall -o four.o -c four.c

Then, simply list the object files to link them together:


% gcc -Wall -o bigproject one.o two.o three.o four.o

There are more complicated ways to build large programs, using static and dynamic
libraries, but we won’t go into those in our examples.

1.3 HEADER FILES


The first line in the C “Hello world” program presented earlier in the chapter is an
include directive: it is similar to Perl’s require in that it instructs the language to
go find a library file and read it in. However, whereas Perl’s .pm and .pl library files
contain real Perl code, C’s .h files (header files) contain only the promise of code—
they contain function prototypes, and just like Perl’s subroutine prototypes, these
prototypes allow the compiler to check your use of the functions while specifying that
the real code will come later.
NOTE Header files can contain any code, but they’re typically used for function
prototypes that several C source files will need; they are also often used to
declare constants (see section 1.9), enumerations (sets of related constants),
and structures (see section 3.4).
But what function’s prototype do we need, and where will the real code come from?
The only function we use is printf, in line 5 of our example. Perl has a printf
function, too, and the two functions are almost identical. However, all the Perl func-
tions documented in perlfunc are built in to the language; C, on the other hand,
has no built-in functions. Everything is provided by a library called the standard C
library, which is included when any C program is compiled. The printf function
comes from a section of the standard C library called the standard IO library, and to
let the C compiler ensure that we are using it properly, we have it read the header file
that contains the prototypes for the standard IO library, stdio.h.3

3
It’s almost like use strict is always on—you can’t use any function without telling C where it’s
coming from (or at least you shouldn’t, because if you fail to declare the prototype, the compiler will
make some assumptions that are unlikely to be correct).

HEADER FILES 3
1.4 THE MAIN FUNCTION
The Perl version of the “Hello world” program is much smaller because everything in
C must be inside a function; if you have Perl code outside any subroutine, it will all
be executed in order. C needs all this code in one place: the main function. When
your program begins, C arranges for this function to be called.
NOTE What you’d call a subroutine in Perl is called a function in C.
This function must have a prototype, and here it is again:4
int main(int argc, char* argv[]);

Perl’s prototypes tell you only what type of data is coming into the function: sub
main($@) tells you that the subroutine main takes a scalar and an array. The proto-
types can also coerce values into a given type; for instance, sub take_ref(\%) will
make the first element into a reference to a hash.
In C, you’re not only told what’s coming into the function, you’re also told what
variables it should be stored in, and also what type of data the function should return.
C’s prototypes do not coerce values to a type—instead, if you pass the wrong type, the
C compiler will give an error.
In this case, we’re returning an integer, and we’re being given an integer called
argc and something called argv. We’ll look at what char * means later, but you
might be able to guess that argv is similar to Perl’s @ARGV and [] might denote an
array—argv is an array of the command-line parameters. argc is the number of ele-
ments in the array—that is, the number of command-line parameters passed to the
program (the argument count). One difference between Perl and C is that in C, argv
contains the name of the command in element 0, whereas in Perl, @ARGV does not
contain the command name (that can be retrieved using $0).
NOTE main is a special C function in the sense that it can have multiple proto-
types and you can decide which one to use. If you are not interested in
using command-line arguments, you can use a much simpler prototype
that has no arguments:
int main(void);
Some compilers also support a third argument to main:
int main(int argc, char *argv[], char **envp);
Here, envp provides access to the process environment. It is not part of
POSIX or the ANSI C89 standard, so we won’t mention it again.

4
ISO standard C main is defined as being int main(int argc, char** argv), but many pro-
grammers use the (roughly) equivalent char* argv[]. The difference is horribly subtle. We use
char* argv[] here because it’s easier to understand.

4 CH AP TE R 1 C FOR PERL PROGRAMMERS


The main function almost always has the two-argument prototype given earlier: it
should take two parameters that represent the command line and return an integer
value to the operating system (the exit status). Additionally, just as in Perl, the pro-
gram can end implicitly when there is no more code to execute, or explicitly when the
exit function is called. We showed another explicit method in our first example,
which returned a value to the operating system, ending the main function. We could
also, theoretically, allow execution to fall off the end of the main function:
#include <stdio.h>

int main(int argc, char *argv[])


{
printf("hello, world\n");
/* No return, just falls off. */
}

TIP This example includes the use of a C comment. Comments are made up of
matched pairs of /* and */.5 Note that comments cannot be nested. This
is legal:
/*
Comment out some code:
printf("This won't print\n");

Now carry on with the program:


*/
But this isn’t:
/*
Comment out some code:
printf("This won't print\n"); /* A comment */

Now carry on with the program:


*/
The comment will be ended at the first */—that is, after A comment—
and the C compiler will try to compile Now carry on….
Allowing execution to fall off the end of main is not recommended; doing so pro-
duces a warning to the effect that C expected your function to return a value, and it
never did. Finally, we can call exit explicitly:
#include <stdio.h>

int main(int argc, char *argv[])


{
printf("hello, world\n");
exit(0);
}

5
Many modern compilers (and the C99 standard) also implement C++-style // comments. These com-
ments act just like Perl # comments.

THE MAIN FUNCTION 5


Random documents with unrelated
content Scribd suggests to you:
and adequate provision for their religious and secular instruction, as
also for their useful employment. Disregarding sarcastic critics, who
protested against the “ultra-humanitarianism which sought to make
jails too comfortable and tended to pamper criminals,” Miss Fry
pursued her way and finally brought about the passing of Acts
(1823–24), in which it was laid down that over and above safe
custody it was essential to preserve health, improve morals, and
enforce useful labor in all prisons. Not content with these results,
Miss Fry likewise inspected during the time from 1818 to 1841 the
principal prisons of Scotland, Ireland, France, Switzerland, Belgium,
Holland, Southern Germany, and Denmark, everywhere conferring
personally with the leading prison officials. By keeping up a constant
correspondence with them she had the satisfaction of hearing from
almost every quarter of Europe that the authorities were giving an
ever increasing consideration to her suggestions.—
Following the example set by Miss Fry, women in many
countries aided in forming societies for the improvement of prison-
discipline. They also established reformatories for women and
juvenile delinquents. For instance Mrs. Abbey Hopper Gibbons
assisted in founding the “Women’s Prison Association of New York”
in 1844 and the “Isaac T. Hopper Home.” Its objects were: “First, the
improvement of the condition of the prisoners, whether detained on
trial or finally convicted, or as witnesses; secondly, the support and
encouragement of reformed convicts after their discharge, by
affording them an opportunity of obtaining an honest livelihood, and
sustaining them in their efforts to reform.”
The association employs an executive secretary who visits all
the places where women are detained in the State or City of New
York, keeps track of the housing conditions and studies the
treatment of the prisoners. On the basis of this exact knowledge, the
Association has proposed various reforms; for example the
establishment of Bedford Reformatory was largely due to the efforts
of this society, and the appointment of police matrons in the city
station houses. Through the instrumentality of Mrs. Hopper Gibbons
the “New York State Reformatory for Women and Girls” was
established by the Legislature.
Through the efforts of Linda Gilbert various prisons
throughout the country were provided with libraries. She also
secured the incorporation of the “Gilbert Library and Prisoners’ Aid
Society” under the laws of the State of New York. Furthermore she
procured employment for thousands of ex-convicts, and aided others
in establishing in business in a small way.—
To enumerate what women have contributed to culture as
founders and patronesses of infant homes, foundling and orphan
asylums, industrial schools and homes for boys and girls, of refuges
for unfortunate women, invalids and the aged, of hospitals for
destitute children and for people afflicted with tuberculosis, cancer,
and incurable diseases, is a task impossible for the limited space of
this book. Besides, all information is fragmentary and far too
insufficient to give a true idea of the vast sums and immense amount
of time, labor, and effort, devoted by women to these works of
charity. Constantly on the lookout to alleviate sorrow and provide
comfort, they have not forgotten even those lonely men, who do duty
in remote light houses and life-saving stations. It was through the
efforts of women that these involuntary hermits, who often do not
come in touch with other human beings for several months, are
regularly provided with interesting books and entertaining games.
Mrs. Matilde Ziegler of New York has taken a special
interest in the blind. Mrs. Ziegler, at an expense of $20,000 a year,
founded a monthly magazine for the blind, which has a printing
press of double the capacity of any printing plant for the blind in any
other country. Blind girls do all the work connected with this
magazine.
Georgia Trader in Cincinnati established school classes for
the blind and a library with over 25,000 volumes, from which books
in raised type are sent to the blind all over the country, free of any
charge. She also founded a working-home for blind girls, where they
are profitably employed in weaving rugs, and in various artistic work
and handicraft.
Jane Addams in 1889 opened in Chicago a social settlement,
known as “Hull House.” Wonderful work in sociology is done there.
Many thousands of men, women and children are instructed in all
kinds of handicraft, and directed to places, where they can make an
honest and profitable living. They have also access to an excellent
library, comfortable club rooms, lecture-halls, kindergarten, play-
grounds and other institutions.
Miss Addams is to-day recognized as one of the foremost
women in her line of work, and by her example as well as through
her public lectures and able books, has probably done more than
anybody else for the extension of practical sociology.
Women have also taken charge of thousands of tired working-
girls and sent them to the country for a short rest during the
summer, thus enabling them to take up their lives of toil with
renewed vigor and courage.
Similar organizations have established vacation schools to
save children from the demoralization of the long summer idleness,
and to secure for them fresh air vacations.
Moved by a sincere desire to improve the conditions of the
despised and maltreated American Indians, Helen Hunt Jackson,
Alice Fletcher, and Mary L. Bonney succeeded after
indefatigable efforts in awakening interest among the legislators in
their work. Miss Fletcher, in her valuable book “Indian Civilization
and Education,” gave such ample proof of her special qualifications
that she was appointed by President Cleveland in 1887 as a special
agent of the Government, to allot lands to various Indian tribes.
Mary L. Bonney devoted herself principally to educational work and,
in 1881, was foremost in the task of organizing the “Indian Treaty-
Keeping and Protective Association” by which the many unlawful
encroachments of white settlers, and the oppression of the Red Men
by government agents were stopped.
In their efforts to alleviate the hard lot of negro slaves,
Lucretia Mott, Sarah and Angelica Grimke, Harriet Beecher
Stowe, and many others, braved criticism, insults and social
ostracism.
By organizing societies for the prevention of cruelty to
children and animals, women have taken care of those who cannot
speak for themselves. In many cities they have likewise provided
drinking fountains for men and for animals.
All women members of the “National Association of the
Audubon Societies,” that protect bird-life in America, bind
themselves never to decorate their hats with plumes and feathers.
They have also secured laws that forbid hunters to kill useful birds,
and prevent milliners from buying or exhibiting feathers and stuffed
skins of such birds.
As generous patronesses of education, science and art many
women have set themselves lasting monuments.
Catherine L. Wolfe donated to the Metropolitan Museum
of Art in New York not only her magnificent collection of paintings,
but likewise a fund of $200,000 for its preservation and increase. A
million dollars was also bequeathed by her to several educational
institutions founded by her father and herself. She is also known as
the founder of the New York Home for Incurables.
Mary Tileston Hemenway supported the so-called
Hemenway Expeditions for the archæological exploration of certain
regions of Arizona and New Mexico.
Jane Lathrop Stanford, wife of Leland Stanford, railway
constructor, and U. S. Senator from California, founded in memory
of her son the “Leland Stanford Jr. University” at Palo Alto, near San
Francisco. At her own expense Mrs. Stanford established a museum,
connected with the university, containing objects of art, and many
things she had collected during her extensive travels. At her death
the entire estate of the Stanfords, amounting to about $50,000,000,
was left to endow this great university. Her San Francisco home, on
Nob Hill, became an art gallery and museum.
Phœbe Hearst, wife of George Hearst, and mother of
William Randolph Hearst, made large donations to the University of
California. These included $800,000 for the erection and equipment
of the Hearst Memorial Mining Building. She also made provision for
twenty scholarships for women, and founded a number of free
libraries in mining towns with which her husband had been
associated. Mrs. Hearst was also actively interested in every kind of
organization for the welfare of women. Furthermore she established
and maintained two kindergarten schools in San Francisco, and
three in Washington, one of which is for colored children. Her most
important gift to the District of Columbia was the National Cathedral
School for Girls, erected on a beautiful site on the outskirts of the
city.
Margaret Olivia Sage, the widow of Russell Sage, donated
between seventy-five and eighty million dollars for charitable and
educational purposes. With ten millions she established in 1907 the
“Sage Foundation for Social Betterment.” Its purpose is the
improvement of social and living conditions in the United States. It
does not attempt to relieve individual or family need, but tries to
seek out and eliminate causes of this evil. It furthers education that
more directly affects social and living conditions, such as industrial
education, education in household arts, and the training of social
workers. In the pursuit of these aims the Sage Foundation subsidized
worthy activities and organizations; it has established investigational
and propagandist departments of its own; invested its funds in
activities with a social purpose; and published extensively books and
pamphlets on social subjects. Since the work of the Russell Sage
Foundation aids social advance for people of every nation, Mrs. Sage
became one of the benefactors not only of this country, but of the
world.
Among the many donations Mrs. Sage made to other
institutions, were $600,000 to the Troy Female Seminary, which
was one of the first schools in America for the higher education of
girls; $1,600,000 to the Woman’s Hospital of New York; $1,600,000
to the Children’s Aid Society; $1,600,000 to the Metropolitan
Museum of Art; $1,600,000 to the American Museum of Natural
History; and $1,600,000 to Syracuse University.
The list here given mentions only a few of the innumerable
philanthropic works of American women. Similar lists could be made
for all other countries, but the material has never been properly
collected. Besides, by far the greatest number of such benevolent acts
have been performed without public knowledge. But wherever we go,
we find women active, helpful, and persevering, always rejoicing in
the accomplishment of good.
THE HUNDRED YEARS’ BATTLE FOR
WOMAN SUFFRAGE.
“If particular care and attention are not paid to the ladies, we
are determined to foment a rebellion, and will not hold ourselves
bound to obey any laws in which we have no voice or
representation.”—This was the warning directed by Mrs. John
Adams in March, 1776, to her husband while he was attending the
Continental Congress, assembled in Philadelphia to consider the
Declaration of Independence.
When this document was framed and adopted without
recognizing the rights of women, Mrs. Adams and a number of other
women, deeply indignant, made good the threat of Mrs. Adams and
opened that most remarkable warfare, which has lasted for more
than a hundred years and may be called “Woman’s Battle for
Suffrage.”
That they were deeply disappointed by the inattention of
Congress, may be inferred from a letter by Hannah Lee, the sister
of General Lee, in which she asks her brother to demand from
Congress suffrage for women, as otherwise they would not pay any
taxes. The same request was made by various other prominent
women, who pointed to the fact that, while their husbands and sons
had fought for the inherent rights of men, they had likewise fought
for the rights of women. But as at that time American women were
not organized their demands failed to make the necessary impression
and remained unheeded. Besides, the majority of American women
receiving only a very limited education, took little interest in the
question, because of their ignorance of its importance. Thus, the
subject of woman’s rights and suffrage dragged on until women had
discovered, that there is strength in numbers, in federation, and that
federation is the preliminary requirement to make victory possible.
The evolution of women’s clubs during the 19th Century is one
of the most striking and most important phenomena in woman’s
history. The movement began with the sewing or spinning circles of
long ago, and made a great stride when the custom was initiated of
some members reading while the others sewed. Later on these circles
evolved into reading-clubs, which again developed into literary
societies and associations for public improvement, aiming at the
establishment of public schools and libraries, the erection of
hospitals, orphan asylums, the sanitation of the streets, and other
public works.
Such women’s clubs were not even afraid to tackle such most
difficult problems as the abolition of slavery, which, at the end of the
18th and the beginning of the 19th Century, became the burning
question of the time. The hot discussion of this problem split the
population of the United States into two hostile factions, of which the
South with its partisans in the North made desperate efforts to
prevent the free expression of opinion respecting the institution of
slavery. In the slave States even the Christian churches used their
influence in favor of the maintenance of slavery.
Among the first and strongest advocates of abolition were
Sarah and Angelina Grimke, the daughters of a family of
Salzburgers, who during the 18th Century had immigrated into South
Carolina and Georgia. Shocked by the inhuman treatment and
cruelties inflicted upon the slaves all round, and suffering intensely
from the stand taken by their own relatives, the sisters resolved to
fight these abuses.
While visiting Philadelphia, Sarah came under the influence of
the Quakers, and read the strong protest against slavery, which
Pastorius and the settlers of Germantown in 1688 had directed to the
Quaker meeting. Returning to her home, Sarah besought her
relatives to free their slaves. Failing in this effort, she left her home,
joined the Quaker society of the “Friends” in Philadelphia, and in
1835 directed an “Appeal to the Christian Women of the South,”
imploring them to become active on behalf of the slaves. This
pamphlet aroused such a profound sensation wherever it was read,
that when some time afterward Miss Grimke expressed a desire to
visit her former home, the mayor of Charleston called upon her
mother and informed her that the police had been instructed to
prevent her daughter’s landing when the steamer should come into
port. He also would see to it that she might not communicate with
any person, by letter or otherwise, and that, if she should elude the
vigilance of the police and go ashore, she was to be arrested and
imprisoned until the return of the vessel. As threats of personal
violence were also made, Miss Grimke abandoned her visit, but
published soon afterward “An Epistle to the Clergy of the Southern
States,” and, at the same time, began to address meetings in
Pennsylvania as well as in the New England States, in order to rouse
the dormant moral sense of the hearers to protest against the
colossal sin of the nation. She was assisted by her sister Angelina and
such eloquent speakers as Lucretia Mott, Elizabeth Stanton,
William Lloyd Garrison and others. These agitators finally
created such a stir, that the conservatives and opponents of abolition
decided that they must be silenced. Quite often their meetings were
disturbed by mobs; halls were refused them, and violence was
threatened. The General Association of Congregational Ministers of
Massachusetts passed a resolution censuring the Grimke sisters, and
issued a pastoral letter containing a tirade against “female
preachers.” But in spite of all efforts, public sentiment in the North
in favor of abolition steadily grew, until it became evident that the
question could not be settled without an armed conflict.
At a gathering of abolitionists, held on July 19th, 1848, at the
home of Mrs. Elizabeth Cady Stanton in Seneca, N.Y., the
question of women’s rights was eagerly discussed. Mrs. Stanton, the
daughter of a lawyer, had found by frequent visits to her father’s
office that according to the then existing laws, which had been
adopted from England, married women had no right of disposal over
their own inherited property, their own income, or their own
children, no matter how unfit, degraded, and cruel their husbands
might be. There was even no redress for corporal punishment which
the husbands might inflict on their wives.
ELIZABETH CADY STANTON.

Another woman, present at the gathering, was Lucretia


Mott, a Quaker teacher. It had been her experience, that female
teachers, having paid for their education just as much as the males,
obtained, when teaching, only half of the compensation granted to
male teachers.
But the indignation of the two women over the inferior
position of woman had been especially excited while attending the
World’s Anti-Slavery Convention, held in 1840 at London. Both
women, together with Mrs. Wendell Phillips, had been appointed
delegates by the abolitionists of America, and as they were able
speakers, much had been expected from their eloquence. But when
the women submitted their credentials, they discovered that the
English abolitionists had not reformed their antiquated views of
male predominance and would not admit any woman as delegate nor
on the platform. When the question was submitted to vote, the
women were excluded by a large majority. This flat refusal to
recognize woman’s right to an equal participation in all social,
political, and religious affairs brought what is termed “the Woman
Question” into greater prominence than ever before. The gathering
in the Wesleyan chapel, at Seneca Falls, N.Y., Mrs. Stanton’s home, is
known as the First Woman’s Rights Convention. Held on the
19th and 20th of July, 1848, it was attended by 68 women and 38
men. The simultaneous discussion of the subject of slavery and the
natural rights of man had as their logical consequence, on the part of
women, the demand of a privilege exercised in many cases by
persons far below them in intelligence and education. They asserted
that many of their number were taxpayers, that all were interested in
good government, and that it would be unjust for women of
intelligence to be deprived of a vote while ignorant negroes could
have a voice in the government. Furthermore they asserted that the
participation of women would have a purifying effect on politics.
At the close of the second day the convention adopted the
following:

Declaration of Sentiments.
“The history of mankind is a history of repeated injuries and
usurpations on the part of man toward woman, having in direct
object the establishment of an absolute tyranny over her. To prove
this, let facts be submitted to a candid world.
“He has never permitted her to exercise her inalienable right
to the elective franchise.
“He has compelled her to submit to laws in the formation of
which she had no voice.
“He has withheld from her rights which are given to the most
ignorant and degraded men—both natives and foreigners.
“Having deprived her of this first right of a citizen, the elective
franchise, thereby leaving her without representation in the halls of
legislation, he has oppressed her on all sides.
“He has made her, if married, in the eye of the law, civilly
dead.
“He has taken from her all right in property, even to the wages
she earns.
“He has so framed the laws of divorce as to what shall be the
proper causes, and, in case of separation, to whom the guardianship
of the children shall be given, as to be wholly regardless of the
happiness of women—the law in all cases going upon a false
supposition of the supremacy of man, and giving all power into his
hands.
“After depriving her of all rights as a married woman, if single
and the owner of property, he has taxed her to support a government
which recognizes her only when her property can be made profitable
to it.
“He has monopolized nearly all the profitable employments,
and from those she is permitted to follow she receives but a scanty
remuneration. He closes against her all the avenues of wealth and
distinction which he considers most honorable to himself. As a
teacher of theology, medicine, or law, she is not known.
“He allows her in church, as well as state, but a subordinate
position, claiming Apostolic authority for her exclusion from the
ministry and, with some exceptions, from any public participation in
the affairs of the church.
“He has created a false public sentiment by giving to the world
a different code of morals for men and women, by which moral
delinquencies which exclude women from society are not only
tolerated but deemed of little account in man.
“He has usurped the prerogative of Jehovah himself, claiming
it as his right to assign for her a sphere of action, when that belongs
to her conscience and God.
“He has endeavored, in every way that he could, to destroy her
confidence in her own powers, to lessen her self-respect, and to make
her willing to lead a dependent and abject life.
“Now, in view of this disfranchisement of one-half the people
of this country, their social and religious degradation; in view of the
unjust laws mentioned, and because women do feel themselves
aggrieved, oppressed and fraudulently deprived of their most sacred
rights, we insist that they have immediate admission to all the rights
and privileges which belong to them as citizens of the United States.”

Of course, this declaration, modeled after the immortal


Declaration of 1776, did not fail to create a sensation everywhere.
Other conventions were held in Rochester and Syracuse, N.Y., and in
Salem, Ohio. They brought to the front a number of wonderful
women, whose names were henceforth connected with this
movement, first among them Susan B. Anthony, Lucy Stone,
Paulina Wright Davis and Anna Howard Shaw. In October,
1850, the First National Woman’s Rights Convention was held
at Worcester, Mass. Attended by delegates from nine states it was
distinguished by addresses and papers of the highest character,
which filled the audiences with enthusiasm. A National Committee
was formed, under whose management conventions were held
annually in various cities. An account of the convention, written by
Mrs. John Stuart Mill, in the “Westminster Review,” London,
marked the beginning of the movement for woman suffrage in Great
Britain. But in spite of all efforts and agitation, progress was but
slow. The first result was not gained before 1861, when Kansas
granted school suffrage to women, a step that was not followed by
other states for many years afterwards.
How averse the stronger sex was to grant women suffrage
became evident, when in 1868 the 14th and 15th amendments to the
Constitution of the United States were adopted. These amendments
abolished slavery and gave the freed negroes of the South all
privileges of citizenship, including the right to vote. Section 1 of the
15th amendment reads:
“The right of citizens to vote shall not be denied or
abridged by the United States, or by any State, on
account of race, color, or previous condition of
servitude.”
As the advocates of woman suffrage were American citizens,
they held themselves entitled to the same rights as granted to the
negroes. But their demands to be registered as legal voters were
denied by the registrars of elections. Now the women appealed to the
courts, to see if their claim would be sustained by invoking the aid of
those constitutional amendments above cited. But the uniform
decision in each court was that these amendments had in no way
changed or abridged the right of each State to restrict suffrage to
males, and that they applied only to the men of color and to existing
rights and privileges. An appeal to the Supreme Court resulted in the
decision that this body was in accordance with the decisions of the
State courts.
To test the application of the 14th and 15th amendments to
the Constitution Susan B. Anthony,—who in 1860 with others had
been successful in securing the passage of an Act of the New York
Legislation, giving to married women the possession of their
earnings, as well as the guardianship of their children,—cast in 1872
ballots at the State and Congressional elections in New York. Miss
Anthony was indicted and in 1873 found guilty of criminal offense
against the United States for knowingly voting for congressmen
without having a lawful right to vote, which offense was punishable,
under Act of Congress, by a heavy fine or imprisonment. Fined $100
for illegal voting, Miss Anthony declared that she would never pay
the penalty, and in fact it has never been collected.

SUSAN B. ANTHONY.

Undaunted by the decision of the Court, Miss Anthony in 1875


proposed the following amendment to Article 1 of the Constitution:
“Section 1. The right of citizens of the United States to vote
shall not be denied or abridged by the United States or by any State
on account of sex.
“Section 2. Congress shall have power by appropriate
legislation to enforce the provisions of this article.”
This resolution was introduced by Senator Sargent of
California in 1878, but was rejected several times. In 1887 it secured
in the Senate only 14 affirmative to 34 negative votes.
But several years before the indictment of Miss Anthony
woman suffrage had already won its first victory, in the Territory of
Wyoming. The Organic Act for the regulation of the Territorial
governments provides that at the first election in any Territory male
citizens of the age of twenty-one years shall vote, but
“at all subsequent elections the qualifications of
voters and for holding office shall be such as may be
prescribed by the legislative assembly of each Territory.”
Under this act the first legislative assembly of Wyoming, in
1869, granted women the right to vote and to hold office upon the
same terms as men. An effort made in 1871, to repeal this statute,
failed, and to the men of Wyoming belongs the honor, of having been
first to recognize the rights of women.
A further gain was made when the Republican National
Convention of 1872 and 1876 resolved that “the honest demands” of
women for additional rights should be treated with respectful
consideration.
Of still greater importance was the organization of two
national Woman Suffrage Associations, the one with headquarters in
New York, the other in Boston. A union of these two bodies was
effected in 1890 under the title of “The National American
Woman Suffrage Association.”
Mrs. Stanton was elected president of the new organization.
When in 1892 she resigned from her office because of advancing age,
she was followed by Miss Anthony, who in 1900 resigned at the age
of 80. Her successors were Miss Anna Howard Shaw and Mrs.
Carrie Chapman Catt.
Under the able leadership of these brilliant women victory
was now followed by victory. Up to 1914 Colorado, Idaho,
Washington, California, Arizona, Kansas, Oregon, Nevada, Utah and
Montana had joined the ranks of Woman Suffrage States; also the
Territory of Alaska.
To these Western regions the Eastern and Southern States
formed a strange contrast, as so far the suffragists had been unable
to conquer one of them. For this surprising fact I fail to find any
other explanation but that the Western men are much more
conscious of a great historical truth, which the men in the East and
South seem to have almost forgotten, namely: that to the women
the founding of real culture in America is due. Having
heroically shared with their husbands all hardships and
dangers, having gone with them on their hazardous
journeys into the wilderness, even on their long voyages
across the prairies and Rocky Mountains to far Oregon and
California, the women provided the first permanent homes
and filled them with comfort, sunshine and happiness. In
recognition of these facts the Western men granted their
partners only a well deserved tribute of gratitude.
In many places the men expressed their respect for the gentler
sex by electing women to important public offices, and in almost all
cases these positions have been filled to the fullest satisfaction.

The steady progress of woman suffrage in the United States


was followed by the women of other countries with intense interest,
especially by those of Great Britain and Australia. Encouraged to like
activity, they demonstrated with convincing clearness the injustice of
the legislatures toward women and thus prepared the way for a
similar movement in favor of woman suffrage. The result was that
the English government in 1869 adopted the Municipal Reform Act,
which permits women to vote in all municipal elections. An Act of
1870 gave them the school vote. The Act of 1888 made them voters
for the county councils. An Act of 1894 abolished in all departments
of local government the qualification of sex.
DR. ANNA HOWARD SHAW.

New Zealand, one of the most progressive of all countries,


went even farther. The women there were granted suffrage in 1893
on the same basis with men. A similar step was taken in the following
year by South Australia. And when in 1901 the Commonwealth of
Australia was formed by the federation of the six provinces, or states,
of New South Wales, Victoria, Queensland, South Australia, Western
Australia and Tasmania, one of the first steps was to give all women
full national suffrage.
In the countries of continental Europe the evolution of local
women’s organizations to State- and National Unions had been the
same as in the United States and in England. But the majority of
these societies remained conservative in regard to woman suffrage.
Germany since 1813 has had the “Vaterlaendische
Frauenverein” (Patriotic Women’s League), a union of wonderful
helpers for suffering humanity, both in peace and in war. Since 1865
a “General Association of German Women” tried to secure new rights
for women, both along political and economic lines. A “Society for
Woman Suffrage” was not formed before 1902. But only two years
later the “International Suffrage Alliance” was formed in Berlin,
with Mrs. Carrie Chapman Catt, of New York, as president. The
progressive movement in Germany took largely the form of
educational and industrial training. And the women shared the
national belief that education precedes every good, and that for their
legal and political protection from injustice they might rely upon
their male relatives.

CARRIE CHAPMAN CATT.

In certain districts of Germany, Austria, Denmark, Hungary


and Russia women who owned property, were permitted to cast their
votes on various communal matters, either by proxy or in person. In
Belgium, the Netherlands, France, Italy, Switzerland, Roumania and
Bulgaria women had no political rights whatever, but were permitted
to vote for certain state boards—educational, philanthropic,
correctional and industrial. In France, women as a rule showed little
sympathy with suffrage, retaining their racial instinct that they might
accomplish more through social influence, personal suasion and the
special charms of their sex than by working openly through the
ballot.
In Switzerland few women had the courage to seek
emancipation, as those who favored the movement were looked upon
as disreputable persons without regard for social laws. In Portugal
and Spain women remained absolutely indifferent. Sweden had given
women the right to vote in all elections, except for representatives,
while Finland and Norway in 1906 and 1907 granted full suffrage
rights and eligibility to women upon exceedingly generous terms.
Since the beginning of the 20th Century the Modern Woman’s
Rights Movement has also caused significant changes in the status of
the women of the Balkan States, and of the countries of the Orient
and the Far East. Restrictions and obstacles, placed on woman by
tradition and religious rules, have been abolished. Many
Mohammedan women for instance appear to-day on the streets
without veils, a thing that no prominent woman could do formerly.
The establishment of girls’ schools, woman’s colleges, universities,
woman clubs and journals mark likewise the progress of the
movement. And in Servia, Bulgaria, Greece, Turkey, Egypt and Japan
exist federations of women’s clubs, which can be regarded as political
organizations.
Thus, at the beginning of the memorable year of 1914 woman
throughout the civilized world had gained various degrees of
freedom in the exercise of her political rights.
WHY WOMEN WANT AND NEED THE VOTE.
Few questions have been so universally and intensely
discussed as the right and expediency of Woman Suffrage. Its
opponents assert that the true woman needs no governing authority
conferred upon her by law. While discussing this question one
“gentleman” said “that the highest evidence of respect that man
could exhibit toward woman, and the noblest service he could
perform for her, were to vote Nay to the proposition that would take
from her the diadem of pearls, the talisman of faith, hope and love,
by which all other requests are won from men, and substitute for it
the iron crown of authority.”
The chief arguments brought forward against woman suffrage
are: that the majority of the women never desired it, because they
were already represented by their husbands, fathers and brothers;
that there were already too many voters, and that by admitting
women to suffrage the whole machinery and cost of voting would be
doubled without changing the result; that women would not have
time to perform their political duties without neglecting their higher
duties at home; that women were too emotional and sentimental to
be entrusted with the ballot; that women would cease to vote after
the novelty had worn off; that the introduction of women into
political life would increase its bitterness, and would abolish chivalry
with its refining influence on men; that the franchise, in a large
majority of instances, would be exercised under the influence of
priests, parsons, and ministers, under the power of religious
prejudice, and that religious feuds would affect political life much
more than under present circumstances. And finally it has been
asserted that woman suffrage would place a new and terrible strain
upon family relations as the introduction of political disputes into
domestic life would lead to quarrels and divorce.
These arguments were answered in an editorial of the “New
York American” of October 6, 1912, as follows:
“The ballot is the weapon that men use in defending their
rights. It is the voice with which men express their opinions, their
wishes, as to law, in the more settled civilization where the ballot is
the recognized power. Little by little the mass of the people—that is
to say, of the men—have got the ballot. Originally there was no ballot.
Savage tribes held disorganized meetings, and shouted their
opinions. The loudest shouters won, and the man who could hit the
hardest led the others. Little by little the big man formed his own
opinions, alone reached his own decisions, and the others had
nothing to say. The expression of opinion was confined to one, or to a
few leaders, gathered under a chief, or, where religion ruled, opinion
was controlled by the priests in the old temples making up their
minds what would be good for them, and forcing their will on
ignorant people. For many centuries the kings, the nobles and the
priests ruled—and the people had nothing to say. Men and women
alike were without the vote.
“Little by little, the men got the vote, and now, in civilized
countries, universal suffrage became the rule, as regards men. The
women were shut out because men always have had the idea that
voting was in some way connected with fighting. Their thoughts went
back to the old savage mob shouting its determination to attack and
kill—leaving the women at home. And the ignoring of women
persists, although little by little the voting power has been used, not
to make war, but to prevent war.
“Now, in every country calling itself civilized, the chief use of
the ballot is to express ideas of peace—justice. The ballot that was
once the expression of man’s fighting quality is now the expression of
his better nature, and for that reason it is time to give that ballot to
the better half of the human race, to the women that have civilized it.
“Supporters of women suffrage are, and for many years have
been, the best men in the country. Men that are unselfish, just,
scorning ridicule, and proud to vindicate the rights of their own
mothers and sisters, have long demanded votes for women. The
women that have worked and fought for the suffrage have been,
beyond all comparison, the best women of this and other countries.
Humorists used to talk of “short-haired women and long-haired
men” as the advocates of woman suffrage. That is a foolish and false
division. The women with good foreheads, earnest, gentle and
dignified faces have been the advocates of votes for women. The
women with low foreheads, plastered with hair, the women with
their faces painted, the women with a hundred thoughts for dress
and no thought for anything else, have been the opponents of women
suffrage. And the men, brutal, conceited, looking upon woman as a
piece of property, created for man’s pleasure or for his service, have
been the men that opposed suffrage. Another class opposed to
woman suffrage is the most dangerous class of all. That is the class
that would keep in ignorance women, and men, too, if it could. Those
that prey upon the ignorance and superstition of women are anxious
that women shall know as little as possible. They do not want the
women to vote, for voting means thinking, and thinking
means freedom. Wherever women have voted they have bettered
conditions.”—
Lecky in his valuable book “Democracy and Liberty” writes on
page 547: “It has been gravely alleged that the whole character of the
female sex would be revolutionized, or at least seriously impaired, if
they were brought by the suffrage into public life. There is perhaps
no subject in which exaggerations so enormous and so grotesque
may be found in the writings of considerable men. Considered in
itself, the process of voting is now merely that of marking once in
several years a ballot-paper in a quiet room, and it may be easily
accomplished in five minutes. And can it reasonably be said that the
time or thought which an average male elector bestows on the
formation of his political opinions is such as to interfere in any
appreciable degree with the currents of his thoughts, with the
tendencies of his character or life? Men wrote on this subject as if
public life and interests formed the main occupation of an ordinary
voter. It is said that domestic life should be the one sphere of woman.
Very many women—especially those to whom the vote would be
conceded—have no domestic, or but few domestic duties to attend to,
and are compelled, if they are not wholly frivolous or wholly apathic,
to seek spheres of useful activity beyond their homes. Even a full
domestic life is scarcely more absorbing to a woman than
professional life to a man. Scarcely any woman is so engrossed in it
that she cannot bestow on public affairs an amount of time and
intelligence equal to that which is bestowed on it by thousands of
masculine voters. Nothing can be more fantastic than to argue as if
electors were a select body, mainly occupied with political studies
and public interests.
“Women form a great section of the community, and they
have many special interests. The opening to them of employments,
professions and endowments; the regulation of their labor; questions
of women’s property and succession; the punishment of crimes
against women; female education; laws relating to marriage,
guardianship, and divorce, may all be cited; and in the great drink
question they are even more interested than men, for though they are
the more sober sex, they are also the sex which suffers most from the
consequences of intemperance. With such a catalogue of special
interests it is impossible to say that they have not a claim to
representation.”—
Among the arguments in favor of woman suffrage the most
important are the following: As women are citizens of a Government
of the people, by the people, and for the people, and as women
are people, who wish to do their civic duty, it is unfair that they
should be governed by laws in the making of which they have no
voice. As women are equally concerned with men in good and bad
government, and equally responsible for civic righteousness, and as
they must obey the laws just as men do, they should vote equally with
men.
If it is true that “taxation without representation is tyranny”
then tax-paying women who support the government by paying
taxes, should have the right to vote to elect such representatives, who
protect them against unjust taxation.
Working women need the ballot to regulate the conditions
under which they work. Millions of women are wage-earners and
their health is often endangered by bad working conditions and
sweat-shop methods that can only be remedied by legislation.
Business women need the ballot to secure for themselves a
fair opportunity in their business, and to protect themselves against
adverse legislation.
Mothers and housekeepers need the vote to regulate the moral
and sanitary conditions under which their families must live. Women
are forever told that their place is in the home. But what do men
expect of them in the home? Merely to stay there is not enough. They
are a failure unless they do certain things for the home. They must
minister, as far as their means allow, to the health and welfare, moral
as well as physical, of their family, and especially of the children.
They, more than anybody else, are held responsible for what
becomes of the children. Women are responsible for the cleanliness
of the house, for the wholesomeness of the food, for their children’s
health and morals. But mothers cannot control these things, if the
neighbors are allowed to live in filth, if dealers are permitted to sell
poor or adulterated food, if the plumbing in the house is unsanitary,
if garbage accumulates and the halls and stairs are left dirty. They
can take every care to avoid fire, but if the house has been badly
built, if the fire-escapes are insufficient or not fire-proof, they cannot
guard their children from the horrors of being maimed or killed by
fire. They can open the windows to give the children the air that we
are told is so necessary. But if the air is laden with infection and
contagious diseases, they cannot protect the children from this
danger. They can send the children out for air and exercise, but if the
conditions that surround them in the streets are immoral and
degrading, they cannot protect them from these influences. Women
alone cannot make these things right. But the City administration
can do it. The administration is elected by the people, to protect the
interests of the people. As men hold women responsible for the
conditions under which the children live, the women should have
something to say about the city’s housekeeping, even if they must
introduce an occasional house-cleaning.
What enormous influence women are able to exert in vital
questions has been demonstrated in the Temperance Movement;
which originated in the United States. Since the beginning of the
colonization of the Western Hemisphere Americans have been heavy
consumers of rum, whiskey, and other intoxicating liquors.
“Everybody drank, and on all occasions,” says a writer who has left
us a pen picture of these bibulous days. Drunkenness and all the evils
resulting from it increased with the gradual development of the
“saloon” and the habit of “treating,” two institutions peculiar to
America and almost unknown in Europe.
For generations the women were the greatest sufferers from
the intemperance of the men, because many husbands came home
besotted, their faculties benumbed to an unconsciousness of their
own degradation, with wages gone, and employment forfeited. The
purer and gentler the wife in such case, the more intense her
suffering. So it was but natural, that when the first “Anti-Spirits
Association” was formed in 1808 in Greenfield, Saratoga County,
New York, several women should join it. The movement made rapid
progress, and in 1826 the “American Temperance Society” was
founded. In 1829 and 1830 similar associations were started in
Ireland and England; and in 1846 the first “World’s Temperance
Convention” was held at London. In 1873 women became a real
force in the field when the women inhabitants of Hillsborough, a
small town in Ohio, started what became known as “The Women’s
Crusade.”
Frances E. Willard, one of its principal leaders, described the
proceedings in the following graphic manner: “Usually the women
came in a long procession from their rendezvous at some church,
where they had held a morning prayer meeting. Marching two and
two in a column, they entered the saloon with kind faces, and the
sweet songs of church and home upon their lips, while some
Madonna-like leader with the Gospel in her looks, took her stand
beside the bar and gently asked if she might read God’s word and
offer prayer. After that the ladies seated themselves, took their
knitting or embroidery, and watched the men who patronized the
saloons. While some of them cursed the women openly, and some
quietly slunk out of sight, others began to sign the pledge these
women brought with them. In the meantime one of the ladies
pleaded with the proprietor to give up his business. Many of these
liquor dealers surrendered and then followed stirring scenes, and
amid songs and the ringing of the church bells the contents of barrels
and bottles were gurgling into the gutter, while the whole town
assembled to rejoice in this new fashion of exorcising the evil spirits.
“Not everywhere the ladies met with success. In Cincinnati
such a procession of women, including the wives of leading pastors,
were arrested and locked up in jail; at other places dogs were set on
the crusaders, or they were smoked out, or had the hose turned on
them.”
The movement, wholly emotional, and in many cases
hysterical, spread throughout the country like a prairie fire. In 1874
it led to the organization of “The Woman’s Christian
Temperance Union,” and, in 1883, to the founding of “The
World’s Women’s Temperance Union,” the members of which
wear a white ribbon and have the motto: “Woman will bless and
brighten every place she enters, and she will enter every place.”
Since the founding of this world’s union the movement has
extended over many countries and has branched out into a multitude
of organizations. Their influence has been widely felt in legislatures,
and in all elections in which laws have been voted upon for the
regulation of the production and sale of liquors.—
Another question in which women are deeply concerned is
that of Child-labor, the reckless exploitation of children in the
interest of industry. Evidences that in England the dreadful abuses,
committed by unscrupulous mine- and factory-owners, as described
in a former chapter, have continued to the present times, were
submitted to the International Women’s Congress, held in 1899 in
London. It was reported that at that time 144,026 children below the
age of 12 years were employed in workshops, mines, factories and
warehouses. Of these children 131 had not yet reached the age of 7
years; 1120 were under 8; 4211 under 9; 11,027 under 10, and 122,131
under 11 years of age. Miss Montessori, the Italian delegate to the
Congress, described the hard work of the children employed in the
sulphur mines of Sicily. As they have to carry heavy loads on their
shoulders through low gangways and over steep ladders and
stairways, they are compelled to walk in a stooped position, and
therefore in time become deformed and crippled.
In the United States the question of child-labor is likewise a
matter of deep concern to men as well as to women. As every State
has its own Legislature, there exists a varied assortment of child-
labor laws. Ten or fifteen years ago several states had none whatever.
Others prohibited the employment of children under ten years, while
still others had an age limit of twelve or fourteen years. The same
diversity prevailed in regard to the hours of labor. Some states had
no legislation in this direction, while others forbade any child to
work longer than ten hours daily.
During the year 1890 there was a total of 860,786 children
between the ages of ten and fifteen years at work in various
occupations in the United States. A report of the Bureau of Mines of
Pennsylvania for 1901 stated 24,023 of the employees of the
anthracite coal mines in Pennsylvania were children.
In 1918 investigators of the children’s bureau of the
Department of Labor reported that the number of minors employed
in factories, mines and quarries has increased at a rapid rate since
the U. S. Supreme Court, on June 5th, 1918, nullified the child-labor
act of 1916 as unconstitutional. Not only are a greatly increased
number of children employed, but they are kept at work longer hours
than before. Since the future of such children as well as the future of
the country depend to a very great extent upon what legislators do in
regard to children, it is obvious that women are deeply concerned in
this question.—
The need of women’s participation in government and of an
“occasional house-cleaning” in the Legislatures as well as in the
Municipal Administrations becomes evident, when we realize that
one of the most revolting crimes is committed daily in our
communities, quite often with the silent protection of corrupt
officials and politicians. We refer to the White Slave Trade. As few
people have any definite idea of its extent and terrors, some
authentic facts are here given, which, at the same time, demonstrate
men’s indifference as well as the urgent need of woman’s
interference for its suppression.
As everybody knows, the traffic in young girls for purposes of
prostitution is as old as humanity. It has flourished in all ages and in
all countries. But it was during the 19th Century that it found its
systematic organization and its most extensive development.
With alarming frequency, the papers report that some young
woman or girl is “missing,” having stepped out of her home on some
household errand, and from this moment having vanished as though
swallowed by the earth. Such was the case of Dorothy Arnold, who
some years ago left her cosy home in New York, to do some shopping
in a department store. She never returned and no trace of her was
ever discovered. This particular case attracted wide attention all over
the United States, as Miss Arnold, a beautiful girl of eighteen, was
the daughter of wealthy parents, who spent a fortune in desperate
but futile attempts to recover their child.—
Every year hundreds of similar cases occur in our country,
some in San Francisco, some in New York, Baltimore, St. Louis,
Chicago and elsewhere. If the exact number of such missing girls
could be known, the public might well be shocked; and horrified if it
would know the sad lot that befalls the majority of these unfortunate
girls. Where efforts to ascertain their fate have met with success, it
was found that in ninety out of a hundred cases such girls became
victims of the most detestable fiends on earth, human ghouls, who
make fortunes by luring innocent and inexperienced women into the
most degrading slavery.
There were many events that favored the development of the
white slave trade. The discovery of gold in California and the
construction of many transcontinental railroads were followed by the
opening of the rich mining- and lumber-districts in the northwestern
and western parts of the United States, and in Canada. In more
recent years came the opening of the gold and diamond fields in
South Africa, of the gold grounds in Alaska, the construction of the
Panama Canal and the great transcontinental railroads through
Siberia and Africa. All these great undertakings attracted many
thousands of men, who were ready to squander their earnings in
gambling, drinking and any other kind of dissipation. Women, of
course, stood at the head of things in demand. And as there are
always people eager to profit by catering to such passions, the white
slave trade assumed most threatening proportions.
To ensnare victims, the slave dealers insert enticing
advertisements offering profitable positions to waitresses,
chambermaids, servants, governesses, and other female help in
hotels, boarding houses and private families. They send their
“procurers” or agents to the dance-halls and cheap pleasure resorts,
and to those industrial towns, where large numbers of poorly paid
young girls toil in mills and factories. Here they approach their prey
under all kinds of disguises and pretenses. One especially ingenious
procurer of New York has been credited with gaining the
acquaintance of young girls in the garb of a priest. And George Kibbe
Turner in an article “The Daughters of the Poor” (published in 1910
in McClure’s Magazine) made the statement that a gang of such
fiends worked under the name “The New York Independent
Benevolent Association”!
However, the chief recruiting-grounds for the white slave
trade are the miserable Jewish Ghettos of Poland, Russia, Galicia,
Hungary, Austria and Roumania, where always numbers of degraded
men can be found, ready to sell their own kindred for any price
offered. With the help of such procurers four principal centers of the
white slave trade were created: Lemberg, London, Paris and New
York, with branches in all parts of America, Africa and Asia.
Of course such a villainous trade would not be possible
without the silent protection of corrupt officials and political
machines, who share in its enormous profits. Inside information on
this subject was received through the disclosures, made during the
latter parts of the last century about conditions in the mining and
lumber regions of Michigan and Wisconsin. In January, 1887,
Representative Breen appeared before the House Judiciary
Committee of the legislature of Michigan and stated the existence of
a regular trade in young and innocent girls for purposes of
prostitution between Chicago, Duluth and other cities with the
mining and lumber districts south of Lake Superior. As he said that
the horrors of the camps into which these girls were lured beggared
description, several newspapers, among them the “Chicago Herald”
and “The New York World,” dispatched representatives, disguised as
woodmen, to those regions to investigate the truth of these
statements. They found that almost without exception the girls, kept
in these camps, had been secured under promise of respectable
employment. The houses, in which they were imprisoned, were
surrounded by stockades twenty or thirty feet in height, the one door
guarded night and day by a man with a rifle, while within were a
number of bulldogs to prevent the girls from escaping. In the largest
of such lumber camps dens from twenty to seventy-five girls were
found.
On January 24, 1887, the “New York World” published the
story of an unfortunate girl, who had been lured by an advertisement
to work in a lumberman’s hotel in the North. Believing the position
to be respectable, she went there, but after her arrival at the place
she was taken to a rough two-story building surrounded by a slab
fence twenty feet high, within which was a cordon of bulldogs,
thirteen in number, chained to iron stakes driven into the ground. In
this place she was compelled, like all the other girls, of which there
were always from eleven to thirty, to drink and dance with the men
of the mining and lumber camps. They were not permitted to refuse
any request of those visitors. A complaint of any kind, even of
sickness, meant a whipping, frequently with a rawhide upon the
naked body, sometimes with the butt of a revolver. When the log
drives were going on, there would be hundreds of men there night
and day, not human beings, but fiends.
“Oh, it was awful, awful!” cried the girl after her release. “I
would rather stay in prison until I die than go back there for one day.
I tried to escape three times and was caught. They unchained the
dogs and let them get so near me that I cried out in terror and begged
them to take the dogs away and I would go back. Then, of course, I
was beaten. I tried, too, to smuggle out notes to the Sheriff through
visitors, but they would take them to the proprietor instead, and he
would pay for them. Once I did get a note to the Deputy Sheriff at
Florence, Wisconsin, and he came and inquired. But the proprietor
gave him $50, and he went away. I was awfully beaten then. While I
lived this life, from March until September, two inmates died, both
from brutal treatment. They were as good as murdered. Nearly all
the girls came without knowing the character of the house, and first
implored to get away. The county officers came to the places to drink
and dance with the girls. They are controlled by a rich man in Iron
Mountain, who owns these houses and rents them for $100 a
month.”
That the den keepers were always on good terms with the
officials, appears also from the following report of the “Chicago
Herald” of April 17, 1892, in which attention is called to the
continuance of the horrible conditions in the mining- and lumber-
camps. “Four years ago, when “The Herald” exposed the pinery dens,
Marinette was known as the wickedest city in the country. It was the
rendezvous of every species of bad men. Thugs, thieves and gamblers
practically held possession of the town. Their influence was felt in all
municipal affairs. Certain officers of the law seemed in active
sympathy with them, and it was almost impossible to secure the
arrest and conviction of men guilty of infamous crimes. Dives of the
vilest character ran open on the outskirts of the town. Their inmates,
recruited from all parts of the country by the subtle arts of well
known procurers, were kept in a state of abject slavery. Iron balls and
chains, suffocating cords and the whistling lash were used on
refractory girls and women. Bodies of ill-starred victims were
sometimes found in the woods, but the discovery was rarely followed
by investigation. The dive keepers were wealthy and knew how to
ease the conscience of any over-zealous officer.”
Another report states: “Many den-keepers wield a powerful
influence in the local elections; one of the worst of such, after paying
the constable $12 for the return of a girl who had tried to escape,
beat her with a revolver until tired and was then only prevented by a
woodman from turning loose a bulldog upon her; but such was his
political influence that he was elected justice of the peace the
following spring!”—
About the same time, at a session of the National Social Purity
Congress held in Baltimore, the following statement was made: “Of
the 230,000 erring girls in this country, over half have been snared
or sold into their lives of shame. Their average life is five years.
Forty-six thousand are carted out to Potters Field every year. Over
one hundred American homes have to be desolated every day to
recruit the ranks of shame. Isn’t it time for somebody to try to save
these girls from falling into those dens of iniquity? Twenty million
Christians can rescue 230,000 erring girls, or surely the religion of
Jesus Christ is a failure.”
Terrible happenings, as for instance the murder of Ruth
Cruger of New York in 1917, and similar cases in February and
March, 1919, have disclosed that gangs of white slave traders still
exist in America and do a flourishing business. The prices paid to
agents depend upon the girl’s youth and beauty, ranging from $20 to
$1000, and even more.
The enormous and thoroughly organized traffic in girl-
children in England was exposed by the revelations of the “Pall Mall
Gazette,” which roused the people to earnest efforts against this
commerce and secured the formation of the “Society for the
Prevention of Traffic in English Girls.” In giving details of this traffic
the paper said:
“London, the great metropolis of Christian England, the
largest city of ancient and modern times, is acknowledged by
statisticians and sociologists to be the point where crime, vice,
despair, and misery are found in their deepest depth and greatest
diversity. Not Babylon of old, whose name is the synonym of all that
is vile; not Rome, “Mother of Harlots,” not Corinth, in whose temple
a thousand girls were kept for prostitution in service of God, not the

You might also like